Fix crash on Vulkan when constant buffer is missing
This commit is contained in:
@@ -604,7 +604,14 @@ void GPUContextVulkan::UpdateDescriptorSets(const SpirvShaderDescriptorInfo& des
|
||||
VkDeviceSize offset = 0, range = 0;
|
||||
uint32 dynamicOffset = 0;
|
||||
if (!handle)
|
||||
handle = (GPUConstantBufferVulkan*)_device->HelperResources.GetDummyConstantBuffer();
|
||||
{
|
||||
auto cb = (GPUConstantBufferVulkan*)_device->HelperResources.GetDummyConstantBuffer();
|
||||
// TODO: cache this allocation within a frame
|
||||
const auto allocation = _device->UniformBufferUploader->Allocate(cb->GetSize(), 0, this);
|
||||
Platform::MemoryClear(allocation.CPUAddress, allocation.Size);
|
||||
cb->Allocation = allocation;
|
||||
handle = cb;
|
||||
}
|
||||
handle->DescriptorAsDynamicUniformBuffer(this, buffer, offset, range, dynamicOffset);
|
||||
needsWrite |= dsWriter.WriteDynamicUniformBuffer(descriptorIndex, buffer, offset, range, dynamicOffset, index);
|
||||
break;
|
||||
|
||||
@@ -946,9 +946,7 @@ GPUBufferVulkan* HelperResourcesVulkan::GetDummyVertexBuffer()
|
||||
GPUConstantBuffer* HelperResourcesVulkan::GetDummyConstantBuffer()
|
||||
{
|
||||
if (!_dummyCB)
|
||||
{
|
||||
_dummyCB = _device->CreateConstantBuffer(256, TEXT("DummyConstantBuffer"));
|
||||
}
|
||||
_dummyCB = _device->CreateConstantBuffer(1024, TEXT("DummyConstantBuffer"));
|
||||
return _dummyCB;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user