google / google/shaderc

16-bit bitshifts with optimizations enabled causes unfixable validation error

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

Description

```GLSL
#version 460

#extension GL_EXT_shader_16bit_storage : require
#extension GL_EXT_shader_explicit_arithmetic_types : require

buffer TestInput {
int16_t test;
};

layout(local_size_x = 1) in;
void main(){
test = bitfieldExtract(test, 0s, 8s);
}
```

This minimal repro compute shader fails with a validation error with optimizations:
```
shaderc: internal error: compilation succeeded but failed to optimize: [VUID-RuntimeSpirv-None-10824] Expected 32-bit int type for Base operand: BitFieldSExtract
This is allowed if you enable the maintenance9 feature (or use the --allow-vulkan-32-bit-bitwise command line flag)
%19 = OpBitFieldSExtract %short %16 %short_0 %short_8
```

This is very frustrating, as both the GLSL code and the generated SPIR-V is valid, but the internal validation that happens after optimizations complains about a Vulkan feature, one that I will have enabled. I can't tell Shaderc to enable maintenance9 or to pass the cmd line flag in the validator, so this is unfixable and makes it impossible for me to compile my shaders. 😢

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.