Skip to content

Commit

Permalink
add VK_KHR_maintenance5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
qbojj committed Feb 27, 2024
1 parent fa70f8f commit ad597cb
Show file tree
Hide file tree
Showing 24 changed files with 594 additions and 314 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2411,7 +2411,7 @@ void VulkanPipelineStateViewer::setState()
BufferDescription *buf = m_Ctx.GetBuffer(state.inputAssembly.indexBuffer.resourceId);

if(buf)
length = buf->length;
length = qMin(buf->length, state.inputAssembly.indexBuffer.byteSize);

RDTreeWidgetItem *node = new RDTreeWidgetItem(
{tr("Index"), state.inputAssembly.indexBuffer.resourceId, tr("Index"), lit("-"),
Expand Down Expand Up @@ -3802,7 +3802,7 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe::
if(ib)
{
name = m_Ctx.GetResourceName(ia.indexBuffer.resourceId);
length = ib->length;
length = qMin(ib->length, ia.indexBuffer.byteSize);
}

QString ifmt = lit("UNKNOWN");
Expand Down
2 changes: 1 addition & 1 deletion renderdoc/api/replay/pipestate.inl
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ BoundVBuffer PipeState::GetIBuffer() const
ret.resourceId = m_Vulkan->inputAssembly.indexBuffer.resourceId;
ret.byteOffset = m_Vulkan->inputAssembly.indexBuffer.byteOffset;
ret.byteStride = m_Vulkan->inputAssembly.indexBuffer.byteStride;
ret.byteSize = ~0ULL;
ret.byteSize = m_Vulkan->inputAssembly.indexBuffer.byteSize;
}
}

Expand Down
5 changes: 4 additions & 1 deletion renderdoc/api/replay/vk_pipestate.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ When not using pipeline libraries, this will be identical to :data:`pipelinePreR
)");
ResourceId pipelineFragmentLayoutResourceId;
DOCUMENT("The flags used to create the pipeline object.");
uint32_t flags = 0;
uint64_t flags = 0;

DOCUMENT(R"(The bound descriptor sets.
Expand All @@ -411,6 +411,9 @@ struct IndexBuffer
DOCUMENT("The byte offset from the start of the buffer to the beginning of the index data.");
uint64_t byteOffset = 0;

DOCUMENT("The number of bytes in the index buffer.");
uint64_t byteSize = 0;

DOCUMENT(R"(The number of bytes for each index in the index buffer. Typically 2 or 4 bytes but
it can be 0 if no index buffer is bound.
)");
Expand Down
2 changes: 1 addition & 1 deletion renderdoc/driver/vulkan/extension_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ Maintainers can update this file by updating vk.xml in this folder and running `
* `VK_KHR_maintenance2`
* `VK_KHR_maintenance3`
* `VK_KHR_maintenance4`
* `VK_KHR_maintenance5`
* `VK_KHR_multiview`
* `VK_KHR_performance_query`
* `VK_KHR_pipeline_executable_properties`
Expand Down Expand Up @@ -235,7 +236,6 @@ KHR extensions will definitely be implemented at some point, though KHR extensio

* `VK_KHR_cooperative_matrix`
* `VK_KHR_dynamic_rendering_local_read`
* `VK_KHR_maintenance5`
* `VK_KHR_maintenance6`
* `VK_KHR_map_memory2`
* `VK_KHR_shader_expect_assume`
Expand Down
1 change: 1 addition & 0 deletions renderdoc/driver/vulkan/vk_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,7 @@ enum class VulkanChunk : uint32_t
vkCmdCopyAccelerationStructureToMemoryKHR,
vkCmdCopyMemoryToAccelerationStructureKHR,
vkCreateAccelerationStructureKHR,
vkCmdBindIndexBuffer2KHR,
Max,
};

Expand Down
11 changes: 9 additions & 2 deletions renderdoc/driver/vulkan/vk_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,10 @@ static const VkExtensionProperties supportedExtensions[] = {
VK_KHR_MAINTENANCE_4_EXTENSION_NAME,
VK_KHR_MAINTENANCE_4_SPEC_VERSION,
},
{
VK_KHR_MAINTENANCE_5_EXTENSION_NAME,
VK_KHR_MAINTENANCE_5_SPEC_VERSION,
},
{
VK_KHR_MULTIVIEW_EXTENSION_NAME,
VK_KHR_MULTIVIEW_SPEC_VERSION,
Expand Down Expand Up @@ -1761,8 +1765,7 @@ static const VkExtensionProperties supportedExtensions[] = {
{
VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME,
VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_SPEC_VERSION,
},
};
}};

// this is the list of extensions we provide - regardless of whether the ICD supports them
static const VkExtensionProperties renderdocProvidedDeviceExtensions[] = {
Expand Down Expand Up @@ -4003,6 +4006,10 @@ bool WrappedVulkan::ProcessChunk(ReadSerialiser &ser, VulkanChunk chunk)
case VulkanChunk::vkCreateAccelerationStructureKHR:
return Serialise_vkCreateAccelerationStructureKHR(ser, VK_NULL_HANDLE, NULL, NULL, NULL);

case VulkanChunk::vkCmdBindIndexBuffer2KHR:
return Serialise_vkCmdBindIndexBuffer2KHR(ser, VK_NULL_HANDLE, VK_NULL_HANDLE, 0, 0,
VK_INDEX_TYPE_MAX_ENUM);

// chunks that are reserved but not yet serialised
case VulkanChunk::vkResetCommandPool:
case VulkanChunk::vkCreateDepthTargetView:
Expand Down
14 changes: 14 additions & 0 deletions renderdoc/driver/vulkan/vk_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -2878,4 +2878,18 @@ class WrappedVulkan : public IFrameCapturer
VkDevice device, uint32_t accelerationStructureCount,
const VkAccelerationStructureKHR *pAccelerationStructures, VkQueryType queryType,
size_t dataSize, void *pData, size_t stride);

// VK_KHR_maintenance5
IMPLEMENT_FUNCTION_SERIALISED(void, vkCmdBindIndexBuffer2KHR, VkCommandBuffer commandBuffer,
VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size,
VkIndexType indexType);
IMPLEMENT_FUNCTION_SERIALISED(void, vkGetDeviceImageSubresourceLayoutKHR, VkDevice device,
const VkDeviceImageSubresourceInfoKHR *pInfo,
VkSubresourceLayout2KHR *pLayout);
IMPLEMENT_FUNCTION_SERIALISED(void, vkGetImageSubresourceLayout2KHR, VkDevice device,
VkImage image, const VkImageSubresource2KHR *pSubresource,
VkSubresourceLayout2KHR *pLayout);
IMPLEMENT_FUNCTION_SERIALISED(void, vkGetRenderingAreaGranularityKHR, VkDevice device,
const VkRenderingAreaInfoKHR *pRenderingAreaInfo,
VkExtent2D *pGranularity);
};
36 changes: 18 additions & 18 deletions renderdoc/driver/vulkan/vk_dispatchtables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ void InitInstanceExtensionTables(VkInstance instance, InstanceDeviceInfo *info)
}

#undef HookInitPromotedExtension
#define HookInitPromotedExtension(cond, func, suffix) \
if(cond) \
{ \
InstanceGPA(func); \
InstanceGPA(CONCAT(func, suffix)); \
if(table->func == NULL) \
table->func = table->CONCAT(func, suffix); \
if(table->CONCAT(func, suffix) == NULL) \
table->CONCAT(func, suffix) = table->func; \
#define HookInitPromotedExtension(cond, version, func, suffix) \
if(cond) \
{ \
InstanceGPA(func); \
InstanceGPA(CONCAT(func, suffix)); \
if(table->func == NULL) \
table->func = table->CONCAT(func, suffix); \
if(table->CONCAT(func, suffix) == NULL) \
table->CONCAT(func, suffix) = table->func; \
}

#undef HookInitExtensionEXTtoKHR
Expand Down Expand Up @@ -140,15 +140,15 @@ void InitDeviceExtensionTables(VkDevice device, InstanceDeviceInfo *info)
}

#undef HookInitPromotedExtension
#define HookInitPromotedExtension(cond, func, suffix) \
if(cond) \
{ \
DeviceGPA(func); \
DeviceGPA(CONCAT(func, suffix)); \
if(table->func == NULL) \
table->func = table->CONCAT(func, suffix); \
if(table->CONCAT(func, suffix) == NULL) \
table->CONCAT(func, suffix) = table->func; \
#define HookInitPromotedExtension(cond, version, func, suffix) \
if(cond) \
{ \
DeviceGPA(func); \
DeviceGPA(CONCAT(func, suffix)); \
if(table->func == NULL) \
table->func = table->CONCAT(func, suffix); \
if(table->CONCAT(func, suffix) == NULL) \
table->CONCAT(func, suffix) = table->func; \
}

#undef HookInitExtensionEXTtoKHR
Expand Down

0 comments on commit ad597cb

Please sign in to comment.