forked from GPUOpen-LibrariesAndSDKs/RenderPipelineShaders
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_hlsl_intrinsics.rpsl
67 lines (41 loc) · 1.37 KB
/
test_hlsl_intrinsics.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
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// This file is part of the AMD Render Pipeline Shaders SDK which is
// released under the AMD INTERNAL EVALUATION LICENSE.
//
// See file LICENSE.txt for full license details.
node Foo(uint ia[10], float fa[16]);
export void rps_main(int i1, uint u1, int2 i2, uint3 u3, float f1, float4 f4)
{
uint ia[10];
float fa[16];
ia[0] = (uint)abs(i1);
ia[1] = (i1 >> 3) & 0xff;
ia[2] = asuint(f4.w);
ia[3] = mad(u3.x, u3.y, u3.z);
ia[4] = countbits(u3.y);
ia[5] = u3.x / 17;
ia[6] = u3.x % 17;
uint64_t xx = (uint64_t(u1) << 32) | u3.x;
xx = xx / ((uint64_t)u3.y + 1);
ia[7] = uint(xx & 0xffffffff);
ia[8] = firstbithigh(u3.y);
ia[9] = firstbithigh(-(int)u3.y - 4096);
fa[0] = atan2(f4.x + f1, f4.y);
fa[1] = asfloat(u1);
fa[2] = (all(f4 > 0) && any(u3 < 1000)) ? float(u1) : float(i1);
fa[3] = i1 ? f4.x : f4.y;
fa[4] = max(f4.x, f4.y);
fa[5] = lerp(f4.x, f4.y, f4.z);
fa[6] = floor(f4.x);
fa[7] = ceil(f4.y);
fa[8] = round(f4.z);
fa[9] = trunc(f4.w);
fa[10] = (isinf(f4.x) || isnan(f4.y) || !isfinite(f4.z)) ? 1.0f : 2.0f;
fa[11] = mad(f4.y, f4.z, f4.x);
fa[12] = cos(f4.x);
fa[13] = rsqrt(abs(f4.y) + 0.0001f);
fa[14] = saturate(f4.z);
fa[15] = exp(min(f4.z, 1));
Foo(ia, fa);
}