9cfbef001f71 — Leonard Ritter a month ago
* `glsl`: added `gl_PrimitiveID`
* SPIR-V: fixed `PrimitiveId` depending on raytracingNV rather than geometry capability
2 files changed, 4 insertions(+), 1 deletions(-)

M lib/scopes/glsl.sc
M src/gen_spirv.cpp
M lib/scopes/glsl.sc +2 -0
@@ 515,6 515,8 @@ do
         gl_InstanceID = (ptrtoref (extern 'spirv.InstanceId i32 (storage-class = 'Input)))
         gl_InstanceIndex = (ptrtoref (extern 'spirv.InstanceIndex i32 (storage-class = 'Input)))
 
+        gl_PrimitiveID = (ptrtoref (extern 'spirv.PrimitiveId i32 (storage-class = 'Input)))
+
         gl_NumWorkGroups = (ptrtoref (extern 'spirv.NumWorkgroups uvec3 (storage-class = 'Input)))
         gl_WorkGroupID = (ptrtoref (extern 'spirv.WorkgroupId uvec3 (storage-class = 'Input)))
         gl_WorkGroupSize = (ptrtoref (extern 'spirv.WorkgroupSize uvec3 (storage-class = 'Input)))

          
M src/gen_spirv.cpp +2 -1
@@ 2040,7 2040,8 @@ struct SPIRVGenerator {
         case spv::BuiltInCullDistance:
             builder.addCapability(spv::CapabilityCullDistance); break;
         case spv::BuiltInPrimitiveId:
-            builder.addCapability(spv::CapabilityRayTracingNV); break;
+            //builder.addCapability(spv::CapabilityRayTracingNV); break;
+            builder.addCapability(spv::CapabilityGeometry); break;
         case spv::BuiltInLayer:
             builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT);
             break;