Skip to content

Invalid GLSL produced from valid SPIRV #2393

@MartynJacques-Arm

Description

@MartynJacques-Arm

Decompiling valid SPIRV results in invalid GLSL.

$ spirv-cross --stage comp --version 460 --vulkan-semantics lumen.spirv --output out.glsl

$ glslangValidator -g -V -S comp --target-env spirv1.6 out.glsl 
out.glsl
ERROR: out.glsl:317: 'ShadowTraces' : undeclared identifier 
ERROR: out.glsl:317: '_m0' : unknown swizzle selection 
ERROR: out.glsl:317: '_m0' : unknown swizzle selection 
ERROR: out.glsl:317: '_m0' : unknown swizzle selection 
ERROR: out.glsl:317: '=' :  cannot convert from ' temp float' to ' temp highp uint'
ERROR: out.glsl:317: '' : compilation terminated 
ERROR: 6 compilation errors.  No code generated.


SPIR-V is not generated for failed compile or link

Tested on

$ ./glslangValidator --version                                                               
Glslang Version: 11:15.0.0
ESSL Version: OpenGL ES GLSL 3.20 glslang Khronos. 15.0.0
GLSL Version: 4.60 glslang Khronos. 15.0.0
SPIR-V Version 0x00010600, Revision 1
GLSL.std.450 Version 100, Revision 1
Khronos Tool ID 8
SPIR-V Generator Version 11
GL_KHR_vulkan_glsl version 100
ARB_GL_gl_spirv version 100

$ ./spirv-cross --version                                                                                    
Git commit: vulkan-sdk-1.3.296.0-10-g36e54568 Timestamp: 2024-10-14T16:18:23

lumen_spirv.txt
out_glsl.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther progress depends on answer from issue creator.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions