Skip to content

Commit b226fe2

Browse files
Portable Acceleration Structures (#1955)
- worked mostly on decode::VulkanAddressReplacer - enables portable replay of raytracing pipelines, when using RebindAllocator (-m rebind). - work on Acceleration Structures (AS): -> tracking, meta-commands, copies, query-pool handling and rebuild -> rebuild AS from original input-buffers when trimming. -> check AS- and scratch-buffer sizes, replace resources with shadow objects where required
1 parent 554a54e commit b226fe2

31 files changed

+2005
-1276
lines changed

android/framework/util/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ add_library(gfxrecon_util STATIC "")
22

33
target_sources(gfxrecon_util
44
PRIVATE
5+
${GFXRECON_SOURCE_DIR}/framework/util/alignment_utils.h
56
${GFXRECON_SOURCE_DIR}/framework/util/argument_parser.h
67
${GFXRECON_SOURCE_DIR}/framework/util/argument_parser.cpp
78
${GFXRECON_SOURCE_DIR}/framework/util/buffer_writer.h

framework/decode/metadata_consumer_base.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ class MetadataConsumerBase
116116
format::HandleId device_id,
117117
uint32_t info_count,
118118
StructPointerDecoder<Decoded_VkAccelerationStructureBuildGeometryInfoKHR>* geometry_infos,
119-
StructPointerDecoder<Decoded_VkAccelerationStructureBuildRangeInfoKHR*>* range_infos,
120-
std::vector<std::vector<VkAccelerationStructureInstanceKHR>>& instance_buffers_data)
119+
StructPointerDecoder<Decoded_VkAccelerationStructureBuildRangeInfoKHR*>* range_infos)
121120
{}
122121

123122
virtual void ProcessCopyVulkanAccelerationStructuresMetaCommand(

framework/decode/screenshot_handler.cpp

+8-28
Original file line numberDiff line numberDiff line change
@@ -539,25 +539,6 @@ VkDeviceSize ScreenshotHandler::GetCopyBufferSize(VkDevice
539539
return memory_requirements.size;
540540
}
541541

542-
uint32_t ScreenshotHandler::GetMemoryTypeIndex(const VkPhysicalDeviceMemoryProperties& memory_properties,
543-
uint32_t type_bits,
544-
VkMemoryPropertyFlags property_flags) const
545-
{
546-
uint32_t memory_type_index = std::numeric_limits<uint32_t>::max();
547-
548-
for (uint32_t i = 0; i < memory_properties.memoryTypeCount; ++i)
549-
{
550-
if ((type_bits & (1 << i)) &&
551-
((memory_properties.memoryTypes[i].propertyFlags & property_flags) == property_flags))
552-
{
553-
memory_type_index = i;
554-
break;
555-
}
556-
}
557-
558-
return memory_type_index;
559-
}
560-
561542
VkResult ScreenshotHandler::CreateCopyResource(VkDevice device,
562543
const encode::VulkanDeviceTable* device_table,
563544
const VkPhysicalDeviceMemoryProperties& memory_properties,
@@ -597,17 +578,17 @@ VkResult ScreenshotHandler::CreateCopyResource(VkDevice
597578
device_table->GetBufferMemoryRequirements(device, copy_resource->buffer, &memory_requirements);
598579

599580
uint32_t memory_type_index =
600-
GetMemoryTypeIndex(memory_properties,
601-
memory_requirements.memoryTypeBits,
602-
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
581+
graphics::GetMemoryTypeIndex(memory_properties,
582+
memory_requirements.memoryTypeBits,
583+
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
603584

604585
if (memory_type_index == std::numeric_limits<uint32_t>::max())
605586
{
606587
/* fallback to coherent */
607-
memory_type_index =
608-
GetMemoryTypeIndex(memory_properties,
609-
memory_requirements.memoryTypeBits,
610-
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
588+
memory_type_index = graphics::GetMemoryTypeIndex(memory_properties,
589+
memory_requirements.memoryTypeBits,
590+
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
591+
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
611592
}
612593

613594
assert(memory_type_index != std::numeric_limits<uint32_t>::max());
@@ -660,9 +641,8 @@ VkResult ScreenshotHandler::CreateCopyResource(VkDevice
660641
VkMemoryRequirements memory_requirements;
661642
device_table->GetImageMemoryRequirements(device, copy_resource->convert_image, &memory_requirements);
662643

663-
uint32_t memory_type_index = GetMemoryTypeIndex(
644+
uint32_t memory_type_index = graphics::GetMemoryTypeIndex(
664645
memory_properties, memory_requirements.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
665-
666646
assert(memory_type_index != std::numeric_limits<uint32_t>::max());
667647

668648
VkMemoryAllocateInfo allocate_info = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };

framework/decode/screenshot_handler.h

-4
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ class ScreenshotHandler : public ScreenshotHandlerBase
100100
uint32_t width,
101101
uint32_t height) const;
102102

103-
uint32_t GetMemoryTypeIndex(const VkPhysicalDeviceMemoryProperties& memory_properties,
104-
uint32_t type_bits,
105-
VkMemoryPropertyFlags property_flags) const;
106-
107103
VkResult CreateCopyResource(VkDevice device,
108104
const encode::VulkanDeviceTable* device_table,
109105
const VkPhysicalDeviceMemoryProperties& memory_properties,

0 commit comments

Comments
 (0)