mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-16 23:06:03 +00:00
GPU: Rename VertexBinding to VertexBufferDescription (#10811)
This commit is contained in:
@@ -692,16 +692,32 @@ SDL_GPUGraphicsPipeline *SDL_CreateGPUGraphicsPipeline(
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (graphicsPipelineCreateInfo->vertex_input_state.num_vertex_bindings > 0 && graphicsPipelineCreateInfo->vertex_input_state.vertex_bindings == NULL) {
|
||||
SDL_assert_release(!"Vertex bindings array pointer cannot be NULL!");
|
||||
if (graphicsPipelineCreateInfo->vertex_input_state.num_vertex_buffers > 0 && graphicsPipelineCreateInfo->vertex_input_state.vertex_buffer_descriptions == NULL) {
|
||||
SDL_assert_release(!"Vertex buffer descriptions array pointer cannot be NULL!");
|
||||
return NULL;
|
||||
}
|
||||
if (graphicsPipelineCreateInfo->vertex_input_state.num_vertex_buffers > MAX_VERTEX_BUFFERS) {
|
||||
SDL_assert_release(!"The number of vertex buffer descriptions in a vertex input state must not exceed 16!");
|
||||
return NULL;
|
||||
}
|
||||
if (graphicsPipelineCreateInfo->vertex_input_state.num_vertex_attributes > 0 && graphicsPipelineCreateInfo->vertex_input_state.vertex_attributes == NULL) {
|
||||
SDL_assert_release(!"Vertex attributes array pointer cannot be NULL!");
|
||||
return NULL;
|
||||
}
|
||||
if (graphicsPipelineCreateInfo->vertex_input_state.num_vertex_attributes > MAX_VERTEX_ATTRIBUTES) {
|
||||
SDL_assert_release(!"The number of vertex attributes in a vertex input state must not exceed 16!");
|
||||
return NULL;
|
||||
}
|
||||
Uint32 locations[MAX_VERTEX_ATTRIBUTES];
|
||||
for (Uint32 i = 0; i < graphicsPipelineCreateInfo->vertex_input_state.num_vertex_attributes; i += 1) {
|
||||
CHECK_VERTEXELEMENTFORMAT_ENUM_INVALID(graphicsPipelineCreateInfo->vertex_input_state.vertex_attributes[i].format, NULL);
|
||||
|
||||
locations[i] = graphicsPipelineCreateInfo->vertex_input_state.vertex_attributes[i].location;
|
||||
for (Uint32 j = 0; j < i; j += 1) {
|
||||
if (locations[j] == locations[i]) {
|
||||
SDL_assert_release(!"Each vertex attribute location in a vertex input state must be unique!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (graphicsPipelineCreateInfo->depth_stencil_state.enable_depth_test) {
|
||||
CHECK_COMPAREOP_ENUM_INVALID(graphicsPipelineCreateInfo->depth_stencil_state.compare_op, NULL)
|
||||
|
@@ -232,7 +232,8 @@ static inline Sint32 BytesPerImage(
|
||||
#define MAX_COMPUTE_WRITE_TEXTURES 8
|
||||
#define MAX_COMPUTE_WRITE_BUFFERS 8
|
||||
#define UNIFORM_BUFFER_SIZE 32768
|
||||
#define MAX_BUFFER_BINDINGS 16
|
||||
#define MAX_VERTEX_BUFFERS 16
|
||||
#define MAX_VERTEX_ATTRIBUTES 16
|
||||
#define MAX_COLOR_TARGET_BINDINGS 4
|
||||
#define MAX_PRESENT_COUNT 16
|
||||
#define MAX_FRAMES_IN_FLIGHT 3
|
||||
@@ -411,7 +412,7 @@ struct SDL_GPUDevice
|
||||
|
||||
void (*BindVertexBuffers)(
|
||||
SDL_GPUCommandBuffer *commandBuffer,
|
||||
Uint32 firstBinding,
|
||||
Uint32 firstSlot,
|
||||
const SDL_GPUBufferBinding *bindings,
|
||||
Uint32 numBindings);
|
||||
|
||||
|
@@ -672,8 +672,8 @@ typedef struct D3D11CommandBuffer
|
||||
// defer OMSetBlendState because it combines three different states
|
||||
bool needBlendStateSet;
|
||||
|
||||
ID3D11Buffer *vertexBuffers[MAX_BUFFER_BINDINGS];
|
||||
Uint32 vertexBufferOffsets[MAX_BUFFER_BINDINGS];
|
||||
ID3D11Buffer *vertexBuffers[MAX_VERTEX_BUFFERS];
|
||||
Uint32 vertexBufferOffsets[MAX_VERTEX_BUFFERS];
|
||||
Uint32 vertexBufferCount;
|
||||
|
||||
D3D11Texture *vertexSamplerTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE];
|
||||
@@ -1380,18 +1380,18 @@ static ID3D11RasterizerState *D3D11_INTERNAL_FetchRasterizerState(
|
||||
return result;
|
||||
}
|
||||
|
||||
static Uint32 D3D11_INTERNAL_FindIndexOfVertexBinding(
|
||||
Uint32 targetBinding,
|
||||
const SDL_GPUVertexBinding *bindings,
|
||||
Uint32 numBindings)
|
||||
static Uint32 D3D11_INTERNAL_FindIndexOfVertexSlot(
|
||||
Uint32 targetSlot,
|
||||
const SDL_GPUVertexBufferDescription *bufferDescriptions,
|
||||
Uint32 numDescriptions)
|
||||
{
|
||||
for (Uint32 i = 0; i < numBindings; i += 1) {
|
||||
if (bindings[i].index == targetBinding) {
|
||||
for (Uint32 i = 0; i < numDescriptions; i += 1) {
|
||||
if (bufferDescriptions[i].slot == targetSlot) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_LogError(SDL_LOG_CATEGORY_GPU, "Could not find vertex binding %u!", targetBinding);
|
||||
SDL_LogError(SDL_LOG_CATEGORY_GPU, "Could not find vertex buffer slot %u!", targetSlot);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1420,15 +1420,17 @@ static ID3D11InputLayout *D3D11_INTERNAL_FetchInputLayout(
|
||||
for (Uint32 i = 0; i < inputState.num_vertex_attributes; i += 1) {
|
||||
elementDescs[i].AlignedByteOffset = inputState.vertex_attributes[i].offset;
|
||||
elementDescs[i].Format = SDLToD3D11_VertexFormat[inputState.vertex_attributes[i].format];
|
||||
elementDescs[i].InputSlot = inputState.vertex_attributes[i].binding_index;
|
||||
elementDescs[i].InputSlot = inputState.vertex_attributes[i].buffer_slot;
|
||||
|
||||
bindingIndex = D3D11_INTERNAL_FindIndexOfVertexBinding(
|
||||
bindingIndex = D3D11_INTERNAL_FindIndexOfVertexSlot(
|
||||
elementDescs[i].InputSlot,
|
||||
inputState.vertex_bindings,
|
||||
inputState.num_vertex_bindings);
|
||||
elementDescs[i].InputSlotClass = SDLToD3D11_VertexInputRate[inputState.vertex_bindings[bindingIndex].input_rate];
|
||||
inputState.vertex_buffer_descriptions,
|
||||
inputState.num_vertex_buffers);
|
||||
elementDescs[i].InputSlotClass = SDLToD3D11_VertexInputRate[inputState.vertex_buffer_descriptions[bindingIndex].input_rate];
|
||||
// The spec requires this to be 0 for per-vertex data
|
||||
elementDescs[i].InstanceDataStepRate = (inputState.vertex_bindings[bindingIndex].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) ? inputState.vertex_bindings[bindingIndex].instance_step_rate : 0;
|
||||
elementDescs[i].InstanceDataStepRate = (inputState.vertex_buffer_descriptions[bindingIndex].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE)
|
||||
? inputState.vertex_buffer_descriptions[bindingIndex].instance_step_rate
|
||||
: 0;
|
||||
|
||||
elementDescs[i].SemanticIndex = inputState.vertex_attributes[i].location;
|
||||
elementDescs[i].SemanticName = "TEXCOORD";
|
||||
@@ -1609,13 +1611,13 @@ static SDL_GPUGraphicsPipeline *D3D11_CreateGraphicsPipeline(
|
||||
vertShader->bytecode,
|
||||
vertShader->bytecodeSize);
|
||||
|
||||
if (createinfo->vertex_input_state.num_vertex_bindings > 0) {
|
||||
if (createinfo->vertex_input_state.num_vertex_buffers > 0) {
|
||||
pipeline->vertexStrides = SDL_malloc(
|
||||
sizeof(Uint32) *
|
||||
createinfo->vertex_input_state.num_vertex_bindings);
|
||||
createinfo->vertex_input_state.num_vertex_buffers);
|
||||
|
||||
for (Uint32 i = 0; i < createinfo->vertex_input_state.num_vertex_bindings; i += 1) {
|
||||
pipeline->vertexStrides[i] = createinfo->vertex_input_state.vertex_bindings[i].pitch;
|
||||
for (Uint32 i = 0; i < createinfo->vertex_input_state.num_vertex_buffers; i += 1) {
|
||||
pipeline->vertexStrides[i] = createinfo->vertex_input_state.vertex_buffer_descriptions[i].pitch;
|
||||
}
|
||||
} else {
|
||||
pipeline->vertexStrides = NULL;
|
||||
@@ -3732,7 +3734,7 @@ static void D3D11_BindGraphicsPipeline(
|
||||
|
||||
static void D3D11_BindVertexBuffers(
|
||||
SDL_GPUCommandBuffer *commandBuffer,
|
||||
Uint32 firstBinding,
|
||||
Uint32 firstSlot,
|
||||
const SDL_GPUBufferBinding *bindings,
|
||||
Uint32 numBindings)
|
||||
{
|
||||
@@ -3740,13 +3742,13 @@ static void D3D11_BindVertexBuffers(
|
||||
|
||||
for (Uint32 i = 0; i < numBindings; i += 1) {
|
||||
D3D11Buffer *currentBuffer = ((D3D11BufferContainer *)bindings[i].buffer)->activeBuffer;
|
||||
d3d11CommandBuffer->vertexBuffers[firstBinding + i] = currentBuffer->handle;
|
||||
d3d11CommandBuffer->vertexBufferOffsets[firstBinding + i] = bindings[i].offset;
|
||||
d3d11CommandBuffer->vertexBuffers[firstSlot + i] = currentBuffer->handle;
|
||||
d3d11CommandBuffer->vertexBufferOffsets[firstSlot + i] = bindings[i].offset;
|
||||
D3D11_INTERNAL_TrackBuffer(d3d11CommandBuffer, currentBuffer);
|
||||
}
|
||||
|
||||
d3d11CommandBuffer->vertexBufferCount =
|
||||
SDL_max(d3d11CommandBuffer->vertexBufferCount, firstBinding + numBindings);
|
||||
SDL_max(d3d11CommandBuffer->vertexBufferCount, firstSlot + numBindings);
|
||||
|
||||
d3d11CommandBuffer->needVertexBufferBind = true;
|
||||
}
|
||||
|
@@ -702,8 +702,8 @@ struct D3D12CommandBuffer
|
||||
bool needComputeReadOnlyStorageBufferBind;
|
||||
bool needComputeUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE];
|
||||
|
||||
D3D12Buffer *vertexBuffers[MAX_BUFFER_BINDINGS];
|
||||
Uint32 vertexBufferOffsets[MAX_BUFFER_BINDINGS];
|
||||
D3D12Buffer *vertexBuffers[MAX_VERTEX_BUFFERS];
|
||||
Uint32 vertexBufferOffsets[MAX_VERTEX_BUFFERS];
|
||||
Uint32 vertexBufferCount;
|
||||
|
||||
D3D12Texture *vertexSamplerTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE];
|
||||
@@ -792,7 +792,7 @@ struct D3D12GraphicsPipeline
|
||||
D3D12GraphicsRootSignature *rootSignature;
|
||||
SDL_GPUPrimitiveType primitiveType;
|
||||
|
||||
Uint32 vertexStrides[MAX_BUFFER_BINDINGS];
|
||||
Uint32 vertexStrides[MAX_VERTEX_BUFFERS];
|
||||
|
||||
Uint32 vertexSamplerCount;
|
||||
Uint32 vertexUniformBufferCount;
|
||||
@@ -2531,10 +2531,12 @@ static bool D3D12_INTERNAL_ConvertVertexInputState(SDL_GPUVertexInputState verte
|
||||
desc[i].SemanticName = semantic;
|
||||
desc[i].SemanticIndex = attribute.location;
|
||||
desc[i].Format = SDLToD3D12_VertexFormat[attribute.format];
|
||||
desc[i].InputSlot = attribute.binding_index;
|
||||
desc[i].InputSlot = attribute.buffer_slot;
|
||||
desc[i].AlignedByteOffset = attribute.offset;
|
||||
desc[i].InputSlotClass = SDLToD3D12_InputRate[vertexInputState.vertex_bindings[attribute.binding_index].input_rate];
|
||||
desc[i].InstanceDataStepRate = (vertexInputState.vertex_bindings[attribute.binding_index].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) ? vertexInputState.vertex_bindings[attribute.binding_index].instance_step_rate : 0;
|
||||
desc[i].InputSlotClass = SDLToD3D12_InputRate[vertexInputState.vertex_buffer_descriptions[attribute.buffer_slot].input_rate];
|
||||
desc[i].InstanceDataStepRate = (vertexInputState.vertex_buffer_descriptions[attribute.buffer_slot].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE)
|
||||
? vertexInputState.vertex_buffer_descriptions[attribute.buffer_slot].instance_step_rate
|
||||
: 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2660,8 +2662,8 @@ static SDL_GPUGraphicsPipeline *D3D12_CreateGraphicsPipeline(
|
||||
|
||||
pipeline->pipelineState = pipelineState;
|
||||
|
||||
for (Uint32 i = 0; i < createinfo->vertex_input_state.num_vertex_bindings; i += 1) {
|
||||
pipeline->vertexStrides[i] = createinfo->vertex_input_state.vertex_bindings[i].pitch;
|
||||
for (Uint32 i = 0; i < createinfo->vertex_input_state.num_vertex_buffers; i += 1) {
|
||||
pipeline->vertexStrides[i] = createinfo->vertex_input_state.vertex_buffer_descriptions[i].pitch;
|
||||
}
|
||||
|
||||
pipeline->primitiveType = createinfo->primitive_type;
|
||||
@@ -4250,7 +4252,7 @@ static void D3D12_BindGraphicsPipeline(
|
||||
|
||||
static void D3D12_BindVertexBuffers(
|
||||
SDL_GPUCommandBuffer *commandBuffer,
|
||||
Uint32 firstBinding,
|
||||
Uint32 firstSlot,
|
||||
const SDL_GPUBufferBinding *bindings,
|
||||
Uint32 numBindings)
|
||||
{
|
||||
@@ -4258,13 +4260,13 @@ static void D3D12_BindVertexBuffers(
|
||||
|
||||
for (Uint32 i = 0; i < numBindings; i += 1) {
|
||||
D3D12Buffer *currentBuffer = ((D3D12BufferContainer *)bindings[i].buffer)->activeBuffer;
|
||||
d3d12CommandBuffer->vertexBuffers[firstBinding + i] = currentBuffer;
|
||||
d3d12CommandBuffer->vertexBufferOffsets[firstBinding + i] = bindings[i].offset;
|
||||
d3d12CommandBuffer->vertexBuffers[firstSlot + i] = currentBuffer;
|
||||
d3d12CommandBuffer->vertexBufferOffsets[firstSlot + i] = bindings[i].offset;
|
||||
D3D12_INTERNAL_TrackBuffer(d3d12CommandBuffer, currentBuffer);
|
||||
}
|
||||
|
||||
d3d12CommandBuffer->vertexBufferCount =
|
||||
SDL_max(d3d12CommandBuffer->vertexBufferCount, firstBinding + numBindings);
|
||||
SDL_max(d3d12CommandBuffer->vertexBufferCount, firstSlot + numBindings);
|
||||
|
||||
d3d12CommandBuffer->needVertexBufferBind = true;
|
||||
}
|
||||
@@ -4492,7 +4494,7 @@ static void D3D12_INTERNAL_BindGraphicsResources(
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE cpuHandles[MAX_TEXTURE_SAMPLERS_PER_STAGE];
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE gpuDescriptorHandle;
|
||||
D3D12_VERTEX_BUFFER_VIEW vertexBufferViews[MAX_BUFFER_BINDINGS];
|
||||
D3D12_VERTEX_BUFFER_VIEW vertexBufferViews[MAX_VERTEX_BUFFERS];
|
||||
|
||||
if (commandBuffer->needVertexBufferBind) {
|
||||
for (Uint32 i = 0; i < commandBuffer->vertexBufferCount; i += 1) {
|
||||
|
@@ -1090,21 +1090,23 @@ static SDL_GPUGraphicsPipeline *METAL_CreateGraphicsPipeline(
|
||||
|
||||
// Vertex Descriptor
|
||||
|
||||
if (createinfo->vertex_input_state.num_vertex_bindings > 0) {
|
||||
if (createinfo->vertex_input_state.num_vertex_buffers > 0) {
|
||||
vertexDescriptor = [MTLVertexDescriptor vertexDescriptor];
|
||||
|
||||
for (Uint32 i = 0; i < createinfo->vertex_input_state.num_vertex_attributes; i += 1) {
|
||||
Uint32 loc = createinfo->vertex_input_state.vertex_attributes[i].location;
|
||||
vertexDescriptor.attributes[loc].format = SDLToMetal_VertexFormat[createinfo->vertex_input_state.vertex_attributes[i].format];
|
||||
vertexDescriptor.attributes[loc].offset = createinfo->vertex_input_state.vertex_attributes[i].offset;
|
||||
vertexDescriptor.attributes[loc].bufferIndex = METAL_INTERNAL_GetVertexBufferIndex(createinfo->vertex_input_state.vertex_attributes[i].binding_index);
|
||||
vertexDescriptor.attributes[loc].bufferIndex = METAL_INTERNAL_GetVertexBufferIndex(createinfo->vertex_input_state.vertex_attributes[i].buffer_slot);
|
||||
}
|
||||
|
||||
for (Uint32 i = 0; i < createinfo->vertex_input_state.num_vertex_bindings; i += 1) {
|
||||
binding = METAL_INTERNAL_GetVertexBufferIndex(createinfo->vertex_input_state.vertex_bindings[i].index);
|
||||
vertexDescriptor.layouts[binding].stepFunction = SDLToMetal_StepFunction[createinfo->vertex_input_state.vertex_bindings[i].input_rate];
|
||||
vertexDescriptor.layouts[binding].stepRate = (createinfo->vertex_input_state.vertex_bindings[i].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) ? createinfo->vertex_input_state.vertex_bindings[i].instance_step_rate : 1;
|
||||
vertexDescriptor.layouts[binding].stride = createinfo->vertex_input_state.vertex_bindings[i].pitch;
|
||||
for (Uint32 i = 0; i < createinfo->vertex_input_state.num_vertex_buffers; i += 1) {
|
||||
binding = METAL_INTERNAL_GetVertexBufferIndex(createinfo->vertex_input_state.vertex_buffer_descriptions[i].slot);
|
||||
vertexDescriptor.layouts[binding].stepFunction = SDLToMetal_StepFunction[createinfo->vertex_input_state.vertex_buffer_descriptions[i].input_rate];
|
||||
vertexDescriptor.layouts[binding].stepRate = (createinfo->vertex_input_state.vertex_buffer_descriptions[i].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE)
|
||||
? createinfo->vertex_input_state.vertex_buffer_descriptions[i].instance_step_rate
|
||||
: 1;
|
||||
vertexDescriptor.layouts[binding].stride = createinfo->vertex_input_state.vertex_buffer_descriptions[i].pitch;
|
||||
}
|
||||
|
||||
pipelineDescriptor.vertexDescriptor = vertexDescriptor;
|
||||
@@ -2367,8 +2369,8 @@ static void METAL_BindVertexBuffers(
|
||||
{
|
||||
@autoreleasepool {
|
||||
MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer;
|
||||
id<MTLBuffer> metalBuffers[MAX_BUFFER_BINDINGS];
|
||||
NSUInteger bufferOffsets[MAX_BUFFER_BINDINGS];
|
||||
id<MTLBuffer> metalBuffers[MAX_VERTEX_BUFFERS];
|
||||
NSUInteger bufferOffsets[MAX_VERTEX_BUFFERS];
|
||||
NSRange range = NSMakeRange(METAL_INTERNAL_GetVertexBufferIndex(firstBinding), numBindings);
|
||||
|
||||
if (range.length == 0) {
|
||||
|
@@ -6366,9 +6366,9 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
||||
|
||||
VkPipelineVertexInputStateCreateInfo vertexInputStateCreateInfo;
|
||||
VkPipelineVertexInputDivisorStateCreateInfoEXT divisorStateCreateInfo;
|
||||
VkVertexInputBindingDescription *vertexInputBindingDescriptions = SDL_stack_alloc(VkVertexInputBindingDescription, createinfo->vertex_input_state.num_vertex_bindings);
|
||||
VkVertexInputBindingDescription *vertexInputBindingDescriptions = SDL_stack_alloc(VkVertexInputBindingDescription, createinfo->vertex_input_state.num_vertex_buffers);
|
||||
VkVertexInputAttributeDescription *vertexInputAttributeDescriptions = SDL_stack_alloc(VkVertexInputAttributeDescription, createinfo->vertex_input_state.num_vertex_attributes);
|
||||
VkVertexInputBindingDivisorDescriptionEXT *divisorDescriptions = SDL_stack_alloc(VkVertexInputBindingDivisorDescriptionEXT, createinfo->vertex_input_state.num_vertex_bindings);
|
||||
VkVertexInputBindingDivisorDescriptionEXT *divisorDescriptions = SDL_stack_alloc(VkVertexInputBindingDivisorDescriptionEXT, createinfo->vertex_input_state.num_vertex_buffers);
|
||||
Uint32 divisorDescriptionCount = 0;
|
||||
|
||||
VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCreateInfo;
|
||||
@@ -6445,18 +6445,18 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
||||
|
||||
// Vertex input
|
||||
|
||||
for (i = 0; i < createinfo->vertex_input_state.num_vertex_bindings; i += 1) {
|
||||
vertexInputBindingDescriptions[i].binding = createinfo->vertex_input_state.vertex_bindings[i].index;
|
||||
vertexInputBindingDescriptions[i].inputRate = SDLToVK_VertexInputRate[createinfo->vertex_input_state.vertex_bindings[i].input_rate];
|
||||
vertexInputBindingDescriptions[i].stride = createinfo->vertex_input_state.vertex_bindings[i].pitch;
|
||||
for (i = 0; i < createinfo->vertex_input_state.num_vertex_buffers; i += 1) {
|
||||
vertexInputBindingDescriptions[i].binding = createinfo->vertex_input_state.vertex_buffer_descriptions[i].slot;
|
||||
vertexInputBindingDescriptions[i].inputRate = SDLToVK_VertexInputRate[createinfo->vertex_input_state.vertex_buffer_descriptions[i].input_rate];
|
||||
vertexInputBindingDescriptions[i].stride = createinfo->vertex_input_state.vertex_buffer_descriptions[i].pitch;
|
||||
|
||||
if (createinfo->vertex_input_state.vertex_bindings[i].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) {
|
||||
if (createinfo->vertex_input_state.vertex_buffer_descriptions[i].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) {
|
||||
divisorDescriptionCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < createinfo->vertex_input_state.num_vertex_attributes; i += 1) {
|
||||
vertexInputAttributeDescriptions[i].binding = createinfo->vertex_input_state.vertex_attributes[i].binding_index;
|
||||
vertexInputAttributeDescriptions[i].binding = createinfo->vertex_input_state.vertex_attributes[i].buffer_slot;
|
||||
vertexInputAttributeDescriptions[i].format = SDLToVK_VertexFormat[createinfo->vertex_input_state.vertex_attributes[i].format];
|
||||
vertexInputAttributeDescriptions[i].location = createinfo->vertex_input_state.vertex_attributes[i].location;
|
||||
vertexInputAttributeDescriptions[i].offset = createinfo->vertex_input_state.vertex_attributes[i].offset;
|
||||
@@ -6465,7 +6465,7 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
||||
vertexInputStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
|
||||
vertexInputStateCreateInfo.pNext = NULL;
|
||||
vertexInputStateCreateInfo.flags = 0;
|
||||
vertexInputStateCreateInfo.vertexBindingDescriptionCount = createinfo->vertex_input_state.num_vertex_bindings;
|
||||
vertexInputStateCreateInfo.vertexBindingDescriptionCount = createinfo->vertex_input_state.num_vertex_buffers;
|
||||
vertexInputStateCreateInfo.pVertexBindingDescriptions = vertexInputBindingDescriptions;
|
||||
vertexInputStateCreateInfo.vertexAttributeDescriptionCount = createinfo->vertex_input_state.num_vertex_attributes;
|
||||
vertexInputStateCreateInfo.pVertexAttributeDescriptions = vertexInputAttributeDescriptions;
|
||||
@@ -6473,10 +6473,10 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(
|
||||
if (divisorDescriptionCount > 0) {
|
||||
divisorDescriptionCount = 0;
|
||||
|
||||
for (i = 0; i < createinfo->vertex_input_state.num_vertex_bindings; i += 1) {
|
||||
if (createinfo->vertex_input_state.vertex_bindings[i].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) {
|
||||
divisorDescriptions[divisorDescriptionCount].binding = createinfo->vertex_input_state.vertex_bindings[i].index;
|
||||
divisorDescriptions[divisorDescriptionCount].divisor = createinfo->vertex_input_state.vertex_bindings[i].instance_step_rate;
|
||||
for (i = 0; i < createinfo->vertex_input_state.num_vertex_buffers; i += 1) {
|
||||
if (createinfo->vertex_input_state.vertex_buffer_descriptions[i].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) {
|
||||
divisorDescriptions[divisorDescriptionCount].binding = createinfo->vertex_input_state.vertex_buffer_descriptions[i].slot;
|
||||
divisorDescriptions[divisorDescriptionCount].divisor = createinfo->vertex_input_state.vertex_buffer_descriptions[i].instance_step_rate;
|
||||
|
||||
divisorDescriptionCount += 1;
|
||||
}
|
||||
@@ -8087,7 +8087,7 @@ static void VULKAN_BindGraphicsPipeline(
|
||||
|
||||
static void VULKAN_BindVertexBuffers(
|
||||
SDL_GPUCommandBuffer *commandBuffer,
|
||||
Uint32 firstBinding,
|
||||
Uint32 firstSlot,
|
||||
const SDL_GPUBufferBinding *bindings,
|
||||
Uint32 numBindings)
|
||||
{
|
||||
@@ -8107,7 +8107,7 @@ static void VULKAN_BindVertexBuffers(
|
||||
|
||||
renderer->vkCmdBindVertexBuffers(
|
||||
vulkanCommandBuffer->commandBuffer,
|
||||
firstBinding,
|
||||
firstSlot,
|
||||
numBindings,
|
||||
buffers,
|
||||
offsets);
|
||||
|
Reference in New Issue
Block a user