xref: /aosp_15_r20/external/angle/third_party/glslang/src/Test/hlsl.rw.swizzle.frag (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1RWTexture2D<float3> rwtx;
2RWBuffer<float3> buf;
3
4float3 SomeValue() { return float3(1,2,3); }
5
6float4 main() : SV_Target0
7{
8    int2 tc2 = { 0, 0 };
9    int tc = 0;
10
11    // Test swizzles and partial updates of L-values when writing to buffers and writable textures.
12    rwtx[tc2].zyx = float3(1,2,3);     // full swizzle, simple RHS
13    rwtx[tc2].zyx = SomeValue();       // full swizzle, complex RHS
14    rwtx[tc2].zyx = 2;                 // full swizzle, modify op
15
16    // Partial updates not yet supported.
17    // Partial values, which will use swizzles.
18    // buf[tc].yz = 42;                 // partial swizzle, simple RHS
19    // buf[tc].yz = SomeValue().x;      // partial swizzle, complex RHS
20    // buf[tc].yz += 43;                // partial swizzle, modify op
21
22    // // Partial values, which will use index.
23    // buf[tc].y = 44;                  // single index, simple RHS
24    // buf[tc].y = SomeValue().x;       // single index, complex RHS
25    // buf[tc].y += 45;                 // single index, modify op
26
27    return 0.0;
28}
29