From 839edce85c18627fc2760f1d1a71e5f0212aae7c Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Wed, 24 May 2017 16:58:48 -0600 Subject: layers:Pipe in disable for shader validation Allow VK_VALIDATION_CHECK_SHADERS_EXT enum to disable the spirv-tools- based shader validation in core_validation. There were a few other pieces of internal shader validation and tracking that were tied to the shader_validation bit but I re-enabled those bits for now as we lose the active descriptor binding tracking if those features are disabled. That would lead to a various other features that need to be disabled to avoid crashes. Specifically the connection between command buffers and active samplers, buffer, images that are present in descriptor sets. To test this I ran layer_validation_tests with the shaders disabled and most tests work fine with only the ones testing internal shader validation pieces failing as expected. --- layers/core_validation.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 4a15ced7..d4179bfc 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -2816,7 +2816,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vectorshader_validation && validate_and_capture_pipeline_shader_state(dev_data, pPipeline)) { + if (validate_and_capture_pipeline_shader_state(dev_data, pPipeline)) { skip = true; } // Each shader's stage must be unique @@ -3370,6 +3370,9 @@ static void init_core_validation(instance_layer_data *instance_data, const VkAll void SetDisabledFlags(instance_layer_data *instance_data, VkValidationFlagsEXT *val_flags_struct) { for (uint32_t i = 0; i < val_flags_struct->disabledValidationCheckCount; ++i) { switch (val_flags_struct->pDisabledValidationChecks[i]) { + case VK_VALIDATION_CHECK_SHADERS_EXT: + instance_data->disabled.shader_validation = true; + break; case VK_VALIDATION_CHECK_ALL_EXT: // Set all disabled flags to true instance_data->disabled.SetAll(true); @@ -6477,7 +6480,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer, if (cb_node->in_use.load()) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_16e00062, "MEM", - "Calling vkBeginCommandBuffer() on active command buffer 0x%p before it has completed. " + "Calling vkBeginCommandBuffer() on active command buffer %p before it has completed. " "You must check command buffer fence before this call. %s", commandBuffer, validation_error_map[VALIDATION_ERROR_16e00062]); } @@ -8815,7 +8818,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateShaderModule(VkDevice device, const VkShade VkResult res = dev_data->dispatch_table.CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule); - if (res == VK_SUCCESS && !GetDisables(dev_data)->shader_validation) { + if (res == VK_SUCCESS) { std::lock_guard lock(global_lock); const auto new_shader_module = (SPV_SUCCESS == spv_valid ? new shader_module(pCreateInfo) : new shader_module()); dev_data->shaderModuleMap[*pShaderModule] = unique_ptr(new_shader_module); -- cgit v1.2.3