KhronosGroup / glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Other
3k stars 828 forks source link

GLSL to SPIRV stage crashing right here and I don't know why #3728

Open kryptoid256 opened 1 week ago

kryptoid256 commented 1 week ago

https://github.com/KhronosGroup/glslang/blame/02bc074ac4ad5f6927f75712476b0cd7d9bbd3f7/SPIRV/GlslangToSpv.cpp#L2887

arcady-lunarg commented 1 week ago

Could you attach a shader file that reproduces this issue?

On Sun, Sep 15, 2024, 07:22 kryptoid256 @.***> wrote:

https://github.com/KhronosGroup/glslang/blame/02bc074ac4ad5f6927f75712476b0cd7d9bbd3f7/SPIRV/GlslangToSpv.cpp#L2887

— Reply to this email directly, view it on GitHub https://github.com/KhronosGroup/glslang/issues/3728, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5I72B5OADZ55TLJN5WCR2DZWWCYTAVCNFSM6AAAAABOH2GRKWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUZDMOJRGI3DANA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

kryptoid256 commented 1 week ago

I think I fixed it. The shader I had had conflicting set binding layouts. #version 450 layout(location=0) out vec4 FragColor; layout(location=0) in vec3 dir; layout(set=0,binding=0) uniform sampler cubeSampler; layout(set=0,binding=0)uniform textureCube skybox; void main(){ FragColor=texture(samplerCube(skybox,cubeSampler),dir); } I think it was something like this.

arcady-lunarg commented 1 week ago

It still shouldn't crash and should print some kind of useful message if that is the case.

kryptoid256 commented 1 week ago

Yeah, well it crashed right at that line. No next op found. Oddly it had no problem parsing the shader or compiling the program. Only it crashed when translating to SPIRV.

kryptoid256 commented 1 week ago

I forgot to mention. TBuiltInResource was all zeroes. I didn't know how to initialize it back then.

kryptoid256 commented 1 week ago

So is this library supposed to be used by an OpenGL implementation?

kryptoid256 commented 1 week ago

IT CRASHED AGAIN. I will test it when I have the time.

Hey I have to say I have high school studies and stuff. Maybe I should just post the code for someone else to test? Maybe a docker? I don't know how to use that yet. It was mostly for playing around, but I did not expect to encounter a crash. Maybe if my code is bad.

arcady-lunarg commented 1 week ago

Yes, you should post your code, ideally at least the shader that you are trying to compile that causes glslang to crash and if you're using glslang as a library by calling it from your program, then you should share the code you are using to call glslang. If you're using glslang from the command line, just post the command line.

kryptoid256 commented 1 week ago

I'm compressing it. You can change whatever code to fit your machine.

kryptoid256 commented 1 week ago

Nevermind. Get I'll have to post it on github

kryptoid256 commented 1 week ago

Forget it. I can't do that either.