mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-14 10:36:43 +00:00
Descriptor buffers must force on BDA for all memory
* This is required for any images that will be bound to the memory
This commit is contained in:
@@ -395,7 +395,7 @@ MemoryAllocation WrappedVulkan::AllocateMemoryForResource(bool buffer, VkMemoryR
|
||||
};
|
||||
VkMemoryAllocateInfo info = {
|
||||
VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||
AccelerationStructures() ? &flagsInfo : NULL,
|
||||
(DescriptorBuffers() || AccelerationStructures()) ? &flagsInfo : NULL,
|
||||
allocSize * 1024 * 1024,
|
||||
memoryTypeIndex,
|
||||
};
|
||||
|
||||
@@ -4716,6 +4716,9 @@ VkResult WrappedVulkan::vkCreateDevice(VkPhysicalDevice physicalDevice,
|
||||
if(descBufFeatures && descBufFeatures->descriptorBuffer)
|
||||
{
|
||||
descBufFeatures->descriptorBufferCaptureReplay = VK_TRUE;
|
||||
m_DescriptorBuffers = true;
|
||||
|
||||
RDCLOG("descriptor buffers enabled, ALL MEMORY WILL BE MARKED AS BDA");
|
||||
}
|
||||
|
||||
VkResult ret;
|
||||
@@ -4923,8 +4926,6 @@ VkResult WrappedVulkan::vkCreateDevice(VkPhysicalDevice physicalDevice,
|
||||
if(m_EnabledExtensions.ext_EXT_descriptor_buffer && descBufFeatures &&
|
||||
descBufFeatures->descriptorBuffer)
|
||||
{
|
||||
m_DescriptorBuffers = true;
|
||||
|
||||
// if any update after bind feature is enabled, check robustBufferAccessUpdateAfterBind
|
||||
m_DescriptorBufferProperties = {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT,
|
||||
|
||||
@@ -320,14 +320,15 @@ bool WrappedVulkan::Serialise_vkAllocateMemory(SerialiserType &ser, VkDevice dev
|
||||
{
|
||||
RDCDEBUG("Patching dedicated allocation for incompatible size");
|
||||
|
||||
// if acceleration structures are used, we promote all non-dedicated memory to be BDA as
|
||||
// we can't know if it will be used for an AS or not during capture. That means that
|
||||
// during self-capture if we just remove the dedicated allocation structure here without
|
||||
// any other changes the self-capture layer will promote it to BDA and potentially cause
|
||||
// clashes with reserved addresses elsewhere.
|
||||
// if acceleration structures or descriptor buffers are used, we promote all non-dedicated
|
||||
// memory to be BDA as we can't know if it will be used for an AS or not during capture.
|
||||
// That means that during self-capture if we just remove the dedicated allocation
|
||||
// structure here without any other changes the self-capture layer will promote it to BDA
|
||||
// and potentially cause clashes with reserved addresses elsewhere.
|
||||
//
|
||||
// instead we do the more dangerous thing of adjusting the allocation size to match the
|
||||
// image's memory requirements and keep the dedicated allocation.
|
||||
if(AccelerationStructures())
|
||||
if(AccelerationStructures() || DescriptorBuffers())
|
||||
patched.allocationSize = mrq.size;
|
||||
else
|
||||
RemoveNextStruct(&patched, VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO);
|
||||
@@ -562,7 +563,7 @@ VkResult WrappedVulkan::vkAllocateMemory(VkDevice device, const VkMemoryAllocate
|
||||
// means that when RT is enabled ALL MEMORY IN THE ENTIRE PROGRAM must be marked as BDA just in
|
||||
// case.
|
||||
bool forceBDA = false;
|
||||
if(IsCaptureMode(m_State) && AccelerationStructures())
|
||||
if(IsCaptureMode(m_State) && (AccelerationStructures() || DescriptorBuffers()))
|
||||
{
|
||||
// force BDA flag when creating, by adding the struct if needed
|
||||
forceBDA = true;
|
||||
|
||||
Reference in New Issue
Block a user