From 8f4f4b48c3979171a139d7f2157a2ddcfb2529df Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 10 Mar 2017 16:48:51 +1300 Subject: [PATCH] layers: Check use of CapabilityShaderDrawParameters against ext enable Signed-off-by: Chris Forbes --- layers/core_validation.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index b5043715..89b9a880 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -2391,6 +2391,20 @@ static bool require_feature(debug_report_data *report_data, VkBool32 feature, ch return true; } +static bool require_extension(debug_report_data *report_data, VkBool32 extension, char const *extension_name) { + if (!extension) { + if (log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, + SHADER_CHECKER_FEATURE_NOT_ENABLED, "SC", + "Shader requires extension %s but is not " + "enabled on the device", + extension_name)) { + return false; + } + } + + return true; +} + static bool validate_shader_capabilities(layer_data *dev_data, shader_module const *src) { bool pass = true; @@ -2519,6 +2533,11 @@ static bool validate_shader_capabilities(layer_data *dev_data, shader_module con pass &= require_feature(report_data, enabledFeatures.multiViewport, "multiViewport"); break; + case spv::CapabilityDrawParameters: + pass &= require_extension(report_data, dev_data->device_extensions.khr_shader_draw_parameters_enabled, + VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME); + break; + default: if (log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, SHADER_CHECKER_BAD_CAPABILITY, "SC", "Shader declares capability %u, not supported in Vulkan.", -- 2.34.1