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 26, 2024
1 parent 0f6c619 commit 4681b9b
Show file tree
Hide file tree
Showing 19 changed files with 323 additions and 133 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
3 changes: 3 additions & 0 deletions renderdoc/api/replay/vk_pipestate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@ -978,6 +978,7 @@ enum class VulkanChunk : uint32_t
vkCmdDrawMeshTasksEXT,
vkCmdDrawMeshTasksIndirectEXT,
vkCmdDrawMeshTasksIndirectCountEXT,
vkCmdBindIndexBuffer2KHR,
Max,
};

Expand Down
4 changes: 4 additions & 0 deletions renderdoc/driver/vulkan/vk_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3989,6 +3989,10 @@ bool WrappedVulkan::ProcessChunk(ReadSerialiser &ser, VulkanChunk chunk)
return Serialise_vkCmdSetTessellationDomainOriginEXT(ser, VK_NULL_HANDLE,
VK_TESSELLATION_DOMAIN_ORIGIN_MAX_ENUM);

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 @@ -2812,4 +2812,18 @@ class WrappedVulkan : public IFrameCapturer
VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
VkBuffer countBuffer, VkDeviceSize countBufferOffset,
uint32_t maxDrawCount, uint32_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
Loading

0 comments on commit 4681b9b

Please sign in to comment.