Skip to content

Copying a struct with a bool produces invalid select statement #4086

@spencer-lunarg

Description

@spencer-lunarg

https://godbolt.org/z/srbW3T8Tc

#version 460
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require
#extension GL_EXT_buffer_reference2 : require

struct S1 { bool x; };

layout(set = 0, binding = 1) restrict readonly buffer SSBO {
	S1 s1;
} InBuffer;

layout(buffer_reference) buffer MyBuffer {
	S1 s1;
};

void main() {
	MyBuffer payload;
	payload.s1 = InBuffer.s1;
}

generates invalid SPIR-V

Expected bool scalar or vector type as condition: Select
  %29 = OpSelect %uint %28 %uint_1 %uint_0

Metadata

Metadata

Assignees

No one assigned

    Labels

    SPIR-Vbugsev:miscompileGiven a valid input, glslang produces incorrect or invalid SPIR-V

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions