Skip to content

Commit cd20e94

Browse files
Devon7925csyonghe
andauthored
Add inner texture type to reflection json (#6416)
* Add inner texture type to reflection json * Add expected result of test * Adjust test expected results * Fix ci test result --------- Co-authored-by: Yong He <yonghe@outlook.com>
1 parent 6f2ce72 commit cd20e94

28 files changed

+787
-62
lines changed

source/slang/slang-reflection-json.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,10 @@ static void emitReflectionTypeInfoJSON(PrettyWriter& writer, slang::TypeReflecti
514514
break;
515515

516516
case SLANG_STRUCTURED_BUFFER:
517+
case SLANG_TEXTURE_1D:
518+
case SLANG_TEXTURE_2D:
519+
case SLANG_TEXTURE_3D:
520+
case SLANG_TEXTURE_CUBE:
517521
if (auto resultType = type->getResourceResultType())
518522
{
519523
writer.maybeComma();

tests/bindings/hlsl-to-vulkan-array.hlsl.expected

+9-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ standard output = {
2222
"name": "tex",
2323
"type": {
2424
"kind": "resource",
25-
"baseShape": "texture2D"
25+
"baseShape": "texture2D",
26+
"resultType": {
27+
"kind": "vector",
28+
"elementCount": 4,
29+
"elementType": {
30+
"kind": "scalar",
31+
"scalarType": "float32"
32+
}
33+
}
2634
},
2735
"binding": {"kind": "shaderResource", "index": 0}
2836
},

tests/bindings/hlsl-to-vulkan-combined.hlsl.expected

+14-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,27 @@ standard output = {
99
"binding": {"kind": "descriptorTableSlot", "index": 0},
1010
"type": {
1111
"kind": "resource",
12-
"baseShape": "texture2D"
12+
"baseShape": "texture2D",
13+
"resultType": {
14+
"kind": "scalar",
15+
"scalarType": "float32"
16+
}
1317
}
1418
},
1519
{
1620
"name": "t1",
1721
"binding": {"kind": "descriptorTableSlot", "index": 1},
1822
"type": {
1923
"kind": "resource",
20-
"baseShape": "texture2D"
24+
"baseShape": "texture2D",
25+
"resultType": {
26+
"kind": "vector",
27+
"elementCount": 4,
28+
"elementType": {
29+
"kind": "scalar",
30+
"scalarType": "float32"
31+
}
32+
}
2133
}
2234
}
2335
],

tests/bindings/hlsl-to-vulkan-global.hlsl.expected

+9-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@ standard output = {
2525
"binding": {"kind": "descriptorTableSlot", "index": 0},
2626
"type": {
2727
"kind": "resource",
28-
"baseShape": "texture2D"
28+
"baseShape": "texture2D",
29+
"resultType": {
30+
"kind": "vector",
31+
"elementCount": 4,
32+
"elementType": {
33+
"kind": "scalar",
34+
"scalarType": "float32"
35+
}
36+
}
2937
}
3038
},
3139
{

tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl.expected

+18-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ standard output = {
99
"binding": {"kind": "shaderResource", "index": 10},
1010
"type": {
1111
"kind": "resource",
12-
"baseShape": "texture2D"
12+
"baseShape": "texture2D",
13+
"resultType": {
14+
"kind": "vector",
15+
"elementCount": 4,
16+
"elementType": {
17+
"kind": "scalar",
18+
"scalarType": "float32"
19+
}
20+
}
1321
}
1422
},
1523
{
@@ -81,7 +89,15 @@ standard output = {
8189
"binding": {"kind": "shaderResource", "index": 11},
8290
"type": {
8391
"kind": "resource",
84-
"baseShape": "texture2D"
92+
"baseShape": "texture2D",
93+
"resultType": {
94+
"kind": "vector",
95+
"elementCount": 4,
96+
"elementType": {
97+
"kind": "scalar",
98+
"scalarType": "float32"
99+
}
100+
}
85101
}
86102
},
87103
{

tests/bindings/hlsl-to-vulkan-shift.hlsl.expected

+18-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ standard output = {
99
"binding": {"kind": "shaderResource", "index": 5},
1010
"type": {
1111
"kind": "resource",
12-
"baseShape": "texture2D"
12+
"baseShape": "texture2D",
13+
"resultType": {
14+
"kind": "vector",
15+
"elementCount": 4,
16+
"elementType": {
17+
"kind": "scalar",
18+
"scalarType": "float32"
19+
}
20+
}
1321
}
1422
},
1523
{
@@ -81,7 +89,15 @@ standard output = {
8189
"binding": {"kind": "shaderResource", "space": 2, "index": 7},
8290
"type": {
8391
"kind": "resource",
84-
"baseShape": "texture2D"
92+
"baseShape": "texture2D",
93+
"resultType": {
94+
"kind": "vector",
95+
"elementCount": 4,
96+
"elementType": {
97+
"kind": "scalar",
98+
"scalarType": "float32"
99+
}
100+
}
85101
}
86102
},
87103
{

tests/cross-compile/cpp-resource-reflection.slang.64.expected

+5-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ standard output = {
9595
"binding": {"kind": "uniform", "offset": 24, "size": 8},
9696
"type": {
9797
"kind": "resource",
98-
"baseShape": "texture2D"
98+
"baseShape": "texture2D",
99+
"resultType": {
100+
"kind": "scalar",
101+
"scalarType": "float32"
102+
}
99103
}
100104
},
101105
{

tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang.expected

+10-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ standard output = {
6767
"binding": {"kind": "shaderResource", "index": 0},
6868
"type": {
6969
"kind": "resource",
70-
"baseShape": "texture2D"
70+
"baseShape": "texture2D",
71+
"resultType": {
72+
"kind": "scalar",
73+
"scalarType": "float32"
74+
}
7175
}
7276
},
7377
{
@@ -76,7 +80,11 @@ standard output = {
7680
"type": {
7781
"kind": "resource",
7882
"baseShape": "texture2D",
79-
"array": true
83+
"array": true,
84+
"resultType": {
85+
"kind": "scalar",
86+
"scalarType": "float32"
87+
}
8088
}
8189
},
8290
{

tests/reflection/arrays.hlsl.expected

+27-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,15 @@ standard output = {
9090
"binding": {"kind": "shaderResource", "index": 0},
9191
"type": {
9292
"kind": "resource",
93-
"baseShape": "texture2D"
93+
"baseShape": "texture2D",
94+
"resultType": {
95+
"kind": "vector",
96+
"elementCount": 4,
97+
"elementType": {
98+
"kind": "scalar",
99+
"scalarType": "float32"
100+
}
101+
}
94102
}
95103
},
96104
{
@@ -101,7 +109,15 @@ standard output = {
101109
"elementCount": 16,
102110
"elementType": {
103111
"kind": "resource",
104-
"baseShape": "texture2D"
112+
"baseShape": "texture2D",
113+
"resultType": {
114+
"kind": "vector",
115+
"elementCount": 4,
116+
"elementType": {
117+
"kind": "scalar",
118+
"scalarType": "float32"
119+
}
120+
}
105121
}
106122
}
107123
},
@@ -110,7 +126,15 @@ standard output = {
110126
"binding": {"kind": "shaderResource", "index": 17},
111127
"type": {
112128
"kind": "resource",
113-
"baseShape": "texture2D"
129+
"baseShape": "texture2D",
130+
"resultType": {
131+
"kind": "vector",
132+
"elementCount": 4,
133+
"elementType": {
134+
"kind": "scalar",
135+
"scalarType": "float32"
136+
}
137+
}
114138
}
115139
},
116140
{

tests/reflection/binding-gl.hlsl.expected

+27-3
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,47 @@ standard output = {
9090
"binding": {"kind": "descriptorTableSlot", "space": 2, "index": 1},
9191
"type": {
9292
"kind": "resource",
93-
"baseShape": "texture2D"
93+
"baseShape": "texture2D",
94+
"resultType": {
95+
"kind": "vector",
96+
"elementCount": 4,
97+
"elementType": {
98+
"kind": "scalar",
99+
"scalarType": "float32"
100+
}
101+
}
94102
}
95103
},
96104
{
97105
"name": "ta",
98106
"binding": {"kind": "descriptorTableSlot", "space": 3, "index": 2},
99107
"type": {
100108
"kind": "resource",
101-
"baseShape": "texture2D"
109+
"baseShape": "texture2D",
110+
"resultType": {
111+
"kind": "vector",
112+
"elementCount": 4,
113+
"elementType": {
114+
"kind": "scalar",
115+
"scalarType": "float32"
116+
}
117+
}
102118
}
103119
},
104120
{
105121
"name": "ty",
106122
"binding": {"kind": "descriptorTableSlot", "index": 0},
107123
"type": {
108124
"kind": "resource",
109-
"baseShape": "texture2D"
125+
"baseShape": "texture2D",
126+
"resultType": {
127+
"kind": "vector",
128+
"elementCount": 4,
129+
"elementType": {
130+
"kind": "scalar",
131+
"scalarType": "float32"
132+
}
133+
}
110134
}
111135
},
112136
{

tests/reflection/binding-push-constant-gl.hlsl.expected

+27-3
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,47 @@ standard output = {
147147
"binding": {"kind": "descriptorTableSlot", "space": 2, "index": 1},
148148
"type": {
149149
"kind": "resource",
150-
"baseShape": "texture2D"
150+
"baseShape": "texture2D",
151+
"resultType": {
152+
"kind": "vector",
153+
"elementCount": 4,
154+
"elementType": {
155+
"kind": "scalar",
156+
"scalarType": "float32"
157+
}
158+
}
151159
}
152160
},
153161
{
154162
"name": "ta",
155163
"binding": {"kind": "descriptorTableSlot", "space": 3, "index": 2},
156164
"type": {
157165
"kind": "resource",
158-
"baseShape": "texture2D"
166+
"baseShape": "texture2D",
167+
"resultType": {
168+
"kind": "vector",
169+
"elementCount": 4,
170+
"elementType": {
171+
"kind": "scalar",
172+
"scalarType": "float32"
173+
}
174+
}
159175
}
160176
},
161177
{
162178
"name": "ty",
163179
"binding": {"kind": "descriptorTableSlot", "index": 0},
164180
"type": {
165181
"kind": "resource",
166-
"baseShape": "texture2D"
182+
"baseShape": "texture2D",
183+
"resultType": {
184+
"kind": "vector",
185+
"elementCount": 4,
186+
"elementType": {
187+
"kind": "scalar",
188+
"scalarType": "float32"
189+
}
190+
}
167191
}
168192
},
169193
{

tests/reflection/cross-compile.slang.expected

+9-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ standard output = {
99
"binding": {"kind": "descriptorTableSlot", "index": 0},
1010
"type": {
1111
"kind": "resource",
12-
"baseShape": "texture2D"
12+
"baseShape": "texture2D",
13+
"resultType": {
14+
"kind": "vector",
15+
"elementCount": 4,
16+
"elementType": {
17+
"kind": "scalar",
18+
"scalarType": "float32"
19+
}
20+
}
1321
}
1422
},
1523
{

0 commit comments

Comments
 (0)