Skip to content

Commit 3ea2c8f

Browse files
authored
Merge pull request KhronosGroup#2343 from KhronosGroup/fix-non-determinism
Fix recently found non-determinism with gl_WorldToObject3x4EXT.
2 parents 3aa4431 + f80ef74 commit 3ea2c8f

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

SPIRV/GlslangToSpv.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,9 +2056,9 @@ std::pair<spv::Id, spv::Id> TGlslangToSpvTraverser::getForcedType(glslang::TBuil
20562056
// builtins. During visitBinary we insert a transpose
20572057
case glslang::EbvWorldToObject3x4:
20582058
case glslang::EbvObjectToWorld3x4: {
2059-
std::pair<spv::Id, spv::Id> ret(builder.makeMatrixType(builder.makeFloatType(32), 4, 3),
2060-
builder.makeMatrixType(builder.makeFloatType(32), 3, 4)
2061-
);
2059+
spv::Id mat43 = builder.makeMatrixType(builder.makeFloatType(32), 4, 3);
2060+
spv::Id mat34 = builder.makeMatrixType(builder.makeFloatType(32), 3, 4);
2061+
std::pair<spv::Id, spv::Id> ret(mat43, mat34);
20622062
return ret;
20632063
}
20642064
default:

Test/baseResults/spv.ext.World3x4.rahit.out

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ spv.ext.World3x4.rahit
5050
43(gl_LaunchIDEXT): 42(ptr) Variable Input
5151
44: TypeVector 40(int) 2
5252
47: TypeVector 10(int) 2
53-
55: TypeVector 6(float) 4
54-
56: TypeMatrix 55(fvec4) 3
55-
57: TypeVector 6(float) 3
56-
58: TypeMatrix 57(fvec3) 4
57-
59: TypePointer Input 58
53+
55: TypeVector 6(float) 3
54+
56: TypeMatrix 55(fvec3) 4
55+
57: TypeVector 6(float) 4
56+
58: TypeMatrix 57(fvec4) 3
57+
59: TypePointer Input 56
5858
60(gl_WorldToObject3x4EXT): 59(ptr) Variable Input
59-
65: TypePointer Function 56
59+
65: TypePointer Function 58
6060
70: TypeVector 10(int) 4
6161
71: TypePointer Function 70(ivec4)
6262
76: TypeImage 10(int) 3D nonsampled format:R32i
6363
77: TypePointer UniformConstant 76
6464
78(result): 77(ptr) Variable UniformConstant
65-
86: TypePointer HitAttributeKHR 57(fvec3)
65+
86: TypePointer HitAttributeKHR 55(fvec3)
6666
87(attribs): 86(ptr) Variable HitAttributeKHR
67-
88: TypePointer IncomingRayPayloadKHR 57(fvec3)
67+
88: TypePointer IncomingRayPayloadKHR 55(fvec3)
6868
89(hitValue): 88(ptr) Variable IncomingRayPayloadKHR
6969
4(main): 2 Function None 3
7070
5: Label
@@ -110,8 +110,8 @@ spv.ext.World3x4.rahit
110110
52: 37(ivec3) CompositeConstruct 50 51 49
111111
Store 39(p) 52
112112
54: 6(float) Load 8(k)
113-
61: 58 Load 60(gl_WorldToObject3x4EXT)
114-
62: 56 Transpose 61
113+
61: 56 Load 60(gl_WorldToObject3x4EXT)
114+
62: 58 Transpose 61
115115
63: 10(int) Load 14(col)
116116
64: 10(int) Load 25(row)
117117
Store 66(indexable) 62

gtests/Spv.FromFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ INSTANTIATE_TEST_CASE_P(
560560
"spv.ext.RayGenShader.rgen",
561561
"spv.ext.RayGenShader11.rgen",
562562
"spv.ext.RayGenShaderArray.rgen",
563-
//"spv.ext.World3x4.rahit", this is triggering non-deterministic results
563+
"spv.ext.World3x4.rahit",
564564
})),
565565
FileNameAsCustomTestSuffix
566566
);

0 commit comments

Comments
 (0)