-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Hi Sascha,
Just wanted to raise that we've seen glslang (even the latest from master) generating invalid SPIR-V code for your Raytracing demp, it gets a type conversion wrong on the Sphere type, and our compiler is trying to adhere closely to the SPIR-V specification.
I'll raise an issue with the working group as well, but just thought I'd point it out if you wanted to use shaderc or run the spv-validator as part of your build.
Cheers,
Alex
------------ Bit more write up ------------
The problem is that there is a type, Sphere, which is used both in an SSBO (Spheres) and also for parameter types (sphereIntersect and SphereNormal).
In SPIR-V the SSBO type must be decorated with information on how the type is laid out in memory, i.e. each field has a byte offset from the start of the struct. But these decorations are only allowed
on SSBO type - this is for various layout reasons.
The SPIR-V generator is forced to generate separate types for the Sphere type when used for SSBO and the Sphere type when used for parameter.
Looking at the generated SPIR-V (comp.spv.lst) there is
-
a %Sphere_0 (line 87), which must be the SSBO type as it is decorated with offsets (line 196),
-
a %Sphere_1 (line 99), which is the type used for the arguments,
-
a %Sphere (line 231), which is the type used for the parameters.
I can understand why we need %Sphere_0 and %Sphere_1, but I don't understand why we need %Sphere as well - I would have thought that %Sphere_1 and %Sphere should be the same.
This causes an invalid assignment when used as the types are not the same.