diff --git a/Test/baseResults/spv.RayGenShaderArray.rgen.out b/Test/baseResults/spv.RayGenShaderArray.rgen.out new file mode 100644 index 0000000000..7430756928 --- /dev/null +++ b/Test/baseResults/spv.RayGenShaderArray.rgen.out @@ -0,0 +1,140 @@ +spv.RayGenShaderArray.rgen +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 89 + + Capability ShaderNonUniformEXT + Capability RuntimeDescriptorArrayEXT + Capability RayTracingNV + Extension "SPV_EXT_descriptor_indexing" + Extension "SPV_NV_ray_tracing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint RayGenerationNV 4 "main" 11 21 + Source GLSL 460 + SourceExtension "GL_EXT_nonuniform_qualifier" + SourceExtension "GL_NV_ray_tracing" + Name 4 "main" + Name 8 "lx" + Name 11 "gl_LaunchIDNV" + Name 16 "ly" + Name 20 "sx" + Name 21 "gl_LaunchSizeNV" + Name 24 "sy" + Name 30 "accNV0" + Name 34 "block" + MemberName 34(block) 0 "dir" + MemberName 34(block) 1 "origin" + MemberName 34(block) 2 "i" + Name 36 "" + Name 60 "accNV1" + Name 88 "payload" + Decorate 11(gl_LaunchIDNV) BuiltIn LaunchIdNV + Decorate 21(gl_LaunchSizeNV) BuiltIn LaunchSizeNV + Decorate 30(accNV0) DescriptorSet 0 + Decorate 30(accNV0) Binding 0 + MemberDecorate 34(block) 0 Offset 0 + MemberDecorate 34(block) 1 Offset 16 + MemberDecorate 34(block) 2 Offset 28 + Decorate 34(block) BufferBlock + Decorate 60(accNV1) DescriptorSet 0 + Decorate 60(accNV1) Binding 1 + Decorate 75 DecorationNonUniformEXT + Decorate 77 DecorationNonUniformEXT + Decorate 88(payload) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LaunchIDNV): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) + 17: 6(int) Constant 1 +21(gl_LaunchSizeNV): 10(ptr) Variable Input + 27: TypeAccelerationStructureNV + 28: TypeRuntimeArray 27 + 29: TypePointer UniformConstant 28 + 30(accNV0): 29(ptr) Variable UniformConstant + 31: TypeFloat 32 + 32: TypeVector 31(float) 3 + 33: TypeInt 32 1 + 34(block): TypeStruct 32(fvec3) 32(fvec3) 33(int) + 35: TypePointer ShaderRecordBufferNV 34(block) + 36: 35(ptr) Variable ShaderRecordBufferNV + 37: 33(int) Constant 2 + 38: TypePointer ShaderRecordBufferNV 33(int) + 41: TypePointer UniformConstant 27 + 48: 33(int) Constant 1 + 49: TypePointer ShaderRecordBufferNV 32(fvec3) + 52: 31(float) Constant 1056964608 + 53: 33(int) Constant 0 + 56: 31(float) Constant 1061158912 + 57: 6(int) Constant 2 + 58: TypeArray 27 57 + 59: TypePointer UniformConstant 58 + 60(accNV1): 59(ptr) Variable UniformConstant + 86: TypeVector 31(float) 4 + 87: TypePointer RayPayloadNV 86(fvec4) + 88(payload): 87(ptr) Variable RayPayloadNV + 4(main): 2 Function None 3 + 5: Label + 8(lx): 7(ptr) Variable Function + 16(ly): 7(ptr) Variable Function + 20(sx): 7(ptr) Variable Function + 24(sy): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LaunchIDNV) 12 + 15: 6(int) Load 14 + Store 8(lx) 15 + 18: 13(ptr) AccessChain 11(gl_LaunchIDNV) 17 + 19: 6(int) Load 18 + Store 16(ly) 19 + 22: 13(ptr) AccessChain 21(gl_LaunchSizeNV) 12 + 23: 6(int) Load 22 + Store 20(sx) 23 + 25: 13(ptr) AccessChain 21(gl_LaunchSizeNV) 17 + 26: 6(int) Load 25 + Store 24(sy) 26 + 39: 38(ptr) AccessChain 36 37 + 40: 33(int) Load 39 + 42: 41(ptr) AccessChain 30(accNV0) 40 + 43: 27 Load 42 + 44: 6(int) Load 8(lx) + 45: 6(int) Load 16(ly) + 46: 6(int) Load 20(sx) + 47: 6(int) Load 24(sy) + 50: 49(ptr) AccessChain 36 48 + 51: 32(fvec3) Load 50 + 54: 49(ptr) AccessChain 36 53 + 55: 32(fvec3) Load 54 + TraceNV 43 44 45 46 47 12 51 52 55 56 48 + 61: 38(ptr) AccessChain 36 37 + 62: 33(int) Load 61 + 63: 41(ptr) AccessChain 60(accNV1) 62 + 64: 27 Load 63 + 65: 6(int) Load 8(lx) + 66: 6(int) Load 16(ly) + 67: 6(int) Load 20(sx) + 68: 6(int) Load 24(sy) + 69: 49(ptr) AccessChain 36 48 + 70: 32(fvec3) Load 69 + 71: 49(ptr) AccessChain 36 53 + 72: 32(fvec3) Load 71 + TraceNV 64 65 66 67 68 12 70 52 72 56 48 + 73: 38(ptr) AccessChain 36 37 + 74: 33(int) Load 73 + 75: 33(int) CopyObject 74 + 76: 41(ptr) AccessChain 30(accNV0) 75 + 77: 27 Load 76 + 78: 6(int) Load 8(lx) + 79: 6(int) Load 16(ly) + 80: 6(int) Load 20(sx) + 81: 6(int) Load 24(sy) + 82: 49(ptr) AccessChain 36 48 + 83: 32(fvec3) Load 82 + 84: 49(ptr) AccessChain 36 53 + 85: 32(fvec3) Load 84 + TraceNV 77 78 79 80 81 12 83 52 85 56 48 + Return + FunctionEnd diff --git a/Test/spv.RayGenShaderArray.rgen b/Test/spv.RayGenShaderArray.rgen new file mode 100644 index 0000000000..d7434583cc --- /dev/null +++ b/Test/spv.RayGenShaderArray.rgen @@ -0,0 +1,22 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +#extension GL_EXT_nonuniform_qualifier : enable +layout(binding = 0, set = 0) uniform accelerationStructureNV accNV0[]; +layout(binding = 1, set = 0) uniform accelerationStructureNV accNV1[2]; +layout(location = 0) rayPayloadNV vec4 payload; +layout(shaderRecordNV) buffer block +{ + vec3 dir; + vec3 origin; + int i; +}; +void main() +{ + uint lx = gl_LaunchIDNV.x; + uint ly = gl_LaunchIDNV.y; + uint sx = gl_LaunchSizeNV.x; + uint sy = gl_LaunchSizeNV.y; + traceNV(accNV0[i], lx, ly, sx, sy, 0u, origin, 0.5f, dir, 0.75f, 1); + traceNV(accNV1[i], lx, ly, sx, sy, 0u, origin, 0.5f, dir, 0.75f, 1); + traceNV(accNV0[nonuniformEXT(i)], lx, ly, sx, sy, 0u, origin, 0.5f, dir, 0.75f, 1); +} diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 6a8d379b09..8384eb969e 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -3894,7 +3894,10 @@ void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermType // check for additional things allowed by GL_EXT_nonuniform_qualifier if (base.getBasicType() == EbtSampler || - (base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer())) +#ifdef NV_EXTENSIONS + base.getBasicType() == EbtAccStructNV || +#endif + (base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer())) requireExtensions(loc, 1, &E_GL_EXT_nonuniform_qualifier, "variable index"); else error(loc, "", "[", "array must be redeclared with a size before being indexed with a variable"); diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp old mode 100755 new mode 100644 index 4438ba36f9..5a126f1d33 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -593,6 +593,7 @@ INSTANTIATE_TEST_CASE_P( "spv.atomicInt64.comp", "spv.shadingRate.frag", "spv.RayGenShader.rgen", + "spv.RayGenShaderArray.rgen", "spv.RayGenShader_Errors.rgen", "spv.RayConstants.rgen", "spv.IntersectShader.rint",