Skip to content

16-bit bitshifts with optimizations enabled causes unfixable validation error #1540

@ccpisheden

Description

@ccpisheden
#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. 😢

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions