@@ -514,19 +514,29 @@ VkResult WrappedVulkan::vkAllocateMemory(VkDevice device, const VkMemoryAllocate
514
514
// will be bound against since there's no requirement for the buffer to be marked as BDA. This
515
515
// means that when RT is enabled ALL MEMORY IN THE ENTIRE PROGRAM must be marked as BDA just in
516
516
// case.
517
+ //
518
+ // we don't force this on for memory allocations that are going to be used for dedicated images
519
+ bool forceBDA = false ;
517
520
if (IsCaptureMode (m_State) && AccelerationStructures ())
518
521
{
519
- // force BDA flag when creating, by adding the struct if needed
520
- if (memFlags)
521
- {
522
- memFlags->flags |= VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT;
523
- }
524
- else
522
+ VkMemoryDedicatedAllocateInfo *dedicated = (VkMemoryDedicatedAllocateInfo *)FindNextStruct (
523
+ pAllocateInfo, VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO);
524
+ if (dedicated == NULL || dedicated->image == VK_NULL_HANDLE)
525
525
{
526
- rtForcedFlags.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT |
527
- VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT;
528
- rtForcedFlags.pNext = unwrapped.pNext ;
529
- unwrapped.pNext = &rtForcedFlags;
526
+ // force BDA flag when creating, by adding the struct if needed
527
+ forceBDA = true ;
528
+
529
+ if (memFlags)
530
+ {
531
+ memFlags->flags |= VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT;
532
+ }
533
+ else
534
+ {
535
+ rtForcedFlags.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT |
536
+ VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT;
537
+ rtForcedFlags.pNext = unwrapped.pNext ;
538
+ unwrapped.pNext = &rtForcedFlags;
539
+ }
530
540
}
531
541
}
532
542
@@ -690,7 +700,7 @@ VkResult WrappedVulkan::vkAllocateMemory(VkDevice device, const VkMemoryAllocate
690
700
&serialisedInfo, VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO);
691
701
692
702
// see above for this gross workaround we have to do
693
- if (AccelerationStructures () )
703
+ if (forceBDA )
694
704
{
695
705
if (memFlags)
696
706
{
0 commit comments