mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Vulkan: Added serialization of image subresource ref type
Change-Id: Ifae412f3b4a171148f22b11825a370b84de816ee
This commit is contained in:
committed by
Baldur Karlsson
parent
f4e7231fd5
commit
f44ed367d6
@@ -592,6 +592,7 @@ enum class VulkanChunk : uint32_t
|
||||
vkCmdSetDiscardRectangleEXT,
|
||||
DeviceMemoryRefs,
|
||||
vkResetQueryPoolEXT,
|
||||
ImageRefs,
|
||||
Max,
|
||||
};
|
||||
|
||||
|
||||
@@ -1813,6 +1813,7 @@ bool WrappedVulkan::EndFrameCapture(void *dev, void *wnd)
|
||||
|
||||
GetResourceManager()->Serialise_InitialContentsNeeded(ser);
|
||||
GetResourceManager()->InsertDeviceMemoryRefs(ser);
|
||||
GetResourceManager()->InsertImageRefs(ser);
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CHUNK(SystemChunk::CaptureScope, 16);
|
||||
@@ -2911,6 +2912,11 @@ bool WrappedVulkan::ProcessChunk(ReadSerialiser &ser, VulkanChunk chunk)
|
||||
case VulkanChunk::vkResetQueryPoolEXT:
|
||||
return Serialise_vkResetQueryPoolEXT(ser, VK_NULL_HANDLE, VK_NULL_HANDLE, 0, 0);
|
||||
break;
|
||||
case VulkanChunk::ImageRefs:
|
||||
{
|
||||
std::vector<ImgRefsPair> data;
|
||||
return GetResourceManager()->Serialise_ImageRefs(ser, data);
|
||||
}
|
||||
default:
|
||||
{
|
||||
SystemChunk system = (SystemChunk)chunk;
|
||||
@@ -3944,4 +3950,4 @@ TEST_CASE("Validate supported extensions list", "[vulkan]")
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -458,6 +458,28 @@ template bool VulkanResourceManager::Serialise_DeviceMemoryRefs(ReadSerialiser &
|
||||
template bool VulkanResourceManager::Serialise_DeviceMemoryRefs(WriteSerialiser &ser,
|
||||
std::vector<MemRefInterval> &data);
|
||||
|
||||
template <typename SerialiserType>
|
||||
bool VulkanResourceManager::Serialise_ImageRefs(SerialiserType &ser, std::vector<ImgRefsPair> &data)
|
||||
{
|
||||
SERIALISE_ELEMENT(data);
|
||||
|
||||
SERIALISE_CHECK_READ_ERRORS();
|
||||
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
// unpack data into m_ImgFrameRefs
|
||||
for(auto it = data.begin(); it != data.end(); it++)
|
||||
m_ImgFrameRefs.insert({it->image, it->imgRefs});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template bool VulkanResourceManager::Serialise_ImageRefs(ReadSerialiser &ser,
|
||||
std::vector<ImgRefsPair> &imageRefs);
|
||||
template bool VulkanResourceManager::Serialise_ImageRefs(WriteSerialiser &ser,
|
||||
std::vector<ImgRefsPair> &imageRefs);
|
||||
|
||||
void VulkanResourceManager::InsertDeviceMemoryRefs(WriteSerialiser &ser)
|
||||
{
|
||||
std::vector<MemRefInterval> data;
|
||||
@@ -478,6 +500,24 @@ void VulkanResourceManager::InsertDeviceMemoryRefs(WriteSerialiser &ser)
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanResourceManager::InsertImageRefs(WriteSerialiser &ser)
|
||||
{
|
||||
std::vector<ImgRefsPair> data;
|
||||
data.reserve(m_ImgFrameRefs.size());
|
||||
size_t sizeEstimate = 32;
|
||||
|
||||
for(auto it = m_ImgFrameRefs.begin(); it != m_ImgFrameRefs.end(); it++)
|
||||
{
|
||||
data.push_back({it->first, it->second});
|
||||
sizeEstimate += sizeof(ImgRefsPair) + sizeof(FrameRefType) * it->second.rangeRefs.size();
|
||||
}
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::ImageRefs, sizeEstimate);
|
||||
Serialise_ImageRefs(ser, data);
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanResourceManager::MarkSparseMapReferenced(ResourceInfo *sparse)
|
||||
{
|
||||
if(sparse == NULL)
|
||||
|
||||
@@ -273,7 +273,11 @@ public:
|
||||
template <typename SerialiserType>
|
||||
bool Serialise_DeviceMemoryRefs(SerialiserType &ser, std::vector<MemRefInterval> &data);
|
||||
|
||||
template <typename SerialiserType>
|
||||
bool Serialise_ImageRefs(SerialiserType &ser, std::vector<ImgRefsPair> &data);
|
||||
|
||||
void InsertDeviceMemoryRefs(WriteSerialiser &ser);
|
||||
void InsertImageRefs(WriteSerialiser &ser);
|
||||
|
||||
ResourceId GetID(WrappedVkRes *res)
|
||||
{
|
||||
|
||||
@@ -906,10 +906,13 @@ struct ImageInfo
|
||||
// images, and the depth of 2D images must equal 1. We need to ensure this holds, even if the
|
||||
// application is invalid, since we rely on `depth>1` to detect 3D images and correctly handle
|
||||
// 2D views of 3D images.
|
||||
switch(ci.imageType)
|
||||
if(ci.imageType == VK_IMAGE_TYPE_1D)
|
||||
{
|
||||
case VK_IMAGE_TYPE_1D: extent.height = extent.depth = 1; break;
|
||||
case VK_IMAGE_TYPE_2D: extent.depth = 1; break;
|
||||
extent.height = extent.depth = 1;
|
||||
}
|
||||
else if(ci.imageType == VK_IMAGE_TYPE_2D)
|
||||
{
|
||||
extent.depth = 1;
|
||||
}
|
||||
}
|
||||
ImageInfo(const SwapchainInfo &swapInfo)
|
||||
@@ -1134,6 +1137,34 @@ struct ImgRefs
|
||||
inline FrameRefType Merge(const ImgRefs &other) { return Merge(other, ComposeFrameRefs); }
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(ImgRefs);
|
||||
|
||||
template <class SerialiserType>
|
||||
void DoSerialise(SerialiserType &ser, ImgRefs &el)
|
||||
{
|
||||
SERIALISE_MEMBER(rangeRefs);
|
||||
SERIALISE_MEMBER(imageInfo);
|
||||
SERIALISE_MEMBER(aspectMask);
|
||||
SERIALISE_MEMBER(areAspectsSplit);
|
||||
SERIALISE_MEMBER(areLevelsSplit);
|
||||
SERIALISE_MEMBER(areLayersSplit);
|
||||
}
|
||||
|
||||
struct ImgRefsPair
|
||||
{
|
||||
ResourceId image;
|
||||
ImgRefs imgRefs;
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(ImgRefsPair);
|
||||
|
||||
template <class SerialiserType>
|
||||
void DoSerialise(SerialiserType &ser, ImgRefsPair &el)
|
||||
{
|
||||
SERIALISE_MEMBER(image);
|
||||
SERIALISE_MEMBER(imgRefs);
|
||||
}
|
||||
|
||||
template <typename Compose>
|
||||
FrameRefType ImgRefs::Update(ImageRange range, FrameRefType refType, Compose comp)
|
||||
{
|
||||
|
||||
@@ -6976,6 +6976,7 @@ INSTANTIATE_SERIALISE_TYPE(VkXYColorEXT);
|
||||
INSTANTIATE_SERIALISE_TYPE(DescriptorSetSlot);
|
||||
INSTANTIATE_SERIALISE_TYPE(ImageRegionState);
|
||||
INSTANTIATE_SERIALISE_TYPE(ImageLayouts);
|
||||
INSTANTIATE_SERIALISE_TYPE(ImageInfo);
|
||||
|
||||
#if ENABLED(RDOC_WIN32)
|
||||
template <typename SerialiserType>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
template <>
|
||||
rdcstr DoStringise(const VulkanChunk &el)
|
||||
{
|
||||
RDCCOMPILE_ASSERT((uint32_t)VulkanChunk::Max == 1134, "Chunks changed without updating names");
|
||||
RDCCOMPILE_ASSERT((uint32_t)VulkanChunk::Max == 1135, "Chunks changed without updating names");
|
||||
|
||||
BEGIN_ENUM_STRINGISE(VulkanChunk)
|
||||
{
|
||||
@@ -166,6 +166,7 @@ rdcstr DoStringise(const VulkanChunk &el)
|
||||
STRINGISE_ENUM_CLASS(vkCmdSetDiscardRectangleEXT)
|
||||
STRINGISE_ENUM_CLASS_NAMED(DeviceMemoryRefs, "Internal: Device Memory References")
|
||||
STRINGISE_ENUM_CLASS(vkResetQueryPoolEXT);
|
||||
STRINGISE_ENUM_CLASS_NAMED(ImageRefs, "Image References")
|
||||
STRINGISE_ENUM_CLASS_NAMED(Max, "Max Chunk");
|
||||
}
|
||||
END_ENUM_STRINGISE()
|
||||
@@ -2486,4 +2487,4 @@ rdcstr DoStringise(const VkFullScreenExclusiveEXT &el)
|
||||
}
|
||||
END_ENUM_STRINGISE();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user