mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 19:40:06 +00:00
Fix bug where shaderRecordNV buffers were using StorageBuffer storage class
This commit is contained in:
parent
b23d232ec5
commit
61a0cd19cc
11
SPIRV/GlslangToSpv.cpp
Executable file → Normal file
11
SPIRV/GlslangToSpv.cpp
Executable file → Normal file
@ -1088,6 +1088,13 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
|
||||
return spv::StorageClassUniformConstant;
|
||||
}
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (type.getQualifier().isUniformOrBuffer() &&
|
||||
type.getQualifier().layoutShaderRecordNV) {
|
||||
return spv::StorageClassShaderRecordBufferNV;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (glslangIntermediate->usingStorageBuffer() && type.getQualifier().storage == glslang::EvqBuffer) {
|
||||
addPre13Extension(spv::E_SPV_KHR_storage_buffer_storage_class);
|
||||
return spv::StorageClassStorageBuffer;
|
||||
@ -1096,10 +1103,6 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
|
||||
if (type.getQualifier().isUniformOrBuffer()) {
|
||||
if (type.getQualifier().layoutPushConstant)
|
||||
return spv::StorageClassPushConstant;
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (type.getQualifier().layoutShaderRecordNV)
|
||||
return spv::StorageClassShaderRecordBufferNV;
|
||||
#endif
|
||||
if (type.getBasicType() == glslang::EbtBlock)
|
||||
return spv::StorageClassUniform;
|
||||
return spv::StorageClassUniformConstant;
|
||||
|
101
Test/baseResults/spv.RayGenShader11.rgen.out
Executable file
101
Test/baseResults/spv.RayGenShader11.rgen.out
Executable file
@ -0,0 +1,101 @@
|
||||
spv.RayGenShader11.rgen
|
||||
// Module Version 10300
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 60
|
||||
|
||||
Capability RayTracingNV
|
||||
Extension "SPV_NV_ray_tracing"
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint RayGenerationNV 4 "main" 11 21
|
||||
Source GLSL 460
|
||||
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 29 "accNV"
|
||||
Name 48 "block"
|
||||
MemberName 48(block) 0 "arr"
|
||||
MemberName 48(block) 1 "pad"
|
||||
Name 50 ""
|
||||
Name 56 "payload"
|
||||
Decorate 11(gl_LaunchIDNV) BuiltIn LaunchIdNV
|
||||
Decorate 21(gl_LaunchSizeNV) BuiltIn LaunchSizeNV
|
||||
Decorate 29(accNV) DescriptorSet 0
|
||||
Decorate 29(accNV) Binding 0
|
||||
Decorate 46 ArrayStride 4
|
||||
MemberDecorate 48(block) 0 Offset 0
|
||||
MemberDecorate 48(block) 1 Offset 16
|
||||
Decorate 48(block) Block
|
||||
Decorate 56(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: TypePointer UniformConstant 27
|
||||
29(accNV): 28(ptr) Variable UniformConstant
|
||||
35: TypeFloat 32
|
||||
36: TypeVector 35(float) 3
|
||||
37: 35(float) Constant 0
|
||||
38: 36(fvec3) ConstantComposite 37 37 37
|
||||
39: 35(float) Constant 1056964608
|
||||
40: 35(float) Constant 1065353216
|
||||
41: 36(fvec3) ConstantComposite 40 40 40
|
||||
42: 35(float) Constant 1061158912
|
||||
43: TypeInt 32 1
|
||||
44: 43(int) Constant 1
|
||||
45: 6(int) Constant 4
|
||||
46: TypeArray 35(float) 45
|
||||
47: TypeVector 35(float) 4
|
||||
48(block): TypeStruct 46 47(fvec4)
|
||||
49: TypePointer ShaderRecordBufferNV 48(block)
|
||||
50: 49(ptr) Variable ShaderRecordBufferNV
|
||||
51: 43(int) Constant 0
|
||||
52: 43(int) Constant 3
|
||||
53: TypePointer ShaderRecordBufferNV 35(float)
|
||||
55: TypePointer RayPayloadNV 47(fvec4)
|
||||
56(payload): 55(ptr) Variable RayPayloadNV
|
||||
58: TypePointer ShaderRecordBufferNV 47(fvec4)
|
||||
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
|
||||
30: 27 Load 29(accNV)
|
||||
31: 6(int) Load 8(lx)
|
||||
32: 6(int) Load 16(ly)
|
||||
33: 6(int) Load 20(sx)
|
||||
34: 6(int) Load 24(sy)
|
||||
TraceNV 30 31 32 33 34 12 38 39 41 42 44
|
||||
54: 53(ptr) AccessChain 50 51 52
|
||||
Store 54 40
|
||||
57: 47(fvec4) Load 56(payload)
|
||||
59: 58(ptr) AccessChain 50 44
|
||||
Store 59 57
|
||||
Return
|
||||
FunctionEnd
|
19
Test/spv.RayGenShader11.rgen
Normal file
19
Test/spv.RayGenShader11.rgen
Normal file
@ -0,0 +1,19 @@
|
||||
#version 460
|
||||
#extension GL_NV_ray_tracing : enable
|
||||
layout(binding = 0, set = 0) uniform accelerationStructureNV accNV;
|
||||
layout(location = 0) rayPayloadNV vec4 payload;
|
||||
layout(shaderRecordNV) buffer block
|
||||
{
|
||||
float arr[4];
|
||||
vec4 pad;
|
||||
};
|
||||
void main()
|
||||
{
|
||||
uint lx = gl_LaunchIDNV.x;
|
||||
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);
|
||||
arr[3] = 1.0f;
|
||||
pad = payload;
|
||||
}
|
@ -405,6 +405,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
"spv.float32.frag",
|
||||
"spv.float64.frag",
|
||||
"spv.multiView.frag",
|
||||
"spv.RayGenShader11.rgen",
|
||||
"spv.subgroup.frag",
|
||||
"spv.subgroup.geom",
|
||||
"spv.subgroup.tesc",
|
||||
|
Loading…
Reference in New Issue
Block a user