-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRootConstArray.sm
More file actions
57 lines (48 loc) · 1.33 KB
/
Copy pathRootConstArray.sm
File metadata and controls
57 lines (48 loc) · 1.33 KB
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
# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
#
# SPDX-License-Identifier: MIT OR Apache-2.0
SOURCE csshader
ByteAddressBuffer inbuf : register(t0); // SRV
RWByteAddressBuffer outbuf : register(u0); // UAV
cbuffer mycb : register (b0) {
float4 a[2];
};
[numthreads(32, 1, 1)]
void CSMain(uint3 DTid : SV_DispatchThreadID) {
unsigned int idx = inbuf.Load<uint>(DTid.x * 4);
outbuf.Store<float>(DTid.x * 4, a[idx%2].y);
}
END
OBJECT csobj csshader cs_6_2 CSMain
BUFFER inbuf DATA_TYPE uint32 SIZE 64 SERIES_FROM 0 INC_BY 1
BUFFER outbuf DATA_TYPE float SIZE 32 FILL 0
ROOT default
TABLE UAV REGISTER 0 NUMBER 1 SPACE 0
TABLE SRV REGISTER 0 NUMBER 1 SPACE 0
ROOT_CONST NUMBER 8 REGISTER 0 SPACE 0
END
PIPELINE cspipe COMPUTE
ATTACH csobj
ROOT default
END
VIEW inview inbuf AS SRV
VIEW outview outbuf AS UAV
DISPATCH cspipe
BIND 0 TABLE outview
BIND 1 TABLE inview
# ROOT_CONST <bind idx> RAW <bytes>
ROOT_CONST 2 RAW 32
float 0.5
float 1.5
float 2.5
float 3.5
float 4.5
float 5.5
float 6.5
float 7.5
END
RUN 1 1 1
EXPECT outbuf float OFFSET 0 EQ 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5
EXPECT outbuf float OFFSET 32 EQ 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5
EXPECT outbuf float OFFSET 64 EQ 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5
EXPECT outbuf float OFFSET 96 EQ 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5