forked from overdesigned/RenderPipelineShaders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_scheduler.rpsl
242 lines (202 loc) · 8.37 KB
/
test_scheduler.rpsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
// Copyright (c) 2024 Advanced Micro Devices, Inc.
//
// This file is part of the AMD Render Pipeline Shaders SDK which is
// released under the MIT LICENSE.
//
// See file LICENSE.txt for full license details.
node draw(uint id, rtv rt : SV_Target0);
compute node comp_draw(uint id, uav rt);
node blt(uint id, rtv dst : SV_Target0, ps_srv src);
node blt_all(uint id, rtv dst : SV_Target0, ps_srv srcs[12]);
export void program_order(texture output)
{
ResourceDesc desc = output.desc();
texture t0 = create_texture(desc);
texture t1 = create_texture(desc);
texture t2 = create_texture(desc);
texture t3 = create_texture(desc);
texture t4 = create_texture(desc);
texture t5 = create_texture(desc);
draw(0, t0);
draw(1, t1);
draw(2, t2);
draw(3, t3);
draw(4, t4);
draw(5, t5);
blt(6, output, t0);
blt(7, output, t1);
blt(8, output, t2);
blt(9, output, t3);
blt(10, output, t4);
blt(11, output, t5);
draw(12, t0);
blt(13, output, t0);
draw(14, t1);
blt(15, output, t1);
draw(16, t2);
blt(17, output, t2);
draw(18, t3);
blt(19, output, t3);
draw(20, t4);
blt(21, output, t4);
draw(22, t5);
blt(23, output, t5);
}
export void memory_saving(texture output)
{
ResourceDesc desc = output.desc();
texture t0 = create_texture(desc);
texture t1 = create_texture(desc);
texture t2 = create_texture(desc);
texture t3 = create_texture(desc);
texture t4 = create_texture(desc);
texture t5 = create_texture(desc);
draw(0, t0);
draw(1, t1);
draw(2, t2);
draw(3, t3);
draw(4, t4);
draw(5, t5);
blt(6, output, t0);
blt(7, output, t1);
blt(8, output, t2);
blt(9, output, t3);
blt(10, output, t4);
blt(11, output, t5);
}
export void random_order(texture output)
{
ResourceDesc desc = output.desc();
texture tmp[12];
for (uint i = 0; i < 12; i++)
{
tmp[i] = create_texture(desc);
draw(i, tmp[i]);
}
blt_all(12, output, tmp);
}
export void dead_code_elimination(texture output, bool bBlt0, bool bBlt1)
{
ResourceDesc desc = output.desc();
texture t0 = create_texture(desc);
texture t1 = create_texture(desc);
draw(0, t0);
draw(1, t1);
if (bBlt0)
{
blt(2, output, t0);
}
if (bBlt1)
{
blt(3, output, t1);
}
}
export void gfx_comp_batching(texture output)
{
ResourceDesc desc = output.desc();
texture t0 = create_texture(desc);
texture t1 = create_texture(desc);
texture t2 = create_texture(desc);
texture t3 = create_texture(desc);
texture t4 = create_texture(desc);
texture t5 = create_texture(desc);
draw(0, t0);
comp_draw(1, t1);
comp_draw(2, t2);
draw(3, t3);
draw(4, t4);
comp_draw(5, t5);
blt(6, output, t0);
blt(7, output, t1);
blt(8, output, t2);
blt(9, output, t3);
blt(10, output, t4);
blt(11, output, t5);
}
node draw_mrt_wo_rt0(uint id, discard_rtv rt : SV_Target0, rtv rt1 : SV_Target1);
node draw_with_ds_clear(uint id, rtv rt : SV_Target0, [readwrite(depth)][writeonly(stencil)] texture d : SV_DepthStencil, float clearDepth : SV_ClearDepth, uint clearStencil : SV_ClearStencil);
node draw_with_ds_wo_stencil(uint id, rtv rt : SV_Target0, [readwrite(depth)][writeonly(stencil)] texture d : SV_DepthStencil);
node draw_with_ds_wo_depth(uint id, rtv rt : SV_Target0, [writeonly(depth)][readwrite(stencil)] texture d : SV_DepthStencil);
node draw_with_ds_wo_depthstencil(uint id, rtv rt : SV_Target0, [writeonly(depth, stencil)] texture d : SV_DepthStencil);
node draw_with_ds_ro_depthstencil(uint id, rtv rt : SV_Target0, [readonly(depth, stencil)] texture d : SV_DepthStencil);
node draw_with_depth_srv(uint id, rtv rt : SV_Target0, [readonly(ps)] texture d);
node draw_with_stencil_srv(uint id, rtv rt : SV_Target0, [readonly(ps)] texture s);
node draw_with_overlapped_views(uint id,
[readonly(cs)] texture t0,
[writeonly(cs)] texture u0,
[readonly(cs, discard_before)] texture t1,
[readonly(cs)] texture t2,
[readonly(cs)] texture t3,
[readonly(cs, discard_after)] texture t4,
[readonly(cs)] texture t5,
[readonly(cs)] texture t6,
[readonly(cs)] texture t7,
[readonly(cs, discard_after)] texture t8);
node draw_with_overlapped_views2(uint id,
[readonly(cs, discard_after)] texture t0,
[readonly(cs, discard_before)] texture t1);
export void subres_data_lifetime(texture output)
{
ResourceDesc desc = output.desc();
uint mips_levels = 5;
uint array_slices = 10;
texture t0 = create_tex2d(desc.Format, (uint)desc.Width, desc.Height, mips_levels, array_slices, 1);
texture t1 = create_tex2d(desc.Format, (uint)desc.Width, desc.Height, 1, 1, 3);
texture t2 = create_tex2d(desc.Format, (uint)desc.Width, desc.Height, 5, 1, 1);
texture d0 = create_tex2d(RPS_FORMAT_D32_FLOAT_S8X24_UINT, (uint)desc.Width, desc.Height, 1, 1, 1);
draw(0, t0.array(0).mips(0));
// array[1].mip[0] to be discarded
draw_mrt_wo_rt0(1, t0.array(1).mips(0), t0.array(0).mips(0));
draw(2, t0.array(2).mips(0));
// array[2].mip[0] to be discarded
draw_mrt_wo_rt0(3, t0.array(2).mips(0), t0.array(3).mips(0));
draw(4, t0.array(0, 4).mips(0));
// array[0, 1].mip[0] to be discarded
draw_mrt_wo_rt0(5, t0.array(0, 2).mips(0), t0.array(3).mips(0));
draw(6, t0.array(0, 3).mips(0));
// discard range not fully overlapping
draw_mrt_wo_rt0(7, t0.array(1, 3).mips(0), t0.array(5).mips(0));
draw(8, t1);
draw_with_ds_clear(9, t1, d0, 1.0f, 0);
draw_with_ds_wo_stencil(10, t1, d0);
draw_with_ds_wo_depth(11, t1, d0);
draw_with_depth_srv(12, t1, d0.format(RPS_FORMAT_R32_FLOAT_X8X24_TYPELESS));
draw_with_ds_wo_depthstencil(13, t1, d0);
draw_with_stencil_srv(14, t1, d0.format(RPS_FORMAT_X32_TYPELESS_G8X24_UINT));
draw_with_ds_ro_depthstencil(15, t1, d0);
blt(16, output, t0);
blt(17, output, t1);
draw(18, t2.mips(0)); // discard_before
draw(19, t2.mips(1)); // discard_before
draw(20, t2.mips(2)); // discard_before | discard_after (patched)
draw(21, t2.mips(3)); // discard_before
draw_with_overlapped_views(22,
t2.mips(0), // RO -> 0
t2.mips(2), // WO -> discard_before | discard_after (patched)
t2.mips(0), // RO(discard_before) -> discard_before
t2.mips(0), // RO -> 0
t2.mips(1), // RO -> discard_after (patched)
t2.mips(1), // RO(discard_after) -> discard_after
t2.mips(1), // RO -> discard_after (patched)
t2.mips(3), // RO -> 0
t2.mips(3), // RO -> 0
t2.mips(4));// RO(discard_after) -> discard_after | discard_before
draw_with_overlapped_views(23,
t2.mips(0), // RO -> 0
t2.mips(2), // WO -> discard_before
t2.mips(1), // RO(discard_before) -> discard_before
t2.mips(3), // RO -> discard_after (patched)
t2.mips(3), // RO -> discard_after (patched)
t2.mips(4), // RO(discard_after) -> discard_after | discard_before(patched)
t2.mips(3), // RO -> discard_after (patched)
t2.mips(3), // RO -> discard_after (patched)
t2.mips(3), // RO -> discard_after (patched)
t2.mips(4));// RO(discard_after) -> discard_after | discard_before(patched)
blt(24, output, t2.mips(1)); // 0
blt(25, output, t2.mips(2)); // 0
blt(26, output, t2.mips(4)); // discard_before | discard_after (patched)
draw_with_overlapped_views2(27, t2.mips(0, 3), t2.mips(2, 3)); // discard_after, discard_before.
blt(28, output, t2.mips(2)); // 0
blt(29, output, t2.mips(1)); // discard_before (patched)
blt(30, output, t2); // discard_after
}