diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp index f1136fd5ea4..167f8ab8fe3 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp @@ -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("-"), @@ -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"); diff --git a/renderdoc/api/replay/pipestate.inl b/renderdoc/api/replay/pipestate.inl index 1724d378a34..f4e23163ef7 100644 --- a/renderdoc/api/replay/pipestate.inl +++ b/renderdoc/api/replay/pipestate.inl @@ -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; } } diff --git a/renderdoc/api/replay/vk_pipestate.h b/renderdoc/api/replay/vk_pipestate.h index 248f93d67b8..3e86fb86981 100644 --- a/renderdoc/api/replay/vk_pipestate.h +++ b/renderdoc/api/replay/vk_pipestate.h @@ -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. @@ -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. )"); diff --git a/renderdoc/driver/vulkan/extension_support.md b/renderdoc/driver/vulkan/extension_support.md index 59cc683d7f5..a49791c3687 100644 --- a/renderdoc/driver/vulkan/extension_support.md +++ b/renderdoc/driver/vulkan/extension_support.md @@ -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` @@ -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` diff --git a/renderdoc/driver/vulkan/vk_common.h b/renderdoc/driver/vulkan/vk_common.h index 84914c9e7a2..6208e4ec725 100644 --- a/renderdoc/driver/vulkan/vk_common.h +++ b/renderdoc/driver/vulkan/vk_common.h @@ -981,6 +981,7 @@ enum class VulkanChunk : uint32_t vkCmdDrawMeshTasksEXT, vkCmdDrawMeshTasksIndirectEXT, vkCmdDrawMeshTasksIndirectCountEXT, + vkCmdBindIndexBuffer2KHR, Max, }; diff --git a/renderdoc/driver/vulkan/vk_core.cpp b/renderdoc/driver/vulkan/vk_core.cpp index 6c9943e498a..88a981ed3ed 100644 --- a/renderdoc/driver/vulkan/vk_core.cpp +++ b/renderdoc/driver/vulkan/vk_core.cpp @@ -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, @@ -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[] = { @@ -3989,6 +3992,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: diff --git a/renderdoc/driver/vulkan/vk_core.h b/renderdoc/driver/vulkan/vk_core.h index 854ba15103f..e911e61f73f 100644 --- a/renderdoc/driver/vulkan/vk_core.h +++ b/renderdoc/driver/vulkan/vk_core.h @@ -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); }; diff --git a/renderdoc/driver/vulkan/vk_dispatchtables.cpp b/renderdoc/driver/vulkan/vk_dispatchtables.cpp index b2fcc812715..1de66ab944d 100644 --- a/renderdoc/driver/vulkan/vk_dispatchtables.cpp +++ b/renderdoc/driver/vulkan/vk_dispatchtables.cpp @@ -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 @@ -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 diff --git a/renderdoc/driver/vulkan/vk_hookset_defs.h b/renderdoc/driver/vulkan/vk_hookset_defs.h index 0eebcebaa29..0b92248cc19 100644 --- a/renderdoc/driver/vulkan/vk_hookset_defs.h +++ b/renderdoc/driver/vulkan/vk_hookset_defs.h @@ -554,7 +554,8 @@ DeclExt(EXT_scalar_block_layout); \ DeclExt(KHR_vertex_attribute_divisor); \ DeclExt(KHR_line_rasterization); \ - DeclExt(KHR_calibrated_timestamps); + DeclExt(KHR_calibrated_timestamps); \ + DeclExt(KHR_maintenance5); // for simplicity and since the check itself is platform agnostic, // these aren't protected in platform defines @@ -679,7 +680,8 @@ CheckExt(EXT_scalar_block_layout, VK12); \ CheckExt(KHR_vertex_attribute_divisor, VKXX); \ CheckExt(KHR_line_rasterization, VKXX); \ - CheckExt(KHR_calibrated_timestamps, VKXX); + CheckExt(KHR_calibrated_timestamps, VKXX); \ + CheckExt(KHR_maintenance5, VKXX); #define HookInitVulkanInstanceExts_PhysDev() \ HookInitExtension(KHR_surface, GetPhysicalDeviceSurfaceSupportKHR); \ @@ -694,25 +696,27 @@ HookInitExtension(KHR_display, GetDisplayPlaneCapabilitiesKHR); \ HookInitExtension(NV_external_memory_capabilities, \ GetPhysicalDeviceExternalImageFormatPropertiesNV); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, GetPhysicalDeviceFeatures2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, GetPhysicalDeviceProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, GetPhysicalDeviceFeatures2, \ + KHR); \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ + GetPhysicalDeviceProperties2, KHR); \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ GetPhysicalDeviceFormatProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ GetPhysicalDeviceImageFormatProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ GetPhysicalDeviceQueueFamilyProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ GetPhysicalDeviceMemoryProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ GetPhysicalDeviceSparseImageFormatProperties2, KHR); \ HookInitExtension(EXT_direct_mode_display, ReleaseDisplayEXT); \ HookInitExtension(EXT_display_surface_counter, GetPhysicalDeviceSurfaceCapabilities2EXT); \ - HookInitPromotedExtension(KHR_external_memory_capabilities, \ + HookInitPromotedExtension(KHR_external_memory_capabilities, VK11, \ GetPhysicalDeviceExternalBufferProperties, KHR); \ - HookInitPromotedExtension(KHR_external_semaphore_capabilities, \ + HookInitPromotedExtension(KHR_external_semaphore_capabilities, VK11, \ GetPhysicalDeviceExternalSemaphoreProperties, KHR); \ - HookInitPromotedExtension(KHR_external_fence_capabilities, \ + HookInitPromotedExtension(KHR_external_fence_capabilities, VK11, \ GetPhysicalDeviceExternalFenceProperties, KHR); \ HookInitExtension(KHR_device_group_creation &&KHR_surface, GetPhysicalDevicePresentRectanglesKHR); \ HookInitExtension(KHR_get_surface_capabilities2, GetPhysicalDeviceSurfaceFormats2KHR); \ @@ -724,7 +728,7 @@ HookInitExtension(KHR_performance_query, \ EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR); \ HookInitExtension(KHR_performance_query, GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR); \ - HookInitPromotedExtension(EXT_tooling_info, GetPhysicalDeviceToolProperties, EXT); \ + HookInitPromotedExtension(EXT_tooling_info, VK13, GetPhysicalDeviceToolProperties, EXT); \ HookInitExtension(KHR_fragment_shading_rate, GetPhysicalDeviceFragmentShadingRatesKHR); \ HookInitExtension(EXT_acquire_drm_display, AcquireDrmDisplayEXT); \ HookInitExtension(EXT_acquire_drm_display, GetDrmDisplayEXT); \ @@ -753,30 +757,32 @@ HookInitExtension(KHR_display, CreateDisplayPlaneSurfaceKHR); \ HookInitExtension(NV_external_memory_capabilities, \ GetPhysicalDeviceExternalImageFormatPropertiesNV); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, GetPhysicalDeviceFeatures2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, GetPhysicalDeviceProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, GetPhysicalDeviceFeatures2, \ + KHR); \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ + GetPhysicalDeviceProperties2, KHR); \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ GetPhysicalDeviceFormatProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ GetPhysicalDeviceImageFormatProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ GetPhysicalDeviceQueueFamilyProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ GetPhysicalDeviceMemoryProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ GetPhysicalDeviceSparseImageFormatProperties2, KHR); \ HookInitExtension(EXT_direct_mode_display, ReleaseDisplayEXT); \ HookInitExtension(EXT_display_surface_counter, GetPhysicalDeviceSurfaceCapabilities2EXT); \ - HookInitPromotedExtension(KHR_external_memory_capabilities, \ + HookInitPromotedExtension(KHR_external_memory_capabilities, VK11, \ GetPhysicalDeviceExternalBufferProperties, KHR); \ - HookInitPromotedExtension(KHR_external_semaphore_capabilities, \ + HookInitPromotedExtension(KHR_external_semaphore_capabilities, VK11, \ GetPhysicalDeviceExternalSemaphoreProperties, KHR); \ - HookInitPromotedExtension(KHR_external_fence_capabilities, \ + HookInitPromotedExtension(KHR_external_fence_capabilities, VK11, \ GetPhysicalDeviceExternalFenceProperties, KHR); \ HookInitExtension(EXT_debug_utils, CreateDebugUtilsMessengerEXT); \ HookInitExtension(EXT_debug_utils, DestroyDebugUtilsMessengerEXT); \ HookInitExtension(EXT_debug_utils, SubmitDebugUtilsMessageEXT); \ - HookInitPromotedExtension(KHR_device_group_creation, EnumeratePhysicalDeviceGroups, KHR); \ + HookInitPromotedExtension(KHR_device_group_creation, VK11, EnumeratePhysicalDeviceGroups, KHR); \ /* Not technically accurate - part of KHR_device_group - but these extensions are linked and */ \ /* should always be present/not present together. Keying from the instance extension ensures */ \ /* we'll load this function correctly when populating dispatch tables. */ \ @@ -793,7 +799,7 @@ HookInitExtension(KHR_performance_query, \ EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR); \ HookInitExtension(KHR_performance_query, GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR); \ - HookInitPromotedExtension(EXT_tooling_info, GetPhysicalDeviceToolProperties, EXT); \ + HookInitPromotedExtension(EXT_tooling_info, VK13, GetPhysicalDeviceToolProperties, EXT); \ HookInitExtension(KHR_fragment_shading_rate, GetPhysicalDeviceFragmentShadingRatesKHR); \ HookInitExtension(KHR_calibrated_timestamps, GetPhysicalDeviceCalibrateableTimeDomainsKHR); \ HookInitExtension_Instance_Win32(); \ @@ -802,190 +808,199 @@ HookInitExtension_Instance_Android(); \ HookInitExtension_Instance_Mac(); -#define HookInitVulkanDeviceExts() \ - HookInitExtension(EXT_debug_marker, DebugMarkerSetObjectTagEXT); \ - HookInitExtension(EXT_debug_marker, DebugMarkerSetObjectNameEXT); \ - HookInitExtension(EXT_debug_marker, CmdDebugMarkerBeginEXT); \ - HookInitExtension(EXT_debug_marker, CmdDebugMarkerEndEXT); \ - HookInitExtension(EXT_debug_marker, CmdDebugMarkerInsertEXT); \ - HookInitExtension(KHR_swapchain, CreateSwapchainKHR); \ - HookInitExtension(KHR_swapchain, DestroySwapchainKHR); \ - HookInitExtension(KHR_swapchain, GetSwapchainImagesKHR); \ - HookInitExtension(KHR_swapchain, AcquireNextImageKHR); \ - HookInitExtension(KHR_swapchain, QueuePresentKHR); \ - HookInitExtension(KHR_display_swapchain, CreateSharedSwapchainsKHR); \ - HookInitPromotedExtension(KHR_maintenance1, TrimCommandPool, KHR); \ - HookInitExtension(EXT_display_control, DisplayPowerControlEXT); \ - HookInitExtension(EXT_display_control, RegisterDeviceEventEXT); \ - HookInitExtension(EXT_display_control, RegisterDisplayEventEXT); \ - HookInitExtension(EXT_display_control, GetSwapchainCounterEXT); \ - HookInitExtension(KHR_external_memory_fd, GetMemoryFdKHR); \ - HookInitExtension(KHR_external_memory_fd, GetMemoryFdPropertiesKHR); \ - HookInitExtension(KHR_external_semaphore_fd, ImportSemaphoreFdKHR); \ - HookInitExtension(KHR_external_semaphore_fd, GetSemaphoreFdKHR); \ - HookInitExtension(KHR_external_fence_fd, ImportFenceFdKHR); \ - HookInitExtension(KHR_external_fence_fd, GetFenceFdKHR); \ - HookInitPromotedExtension(KHR_get_memory_requirements2, GetBufferMemoryRequirements2, KHR); \ - HookInitPromotedExtension(KHR_get_memory_requirements2, GetImageMemoryRequirements2, KHR); \ - HookInitPromotedExtension(KHR_get_memory_requirements2, GetImageSparseMemoryRequirements2, KHR); \ - HookInitExtension(AMD_shader_info, GetShaderInfoAMD); \ - HookInitExtension(KHR_push_descriptor, CmdPushDescriptorSetKHR); \ - HookInitPromotedExtension(KHR_descriptor_update_template, CreateDescriptorUpdateTemplate, KHR); \ - HookInitPromotedExtension(KHR_descriptor_update_template, DestroyDescriptorUpdateTemplate, KHR); \ - HookInitPromotedExtension(KHR_descriptor_update_template, UpdateDescriptorSetWithTemplate, KHR); \ - HookInitExtension(KHR_push_descriptor &&KHR_descriptor_update_template, \ - CmdPushDescriptorSetWithTemplateKHR); \ - HookInitPromotedExtension(KHR_bind_memory2, BindBufferMemory2, KHR); \ - HookInitPromotedExtension(KHR_bind_memory2, BindImageMemory2, KHR); \ - HookInitPromotedExtension(KHR_maintenance3, GetDescriptorSetLayoutSupport, KHR); \ - HookInitExtension(AMD_buffer_marker, CmdWriteBufferMarkerAMD); \ - HookInitExtension(EXT_debug_utils, SetDebugUtilsObjectNameEXT); \ - HookInitExtension(EXT_debug_utils, SetDebugUtilsObjectTagEXT); \ - HookInitExtension(EXT_debug_utils, QueueBeginDebugUtilsLabelEXT); \ - HookInitExtension(EXT_debug_utils, QueueEndDebugUtilsLabelEXT); \ - HookInitExtension(EXT_debug_utils, QueueInsertDebugUtilsLabelEXT); \ - HookInitExtension(EXT_debug_utils, CmdBeginDebugUtilsLabelEXT); \ - HookInitExtension(EXT_debug_utils, CmdEndDebugUtilsLabelEXT); \ - HookInitExtension(EXT_debug_utils, CmdInsertDebugUtilsLabelEXT); \ - HookInitPromotedExtension(KHR_sampler_ycbcr_conversion, CreateSamplerYcbcrConversion, KHR); \ - HookInitPromotedExtension(KHR_sampler_ycbcr_conversion, DestroySamplerYcbcrConversion, KHR); \ - HookInitPromotedExtension(KHR_device_group, GetDeviceGroupPeerMemoryFeatures, KHR); \ - HookInitPromotedExtension(KHR_device_group, CmdSetDeviceMask, KHR); \ - HookInitPromotedExtension(KHR_device_group, CmdDispatchBase, KHR); \ - HookInitExtension(KHR_device_group &&KHR_surface, GetDeviceGroupPresentCapabilitiesKHR); \ - HookInitExtension(KHR_device_group &&KHR_surface, GetDeviceGroupSurfacePresentModesKHR); \ - HookInitExtension(KHR_device_group &&KHR_swapchain, AcquireNextImage2KHR); \ - HookInitExtension(protected_memory, GetDeviceQueue2); \ - HookInitPromotedExtension(KHR_draw_indirect_count, CmdDrawIndirectCount, KHR); \ - HookInitPromotedExtension(KHR_draw_indirect_count, CmdDrawIndexedIndirectCount, KHR); \ - HookInitExtension(EXT_validation_cache, CreateValidationCacheEXT); \ - HookInitExtension(EXT_validation_cache, DestroyValidationCacheEXT); \ - HookInitExtension(EXT_validation_cache, MergeValidationCachesEXT); \ - HookInitExtension(EXT_validation_cache, GetValidationCacheDataEXT); \ - HookInitExtension(KHR_shared_presentable_image, GetSwapchainStatusKHR); \ - HookInitPromotedExtension(KHR_create_renderpass2, CreateRenderPass2, KHR); \ - HookInitPromotedExtension(KHR_create_renderpass2, CmdBeginRenderPass2, KHR); \ - HookInitPromotedExtension(KHR_create_renderpass2, CmdNextSubpass2, KHR); \ - HookInitPromotedExtension(KHR_create_renderpass2, CmdEndRenderPass2, KHR); \ - HookInitExtension(EXT_transform_feedback, CmdBindTransformFeedbackBuffersEXT); \ - HookInitExtension(EXT_transform_feedback, CmdBeginTransformFeedbackEXT); \ - HookInitExtension(EXT_transform_feedback, CmdEndTransformFeedbackEXT); \ - HookInitExtension(EXT_transform_feedback, CmdBeginQueryIndexedEXT); \ - HookInitExtension(EXT_transform_feedback, CmdEndQueryIndexedEXT); \ - HookInitExtension(EXT_transform_feedback, CmdDrawIndirectByteCountEXT); \ - HookInitExtension(EXT_conditional_rendering, CmdBeginConditionalRenderingEXT); \ - HookInitExtension(EXT_conditional_rendering, CmdEndConditionalRenderingEXT); \ - HookInitExtension(EXT_sample_locations, CmdSetSampleLocationsEXT); \ - HookInitExtension(EXT_discard_rectangles, CmdSetDiscardRectangleEXT); \ - HookInitExtension(EXT_calibrated_timestamps, GetCalibratedTimestampsEXT); \ - HookInitPromotedExtension(EXT_host_query_reset, ResetQueryPool, EXT); \ - HookInitExtension(EXT_buffer_device_address, GetBufferDeviceAddressEXT); \ - HookInitExtension(EXT_hdr_metadata, SetHdrMetadataEXT); \ - HookInitExtension(AMD_display_native_hdr, SetLocalDimmingAMD); \ - HookInitExtension(KHR_pipeline_executable_properties, GetPipelineExecutablePropertiesKHR); \ - HookInitExtension(KHR_pipeline_executable_properties, GetPipelineExecutableStatisticsKHR); \ - HookInitExtension(KHR_pipeline_executable_properties, \ - GetPipelineExecutableInternalRepresentationsKHR); \ - HookInitExtension(EXT_line_rasterization, CmdSetLineStippleEXT); \ - HookInitExtension(GOOGLE_display_timing, GetRefreshCycleDurationGOOGLE); \ - HookInitExtension(GOOGLE_display_timing, GetPastPresentationTimingGOOGLE); \ - HookInitPromotedExtension(KHR_timeline_semaphore, GetSemaphoreCounterValue, KHR); \ - HookInitPromotedExtension(KHR_timeline_semaphore, WaitSemaphores, KHR); \ - HookInitPromotedExtension(KHR_timeline_semaphore, SignalSemaphore, KHR); \ - HookInitExtension(KHR_performance_query, AcquireProfilingLockKHR); \ - HookInitExtension(KHR_performance_query, ReleaseProfilingLockKHR); \ - HookInitPromotedExtension(KHR_buffer_device_address, GetBufferDeviceAddress, KHR); \ - HookInitPromotedExtension(KHR_buffer_device_address, GetBufferOpaqueCaptureAddress, KHR); \ - HookInitPromotedExtension(KHR_buffer_device_address, GetDeviceMemoryOpaqueCaptureAddress, KHR); \ - HookInitPromotedExtension(EXT_private_data, CreatePrivateDataSlot, EXT); \ - HookInitPromotedExtension(EXT_private_data, DestroyPrivateDataSlot, EXT); \ - HookInitPromotedExtension(EXT_private_data, SetPrivateData, EXT); \ - HookInitPromotedExtension(EXT_private_data, GetPrivateData, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdSetCullMode, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdSetFrontFace, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdSetPrimitiveTopology, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdSetViewportWithCount, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdSetScissorWithCount, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdBindVertexBuffers2, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdSetDepthTestEnable, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdSetDepthWriteEnable, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdSetDepthCompareOp, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdSetDepthBoundsTestEnable, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdSetStencilTestEnable, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state, CmdSetStencilOp, EXT); \ - HookInitPromotedExtension(KHR_copy_commands2, CmdCopyBuffer2, KHR); \ - HookInitPromotedExtension(KHR_copy_commands2, CmdCopyImage2, KHR); \ - HookInitPromotedExtension(KHR_copy_commands2, CmdCopyBufferToImage2, KHR); \ - HookInitPromotedExtension(KHR_copy_commands2, CmdCopyImageToBuffer2, KHR); \ - HookInitPromotedExtension(KHR_copy_commands2, CmdBlitImage2, KHR); \ - HookInitPromotedExtension(KHR_copy_commands2, CmdResolveImage2, KHR); \ - HookInitPromotedExtension(KHR_synchronization2, CmdSetEvent2, KHR); \ - HookInitPromotedExtension(KHR_synchronization2, CmdResetEvent2, KHR); \ - HookInitPromotedExtension(KHR_synchronization2, CmdWaitEvents2, KHR); \ - HookInitPromotedExtension(KHR_synchronization2, CmdPipelineBarrier2, KHR); \ - HookInitPromotedExtension(KHR_synchronization2, CmdWriteTimestamp2, KHR); \ - HookInitPromotedExtension(KHR_synchronization2, QueueSubmit2, KHR); \ - HookInitExtension(KHR_synchronization2 &&AMD_buffer_marker, CmdWriteBufferMarker2AMD); \ - /* No GetQueueCheckpointData2NV without VK_NV_device_diagnostic_checkpoints */ \ - HookInitExtension(KHR_present_wait, WaitForPresentKHR); \ - HookInitPromotedExtension(KHR_maintenance4, GetDeviceBufferMemoryRequirements, KHR); \ - HookInitPromotedExtension(KHR_maintenance4, GetDeviceImageMemoryRequirements, KHR); \ - HookInitPromotedExtension(KHR_maintenance4, GetDeviceImageSparseMemoryRequirements, KHR); \ - HookInitExtension(EXT_color_write_enable, CmdSetColorWriteEnableEXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state2, CmdSetDepthBiasEnable, EXT); \ - HookInitExtension(EXT_extended_dynamic_state2, CmdSetLogicOpEXT); \ - HookInitExtension(EXT_extended_dynamic_state2, CmdSetPatchControlPointsEXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state2, CmdSetPrimitiveRestartEnable, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state2, CmdSetRasterizerDiscardEnable, EXT); \ - HookInitExtension(EXT_vertex_input_dynamic_state, CmdSetVertexInputEXT); \ - HookInitPromotedExtension(KHR_dynamic_rendering, CmdBeginRendering, KHR); \ - HookInitPromotedExtension(KHR_dynamic_rendering, CmdEndRendering, KHR); \ - HookInitExtension(KHR_fragment_shading_rate, CmdSetFragmentShadingRateKHR); \ - HookInitExtension(EXT_pageable_device_local_memory, SetDeviceMemoryPriorityEXT); \ - HookInitExtension(EXT_swapchain_maintenance1, ReleaseSwapchainImagesEXT); \ - HookInitExtension(EXT_attachment_feedback_loop_dynamic_state, \ - CmdSetAttachmentFeedbackLoopEnableEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetAlphaToCoverageEnableEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetAlphaToOneEnableEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetColorBlendAdvancedEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetColorBlendEnableEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetColorBlendEquationEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetColorWriteMaskEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetConservativeRasterizationModeEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageModulationModeNV); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageModulationTableEnableNV); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageModulationTableNV); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageReductionModeNV); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageToColorEnableNV); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageToColorLocationNV); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetDepthClampEnableEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetDepthClipEnableEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetDepthClipNegativeOneToOneEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetExtraPrimitiveOverestimationSizeEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetLineRasterizationModeEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetLineStippleEnableEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetLogicOpEnableEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetPolygonModeEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetProvokingVertexModeEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetRasterizationSamplesEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetRasterizationStreamEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetRepresentativeFragmentTestEnableNV); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetSampleLocationsEnableEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetSampleMaskEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetShadingRateImageEnableNV); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetTessellationDomainOriginEXT); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetViewportSwizzleNV); \ - HookInitExtension(EXT_extended_dynamic_state3, CmdSetViewportWScalingEnableNV); \ - HookInitExtension(EXT_mesh_shader, CmdDrawMeshTasksEXT); \ - HookInitExtension(EXT_mesh_shader, CmdDrawMeshTasksIndirectEXT); \ - HookInitExtension(EXT_mesh_shader, CmdDrawMeshTasksIndirectCountEXT); \ - HookInitExtension(KHR_calibrated_timestamps, GetCalibratedTimestampsKHR); \ - HookInitExtension(KHR_line_rasterization, CmdSetLineStippleKHR); \ - HookInitExtensionEXTtoKHR(CmdSetLineStipple); \ - HookInitExtension_Device_Win32(); \ - HookInitExtension_Device_Linux(); \ - HookInitExtension_Device_GGP(); \ - HookInitExtension_Device_Android(); \ +#define HookInitVulkanDeviceExts() \ + HookInitExtension(EXT_debug_marker, DebugMarkerSetObjectTagEXT); \ + HookInitExtension(EXT_debug_marker, DebugMarkerSetObjectNameEXT); \ + HookInitExtension(EXT_debug_marker, CmdDebugMarkerBeginEXT); \ + HookInitExtension(EXT_debug_marker, CmdDebugMarkerEndEXT); \ + HookInitExtension(EXT_debug_marker, CmdDebugMarkerInsertEXT); \ + HookInitExtension(KHR_swapchain, CreateSwapchainKHR); \ + HookInitExtension(KHR_swapchain, DestroySwapchainKHR); \ + HookInitExtension(KHR_swapchain, GetSwapchainImagesKHR); \ + HookInitExtension(KHR_swapchain, AcquireNextImageKHR); \ + HookInitExtension(KHR_swapchain, QueuePresentKHR); \ + HookInitExtension(KHR_display_swapchain, CreateSharedSwapchainsKHR); \ + HookInitPromotedExtension(KHR_maintenance1, VK11, TrimCommandPool, KHR); \ + HookInitExtension(EXT_display_control, DisplayPowerControlEXT); \ + HookInitExtension(EXT_display_control, RegisterDeviceEventEXT); \ + HookInitExtension(EXT_display_control, RegisterDisplayEventEXT); \ + HookInitExtension(EXT_display_control, GetSwapchainCounterEXT); \ + HookInitExtension(KHR_external_memory_fd, GetMemoryFdKHR); \ + HookInitExtension(KHR_external_memory_fd, GetMemoryFdPropertiesKHR); \ + HookInitExtension(KHR_external_semaphore_fd, ImportSemaphoreFdKHR); \ + HookInitExtension(KHR_external_semaphore_fd, GetSemaphoreFdKHR); \ + HookInitExtension(KHR_external_fence_fd, ImportFenceFdKHR); \ + HookInitExtension(KHR_external_fence_fd, GetFenceFdKHR); \ + HookInitPromotedExtension(KHR_get_memory_requirements2, VK11, GetBufferMemoryRequirements2, KHR); \ + HookInitPromotedExtension(KHR_get_memory_requirements2, VK11, GetImageMemoryRequirements2, KHR); \ + HookInitPromotedExtension(KHR_get_memory_requirements2, VK11, GetImageSparseMemoryRequirements2, \ + KHR); \ + HookInitExtension(AMD_shader_info, GetShaderInfoAMD); \ + HookInitExtension(KHR_push_descriptor, CmdPushDescriptorSetKHR); \ + HookInitPromotedExtension(KHR_descriptor_update_template, VK11, CreateDescriptorUpdateTemplate, \ + KHR); \ + HookInitPromotedExtension(KHR_descriptor_update_template, VK11, DestroyDescriptorUpdateTemplate, \ + KHR); \ + HookInitPromotedExtension(KHR_descriptor_update_template, VK11, UpdateDescriptorSetWithTemplate, \ + KHR); \ + HookInitExtension(KHR_push_descriptor &&KHR_descriptor_update_template, \ + CmdPushDescriptorSetWithTemplateKHR); \ + HookInitPromotedExtension(KHR_bind_memory2, VK11, BindBufferMemory2, KHR); \ + HookInitPromotedExtension(KHR_bind_memory2, VK11, BindImageMemory2, KHR); \ + HookInitPromotedExtension(KHR_maintenance3, VK11, GetDescriptorSetLayoutSupport, KHR); \ + HookInitExtension(AMD_buffer_marker, CmdWriteBufferMarkerAMD); \ + HookInitExtension(EXT_debug_utils, SetDebugUtilsObjectNameEXT); \ + HookInitExtension(EXT_debug_utils, SetDebugUtilsObjectTagEXT); \ + HookInitExtension(EXT_debug_utils, QueueBeginDebugUtilsLabelEXT); \ + HookInitExtension(EXT_debug_utils, QueueEndDebugUtilsLabelEXT); \ + HookInitExtension(EXT_debug_utils, QueueInsertDebugUtilsLabelEXT); \ + HookInitExtension(EXT_debug_utils, CmdBeginDebugUtilsLabelEXT); \ + HookInitExtension(EXT_debug_utils, CmdEndDebugUtilsLabelEXT); \ + HookInitExtension(EXT_debug_utils, CmdInsertDebugUtilsLabelEXT); \ + HookInitPromotedExtension(KHR_sampler_ycbcr_conversion, VK11, CreateSamplerYcbcrConversion, KHR); \ + HookInitPromotedExtension(KHR_sampler_ycbcr_conversion, VK11, DestroySamplerYcbcrConversion, KHR); \ + HookInitPromotedExtension(KHR_device_group, VK11, GetDeviceGroupPeerMemoryFeatures, KHR); \ + HookInitPromotedExtension(KHR_device_group, VK11, CmdSetDeviceMask, KHR); \ + HookInitPromotedExtension(KHR_device_group, VK11, CmdDispatchBase, KHR); \ + HookInitExtension(KHR_device_group &&KHR_surface, GetDeviceGroupPresentCapabilitiesKHR); \ + HookInitExtension(KHR_device_group &&KHR_surface, GetDeviceGroupSurfacePresentModesKHR); \ + HookInitExtension(KHR_device_group &&KHR_swapchain, AcquireNextImage2KHR); \ + HookInitExtension(protected_memory, GetDeviceQueue2); \ + HookInitPromotedExtension(KHR_draw_indirect_count, VK12, CmdDrawIndirectCount, KHR); \ + HookInitPromotedExtension(KHR_draw_indirect_count, VK12, CmdDrawIndexedIndirectCount, KHR); \ + HookInitExtension(EXT_validation_cache, CreateValidationCacheEXT); \ + HookInitExtension(EXT_validation_cache, DestroyValidationCacheEXT); \ + HookInitExtension(EXT_validation_cache, MergeValidationCachesEXT); \ + HookInitExtension(EXT_validation_cache, GetValidationCacheDataEXT); \ + HookInitExtension(KHR_shared_presentable_image, GetSwapchainStatusKHR); \ + HookInitPromotedExtension(KHR_create_renderpass2, VK12, CreateRenderPass2, KHR); \ + HookInitPromotedExtension(KHR_create_renderpass2, VK12, CmdBeginRenderPass2, KHR); \ + HookInitPromotedExtension(KHR_create_renderpass2, VK12, CmdNextSubpass2, KHR); \ + HookInitPromotedExtension(KHR_create_renderpass2, VK12, CmdEndRenderPass2, KHR); \ + HookInitExtension(EXT_transform_feedback, CmdBindTransformFeedbackBuffersEXT); \ + HookInitExtension(EXT_transform_feedback, CmdBeginTransformFeedbackEXT); \ + HookInitExtension(EXT_transform_feedback, CmdEndTransformFeedbackEXT); \ + HookInitExtension(EXT_transform_feedback, CmdBeginQueryIndexedEXT); \ + HookInitExtension(EXT_transform_feedback, CmdEndQueryIndexedEXT); \ + HookInitExtension(EXT_transform_feedback, CmdDrawIndirectByteCountEXT); \ + HookInitExtension(EXT_conditional_rendering, CmdBeginConditionalRenderingEXT); \ + HookInitExtension(EXT_conditional_rendering, CmdEndConditionalRenderingEXT); \ + HookInitExtension(EXT_sample_locations, CmdSetSampleLocationsEXT); \ + HookInitExtension(EXT_discard_rectangles, CmdSetDiscardRectangleEXT); \ + HookInitExtension(EXT_calibrated_timestamps, GetCalibratedTimestampsEXT); \ + HookInitPromotedExtension(EXT_host_query_reset, VK12, ResetQueryPool, EXT); \ + HookInitExtension(EXT_buffer_device_address, GetBufferDeviceAddressEXT); \ + HookInitExtension(EXT_hdr_metadata, SetHdrMetadataEXT); \ + HookInitExtension(AMD_display_native_hdr, SetLocalDimmingAMD); \ + HookInitExtension(KHR_pipeline_executable_properties, GetPipelineExecutablePropertiesKHR); \ + HookInitExtension(KHR_pipeline_executable_properties, GetPipelineExecutableStatisticsKHR); \ + HookInitExtension(KHR_pipeline_executable_properties, \ + GetPipelineExecutableInternalRepresentationsKHR); \ + HookInitExtension(EXT_line_rasterization, CmdSetLineStippleEXT); \ + HookInitExtension(GOOGLE_display_timing, GetRefreshCycleDurationGOOGLE); \ + HookInitExtension(GOOGLE_display_timing, GetPastPresentationTimingGOOGLE); \ + HookInitPromotedExtension(KHR_timeline_semaphore, VK12, GetSemaphoreCounterValue, KHR); \ + HookInitPromotedExtension(KHR_timeline_semaphore, VK12, WaitSemaphores, KHR); \ + HookInitPromotedExtension(KHR_timeline_semaphore, VK12, SignalSemaphore, KHR); \ + HookInitExtension(KHR_performance_query, AcquireProfilingLockKHR); \ + HookInitExtension(KHR_performance_query, ReleaseProfilingLockKHR); \ + HookInitPromotedExtension(KHR_buffer_device_address, VK12, GetBufferDeviceAddress, KHR); \ + HookInitPromotedExtension(KHR_buffer_device_address, VK12, GetBufferOpaqueCaptureAddress, KHR); \ + HookInitPromotedExtension(KHR_buffer_device_address, VK12, GetDeviceMemoryOpaqueCaptureAddress, \ + KHR); \ + HookInitPromotedExtension(EXT_private_data, VK13, CreatePrivateDataSlot, EXT); \ + HookInitPromotedExtension(EXT_private_data, VK13, DestroyPrivateDataSlot, EXT); \ + HookInitPromotedExtension(EXT_private_data, VK13, SetPrivateData, EXT); \ + HookInitPromotedExtension(EXT_private_data, VK13, GetPrivateData, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdSetCullMode, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdSetFrontFace, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdSetPrimitiveTopology, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdSetViewportWithCount, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdSetScissorWithCount, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdBindVertexBuffers2, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdSetDepthTestEnable, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdSetDepthWriteEnable, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdSetDepthCompareOp, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdSetDepthBoundsTestEnable, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdSetStencilTestEnable, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state, VK13, CmdSetStencilOp, EXT); \ + HookInitPromotedExtension(KHR_copy_commands2, VK13, CmdCopyBuffer2, KHR); \ + HookInitPromotedExtension(KHR_copy_commands2, VK13, CmdCopyImage2, KHR); \ + HookInitPromotedExtension(KHR_copy_commands2, VK13, CmdCopyBufferToImage2, KHR); \ + HookInitPromotedExtension(KHR_copy_commands2, VK13, CmdCopyImageToBuffer2, KHR); \ + HookInitPromotedExtension(KHR_copy_commands2, VK13, CmdBlitImage2, KHR); \ + HookInitPromotedExtension(KHR_copy_commands2, VK13, CmdResolveImage2, KHR); \ + HookInitPromotedExtension(KHR_synchronization2, VK13, CmdSetEvent2, KHR); \ + HookInitPromotedExtension(KHR_synchronization2, VK13, CmdResetEvent2, KHR); \ + HookInitPromotedExtension(KHR_synchronization2, VK13, CmdWaitEvents2, KHR); \ + HookInitPromotedExtension(KHR_synchronization2, VK13, CmdPipelineBarrier2, KHR); \ + HookInitPromotedExtension(KHR_synchronization2, VK13, CmdWriteTimestamp2, KHR); \ + HookInitPromotedExtension(KHR_synchronization2, VK13, QueueSubmit2, KHR); \ + HookInitExtension(KHR_synchronization2 &&AMD_buffer_marker, CmdWriteBufferMarker2AMD); \ + /* No GetQueueCheckpointData2NV without VK_NV_device_diagnostic_checkpoints */ \ + HookInitExtension(KHR_present_wait, WaitForPresentKHR); \ + HookInitPromotedExtension(KHR_maintenance4, VK13, GetDeviceBufferMemoryRequirements, KHR); \ + HookInitPromotedExtension(KHR_maintenance4, VK13, GetDeviceImageMemoryRequirements, KHR); \ + HookInitPromotedExtension(KHR_maintenance4, VK13, GetDeviceImageSparseMemoryRequirements, KHR); \ + HookInitExtension(EXT_color_write_enable, CmdSetColorWriteEnableEXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state2, VK13, CmdSetDepthBiasEnable, EXT); \ + HookInitExtension(EXT_extended_dynamic_state2, CmdSetLogicOpEXT); \ + HookInitExtension(EXT_extended_dynamic_state2, CmdSetPatchControlPointsEXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state2, VK13, CmdSetPrimitiveRestartEnable, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state2, VK13, CmdSetRasterizerDiscardEnable, EXT); \ + HookInitExtension(EXT_vertex_input_dynamic_state, CmdSetVertexInputEXT); \ + HookInitPromotedExtension(KHR_dynamic_rendering, VK13, CmdBeginRendering, KHR); \ + HookInitPromotedExtension(KHR_dynamic_rendering, VK13, CmdEndRendering, KHR); \ + HookInitExtension(KHR_fragment_shading_rate, CmdSetFragmentShadingRateKHR); \ + HookInitExtension(EXT_pageable_device_local_memory, SetDeviceMemoryPriorityEXT); \ + HookInitExtension(EXT_swapchain_maintenance1, ReleaseSwapchainImagesEXT); \ + HookInitExtension(EXT_attachment_feedback_loop_dynamic_state, \ + CmdSetAttachmentFeedbackLoopEnableEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetAlphaToCoverageEnableEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetAlphaToOneEnableEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetColorBlendAdvancedEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetColorBlendEnableEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetColorBlendEquationEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetColorWriteMaskEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetConservativeRasterizationModeEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageModulationModeNV); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageModulationTableEnableNV); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageModulationTableNV); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageReductionModeNV); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageToColorEnableNV); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetCoverageToColorLocationNV); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetDepthClampEnableEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetDepthClipEnableEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetDepthClipNegativeOneToOneEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetExtraPrimitiveOverestimationSizeEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetLineRasterizationModeEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetLineStippleEnableEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetLogicOpEnableEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetPolygonModeEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetProvokingVertexModeEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetRasterizationSamplesEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetRasterizationStreamEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetRepresentativeFragmentTestEnableNV); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetSampleLocationsEnableEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetSampleMaskEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetShadingRateImageEnableNV); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetTessellationDomainOriginEXT); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetViewportSwizzleNV); \ + HookInitExtension(EXT_extended_dynamic_state3, CmdSetViewportWScalingEnableNV); \ + HookInitExtension(EXT_mesh_shader, CmdDrawMeshTasksEXT); \ + HookInitExtension(EXT_mesh_shader, CmdDrawMeshTasksIndirectEXT); \ + HookInitExtension(EXT_mesh_shader, CmdDrawMeshTasksIndirectCountEXT); \ + HookInitExtension(KHR_calibrated_timestamps, GetCalibratedTimestampsKHR); \ + HookInitExtension(KHR_line_rasterization, CmdSetLineStippleKHR); \ + HookInitExtensionEXTtoKHR(CmdSetLineStipple); \ + HookInitExtension(KHR_maintenance5, CmdBindIndexBuffer2KHR); \ + HookInitExtension(KHR_maintenance5, GetDeviceImageSubresourceLayoutKHR); \ + HookInitExtension(KHR_maintenance5, GetImageSubresourceLayout2KHR); \ + HookInitExtension(KHR_maintenance5, GetRenderingAreaGranularityKHR); \ + HookInitExtension_Device_Win32(); \ + HookInitExtension_Device_Linux(); \ + HookInitExtension_Device_GGP(); \ + HookInitExtension_Device_Android(); \ HookInitExtension_Device_Mac(); #define DefineHooks() \ @@ -1790,6 +1805,14 @@ uint64_t *, pMaxDeviation); \ HookDefine3(void, vkCmdSetLineStippleKHR, VkCommandBuffer, commandBuffer, uint32_t, \ lineStippleFactor, uint16_t, lineStipplePattern); \ + HookDefine5(void, vkCmdBindIndexBuffer2KHR, VkCommandBuffer, commandBuffer, VkBuffer, buffer, \ + VkDeviceSize, offset, VkDeviceSize, size, VkIndexType, indexType); \ + HookDefine3(void, vkGetDeviceImageSubresourceLayoutKHR, VkDevice, device, \ + const VkDeviceImageSubresourceInfoKHR *, pInfo, VkSubresourceLayout2KHR *, pLayout); \ + HookDefine4(void, vkGetImageSubresourceLayout2KHR, VkDevice, device, VkImage, image, \ + const VkImageSubresource2KHR *, pSubresource, VkSubresourceLayout2KHR *, pLayout); \ + HookDefine3(void, vkGetRenderingAreaGranularityKHR, VkDevice, device, \ + const VkRenderingAreaInfoKHR *, pRenderingAreaInfo, VkExtent2D *, pGranularity); \ HookDefine_Win32(); \ HookDefine_Linux(); \ HookDefine_GGP(); \ diff --git a/renderdoc/driver/vulkan/vk_info.cpp b/renderdoc/driver/vulkan/vk_info.cpp index 5c43e64a91e..76ff0e866ba 100644 --- a/renderdoc/driver/vulkan/vk_info.cpp +++ b/renderdoc/driver/vulkan/vk_info.cpp @@ -792,6 +792,10 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, const VkGraphicsPipelineCreateInfo *pCreateInfo) { flags = pCreateInfo->flags; + auto *pPipelineFlags2 = + FindNextStruct(pCreateInfo, VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); + if(pPipelineFlags2) + flags = ((VkPipelineCreateFlags2CreateInfoKHR *)pPipelineFlags2)->flags; graphicsPipe = true; @@ -1463,6 +1467,10 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk ResourceId id, const VkComputePipelineCreateInfo *pCreateInfo) { flags = pCreateInfo->flags; + auto *pPipelineFlags2 = + FindNextStruct(pCreateInfo, VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); + if(pPipelineFlags2) + flags = ((VkPipelineCreateFlags2CreateInfoKHR *)pPipelineFlags2)->flags; graphicsPipe = false; @@ -1943,7 +1951,7 @@ void VulkanCreationInfo::Buffer::Init(VulkanResourceManager *resourceMan, Vulkan const VkBufferCreateInfo *pCreateInfo, VkMemoryRequirements origMrq) { - usage = pCreateInfo->usage; + usage = (VkBufferUsageFlags2KHR)pCreateInfo->usage; size = pCreateInfo->size; gpuAddress = 0; @@ -1955,6 +1963,13 @@ void VulkanCreationInfo::Buffer::Init(VulkanResourceManager *resourceMan, Vulkan { external = true; } + + auto *usageInfo2 = + FindNextStruct(pCreateInfo, VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR); + if(usageInfo2) + { + usage = ((VkBufferUsageFlags2CreateInfoKHR *)usageInfo2)->usage; + } } void VulkanCreationInfo::BufferView::Init(VulkanResourceManager *resourceMan, diff --git a/renderdoc/driver/vulkan/vk_info.h b/renderdoc/driver/vulkan/vk_info.h index b85552d29db..5fe9a7265e7 100644 --- a/renderdoc/driver/vulkan/vk_info.h +++ b/renderdoc/driver/vulkan/vk_info.h @@ -337,7 +337,7 @@ struct VulkanCreationInfo VkPipeline subpass0pipe; // VkGraphicsPipelineCreateInfo - VkPipelineCreateFlags flags; + VkPipelineCreateFlags2KHR flags; // VkPipelineShaderStageCreateInfo struct Shader @@ -618,7 +618,7 @@ struct VulkanCreationInfo void Init(VulkanResourceManager *resourceMan, VulkanCreationInfo &info, const VkBufferCreateInfo *pCreateInfo, VkMemoryRequirements origMrq); - VkBufferUsageFlags usage; + VkBufferUsageFlags2KHR usage; uint64_t size; uint64_t gpuAddress; bool external; diff --git a/renderdoc/driver/vulkan/vk_layer.cpp b/renderdoc/driver/vulkan/vk_layer.cpp index 487618ed0d0..87ea0285492 100644 --- a/renderdoc/driver/vulkan/vk_layer.cpp +++ b/renderdoc/driver/vulkan/vk_layer.cpp @@ -397,12 +397,16 @@ VK_LAYER_RENDERDOC_CaptureEnumerateInstanceExtensionProperties( // for promoted extensions, we return the function pointer for either name as an alias. #undef HookInitPromotedExtension -#define HookInitPromotedExtension(cond, function, suffix) \ - if(!strcmp(pName, STRINGIZE(CONCAT(vk, function))) || \ - !strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ - { \ - if(cond) \ - return (PFN_vkVoidFunction)&CONCAT(hooked_vk, function); \ +#define HookInitPromotedExtension(cond, version, function, suffix) \ + if(!strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ + { \ + if(cond) \ + return (PFN_vkVoidFunction)&CONCAT(hooked_vk, function); \ + } \ + if(!strcmp(pName, STRINGIZE(CONCAT(vk, function)))) \ + { \ + if(instDevInfo->vulkanVersion >= version) \ + return (PFN_vkVoidFunction)&CONCAT(hooked_vk, function); \ } #undef HookInitExtensionEXTtoKHR @@ -413,6 +417,9 @@ VK_LAYER_RENDERDOC_CaptureEnumerateInstanceExtensionProperties( VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL VK_LAYER_RENDERDOC_CaptureGetDeviceProcAddr(VkDevice device, const char *pName) { + if(device == VK_NULL_HANDLE || pName == NULL) + return NULL; + if(!strcmp("vkGetDeviceProcAddr", pName)) return (PFN_vkVoidFunction)&VK_LAYER_RENDERDOC_CaptureGetDeviceProcAddr; if(!strcmp("vkCreateDevice", pName)) @@ -422,9 +429,6 @@ VK_LAYER_RENDERDOC_CaptureGetDeviceProcAddr(VkDevice device, const char *pName) HookInitVulkanDevice(); - if(device == VK_NULL_HANDLE) - return NULL; - InstanceDeviceInfo *instDevInfo = GetRecord(device)->instDevInfo; DeclExts(); @@ -512,7 +516,7 @@ VK_LAYER_RENDERDOC_CaptureGetInstanceProcAddr(VkInstance instance, const char *p return (PFN_vkVoidFunction)&CONCAT(hooked_vk, function); #undef HookInitPromotedExtension -#define HookInitPromotedExtension(cond, function, suffix) \ +#define HookInitPromotedExtension(cond, version, function, suffix) \ if(!strcmp(pName, STRINGIZE(CONCAT(vk, function))) || \ !strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ return (PFN_vkVoidFunction)&CONCAT(hooked_vk, function); @@ -593,7 +597,7 @@ VK_LAYER_RENDERDOC_Capture_layerGetPhysicalDeviceProcAddr(VkInstance instance, c return NULL; #undef HookInitPromotedExtension -#define HookInitPromotedExtension(cond, function, suffix) \ +#define HookInitPromotedExtension(cond, version, function, suffix) \ if(!strcmp(pName, STRINGIZE(CONCAT(vk, function))) || \ !strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ return NULL; diff --git a/renderdoc/driver/vulkan/vk_next_chains.cpp b/renderdoc/driver/vulkan/vk_next_chains.cpp index 8d3a678f870..78e06bb730c 100644 --- a/renderdoc/driver/vulkan/vk_next_chains.cpp +++ b/renderdoc/driver/vulkan/vk_next_chains.cpp @@ -748,7 +748,11 @@ static void AppendModifiedChainedStruct(byte *&tempMem, VkStruct *outputStruct, UNWRAP_STRUCT_CAPTURE_ONLY(VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR, VkSemaphoreGetFdInfoKHR, \ UnwrapInPlace(out->semaphore)); \ UNWRAP_STRUCT_CAPTURE_ONLY(VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, VkSwapchainCreateInfoKHR, \ - UnwrapInPlace(out->surface), UnwrapInPlace(out->oldSwapchain)); + UnwrapInPlace(out->surface), UnwrapInPlace(out->oldSwapchain)); \ + COPY_STRUCT(VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR, \ + VkBufferUsageFlags2CreateInfoKHR); \ + COPY_STRUCT(VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR, \ + VkPipelineCreateFlags2CreateInfoKHR); // define cases for structs we don't handle at all - only the body of the case needs to be defined // per-function. @@ -804,7 +808,6 @@ static void AppendModifiedChainedStruct(byte *&tempMem, VkStruct *outputStruct, case VK_STRUCTURE_TYPE_BUFFER_COLLECTION_IMAGE_CREATE_INFO_FUCHSIA: \ case VK_STRUCTURE_TYPE_BUFFER_COLLECTION_PROPERTIES_FUCHSIA: \ case VK_STRUCTURE_TYPE_BUFFER_CONSTRAINTS_INFO_FUCHSIA: \ - case VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR: \ case VK_STRUCTURE_TYPE_CHECKPOINT_DATA_2_NV: \ case VK_STRUCTURE_TYPE_CHECKPOINT_DATA_NV: \ case VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDER_PASS_TRANSFORM_INFO_QCOM: \ @@ -1065,7 +1068,6 @@ static void AppendModifiedChainedStruct(byte *&tempMem, VkStruct *outputStruct, case VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV: \ case VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_REDUCTION_STATE_CREATE_INFO_NV: \ case VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV: \ - case VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR: \ case VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_ENUM_STATE_CREATE_INFO_NV: \ case VK_STRUCTURE_TYPE_PIPELINE_INDIRECT_DEVICE_ADDRESS_INFO_NV: \ case VK_STRUCTURE_TYPE_PIPELINE_PROPERTIES_IDENTIFIER_EXT: \ diff --git a/renderdoc/driver/vulkan/vk_overlay.cpp b/renderdoc/driver/vulkan/vk_overlay.cpp index fdc1907db1d..83770a5fcc2 100644 --- a/renderdoc/driver/vulkan/vk_overlay.cpp +++ b/renderdoc/driver/vulkan/vk_overlay.cpp @@ -364,9 +364,19 @@ void VulkanDebugManager::PatchLineStripIndexBuffer(const ActionDescription *acti if(action->flags & ActionFlags::Indexed) { - GetBufferData(rs.ibuffer.buf, - rs.ibuffer.offs + uint64_t(action->indexOffset) * rs.ibuffer.bytewidth, - uint64_t(action->numIndices) * rs.ibuffer.bytewidth, indices); + uint64_t offset = uint64_t(action->indexOffset) * rs.ibuffer.bytewidth; + uint64_t data_len = uint64_t(action->numIndices) * rs.ibuffer.bytewidth; + + uint64_t len = RDCMIN(data_len, rs.ibuffer.size - offset); + + GetBufferData(rs.ibuffer.buf, rs.ibuffer.offs + offset, len, indices); + + if(len < data_len) + { + // fill the rest with 0s + indices.resize((size_t)data_len); + memset(indices.data() + len, 0, (size_t)(data_len - len)); + } if(rs.ibuffer.bytewidth == 4) idx32 = (uint32_t *)indices.data(); diff --git a/renderdoc/driver/vulkan/vk_postvs.cpp b/renderdoc/driver/vulkan/vk_postvs.cpp index 9c6c93713aa..57ec51e7237 100644 --- a/renderdoc/driver/vulkan/vk_postvs.cpp +++ b/renderdoc/driver/vulkan/vk_postvs.cpp @@ -4331,8 +4331,13 @@ void VulkanReplay::FetchVSOut(uint32_t eventId, VulkanRenderState &state) // fetch ibuffer if(state.ibuffer.buf != ResourceId()) - GetBufferData(state.ibuffer.buf, state.ibuffer.offs + action->indexOffset * idxsize, - uint64_t(action->numIndices) * idxsize, idxdata); + { + uint64_t offset = uint64_t(action->indexOffset) * idxsize; + uint64_t data_len = uint64_t(action->numIndices) * idxsize; + + uint64_t len = RDCMIN(data_len, state.ibuffer.size - offset); + GetBufferData(state.ibuffer.buf, state.ibuffer.offs + offset, len, idxdata); + } // figure out what the maximum index could be, so we can clamp our index buffer to something // sane diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index 107779623d8..25d04f4fd20 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -1185,6 +1185,7 @@ void VulkanReplay::SavePipelineState(uint32_t eventId) ret.inputAssembly.indexBuffer.resourceId = rm->GetOriginalID(state.ibuffer.buf); ret.inputAssembly.indexBuffer.byteOffset = state.ibuffer.offs; ret.inputAssembly.indexBuffer.byteStride = state.ibuffer.bytewidth; + ret.inputAssembly.indexBuffer.byteSize = state.ibuffer.size; ret.inputAssembly.primitiveRestartEnable = state.primRestartEnable != VK_FALSE; ret.inputAssembly.topology = MakePrimitiveTopology(state.primitiveTopology, state.patchControlPoints); diff --git a/renderdoc/driver/vulkan/vk_shader_cache.cpp b/renderdoc/driver/vulkan/vk_shader_cache.cpp index e1003da5a4e..6ad450dae9d 100644 --- a/renderdoc/driver/vulkan/vk_shader_cache.cpp +++ b/renderdoc/driver/vulkan/vk_shader_cache.cpp @@ -902,7 +902,7 @@ void VulkanShaderCache::MakeGraphicsPipelineInfo(VkGraphicsPipelineCreateInfo &p VkGraphicsPipelineCreateInfo ret = { VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, NULL, - pipeInfo.flags, + 0, stageCount, stages, &vi, @@ -1017,11 +1017,28 @@ void VulkanShaderCache::MakeGraphicsPipelineInfo(VkGraphicsPipelineCreateInfo &p rs.pNext = &provokeSetup; } + static VkPipelineCreateFlags2CreateInfoKHR flags2 = { + VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR, + }; + + VkPipelineCreateFlags2KHR flags = pipeInfo.flags; + // never create derivatives - ret.flags &= ~VK_PIPELINE_CREATE_DERIVATIVE_BIT; + flags &= ~VK_PIPELINE_CREATE_DERIVATIVE_BIT; - ret.flags &= ~VK_PIPELINE_CREATE_LIBRARY_BIT_KHR; - ret.flags &= ~VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT; + flags &= ~VK_PIPELINE_CREATE_LIBRARY_BIT_KHR; + flags &= ~VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT; + + if(flags >= 0x80000000u) + { + flags2.flags = pipeInfo.flags; + flags2.pNext = ret.pNext; + ret.pNext = &flags2; + } + else + { + ret.flags = (VkPipelineCreateFlags)flags; + } pipeCreateInfo = ret; } @@ -1093,15 +1110,32 @@ void VulkanShaderCache::MakeComputePipelineInfo(VkComputePipelineCreateInfo &pip VkComputePipelineCreateInfo ret = { VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, NULL, - pipeInfo.flags, + 0, stage, rm->GetCurrentHandle(pipeInfo.compLayout), VK_NULL_HANDLE, // base pipeline handle 0, // base pipeline index }; + VkPipelineCreateFlags2KHR flags = pipeInfo.flags; + // never create derivatives - ret.flags &= ~VK_PIPELINE_CREATE_DERIVATIVE_BIT; + flags &= ~VK_PIPELINE_CREATE_DERIVATIVE_BIT; + + static VkPipelineCreateFlags2CreateInfoKHR flags2 = { + VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR, + }; + + if(flags >= 0x80000000u) + { + flags2.flags = pipeInfo.flags; + flags2.pNext = ret.pNext; + ret.pNext = &flags2; + } + else + { + ret.flags = (VkPipelineCreateFlags)flags; + } pipeCreateInfo = ret; } diff --git a/renderdoc/driver/vulkan/vk_state.cpp b/renderdoc/driver/vulkan/vk_state.cpp index 2b5fbe9d64b..86374129ead 100644 --- a/renderdoc/driver/vulkan/vk_state.cpp +++ b/renderdoc/driver/vulkan/vk_state.cpp @@ -138,7 +138,6 @@ void setupRenderingInfo(const VulkanRenderState::DynamicRendering &dynamicRender VulkanRenderState::VulkanRenderState() { - RDCEraseEl(ibuffer); } void VulkanRenderState::BeginRenderPassAndApplyState(WrappedVulkan *vk, VkCommandBuffer cmd, @@ -606,9 +605,17 @@ void VulkanRenderState::BindPipeline(WrappedVulkan *vk, VkCommandBuffer cmd, else if(ibuffer.bytewidth == 1) type = VK_INDEX_TYPE_UINT8_KHR; - ObjDisp(cmd)->CmdBindIndexBuffer( - Unwrap(cmd), Unwrap(vk->GetResourceManager()->GetCurrentHandle(ibuffer.buf)), - ibuffer.offs, type); + VkBuffer idxBufferUnwrapped = + Unwrap(vk->GetResourceManager()->GetCurrentHandle(ibuffer.buf)); + if(ibuffer.size == VK_WHOLE_SIZE) + { + ObjDisp(cmd)->CmdBindIndexBuffer(Unwrap(cmd), idxBufferUnwrapped, ibuffer.offs, type); + } + else + { + ObjDisp(cmd)->CmdBindIndexBuffer2KHR(Unwrap(cmd), idxBufferUnwrapped, ibuffer.offs, + ibuffer.size, type); + } } if(vk->DynamicVertexInput() && dynamicStates[VkDynamicVertexInputEXT]) diff --git a/renderdoc/driver/vulkan/vk_state.h b/renderdoc/driver/vulkan/vk_state.h index b639a7fa44c..650a6f68487 100644 --- a/renderdoc/driver/vulkan/vk_state.h +++ b/renderdoc/driver/vulkan/vk_state.h @@ -150,6 +150,7 @@ struct VulkanRenderState { ResourceId buf; VkDeviceSize offs = 0; + VkDeviceSize size = VK_WHOLE_SIZE; int bytewidth = 0; } ibuffer; diff --git a/renderdoc/driver/vulkan/vk_stringise.cpp b/renderdoc/driver/vulkan/vk_stringise.cpp index a046586bfb9..505330d69e8 100644 --- a/renderdoc/driver/vulkan/vk_stringise.cpp +++ b/renderdoc/driver/vulkan/vk_stringise.cpp @@ -28,7 +28,7 @@ template <> rdcstr DoStringise(const VulkanChunk &el) { - RDCCOMPILE_ASSERT((uint32_t)VulkanChunk::Max == 1201, "Chunks changed without updating names"); + RDCCOMPILE_ASSERT((uint32_t)VulkanChunk::Max == 1202, "Chunks changed without updating names"); BEGIN_ENUM_STRINGISE(VulkanChunk) { @@ -233,6 +233,7 @@ rdcstr DoStringise(const VulkanChunk &el) STRINGISE_ENUM_CLASS(vkCmdDrawMeshTasksEXT) STRINGISE_ENUM_CLASS(vkCmdDrawMeshTasksIndirectEXT) STRINGISE_ENUM_CLASS(vkCmdDrawMeshTasksIndirectCountEXT) + STRINGISE_ENUM_CLASS(vkCmdBindIndexBuffer2KHR) STRINGISE_ENUM_CLASS_NAMED(Max, "Max Chunk"); } END_ENUM_STRINGISE() diff --git a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp index 738979709cc..beb4aaab4b9 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp @@ -3840,6 +3840,7 @@ bool WrappedVulkan::Serialise_vkCmdBindIndexBuffer(SerialiserType &ser, VulkanRenderState &renderstate = GetCmdRenderState(); renderstate.ibuffer.buf = GetResID(buffer); renderstate.ibuffer.offs = offset; + renderstate.ibuffer.size = VK_WHOLE_SIZE; if(indexType == VK_INDEX_TYPE_UINT32) renderstate.ibuffer.bytewidth = 4; @@ -3893,6 +3894,94 @@ void WrappedVulkan::vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer } } +template +bool WrappedVulkan::Serialise_vkCmdBindIndexBuffer2KHR(SerialiserType &ser, + VkCommandBuffer commandBuffer, + VkBuffer buffer, VkDeviceSize offset, + VkDeviceSize size, VkIndexType indexType) +{ + SERIALISE_ELEMENT(commandBuffer); + SERIALISE_ELEMENT(buffer).Important(); + SERIALISE_ELEMENT(offset).OffsetOrSize(); + SERIALISE_ELEMENT(size).OffsetOrSize(); + SERIALISE_ELEMENT(indexType).Important(); + + Serialise_DebugMessages(ser); + + SERIALISE_CHECK_READ_ERRORS(); + + if(IsReplayingAndReading()) + { + m_LastCmdBufferID = GetResourceManager()->GetOriginalID(GetResID(commandBuffer)); + + if(IsActiveReplaying(m_State)) + { + if(InRerecordRange(m_LastCmdBufferID)) + { + commandBuffer = RerecordCmdBuf(m_LastCmdBufferID); + ObjDisp(commandBuffer) + ->CmdBindIndexBuffer2KHR(Unwrap(commandBuffer), Unwrap(buffer), offset, size, indexType); + + { + VulkanRenderState &renderstate = GetCmdRenderState(); + renderstate.ibuffer.buf = GetResID(buffer); + renderstate.ibuffer.offs = offset; + renderstate.ibuffer.size = size; + + if(indexType == VK_INDEX_TYPE_UINT32) + renderstate.ibuffer.bytewidth = 4; + else if(indexType == VK_INDEX_TYPE_UINT8_KHR) + renderstate.ibuffer.bytewidth = 1; + else + renderstate.ibuffer.bytewidth = 2; + } + } + } + else + { + // track while reading, as we need to bind current topology & index byte width in AddAction + if(indexType == VK_INDEX_TYPE_UINT32) + m_BakedCmdBufferInfo[m_LastCmdBufferID].state.ibuffer.bytewidth = 4; + else if(indexType == VK_INDEX_TYPE_UINT8_KHR) + m_BakedCmdBufferInfo[m_LastCmdBufferID].state.ibuffer.bytewidth = 1; + else + m_BakedCmdBufferInfo[m_LastCmdBufferID].state.ibuffer.bytewidth = 2; + + // track while reading, as we need to track resource usage + m_BakedCmdBufferInfo[m_LastCmdBufferID].state.ibuffer.buf = GetResID(buffer); + + ObjDisp(commandBuffer) + ->CmdBindIndexBuffer2KHR(Unwrap(commandBuffer), Unwrap(buffer), offset, size, indexType); + } + } + + return true; +} + +void WrappedVulkan::vkCmdBindIndexBuffer2KHR(VkCommandBuffer commandBuffer, VkBuffer buffer, + VkDeviceSize offset, VkDeviceSize size, + VkIndexType indexType) +{ + SCOPED_DBG_SINK(); + + SERIALISE_TIME_CALL( + ObjDisp(commandBuffer) + ->CmdBindIndexBuffer2KHR(Unwrap(commandBuffer), Unwrap(buffer), offset, size, indexType)); + + if(IsCaptureMode(m_State)) + { + VkResourceRecord *record = GetRecord(commandBuffer); + + CACHE_THREAD_SERIALISER(); + + SCOPED_SERIALISE_CHUNK(VulkanChunk::vkCmdBindIndexBuffer2KHR); + Serialise_vkCmdBindIndexBuffer2KHR(ser, commandBuffer, buffer, offset, size, indexType); + + record->AddChunk(scope.Get(&record->cmdInfo->alloc)); + record->MarkBufferFrameReferenced(GetRecord(buffer), 0, VK_WHOLE_SIZE, eFrameRef_Read); + } +} + template bool WrappedVulkan::Serialise_vkCmdPushConstants(SerialiserType &ser, VkCommandBuffer commandBuffer, VkPipelineLayout layout, @@ -7733,3 +7822,7 @@ INSTANTIATE_FUNCTION_SERIALISED(void, vkCmdBeginRendering, VkCommandBuffer comma const VkRenderingInfo *pRenderingInfo); INSTANTIATE_FUNCTION_SERIALISED(void, vkCmdEndRendering, VkCommandBuffer commandBuffer); + +INSTANTIATE_FUNCTION_SERIALISED(void, vkCmdBindIndexBuffer2KHR, VkCommandBuffer commandBuffer, + VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, + VkIndexType indexType); diff --git a/renderdoc/driver/vulkan/wrappers/vk_get_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_get_funcs.cpp index 779cf784b6b..de7e0bf23b9 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_get_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_get_funcs.cpp @@ -331,13 +331,23 @@ void WrappedVulkan::vkGetDeviceBufferMemoryRequirements(VkDevice device, VkBufferCreateInfo *info = (VkBufferCreateInfo *)unwrappedInfo->pCreateInfo; + VkBufferUsageFlags2KHR usage = (VkBufferUsageFlags2KHR)info->usage; + auto *pUsage2 = FindNextStruct(info, VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR); + if(pUsage2) + usage = ((VkBufferUsageFlags2CreateInfoKHR *)pUsage2)->usage; + // patch the create info the same as we would for vkCreateBuffer - info->usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; - info->usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; + usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; + usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; - if(IsCaptureMode(m_State) && (info->usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT)) + if(IsCaptureMode(m_State) && (usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT)) info->flags |= VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT; + if(pUsage2) + ((VkBufferUsageFlags2CreateInfoKHR *)pUsage2)->usage = usage; + else + info->usage = (VkBufferUsageFlags)usage; + ObjDisp(device)->GetDeviceBufferMemoryRequirements(Unwrap(device), unwrappedInfo, pMemoryRequirements); @@ -1171,3 +1181,25 @@ VkResult WrappedVulkan::vkGetPhysicalDeviceFragmentShadingRatesKHR( ->GetPhysicalDeviceFragmentShadingRatesKHR(Unwrap(physicalDevice), pFragmentShadingRateCount, pFragmentShadingRates); } + +void WrappedVulkan::vkGetDeviceImageSubresourceLayoutKHR(VkDevice device, + const VkDeviceImageSubresourceInfoKHR *pInfo, + VkSubresourceLayout2KHR *pLayout) +{ + ObjDisp(device)->GetDeviceImageSubresourceLayoutKHR(Unwrap(device), pInfo, pLayout); +} + +void WrappedVulkan::vkGetImageSubresourceLayout2KHR(VkDevice device, VkImage image, + const VkImageSubresource2KHR *pSubresource, + VkSubresourceLayout2KHR *pLayout) +{ + ObjDisp(device)->GetImageSubresourceLayout2KHR(Unwrap(device), Unwrap(image), pSubresource, + pLayout); +} + +void WrappedVulkan::vkGetRenderingAreaGranularityKHR(VkDevice device, + const VkRenderingAreaInfoKHR *pRenderingAreaInfo, + VkExtent2D *pGranularity) +{ + ObjDisp(device)->GetRenderingAreaGranularityKHR(Unwrap(device), pRenderingAreaInfo, pGranularity); +} diff --git a/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp index b28a280e14f..b3cb2e06503 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp @@ -1649,16 +1649,6 @@ bool WrappedVulkan::Serialise_vkCreateBuffer(SerialiserType &ser, VkDevice devic { VkBuffer buf = VK_NULL_HANDLE; - VkBufferUsageFlags origusage = CreateInfo.usage; - - // ensure we can always readback from buffers - CreateInfo.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; - - // we only need to add TRANSFER_DST_BIT for dedicated buffers, but there's not a reliable way to - // know if a buffer will be dedicated-allocation or not. We assume that TRANSFER_DST is - // effectively free as a usage bit for all sensible implementations so we just add it here. - CreateInfo.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; - // remap the queue family indices if(CreateInfo.sharingMode == VK_SHARING_MODE_CONCURRENT) { @@ -1668,11 +1658,33 @@ bool WrappedVulkan::Serialise_vkCreateBuffer(SerialiserType &ser, VkDevice devic } VkBufferCreateInfo patched = CreateInfo; - byte *tempMem = GetTempMemory(GetNextPatchSize(patched.pNext)); - UnwrapNextChain(m_State, "VkBufferCreateInfo", tempMem, (VkBaseInStructure *)&patched); + VkBufferUsageFlags2KHR origusage = CreateInfo.usage; + auto *pUsage2 = + FindNextStruct(pCreateInfo, VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR); + if(pUsage2) + origusage = ((VkBufferUsageFlags2CreateInfoKHR *)pUsage2)->usage; + + VkBufferUsageFlags2KHR usage = origusage; + + // ensure we can always readback from buffers + usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; + + // we only need to add TRANSFER_DST_BIT for dedicated buffers, but there's not a reliable way to + // know if a buffer will be dedicated-allocation or not. We assume that TRANSFER_DST is + // effectively free as a usage bit for all sensible implementations so we just add it here. + usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; + + if(pUsage2) + ((VkBufferUsageFlags2CreateInfoKHR *)pUsage2)->usage = usage; + else + { + CreateInfo.usage = (VkBufferUsageFlags)usage; + patched.usage = (VkBufferUsageFlags)usage; + } + VkResult ret = ObjDisp(device)->CreateBuffer(Unwrap(device), &patched, NULL, &buf); if(CreateInfo.flags & @@ -1681,7 +1693,10 @@ bool WrappedVulkan::Serialise_vkCreateBuffer(SerialiserType &ser, VkDevice devic APIProps.SparseResources = true; } - CreateInfo.usage = origusage; + if(pUsage2) + ((VkBufferUsageFlags2CreateInfoKHR *)pUsage2)->usage = origusage; + else + CreateInfo.usage = (VkBufferUsageFlags)origusage; if(ret != VK_SUCCESS) { @@ -1710,26 +1725,37 @@ VkResult WrappedVulkan::vkCreateBuffer(VkDevice device, const VkBufferCreateInfo { VkBufferCreateInfo adjusted_info = *pCreateInfo; + byte *tempMem = GetTempMemory(GetNextPatchSize(adjusted_info.pNext)); + UnwrapNextChain(m_State, "VkBufferCreateInfo", tempMem, (VkBaseInStructure *)&adjusted_info); + + VkBufferUsageFlags2KHR origusage = pCreateInfo->usage; + auto *pUsage2 = FindNextStruct(pCreateInfo, VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR); + if(pUsage2) + origusage = ((VkBufferUsageFlags2CreateInfoKHR *)pUsage2)->usage; + + VkBufferUsageFlags2KHR usage = origusage; + // if you change any properties here, ensure you also update // vkGetDeviceBufferMemoryRequirementsKHR // TEMP HACK: Until we define a portable fake hardware, need to match the requirements for usage // on replay, so that the memory requirements are the same - adjusted_info.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; + usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; // we only need to add TRANSFER_DST_BIT for dedicated buffers, but there's not a reliable way to // know if a buffer will be dedicated-allocation or not. We assume that TRANSFER_DST is // effectively free as a usage bit for all sensible implementations so we just add it here. - adjusted_info.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; + usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; // If we're using this buffer for device addresses, ensure we force on capture replay bit. // We ensured the physical device can support this feature before whitelisting the extension. - if(IsCaptureMode(m_State) && (adjusted_info.usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT)) + if(IsCaptureMode(m_State) && (usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT)) adjusted_info.flags |= VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT; - byte *tempMem = GetTempMemory(GetNextPatchSize(adjusted_info.pNext)); - - UnwrapNextChain(m_State, "VkBufferCreateInfo", tempMem, (VkBaseInStructure *)&adjusted_info); + if(pUsage2) + ((VkBufferUsageFlags2CreateInfoKHR *)pUsage2)->usage = usage; + else + adjusted_info.usage = (VkBufferUsageFlags)usage; VkResult ret; SERIALISE_TIME_CALL( @@ -1757,7 +1783,7 @@ VkResult WrappedVulkan::vkCreateBuffer(VkDevice device, const VkBufferCreateInfo // if we're using VK_[KHR|EXT]_buffer_device_address, we fetch the device address that's been // allocated and insert it into the next chain and patch the flags so that it replays // naturally. - if((pCreateInfo->usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT) != 0) + if((origusage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT) != 0) { VkBufferDeviceAddressInfo getInfo = { VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO, @@ -1818,8 +1844,8 @@ VkResult WrappedVulkan::vkCreateBuffer(VkDevice device, const VkBufferCreateInfo record->AddChunk(chunk); - record->storable = (pCreateInfo->usage & (VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | - VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT)) != 0; + record->storable = (origusage & (VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | + VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT)) != 0; bool isSparse = (pCreateInfo->flags & (VK_BUFFER_CREATE_SPARSE_BINDING_BIT | VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT)) != 0; diff --git a/renderdoc/replay/renderdoc_serialise.inl b/renderdoc/replay/renderdoc_serialise.inl index 1a3ca2459d4..51937c60331 100644 --- a/renderdoc/replay/renderdoc_serialise.inl +++ b/renderdoc/replay/renderdoc_serialise.inl @@ -2058,9 +2058,10 @@ void DoSerialise(SerialiserType &ser, VKPipe::IndexBuffer &el) { SERIALISE_MEMBER(resourceId); SERIALISE_MEMBER(byteOffset); + SERIALISE_MEMBER(byteSize); SERIALISE_MEMBER(byteStride); - SIZE_CHECK(24); + SIZE_CHECK(32); } template @@ -2070,7 +2071,7 @@ void DoSerialise(SerialiserType &ser, VKPipe::InputAssembly &el) SERIALISE_MEMBER(indexBuffer); SERIALISE_MEMBER(topology); - SIZE_CHECK(40); + SIZE_CHECK(48); } template @@ -2409,7 +2410,7 @@ void DoSerialise(SerialiserType &ser, VKPipe::State &el) SERIALISE_MEMBER(conditionalRendering); - SIZE_CHECK(2712); + SIZE_CHECK(2720); } #pragma endregion Vulkan pipeline state