google / google/shaderc

Compute shaders compiling to spir-v version 1.6 generates Vulkan validation error due to OpExecutionMode

Open
#1,414 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

Compiling this shader (TestShader.comp):

#version 450

layout (local_size_x = 256) in;

void main() {
// Compute shader code
}

using this code:

shaderc::Compiler compiler;
shaderc::CompileOptions options;
options.SetTargetEnvironment(shaderc_target_env_vulkan, shaderc_env_version_vulkan_1_3);
options.SetWarningsAsErrors();
options.SetGenerateDebugInfo();
options.SetTargetSpirv(shaderc_spirv_version_1_6);
options.SetOptimizationLevel(shaderc_optimization_level_performance);
shaderc::SpvCompilationResult result = compiler.CompileGlslToSpv(shaderSource, shaderc_compute_shader, inputFileName, options);

generates this validation error when running vkCreateShaderModule:

`{ Validation } Validation Error: [ VUID-RuntimeSpirv-LocalSizeId-06434 ] | MessageID = 0xf95e08b7 | vkCreateShaderModule(): SPIR-V OpExecutionMode LocalSizeId is used but maintenance4 feature was not enabled. The Vulkan spec states: If Execution Mode LocalSizeId is used, maintenance4 must be enabled`

This does not happen if I change the target spir-v version to shaderc_spirv_version_1_5.
This does not happen if I compile it directly with `glslc.exe -c TestShader.comp`.

Tested on Vulkan version 1.3 with Vulkan SDK version 1.3.280.0 and whatever shaderc version is included there.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.