From 2d2591bbb7f1204e35f5120701166efb7a87d1e2 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Fri, 7 Jan 2022 12:02:11 +0100 Subject: [PATCH] radv: Expose VK_NV_device_generated_commands. Closes: #6736 Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/00-radv-defaults.conf | 1 + src/amd/vulkan/radv_device.c | 27 +++++++++++++++++++++++++++ src/util/driconf.h | 4 ++++ 3 files changed, 32 insertions(+) diff --git a/src/amd/vulkan/00-radv-defaults.conf b/src/amd/vulkan/00-radv-defaults.conf index a86c66871f3..b6584a1c4cb 100644 --- a/src/amd/vulkan/00-radv-defaults.conf +++ b/src/amd/vulkan/00-radv-defaults.conf @@ -39,6 +39,7 @@ Application bugs worked around in this file: diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 38c4cb73ae2..ad0800bc992 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -607,6 +607,8 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device .GOOGLE_user_type = true, .INTEL_shader_integer_functions2 = true, .NV_compute_shader_derivatives = true, + .NV_device_generated_commands = device->rad_info.gfx_level >= GFX7 && !(device->instance->debug_flags & RADV_DEBUG_NO_IBS) && + driQueryOptionb(&device->instance->dri_options, "radv_dgc"), .NV_mesh_shader = device->use_ngg && device->rad_info.gfx_level >= GFX10_3 && device->instance->perftest_flags & RADV_PERFTEST_NV_MS && !device->use_llvm, /* Undocumented extension purely for vkd3d-proton. This check is to prevent anyone else from @@ -1024,6 +1026,7 @@ static const driOptionDescription radv_dri_options[] = { DRI_CONF_RADV_REQUIRE_ETC2(false) DRI_CONF_RADV_DISABLE_ANISO_SINGLE_LEVEL(false) DRI_CONF_RADV_DISABLE_SINKING_LOAD_INPUT_FS(false) + DRI_CONF_RADV_DGC(false) DRI_CONF_SECTION_END }; // clang-format on @@ -1832,6 +1835,12 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, features->performanceCounterMultipleQueryPools = features->performanceCounterQueryPools; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV: { + VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV *features = + (VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV *)ext; + features->deviceGeneratedCommands = true; + break; + } default: break; } @@ -2532,6 +2541,24 @@ radv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, properties->allowCommandBufferQueryCopies = false; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV: { + VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV *properties = + (VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV *)ext; + properties->maxIndirectCommandsStreamCount = 1; + properties->maxIndirectCommandsStreamStride = UINT32_MAX; + properties->maxIndirectCommandsTokenCount = UINT32_MAX; + properties->maxIndirectCommandsTokenOffset = UINT16_MAX; + properties->minIndirectCommandsBufferOffsetAlignment = 4; + properties->minSequencesCountBufferOffsetAlignment = 4; + properties->minSequencesIndexBufferOffsetAlignment = 4; + + /* Don't support even a shader group count = 1 until we support shader + * overrides during pipeline creation. */ + properties->maxGraphicsShaderGroupCount = 0; + + properties->maxIndirectSequenceCount = UINT32_MAX; + break; + } default: break; } diff --git a/src/util/driconf.h b/src/util/driconf.h index e5d15943b81..1b59743f1d1 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -578,6 +578,10 @@ DRI_CONF_OPT_B(radv_disable_sinking_load_input_fs, def, \ "Disable sinking load inputs for fragment shaders") +#define DRI_CONF_RADV_DGC(def) \ + DRI_CONF_OPT_B(radv_dgc, def, \ + "Expose an experimental implementation of VK_NV_device_generated_commands") + /** * \brief ANV specific configuration options */