0

I'm using shaderc that comes VulkanSDK-1.3.224.1. Attempting to compile the following when added to any of my shaders:

#extension GL_EXT_scalar_block_layout: enable
#extension GL_EXT_buffer_reference2 : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int64   : enable
layout(buffer_reference, buffer_reference_align=4, scalar) buffer test_ref_type{
    uint32_t data[];
};
struct RefTest{
    test_ref_type test;
};

RefTest extract_RefTest(){
    return RefTest(test_ref_type(uint64_t(0)));
}

void main(){
    RefTest ref_test = extract_RefTest();
}

results in

shaderc: internal error: compilation succeeded but failed to optimize: ID 108[%108] has not been defined
  %109 = OpConstantComposite %RefTest %108

However, if I first convert to a uint64_t it works fine:

#extension GL_EXT_scalar_block_layout: enable
#extension GL_EXT_buffer_reference2 : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int64   : enable
layout(buffer_reference, buffer_reference_align=4, scalar) buffer test_ref_type{
    uint32_t data[];
};
struct RefTest{
    uint64_t test;
};

RefTest extract_RefTest(){
    return RefTest(uint64_t(test_ref_type(uint64_t(0))));
}

void main(){
    RefTest ref_test = extract_RefTest();
}

How do I have composite structs with buffer_reference types with out explicit uint64_t conversion?

Krupip
  • 4,404
  • 2
  • 32
  • 54
  • 2
    Any kind of "internal compile error" is a bug within the compiler itself. Even if your code is invalid, it shouldn't error out *that* way. You should file a bug with the tool vendor. – Nicol Bolas Sep 15 '22 at 19:23
  • +1 to what Nicol said. This is most likely a bug in Khronos's glslang. Check whether it happens with glslangValidator and then file a bug on https://github.com/KhronosGroup/glslang if so. – Andrea Sep 18 '22 at 10:49

0 Answers0