mirror of https://github.com/libsdl-org/SDL
GPU: Fix D3D11/D3D12 vertex strides for multiple vertex buffers (#10818)
This commit is contained in:
parent
371cfaf8fe
commit
5771b502f8
|
@ -509,7 +509,7 @@ typedef struct D3D11GraphicsPipeline
|
|||
ID3D11PixelShader *fragmentShader;
|
||||
|
||||
ID3D11InputLayout *inputLayout;
|
||||
Uint32 *vertexStrides;
|
||||
Uint32 vertexStrides[MAX_VERTEX_BUFFERS];
|
||||
|
||||
Uint32 vertexSamplerCount;
|
||||
Uint32 vertexUniformBufferCount;
|
||||
|
@ -1258,9 +1258,6 @@ static void D3D11_ReleaseGraphicsPipeline(
|
|||
if (d3d11GraphicsPipeline->inputLayout) {
|
||||
ID3D11InputLayout_Release(d3d11GraphicsPipeline->inputLayout);
|
||||
}
|
||||
if (d3d11GraphicsPipeline->vertexStrides) {
|
||||
SDL_free(d3d11GraphicsPipeline->vertexStrides);
|
||||
}
|
||||
|
||||
ID3D11VertexShader_Release(d3d11GraphicsPipeline->vertexShader);
|
||||
ID3D11PixelShader_Release(d3d11GraphicsPipeline->fragmentShader);
|
||||
|
@ -1611,16 +1608,12 @@ static SDL_GPUGraphicsPipeline *D3D11_CreateGraphicsPipeline(
|
|||
vertShader->bytecode,
|
||||
vertShader->bytecodeSize);
|
||||
|
||||
SDL_zeroa(pipeline->vertexStrides);
|
||||
if (createinfo->vertex_input_state.num_vertex_buffers > 0) {
|
||||
pipeline->vertexStrides = SDL_malloc(
|
||||
sizeof(Uint32) *
|
||||
createinfo->vertex_input_state.num_vertex_buffers);
|
||||
|
||||
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->vertexStrides[createinfo->vertex_input_state.vertex_buffer_descriptions[i].slot] =
|
||||
createinfo->vertex_input_state.vertex_buffer_descriptions[i].pitch;
|
||||
}
|
||||
} else {
|
||||
pipeline->vertexStrides = NULL;
|
||||
}
|
||||
|
||||
// Resource layout
|
||||
|
|
|
@ -2663,7 +2663,8 @@ static SDL_GPUGraphicsPipeline *D3D12_CreateGraphicsPipeline(
|
|||
pipeline->pipelineState = pipelineState;
|
||||
|
||||
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->vertexStrides[createinfo->vertex_input_state.vertex_buffer_descriptions[i].slot] =
|
||||
createinfo->vertex_input_state.vertex_buffer_descriptions[i].pitch;
|
||||
}
|
||||
|
||||
pipeline->primitiveType = createinfo->primitive_type;
|
||||
|
|
Loading…
Reference in New Issue