Minor style cleanup

d3d11
Caleb Cornett 2024-02-07 07:34:07 -06:00 committed by cosmonaut
parent 0108b26d31
commit db6ad7fb6a
1 changed files with 9 additions and 4 deletions

View File

@ -1619,6 +1619,10 @@ static uint8_t D3D11_INTERNAL_CreateUniformBuffer(
D3D11Renderer *renderer D3D11Renderer *renderer
) { ) {
D3D11_BUFFER_DESC bufferDesc; D3D11_BUFFER_DESC bufferDesc;
ID3D11Buffer *bufferHandle;
D3D11UniformBuffer *uniformBuffer;
HRESULT res;
bufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; bufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
bufferDesc.ByteWidth = UBO_BUFFER_SIZE; bufferDesc.ByteWidth = UBO_BUFFER_SIZE;
bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
@ -1626,8 +1630,7 @@ static uint8_t D3D11_INTERNAL_CreateUniformBuffer(
bufferDesc.StructureByteStride = 0; bufferDesc.StructureByteStride = 0;
bufferDesc.Usage = D3D11_USAGE_DYNAMIC; bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
ID3D11Buffer *bufferHandle; res = ID3D11Device_CreateBuffer(
HRESULT res = ID3D11Device_CreateBuffer(
renderer->device, renderer->device,
&bufferDesc, &bufferDesc,
NULL, NULL,
@ -1635,7 +1638,7 @@ static uint8_t D3D11_INTERNAL_CreateUniformBuffer(
); );
ERROR_CHECK_RETURN("Failed to create uniform buffer", 0); ERROR_CHECK_RETURN("Failed to create uniform buffer", 0);
D3D11UniformBuffer *uniformBuffer = SDL_malloc(sizeof(D3D11UniformBuffer)); uniformBuffer = SDL_malloc(sizeof(D3D11UniformBuffer));
uniformBuffer->offset = 0; uniformBuffer->offset = 0;
uniformBuffer->d3d11Buffer = SDL_malloc(sizeof(D3D11Buffer)); uniformBuffer->d3d11Buffer = SDL_malloc(sizeof(D3D11Buffer));
uniformBuffer->d3d11Buffer->handle = bufferHandle; uniformBuffer->d3d11Buffer->handle = bufferHandle;
@ -1662,6 +1665,8 @@ static D3D11UniformBuffer* D3D11_INTERNAL_AcquireUniformBufferFromPool(
D3D11Renderer *renderer, D3D11Renderer *renderer,
uint64_t blockSize uint64_t blockSize
) { ) {
D3D11UniformBuffer *uniformBuffer;
SDL_LockMutex(renderer->uniformBufferLock); SDL_LockMutex(renderer->uniformBufferLock);
if (renderer->availableUniformBufferCount == 0) if (renderer->availableUniformBufferCount == 0)
@ -1674,7 +1679,7 @@ static D3D11UniformBuffer* D3D11_INTERNAL_AcquireUniformBufferFromPool(
} }
} }
D3D11UniformBuffer *uniformBuffer = renderer->availableUniformBuffers[renderer->availableUniformBufferCount - 1]; uniformBuffer = renderer->availableUniformBuffers[renderer->availableUniformBufferCount - 1];
renderer->availableUniformBufferCount -= 1; renderer->availableUniformBufferCount -= 1;
SDL_UnlockMutex(renderer->uniformBufferLock); SDL_UnlockMutex(renderer->uniformBufferLock);