From de889794134e6245e08a24425a6d686a1be584b8 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Fri, 27 Oct 2017 14:25:05 +0100 Subject: radv: Implement VK_AMD_shader_info This allows an app to query shader statistics and get a disassembly of a shader. RenderDoc git has support for it, so this allows you to view shader disassembly from a capture. When this extension is enabled on a device (or when tracing), we now disable pipeline caching, since we don't get the shader debug info when we retrieve cached shaders. v2: Improvements to resource usage reporting v3: Disassembly string must be null terminated (string_buffer's length does not include the terminator) v4: Fixed LDS reporting. (Bas) Signed-off-by: Alex Smith Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_device.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/amd/vulkan/radv_device.c') diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index d25e9c97ba8..0c2f6fa6312 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -944,10 +944,15 @@ VkResult radv_CreateDevice( VkResult result; struct radv_device *device; + bool keep_shader_info = false; + for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { const char *ext_name = pCreateInfo->ppEnabledExtensionNames[i]; if (!radv_physical_device_extension_supported(physical_device, ext_name)) return vk_error(VK_ERROR_EXTENSION_NOT_PRESENT); + + if (strcmp(ext_name, VK_AMD_SHADER_INFO_EXTENSION_NAME) == 0) + keep_shader_info = true; } /* Check enabled features */ @@ -1041,10 +1046,14 @@ VkResult radv_CreateDevice( device->physical_device->rad_info.max_se >= 2; if (getenv("RADV_TRACE_FILE")) { + keep_shader_info = true; + if (!radv_init_trace(device)) goto fail; } + device->keep_shader_info = keep_shader_info; + result = radv_device_init_meta(device); if (result != VK_SUCCESS) goto fail; -- cgit v1.2.3