KhronosGroup/Vulkan-ValidationLayers

During validation of pipelines with SPIRV 1.4/1.5 and specialization constants, optimizer isn't configured to use Vulkan 1.2

zeux opened this issue · 1 comments

zeux commented

In shader_validation.cpp, ValidatePipelineShaderStage, the following code specializes the shader when specialization constants are present:

        spv_target_env const spirv_environment = ((api_version >= VK_API_VERSION_1_1) ? SPV_ENV_VULKAN_1_1 : SPV_ENV_VULKAN_1_0);
        spvtools::Optimizer optimizer(spirv_environment);

When the input SPIRV blob contains instructions from SPIRV 1.4/1.5, such as SpvOpCopyLogical, optimizer fails to parse SPIRV blob because the environment isn't configured to recognize 1.2 instructions.

The code should be updated to use SPV_ENV_VULKAN_1_2 when api_version is VK_API_VERSION_1_2.

Fixed in #1520