Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 1 | uint tint_insert_bits(uint v, uint n, uint offset, uint count) { |
Antonio Maiorano | 144ebed | 2024-01-30 16:30:15 +0000 | [diff] [blame] | 2 | uint e = (offset + count); |
| 3 | uint mask = ((((offset < 32u) ? (1u << offset) : 0u) - 1u) ^ (((e < 32u) ? (1u << e) : 0u) - 1u)); |
Zhaoming Jiang | 4f3f45c | 2022-11-09 01:54:08 +0000 | [diff] [blame] | 4 | return ((((offset < 32u) ? (n << offset) : 0u) & mask) | (v & ~(mask))); |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 5 | } |
| 6 | |
Natalie Chouinard | 6ee6330 | 2024-06-25 20:45:30 +0000 | [diff] [blame] | 7 | RWByteAddressBuffer prevent_dce : register(u0); |
| 8 | |
Natalie Chouinard | e902718 | 2024-06-13 18:50:19 +0000 | [diff] [blame] | 9 | uint insertBits_e3e3a2() { |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 10 | uint arg_0 = 1u; |
| 11 | uint arg_1 = 1u; |
| 12 | uint arg_2 = 1u; |
| 13 | uint arg_3 = 1u; |
| 14 | uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3); |
Natalie Chouinard | e902718 | 2024-06-13 18:50:19 +0000 | [diff] [blame] | 15 | return res; |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 16 | } |
| 17 | |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 18 | void fragment_main() { |
Natalie Chouinard | e902718 | 2024-06-13 18:50:19 +0000 | [diff] [blame] | 19 | prevent_dce.Store(0u, asuint(insertBits_e3e3a2())); |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 20 | return; |
| 21 | } |
| 22 | |
| 23 | [numthreads(1, 1, 1)] |
| 24 | void compute_main() { |
Natalie Chouinard | e902718 | 2024-06-13 18:50:19 +0000 | [diff] [blame] | 25 | prevent_dce.Store(0u, asuint(insertBits_e3e3a2())); |
Ben Clayton | c0af5c5 | 2022-06-02 14:36:10 +0000 | [diff] [blame] | 26 | return; |
| 27 | } |
Natalie Chouinard | e902718 | 2024-06-13 18:50:19 +0000 | [diff] [blame] | 28 | |
| 29 | struct VertexOutput { |
| 30 | float4 pos; |
| 31 | uint prevent_dce; |
| 32 | }; |
| 33 | struct tint_symbol_1 { |
| 34 | nointerpolation uint prevent_dce : TEXCOORD0; |
| 35 | float4 pos : SV_Position; |
| 36 | }; |
| 37 | |
| 38 | VertexOutput vertex_main_inner() { |
| 39 | VertexOutput tint_symbol = (VertexOutput)0; |
| 40 | tint_symbol.pos = (0.0f).xxxx; |
| 41 | tint_symbol.prevent_dce = insertBits_e3e3a2(); |
| 42 | return tint_symbol; |
| 43 | } |
| 44 | |
| 45 | tint_symbol_1 vertex_main() { |
| 46 | VertexOutput inner_result = vertex_main_inner(); |
| 47 | tint_symbol_1 wrapper_result = (tint_symbol_1)0; |
| 48 | wrapper_result.pos = inner_result.pos; |
| 49 | wrapper_result.prevent_dce = inner_result.prevent_dce; |
| 50 | return wrapper_result; |
| 51 | } |