diff --git a/renderdoc/driver/vulkan/vk_dispatchtables.cpp b/renderdoc/driver/vulkan/vk_dispatchtables.cpp index 1de66ab944..6f2402c7bd 100644 --- a/renderdoc/driver/vulkan/vk_dispatchtables.cpp +++ b/renderdoc/driver/vulkan/vk_dispatchtables.cpp @@ -90,7 +90,7 @@ void InitInstanceExtensionTables(VkInstance instance, InstanceDeviceInfo *info) } #undef HookInitPromotedExtension -#define HookInitPromotedExtension(cond, version, func, suffix) \ +#define HookInitPromotedExtension(cond, func, suffix) \ if(cond) \ { \ InstanceGPA(func); \ @@ -140,7 +140,7 @@ void InitDeviceExtensionTables(VkDevice device, InstanceDeviceInfo *info) } #undef HookInitPromotedExtension -#define HookInitPromotedExtension(cond, version, func, suffix) \ +#define HookInitPromotedExtension(cond, func, suffix) \ if(cond) \ { \ DeviceGPA(func); \ diff --git a/renderdoc/driver/vulkan/vk_dispatchtables.h b/renderdoc/driver/vulkan/vk_dispatchtables.h index 6963f41023..c884f915bc 100644 --- a/renderdoc/driver/vulkan/vk_dispatchtables.h +++ b/renderdoc/driver/vulkan/vk_dispatchtables.h @@ -26,6 +26,7 @@ // layer includes +#include #if ENABLED(RDOC_WIN32) // undefined clashing windows #defines #undef CreateEvent @@ -37,10 +38,19 @@ void InitReplayTables(void *vulkanModule); +// bitmask of extension enabled status +enum ExtensionStatusFlagBits { + NotEnabled = 0, + ExplicitEnabled = 1 << 0, + PromotionEnabled = 1 << 1, +}; + +typedef uint8_t ExtensionStatusFlags; + struct InstanceDeviceInfo { #undef DeclExt -#define DeclExt(name) bool ext_##name = false; +#define DeclExt(name) ExtensionStatusFlags ext_##name = ExtensionStatusFlagBits::NotEnabled; bool brokenGetDeviceProcAddr = false; diff --git a/renderdoc/driver/vulkan/vk_hookset_defs.h b/renderdoc/driver/vulkan/vk_hookset_defs.h index ae528dac24..e7ac2e0f4e 100644 --- a/renderdoc/driver/vulkan/vk_hookset_defs.h +++ b/renderdoc/driver/vulkan/vk_hookset_defs.h @@ -555,12 +555,12 @@ DeclExt(KHR_vertex_attribute_divisor); \ DeclExt(KHR_line_rasterization); \ DeclExt(KHR_calibrated_timestamps); \ - DeclExt(KHR_maintenance5); \ DeclExt(KHR_deferred_host_operations); \ DeclExt(KHR_acceleration_structure); \ DeclExt(KHR_ray_query); \ DeclExt(EXT_nested_command_buffer); \ - DeclExt(EXT_shader_object); + DeclExt(EXT_shader_object); \ + DeclExt(KHR_maintenance5); // for simplicity and since the check itself is platform agnostic, // these aren't protected in platform defines @@ -687,11 +687,11 @@ CheckExt(KHR_vertex_attribute_divisor, VKXX); \ CheckExt(KHR_line_rasterization, VKXX); \ CheckExt(KHR_calibrated_timestamps, VKXX); \ - CheckExt(KHR_maintenance5, VKXX); \ CheckExt(KHR_deferred_host_operations, VKXX); \ CheckExt(KHR_acceleration_structure, VKXX); \ CheckExt(KHR_ray_query, VKXX); \ - CheckExt(EXT_shader_object, VKXX); + CheckExt(EXT_shader_object, VKXX); \ + CheckExt(KHR_maintenance5, VKXX); #define HookInitVulkanInstanceExts_PhysDev() \ HookInitExtension(KHR_surface, GetPhysicalDeviceSurfaceSupportKHR); \ @@ -706,27 +706,25 @@ HookInitExtension(KHR_display, GetDisplayPlaneCapabilitiesKHR); \ HookInitExtension(NV_external_memory_capabilities, \ GetPhysicalDeviceExternalImageFormatPropertiesNV); \ - 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, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, GetPhysicalDeviceFeatures2, KHR); \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, GetPhysicalDeviceProperties2, KHR); \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, \ GetPhysicalDeviceFormatProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, \ GetPhysicalDeviceImageFormatProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, \ GetPhysicalDeviceQueueFamilyProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, \ GetPhysicalDeviceMemoryProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, \ GetPhysicalDeviceSparseImageFormatProperties2, KHR); \ HookInitExtension(EXT_direct_mode_display, ReleaseDisplayEXT); \ HookInitExtension(EXT_display_surface_counter, GetPhysicalDeviceSurfaceCapabilities2EXT); \ - HookInitPromotedExtension(KHR_external_memory_capabilities, VK11, \ + HookInitPromotedExtension(KHR_external_memory_capabilities, \ GetPhysicalDeviceExternalBufferProperties, KHR); \ - HookInitPromotedExtension(KHR_external_semaphore_capabilities, VK11, \ + HookInitPromotedExtension(KHR_external_semaphore_capabilities, \ GetPhysicalDeviceExternalSemaphoreProperties, KHR); \ - HookInitPromotedExtension(KHR_external_fence_capabilities, VK11, \ + HookInitPromotedExtension(KHR_external_fence_capabilities, \ GetPhysicalDeviceExternalFenceProperties, KHR); \ HookInitExtension(KHR_device_group_creation &&KHR_surface, GetPhysicalDevicePresentRectanglesKHR); \ HookInitExtension(KHR_get_surface_capabilities2, GetPhysicalDeviceSurfaceFormats2KHR); \ @@ -738,7 +736,7 @@ HookInitExtension(KHR_performance_query, \ EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR); \ HookInitExtension(KHR_performance_query, GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR); \ - HookInitPromotedExtension(EXT_tooling_info, VK13, GetPhysicalDeviceToolProperties, EXT); \ + HookInitPromotedExtension(EXT_tooling_info, GetPhysicalDeviceToolProperties, EXT); \ HookInitExtension(KHR_fragment_shading_rate, GetPhysicalDeviceFragmentShadingRatesKHR); \ HookInitExtension(EXT_acquire_drm_display, AcquireDrmDisplayEXT); \ HookInitExtension(EXT_acquire_drm_display, GetDrmDisplayEXT); \ @@ -767,32 +765,30 @@ HookInitExtension(KHR_display, CreateDisplayPlaneSurfaceKHR); \ HookInitExtension(NV_external_memory_capabilities, \ GetPhysicalDeviceExternalImageFormatPropertiesNV); \ - 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, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, GetPhysicalDeviceFeatures2, KHR); \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, GetPhysicalDeviceProperties2, KHR); \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, \ GetPhysicalDeviceFormatProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, \ GetPhysicalDeviceImageFormatProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, \ GetPhysicalDeviceQueueFamilyProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, \ GetPhysicalDeviceMemoryProperties2, KHR); \ - HookInitPromotedExtension(KHR_get_physical_device_properties2, VK11, \ + HookInitPromotedExtension(KHR_get_physical_device_properties2, \ GetPhysicalDeviceSparseImageFormatProperties2, KHR); \ HookInitExtension(EXT_direct_mode_display, ReleaseDisplayEXT); \ HookInitExtension(EXT_display_surface_counter, GetPhysicalDeviceSurfaceCapabilities2EXT); \ - HookInitPromotedExtension(KHR_external_memory_capabilities, VK11, \ + HookInitPromotedExtension(KHR_external_memory_capabilities, \ GetPhysicalDeviceExternalBufferProperties, KHR); \ - HookInitPromotedExtension(KHR_external_semaphore_capabilities, VK11, \ + HookInitPromotedExtension(KHR_external_semaphore_capabilities, \ GetPhysicalDeviceExternalSemaphoreProperties, KHR); \ - HookInitPromotedExtension(KHR_external_fence_capabilities, VK11, \ + HookInitPromotedExtension(KHR_external_fence_capabilities, \ GetPhysicalDeviceExternalFenceProperties, KHR); \ HookInitExtension(EXT_debug_utils, CreateDebugUtilsMessengerEXT); \ HookInitExtension(EXT_debug_utils, DestroyDebugUtilsMessengerEXT); \ HookInitExtension(EXT_debug_utils, SubmitDebugUtilsMessageEXT); \ - HookInitPromotedExtension(KHR_device_group_creation, VK11, EnumeratePhysicalDeviceGroups, KHR); \ + HookInitPromotedExtension(KHR_device_group_creation, 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. */ \ @@ -809,7 +805,7 @@ HookInitExtension(KHR_performance_query, \ EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR); \ HookInitExtension(KHR_performance_query, GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR); \ - HookInitPromotedExtension(EXT_tooling_info, VK13, GetPhysicalDeviceToolProperties, EXT); \ + HookInitPromotedExtension(EXT_tooling_info, GetPhysicalDeviceToolProperties, EXT); \ HookInitExtension(KHR_fragment_shading_rate, GetPhysicalDeviceFragmentShadingRatesKHR); \ HookInitExtension(KHR_calibrated_timestamps, GetPhysicalDeviceCalibrateableTimeDomainsKHR); \ HookInitExtension_Instance_Win32(); \ @@ -830,7 +826,7 @@ HookInitExtension(KHR_swapchain, AcquireNextImageKHR); \ HookInitExtension(KHR_swapchain, QueuePresentKHR); \ HookInitExtension(KHR_display_swapchain, CreateSharedSwapchainsKHR); \ - HookInitPromotedExtension(KHR_maintenance1, VK11, TrimCommandPool, KHR); \ + HookInitPromotedExtension(KHR_maintenance1, TrimCommandPool, KHR); \ HookInitExtension(EXT_display_control, DisplayPowerControlEXT); \ HookInitExtension(EXT_display_control, RegisterDeviceEventEXT); \ HookInitExtension(EXT_display_control, RegisterDisplayEventEXT); \ @@ -841,23 +837,19 @@ 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); \ + 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, VK11, CreateDescriptorUpdateTemplate, \ - KHR); \ - HookInitPromotedExtension(KHR_descriptor_update_template, VK11, DestroyDescriptorUpdateTemplate, \ - KHR); \ - HookInitPromotedExtension(KHR_descriptor_update_template, VK11, UpdateDescriptorSetWithTemplate, \ - KHR); \ + 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, VK11, BindBufferMemory2, KHR); \ - HookInitPromotedExtension(KHR_bind_memory2, VK11, BindImageMemory2, KHR); \ - HookInitPromotedExtension(KHR_maintenance3, VK11, GetDescriptorSetLayoutSupport, KHR); \ + 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); \ @@ -867,26 +859,26 @@ 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); \ + 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, VK12, CmdDrawIndirectCount, KHR); \ - HookInitPromotedExtension(KHR_draw_indirect_count, VK12, CmdDrawIndexedIndirectCount, KHR); \ + 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, VK12, CreateRenderPass2, KHR); \ - HookInitPromotedExtension(KHR_create_renderpass2, VK12, CmdBeginRenderPass2, KHR); \ - HookInitPromotedExtension(KHR_create_renderpass2, VK12, CmdNextSubpass2, KHR); \ - HookInitPromotedExtension(KHR_create_renderpass2, VK12, CmdEndRenderPass2, KHR); \ + 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); \ @@ -898,7 +890,7 @@ HookInitExtension(EXT_sample_locations, CmdSetSampleLocationsEXT); \ HookInitExtension(EXT_discard_rectangles, CmdSetDiscardRectangleEXT); \ HookInitExtension(EXT_calibrated_timestamps, GetCalibratedTimestampsEXT); \ - HookInitPromotedExtension(EXT_host_query_reset, VK12, ResetQueryPool, EXT); \ + HookInitPromotedExtension(EXT_host_query_reset, ResetQueryPool, EXT); \ HookInitExtension(EXT_buffer_device_address, GetBufferDeviceAddressEXT); \ HookInitExtension(EXT_hdr_metadata, SetHdrMetadataEXT); \ HookInitExtension(AMD_display_native_hdr, SetLocalDimmingAMD); \ @@ -909,73 +901,69 @@ 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); \ + 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, 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 || EXT_shader_object, VK13, CmdSetCullMode, \ - EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, VK13, \ - CmdSetFrontFace, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, VK13, \ + 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 || EXT_shader_object, CmdSetCullMode, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, CmdSetFrontFace, EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, \ CmdSetPrimitiveTopology, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, VK13, \ + HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, \ CmdSetViewportWithCount, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, VK13, \ + HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, \ CmdSetScissorWithCount, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, VK13, \ + HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, \ CmdBindVertexBuffers2, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, VK13, \ + HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, \ CmdSetDepthTestEnable, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, VK13, \ + HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, \ CmdSetDepthWriteEnable, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, VK13, \ - CmdSetDepthCompareOp, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, VK13, \ + HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, CmdSetDepthCompareOp, \ + EXT); \ + HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, \ CmdSetDepthBoundsTestEnable, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, VK13, \ + HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, \ CmdSetStencilTestEnable, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, 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); \ + HookInitPromotedExtension(EXT_extended_dynamic_state || EXT_shader_object, 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, VK13, GetDeviceBufferMemoryRequirements, KHR); \ - HookInitPromotedExtension(KHR_maintenance4, VK13, GetDeviceImageMemoryRequirements, KHR); \ - HookInitPromotedExtension(KHR_maintenance4, VK13, GetDeviceImageSparseMemoryRequirements, KHR); \ + 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 || EXT_shader_object, VK13, \ + HookInitPromotedExtension(EXT_extended_dynamic_state2 || EXT_shader_object, \ CmdSetDepthBiasEnable, EXT); \ HookInitExtension(EXT_extended_dynamic_state2 || EXT_shader_object, CmdSetLogicOpEXT); \ HookInitExtension(EXT_extended_dynamic_state2 || EXT_shader_object, CmdSetPatchControlPointsEXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state2 || EXT_shader_object, VK13, \ + HookInitPromotedExtension(EXT_extended_dynamic_state2 || EXT_shader_object, \ CmdSetPrimitiveRestartEnable, EXT); \ - HookInitPromotedExtension(EXT_extended_dynamic_state2 || EXT_shader_object, VK13, \ + HookInitPromotedExtension(EXT_extended_dynamic_state2 || EXT_shader_object, \ CmdSetRasterizerDiscardEnable, EXT); \ HookInitExtension(EXT_vertex_input_dynamic_state || EXT_shader_object, CmdSetVertexInputEXT); \ - HookInitPromotedExtension(KHR_dynamic_rendering, VK13, CmdBeginRendering, KHR); \ - HookInitPromotedExtension(KHR_dynamic_rendering, VK13, CmdEndRendering, KHR); \ + 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); \ diff --git a/renderdoc/driver/vulkan/vk_layer.cpp b/renderdoc/driver/vulkan/vk_layer.cpp index 13e1b1f7c9..d1462517ef 100644 --- a/renderdoc/driver/vulkan/vk_layer.cpp +++ b/renderdoc/driver/vulkan/vk_layer.cpp @@ -375,11 +375,11 @@ VK_LAYER_RENDERDOC_CaptureEnumerateInstanceExtensionProperties( #undef DeclExt #define DeclExt(name) \ - bool name = false; \ + ExtensionStatusFlags name = ExtensionStatusFlagBits::NotEnabled; \ (void)name; #undef CheckExt -#define CheckExt(name, ver) name = instDevInfo == NULL || instDevInfo->ext_##name; +#define CheckExt(name, ver) name = instDevInfo == NULL ? ExtensionStatusFlagBits::NotEnabled : instDevInfo->ext_##name; #undef HookInit #define HookInit(function) \ @@ -396,15 +396,15 @@ VK_LAYER_RENDERDOC_CaptureEnumerateInstanceExtensionProperties( // for promoted extensions, we return the function pointer for either name as an alias. #undef HookInitPromotedExtension -#define HookInitPromotedExtension(cond, version, function, suffix) \ +#define HookInitPromotedExtension(cond, function, suffix) \ if(!strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ { \ - if(cond) \ + if(ExtensionStatusFlagBits::ExplicitEnabled & cond) \ return (PFN_vkVoidFunction)&CONCAT(hooked_vk, function); \ } \ if(!strcmp(pName, STRINGIZE(CONCAT(vk, function)))) \ { \ - if(instDevInfo->vulkanVersion >= version) \ + if(ExtensionStatusFlagBits::PromotionEnabled & cond) \ return (PFN_vkVoidFunction)&CONCAT(hooked_vk, function); \ } @@ -515,9 +515,9 @@ VK_LAYER_RENDERDOC_CaptureGetInstanceProcAddr(VkInstance instance, const char *p return (PFN_vkVoidFunction)&CONCAT(hooked_vk, function); #undef HookInitPromotedExtension -#define HookInitPromotedExtension(cond, version, function, suffix) \ +#define HookInitPromotedExtension(cond, function, suffix) \ if(!strcmp(pName, STRINGIZE(CONCAT(vk, function))) || \ - !strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ + !strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ return (PFN_vkVoidFunction)&CONCAT(hooked_vk, function); #undef HookInitExtensionEXTtoKHR @@ -596,7 +596,7 @@ VK_LAYER_RENDERDOC_Capture_layerGetPhysicalDeviceProcAddr(VkInstance instance, c return NULL; #undef HookInitPromotedExtension -#define HookInitPromotedExtension(cond, version, function, suffix) \ +#define HookInitPromotedExtension(cond, function, suffix) \ if(!strcmp(pName, STRINGIZE(CONCAT(vk, function))) || \ !strcmp(pName, STRINGIZE(CONCAT(vk, CONCAT(function, suffix))))) \ return NULL;