// language: metal2.0 #include #include using metal::uint; struct main_Input { }; kernel void main_( metal::uint3 local_id [[thread_position_in_threadgroup]] , metal::texture2d image_mipmapped_src [[user(fake0)]] , metal::texture2d_ms image_multisampled_src [[user(fake0)]] , metal::texture2d image_storage_src [[user(fake0)]] , metal::texture2d_array image_array_src [[user(fake0)]] , metal::texture1d image_1d_src [[user(fake0)]] , metal::texture1d image_dst [[user(fake0)]] ) { metal::uint2 dim = metal::uint2(image_storage_src.get_width(), image_storage_src.get_height()); metal::int2 itc = static_cast(dim * local_id.xy) % metal::int2(10, 20); metal::uint4 value1_ = image_mipmapped_src.read(metal::uint2(itc), static_cast(local_id.z)); metal::uint4 value2_ = image_multisampled_src.read(metal::uint2(itc), static_cast(local_id.z)); metal::uint4 value4_ = image_storage_src.read(metal::uint2(itc)); metal::uint4 value5_ = image_array_src.read(metal::uint2(itc), local_id.z, static_cast(local_id.z) + 1); metal::uint4 value6_ = image_array_src.read(metal::uint2(itc), static_cast(local_id.z), static_cast(local_id.z) + 1); metal::uint4 value7_ = image_1d_src.read(uint(static_cast(local_id.x))); metal::uint4 value1u = image_mipmapped_src.read(metal::uint2(static_cast(itc)), static_cast(local_id.z)); metal::uint4 value2u = image_multisampled_src.read(metal::uint2(static_cast(itc)), static_cast(local_id.z)); metal::uint4 value4u = image_storage_src.read(metal::uint2(static_cast(itc))); metal::uint4 value5u = image_array_src.read(metal::uint2(static_cast(itc)), local_id.z, static_cast(local_id.z) + 1); metal::uint4 value6u = image_array_src.read(metal::uint2(static_cast(itc)), static_cast(local_id.z), static_cast(local_id.z) + 1); metal::uint4 value7u = image_1d_src.read(uint(static_cast(local_id.x))); image_dst.write((((value1_ + value2_) + value4_) + value5_) + value6_, uint(itc.x)); image_dst.write((((value1u + value2u) + value4u) + value5u) + value6u, uint(static_cast(itc.x))); return; } struct depth_loadInput { }; kernel void depth_load( metal::uint3 local_id_1 [[thread_position_in_threadgroup]] , metal::depth2d_ms image_depth_multisampled_src [[user(fake0)]] , metal::texture2d image_storage_src [[user(fake0)]] , metal::texture1d image_dst [[user(fake0)]] ) { metal::uint2 dim_1 = metal::uint2(image_storage_src.get_width(), image_storage_src.get_height()); metal::int2 itc_1 = static_cast(dim_1 * local_id_1.xy) % metal::int2(10, 20); float val = image_depth_multisampled_src.read(metal::uint2(itc_1), static_cast(local_id_1.z)); image_dst.write(metal::uint4(static_cast(val)), uint(itc_1.x)); return; } struct queriesOutput { metal::float4 member_2 [[position]]; }; vertex queriesOutput queries( metal::texture1d image_1d [[user(fake0)]] , metal::texture2d image_2d [[user(fake0)]] , metal::texture2d_array image_2d_array [[user(fake0)]] , metal::texturecube image_cube [[user(fake0)]] , metal::texturecube_array image_cube_array [[user(fake0)]] , metal::texture3d image_3d [[user(fake0)]] , metal::texture2d_ms image_aa [[user(fake0)]] ) { uint dim_1d = image_1d.get_width(); uint dim_1d_lod = image_1d.get_width(); metal::uint2 dim_2d = metal::uint2(image_2d.get_width(), image_2d.get_height()); metal::uint2 dim_2d_lod = metal::uint2(image_2d.get_width(1), image_2d.get_height(1)); metal::uint2 dim_2d_array = metal::uint2(image_2d_array.get_width(), image_2d_array.get_height()); metal::uint2 dim_2d_array_lod = metal::uint2(image_2d_array.get_width(1), image_2d_array.get_height(1)); metal::uint2 dim_cube = metal::uint2(image_cube.get_width()); metal::uint2 dim_cube_lod = metal::uint2(image_cube.get_width(1)); metal::uint2 dim_cube_array = metal::uint2(image_cube_array.get_width()); metal::uint2 dim_cube_array_lod = metal::uint2(image_cube_array.get_width(1)); metal::uint3 dim_3d = metal::uint3(image_3d.get_width(), image_3d.get_height(), image_3d.get_depth()); metal::uint3 dim_3d_lod = metal::uint3(image_3d.get_width(1), image_3d.get_height(1), image_3d.get_depth(1)); metal::uint2 dim_2s_ms = metal::uint2(image_aa.get_width(), image_aa.get_height()); uint sum = (((((((((dim_1d + dim_2d.y) + dim_2d_lod.y) + dim_2d_array.y) + dim_2d_array_lod.y) + dim_cube.y) + dim_cube_lod.y) + dim_cube_array.y) + dim_cube_array_lod.y) + dim_3d.z) + dim_3d_lod.z; return queriesOutput { metal::float4(static_cast(sum)) }; } struct levels_queriesOutput { metal::float4 member_3 [[position]]; }; vertex levels_queriesOutput levels_queries( metal::texture2d image_2d [[user(fake0)]] , metal::texture2d_array image_2d_array [[user(fake0)]] , metal::texturecube image_cube [[user(fake0)]] , metal::texturecube_array image_cube_array [[user(fake0)]] , metal::texture3d image_3d [[user(fake0)]] , metal::texture2d_ms image_aa [[user(fake0)]] ) { uint num_levels_2d = image_2d.get_num_mip_levels(); uint num_levels_2d_array = image_2d_array.get_num_mip_levels(); uint num_layers_2d = image_2d_array.get_array_size(); uint num_levels_cube = image_cube.get_num_mip_levels(); uint num_levels_cube_array = image_cube_array.get_num_mip_levels(); uint num_layers_cube = image_cube_array.get_array_size(); uint num_levels_3d = image_3d.get_num_mip_levels(); uint num_samples_aa = image_aa.get_num_samples(); uint sum_1 = ((((((num_layers_2d + num_layers_cube) + num_samples_aa) + num_levels_2d) + num_levels_2d_array) + num_levels_3d) + num_levels_cube) + num_levels_cube_array; return levels_queriesOutput { metal::float4(static_cast(sum_1)) }; } struct texture_sampleOutput { metal::float4 member_4 [[color(0)]]; }; fragment texture_sampleOutput texture_sample( metal::texture1d image_1d [[user(fake0)]] , metal::texture2d image_2d [[user(fake0)]] , metal::texture2d_array image_2d_array [[user(fake0)]] , metal::texturecube_array image_cube_array [[user(fake0)]] , metal::sampler sampler_reg [[user(fake0)]] ) { metal::float4 a = {}; metal::float2 tc = metal::float2(0.5); metal::float3 tc3_ = metal::float3(0.5); metal::float4 _e8 = image_1d.sample(sampler_reg, 0.5); metal::float4 _e9 = a; a = _e9 + _e8; metal::float4 _e13 = image_2d.sample(sampler_reg, tc); metal::float4 _e14 = a; a = _e14 + _e13; metal::float4 _e18 = image_2d.sample(sampler_reg, tc, metal::int2(3, 1)); metal::float4 _e19 = a; a = _e19 + _e18; metal::float4 _e23 = image_2d.sample(sampler_reg, tc, metal::level(2.3)); metal::float4 _e24 = a; a = _e24 + _e23; metal::float4 _e28 = image_2d.sample(sampler_reg, tc, metal::level(2.3), metal::int2(3, 1)); metal::float4 _e29 = a; a = _e29 + _e28; metal::float4 _e34 = image_2d.sample(sampler_reg, tc, metal::bias(2.0), metal::int2(3, 1)); metal::float4 _e35 = a; a = _e35 + _e34; metal::float4 _e40 = image_2d_array.sample(sampler_reg, tc, 0u); metal::float4 _e41 = a; a = _e41 + _e40; metal::float4 _e46 = image_2d_array.sample(sampler_reg, tc, 0u, metal::int2(3, 1)); metal::float4 _e47 = a; a = _e47 + _e46; metal::float4 _e52 = image_2d_array.sample(sampler_reg, tc, 0u, metal::level(2.3)); metal::float4 _e53 = a; a = _e53 + _e52; metal::float4 _e58 = image_2d_array.sample(sampler_reg, tc, 0u, metal::level(2.3), metal::int2(3, 1)); metal::float4 _e59 = a; a = _e59 + _e58; metal::float4 _e65 = image_2d_array.sample(sampler_reg, tc, 0u, metal::bias(2.0), metal::int2(3, 1)); metal::float4 _e66 = a; a = _e66 + _e65; metal::float4 _e71 = image_2d_array.sample(sampler_reg, tc, 0); metal::float4 _e72 = a; a = _e72 + _e71; metal::float4 _e77 = image_2d_array.sample(sampler_reg, tc, 0, metal::int2(3, 1)); metal::float4 _e78 = a; a = _e78 + _e77; metal::float4 _e83 = image_2d_array.sample(sampler_reg, tc, 0, metal::level(2.3)); metal::float4 _e84 = a; a = _e84 + _e83; metal::float4 _e89 = image_2d_array.sample(sampler_reg, tc, 0, metal::level(2.3), metal::int2(3, 1)); metal::float4 _e90 = a; a = _e90 + _e89; metal::float4 _e96 = image_2d_array.sample(sampler_reg, tc, 0, metal::bias(2.0), metal::int2(3, 1)); metal::float4 _e97 = a; a = _e97 + _e96; metal::float4 _e102 = image_cube_array.sample(sampler_reg, tc3_, 0u); metal::float4 _e103 = a; a = _e103 + _e102; metal::float4 _e108 = image_cube_array.sample(sampler_reg, tc3_, 0u, metal::level(2.3)); metal::float4 _e109 = a; a = _e109 + _e108; metal::float4 _e115 = image_cube_array.sample(sampler_reg, tc3_, 0u, metal::bias(2.0)); metal::float4 _e116 = a; a = _e116 + _e115; metal::float4 _e121 = image_cube_array.sample(sampler_reg, tc3_, 0); metal::float4 _e122 = a; a = _e122 + _e121; metal::float4 _e127 = image_cube_array.sample(sampler_reg, tc3_, 0, metal::level(2.3)); metal::float4 _e128 = a; a = _e128 + _e127; metal::float4 _e134 = image_cube_array.sample(sampler_reg, tc3_, 0, metal::bias(2.0)); metal::float4 _e135 = a; a = _e135 + _e134; metal::float4 _e137 = a; return texture_sampleOutput { _e137 }; } struct texture_sample_comparisonOutput { float member_5 [[color(0)]]; }; fragment texture_sample_comparisonOutput texture_sample_comparison( metal::sampler sampler_cmp [[user(fake0)]] , metal::depth2d image_2d_depth [[user(fake0)]] , metal::depth2d_array image_2d_array_depth [[user(fake0)]] , metal::depthcube image_cube_depth [[user(fake0)]] ) { float a_1 = {}; metal::float2 tc_1 = metal::float2(0.5); metal::float3 tc3_1 = metal::float3(0.5); float _e8 = image_2d_depth.sample_compare(sampler_cmp, tc_1, 0.5); float _e9 = a_1; a_1 = _e9 + _e8; float _e14 = image_2d_array_depth.sample_compare(sampler_cmp, tc_1, 0u, 0.5); float _e15 = a_1; a_1 = _e15 + _e14; float _e20 = image_2d_array_depth.sample_compare(sampler_cmp, tc_1, 0, 0.5); float _e21 = a_1; a_1 = _e21 + _e20; float _e25 = image_cube_depth.sample_compare(sampler_cmp, tc3_1, 0.5); float _e26 = a_1; a_1 = _e26 + _e25; float _e30 = image_2d_depth.sample_compare(sampler_cmp, tc_1, 0.5); float _e31 = a_1; a_1 = _e31 + _e30; float _e36 = image_2d_array_depth.sample_compare(sampler_cmp, tc_1, 0u, 0.5); float _e37 = a_1; a_1 = _e37 + _e36; float _e42 = image_2d_array_depth.sample_compare(sampler_cmp, tc_1, 0, 0.5); float _e43 = a_1; a_1 = _e43 + _e42; float _e47 = image_cube_depth.sample_compare(sampler_cmp, tc3_1, 0.5); float _e48 = a_1; a_1 = _e48 + _e47; float _e50 = a_1; return texture_sample_comparisonOutput { _e50 }; } struct gatherOutput { metal::float4 member_6 [[color(0)]]; }; fragment gatherOutput gather( metal::texture2d image_2d [[user(fake0)]] , metal::texture2d image_2d_u32_ [[user(fake0)]] , metal::texture2d image_2d_i32_ [[user(fake0)]] , metal::sampler sampler_reg [[user(fake0)]] , metal::sampler sampler_cmp [[user(fake0)]] , metal::depth2d image_2d_depth [[user(fake0)]] ) { metal::float2 tc_2 = metal::float2(0.5); metal::float4 s2d = image_2d.gather(sampler_reg, tc_2, metal::int2(0), metal::component::y); metal::float4 s2d_offset = image_2d.gather(sampler_reg, tc_2, metal::int2(3, 1), metal::component::w); metal::float4 s2d_depth = image_2d_depth.gather_compare(sampler_cmp, tc_2, 0.5); metal::float4 s2d_depth_offset = image_2d_depth.gather_compare(sampler_cmp, tc_2, 0.5, metal::int2(3, 1)); metal::uint4 u = image_2d_u32_.gather(sampler_reg, tc_2); metal::int4 i = image_2d_i32_.gather(sampler_reg, tc_2); metal::float4 f = static_cast(u) + static_cast(i); return gatherOutput { (((s2d + s2d_offset) + s2d_depth) + s2d_depth_offset) + f }; } struct depth_no_comparisonOutput { metal::float4 member_7 [[color(0)]]; }; fragment depth_no_comparisonOutput depth_no_comparison( metal::sampler sampler_reg [[user(fake0)]] , metal::depth2d image_2d_depth [[user(fake0)]] ) { metal::float2 tc_3 = metal::float2(0.5); float s2d_1 = image_2d_depth.sample(sampler_reg, tc_3); metal::float4 s2d_gather = image_2d_depth.gather(sampler_reg, tc_3); return depth_no_comparisonOutput { metal::float4(s2d_1) + s2d_gather }; }