blob: 9a7fd7e31eae3c09c328ce9a96fbca5506c226c0 [file] [log] [blame]
James Price3efa5b12024-06-18 15:23:55 +00001#include <metal_stdlib>
2using namespace metal;
James Price48be7e82024-06-19 22:38:07 +00003
James Price3efa5b12024-06-18 15:23:55 +00004struct tint_module_vars_struct {
James Price812c9d02024-06-29 21:54:00 +00005 device uint4* prevent_dce;
James Price3efa5b12024-06-18 15:23:55 +00006 texture2d<uint, access::sample> arg_1;
7 sampler arg_2;
James Price3efa5b12024-06-18 15:23:55 +00008};
James Price48be7e82024-06-19 22:38:07 +00009
James Price3efa5b12024-06-18 15:23:55 +000010struct VertexOutput {
11 float4 pos;
12 uint4 prevent_dce;
13};
James Price48be7e82024-06-19 22:38:07 +000014
James Price3efa5b12024-06-18 15:23:55 +000015struct vertex_main_outputs {
16 float4 VertexOutput_pos [[position]];
17 uint4 VertexOutput_prevent_dce [[user(locn0)]] [[flat]];
18};
dan sinclairf1f381a2023-11-22 09:44:15 +000019
James Price3efa5b12024-06-18 15:23:55 +000020uint4 textureGather_8fae00(tint_module_vars_struct tint_module_vars) {
21 float2 arg_3 = float2(1.0f);
22 uint4 res = tint_module_vars.arg_1.gather(tint_module_vars.arg_2, arg_3, int2(0), component::y);
23 return res;
dan sinclairf1f381a2023-11-22 09:44:15 +000024}
James Price48be7e82024-06-19 22:38:07 +000025
James Price812c9d02024-06-29 21:54:00 +000026fragment void fragment_main(device uint4* prevent_dce [[buffer(0)]], texture2d<uint, access::sample> arg_1 [[texture(0)]], sampler arg_2 [[sampler(0)]]) {
27 tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .arg_1=arg_1, .arg_2=arg_2};
James Price3efa5b12024-06-18 15:23:55 +000028 (*tint_module_vars.prevent_dce) = textureGather_8fae00(tint_module_vars);
dan sinclairf1f381a2023-11-22 09:44:15 +000029}
James Price48be7e82024-06-19 22:38:07 +000030
James Price812c9d02024-06-29 21:54:00 +000031kernel void compute_main(device uint4* prevent_dce [[buffer(0)]], texture2d<uint, access::sample> arg_1 [[texture(0)]], sampler arg_2 [[sampler(0)]]) {
32 tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .arg_1=arg_1, .arg_2=arg_2};
James Price3efa5b12024-06-18 15:23:55 +000033 (*tint_module_vars.prevent_dce) = textureGather_8fae00(tint_module_vars);
dan sinclairf1f381a2023-11-22 09:44:15 +000034}
James Price48be7e82024-06-19 22:38:07 +000035
James Price3efa5b12024-06-18 15:23:55 +000036VertexOutput vertex_main_inner(tint_module_vars_struct tint_module_vars) {
37 VertexOutput out = {};
38 out.pos = float4(0.0f);
39 out.prevent_dce = textureGather_8fae00(tint_module_vars);
40 return out;
dan sinclairf1f381a2023-11-22 09:44:15 +000041}
James Price48be7e82024-06-19 22:38:07 +000042
James Price3efa5b12024-06-18 15:23:55 +000043vertex vertex_main_outputs vertex_main(texture2d<uint, access::sample> arg_1 [[texture(0)]], sampler arg_2 [[sampler(0)]]) {
44 tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_1=arg_1, .arg_2=arg_2};
45 VertexOutput const v = vertex_main_inner(tint_module_vars);
James Price6d87fa62024-09-03 23:24:13 +000046 vertex_main_outputs tint_wrapper_result = {};
47 tint_wrapper_result.VertexOutput_pos = v.pos;
48 tint_wrapper_result.VertexOutput_prevent_dce = v.prevent_dce;
49 return tint_wrapper_result;
dan sinclairf1f381a2023-11-22 09:44:15 +000050}