Merge pull request #1645 from KhronosGroup/dupe-accelstruct

Don't output duplicate OpTypeAccelerationStructureNV declarations
This commit is contained in:
John Kessenich 2019-01-08 09:39:32 +07:00 committed by GitHub
commit 69932ab47f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 8 deletions

View File

@ -565,6 +565,7 @@ Id Builder::makeAccelerationStructureNVType()
Instruction *type;
if (groupedTypes[OpTypeAccelerationStructureNV].size() == 0) {
type = new Instruction(getUniqueId(), NoType, OpTypeAccelerationStructureNV);
groupedTypes[OpTypeAccelerationStructureNV].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
} else {

View File

@ -1,7 +1,7 @@
spv.RayGenShader.rgen
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 60
// Id's are bound by 61
Capability RayTracingNV
Extension "SPV_NV_ray_tracing"
@ -17,21 +17,24 @@ spv.RayGenShader.rgen
Name 20 "sx"
Name 21 "gl_LaunchSizeNV"
Name 24 "sy"
Name 29 "accNV"
Name 29 "accNV0"
Name 48 "block"
MemberName 48(block) 0 "arr"
MemberName 48(block) 1 "pad"
Name 50 ""
Name 56 "payload"
Name 60 "accNV1"
Decorate 11(gl_LaunchIDNV) BuiltIn LaunchIdNV
Decorate 21(gl_LaunchSizeNV) BuiltIn LaunchSizeNV
Decorate 29(accNV) DescriptorSet 0
Decorate 29(accNV) Binding 0
Decorate 29(accNV0) DescriptorSet 0
Decorate 29(accNV0) Binding 0
Decorate 46 ArrayStride 4
MemberDecorate 48(block) 0 Offset 0
MemberDecorate 48(block) 1 Offset 16
Decorate 48(block) BufferBlock
Decorate 56(payload) Location 0
Decorate 60(accNV1) DescriptorSet 0
Decorate 60(accNV1) Binding 1
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@ -45,7 +48,7 @@ spv.RayGenShader.rgen
21(gl_LaunchSizeNV): 10(ptr) Variable Input
27: TypeAccelerationStructureNV
28: TypePointer UniformConstant 27
29(accNV): 28(ptr) Variable UniformConstant
29(accNV0): 28(ptr) Variable UniformConstant
35: TypeFloat 32
36: TypeVector 35(float) 3
37: 35(float) Constant 0
@ -68,6 +71,7 @@ spv.RayGenShader.rgen
55: TypePointer RayPayloadNV 47(fvec4)
56(payload): 55(ptr) Variable RayPayloadNV
58: TypePointer ShaderRecordBufferNV 47(fvec4)
60(accNV1): 28(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
8(lx): 7(ptr) Variable Function
@ -86,7 +90,7 @@ spv.RayGenShader.rgen
25: 13(ptr) AccessChain 21(gl_LaunchSizeNV) 17
26: 6(int) Load 25
Store 24(sy) 26
30: 27 Load 29(accNV)
30: 27 Load 29(accNV0)
31: 6(int) Load 8(lx)
32: 6(int) Load 16(ly)
33: 6(int) Load 20(sx)

View File

@ -1,6 +1,7 @@
#version 460
#extension GL_NV_ray_tracing : enable
layout(binding = 0, set = 0) uniform accelerationStructureNV accNV;
layout(binding = 0, set = 0) uniform accelerationStructureNV accNV0;
layout(binding = 1, set = 0) uniform accelerationStructureNV accNV1; // Unused
layout(location = 0) rayPayloadNV vec4 payload;
layout(shaderRecordNV) buffer block
{
@ -13,7 +14,7 @@ void main()
uint ly = gl_LaunchIDNV.y;
uint sx = gl_LaunchSizeNV.x;
uint sy = gl_LaunchSizeNV.y;
traceNV(accNV, lx, ly, sx, sy, 0u, vec3(0.0f), 0.5f, vec3(1.0f), 0.75f, 1);
traceNV(accNV0, lx, ly, sx, sy, 0u, vec3(0.0f), 0.5f, vec3(1.0f), 0.75f, 1);
arr[3] = 1.0f;
pad = payload;
}