Fix degenerate InputLayout creation when creating graphics pipeline with no vertex attributes
continuous-integration/drone/pr Build is failing Details

pull/47/head
Caleb Cornett 2024-02-06 21:48:16 -06:00
parent 641abe4bb5
commit e022faf545
1 changed files with 12 additions and 4 deletions

View File

@ -927,6 +927,12 @@ static ID3D11InputLayout* D3D11_INTERNAL_FetchInputLayout(
uint32_t i, bindingIndex;
HRESULT res;
/* Don't bother creating/fetching an input layout if there are no attributes. */
if (inputState.vertexAttributeCount == 0)
{
return NULL;
}
/* Allocate an array of vertex elements */
elementDescs = SDL_stack_alloc(
D3D11_INPUT_ELEMENT_DESC,
@ -1119,7 +1125,6 @@ static Refresh_GraphicsPipeline* D3D11_CreateGraphicsPipeline(
}
else
{
/* Not sure if this is even possible, but juuust in case... */
pipeline->vertexStrides = NULL;
}
@ -1888,15 +1893,18 @@ static void D3D11_QueueDestroyGraphicsPipeline(
ID3D11BlendState_Release(d3dGraphicsPipeline->colorAttachmentBlendState);
ID3D11DepthStencilState_Release(d3dGraphicsPipeline->depthStencilState);
ID3D11RasterizerState_Release(d3dGraphicsPipeline->rasterizerState);
ID3D11InputLayout_Release(d3dGraphicsPipeline->inputLayout);
/* FIXME: Release uniform buffers, once that's written in */
if (d3dGraphicsPipeline->inputLayout)
{
ID3D11InputLayout_Release(d3dGraphicsPipeline->inputLayout);
}
if (d3dGraphicsPipeline->vertexStrides)
{
SDL_free(d3dGraphicsPipeline->vertexStrides);
}
/* FIXME: Release uniform buffers, once that's written in */
SDL_free(d3dGraphicsPipeline);
}