diff --git a/src/back/glsl/mod.rs b/src/back/glsl/mod.rs index 0d75c84716..ef2f149336 100644 --- a/src/back/glsl/mod.rs +++ b/src/back/glsl/mod.rs @@ -1380,7 +1380,7 @@ impl<'a, W: Write> Writer<'a, W> { write!(self.out, "{}", INDENT.repeat(indent))?; } for (index, member) in members.iter().enumerate() { - // TODO: handle builtin in better way + // TODO: handle builtin in better way if let Some(Binding::BuiltIn(builtin)) = member.binding { match builtin { crate::BuiltIn::ClipDistance diff --git a/src/back/msl/writer.rs b/src/back/msl/writer.rs index 33317004c5..cde303cb93 100644 --- a/src/back/msl/writer.rs +++ b/src/back/msl/writer.rs @@ -775,7 +775,7 @@ impl Writer { let scalar = scalar_kind_string(scalar_kind); let size = vector_size_str(size); - write!(self.out, "{}{}(", scalar, size)?; + write!(self.out, "{}::{}{}(", NAMESPACE, scalar, size)?; self.put_expression(value, context, true)?; write!(self.out, ")")?; } diff --git a/tests/out/access.msl b/tests/out/access.msl index 8f623b8ab7..36fd357743 100644 --- a/tests/out/access.msl +++ b/tests/out/access.msl @@ -24,5 +24,5 @@ vertex fooOutput foo( , device Bar& bar [[buffer(0)]] , constant _mslBufferSizes& _buffer_sizes [[buffer(24)]] ) { - return fooOutput { static_cast(int4(type5 {bar.data[(1 + (_buffer_sizes.size0 - 64 - 4) / 4) - 1u], static_cast(bar.matrix[3u].x), 3, 4, 5}.inner[vi])) }; + return fooOutput { static_cast(metal::int4(type5 {bar.data[(1 + (_buffer_sizes.size0 - 64 - 4) / 4) - 1u], static_cast(bar.matrix[3u].x), 3, 4, 5}.inner[vi])) }; } diff --git a/tests/out/boids.msl b/tests/out/boids.msl index c49bff9605..05f0760f35 100644 --- a/tests/out/boids.msl +++ b/tests/out/boids.msl @@ -79,10 +79,10 @@ kernel void main1( } } if (cMassCount > 0) { - cMass = (cMass / float2(static_cast(cMassCount))) - vPos; + cMass = (cMass / metal::float2(static_cast(cMassCount))) - vPos; } if (cVelCount > 0) { - cVel = cVel / float2(static_cast(cVelCount)); + cVel = cVel / metal::float2(static_cast(cVelCount)); } vVel = ((vVel + (cMass * params.rule1Scale)) + (colVel * params.rule2Scale)) + (cVel * params.rule3Scale); vVel = metal::normalize(vVel) * metal::clamp(metal::length(vVel), 0.0, 0.1); diff --git a/tests/out/image.msl b/tests/out/image.msl index 87ccd581a2..a8d37578eb 100644 --- a/tests/out/image.msl +++ b/tests/out/image.msl @@ -28,5 +28,5 @@ vertex queriesOutput queries( , metal::texture3d image_3d [[user(fake0)]] , metal::texture2d_ms image_aa [[user(fake0)]] ) { - return queriesOutput { float4(static_cast((((((((((((((((((int(image_1d.get_width()) + int2(image_2d.get_width(), image_2d.get_height()).y) + int2(image_2d.get_width(1), image_2d.get_height(1)).y) + int2(image_2d_array.get_width(), image_2d_array.get_height()).y) + int2(image_2d_array.get_width(1), image_2d_array.get_height(1)).y) + int(image_2d_array.get_array_size())) + int3(image_cube.get_width()).y) + int3(image_cube.get_width(1)).y) + int3(image_cube_array.get_width()).y) + int3(image_cube_array.get_width(1)).y) + int(image_cube_array.get_array_size())) + int3(image_3d.get_width(), image_3d.get_height(), image_3d.get_depth()).z) + int3(image_3d.get_width(1), image_3d.get_height(1), image_3d.get_depth(1)).z) + int(image_aa.get_num_samples())) + int(image_2d.get_num_mip_levels())) + int(image_2d_array.get_num_mip_levels())) + int(image_3d.get_num_mip_levels())) + int(image_cube.get_num_mip_levels())) + int(image_cube_array.get_num_mip_levels()))) }; + return queriesOutput { metal::float4(static_cast((((((((((((((((((int(image_1d.get_width()) + int2(image_2d.get_width(), image_2d.get_height()).y) + int2(image_2d.get_width(1), image_2d.get_height(1)).y) + int2(image_2d_array.get_width(), image_2d_array.get_height()).y) + int2(image_2d_array.get_width(1), image_2d_array.get_height(1)).y) + int(image_2d_array.get_array_size())) + int3(image_cube.get_width()).y) + int3(image_cube.get_width(1)).y) + int3(image_cube_array.get_width()).y) + int3(image_cube_array.get_width(1)).y) + int(image_cube_array.get_array_size())) + int3(image_3d.get_width(), image_3d.get_height(), image_3d.get_depth()).z) + int3(image_3d.get_width(1), image_3d.get_height(1), image_3d.get_depth(1)).z) + int(image_aa.get_num_samples())) + int(image_2d.get_num_mip_levels())) + int(image_2d_array.get_num_mip_levels())) + int(image_3d.get_num_mip_levels())) + int(image_cube.get_num_mip_levels())) + int(image_cube_array.get_num_mip_levels()))) }; } diff --git a/tests/out/operators.msl b/tests/out/operators.msl index 9deefef7a0..48c82bbcaa 100644 --- a/tests/out/operators.msl +++ b/tests/out/operators.msl @@ -4,7 +4,7 @@ metal::float4 splat( ) { - return (((float2(1.0) + float2(2.0)) - float2(3.0)) / float2(4.0)).xyxy + static_cast(int4(5) % int4(2)); + return (((metal::float2(1.0) + metal::float2(2.0)) - metal::float2(3.0)) / metal::float2(4.0)).xyxy + static_cast(metal::int4(5) % metal::int4(2)); } int unary( diff --git a/tests/out/shadow.msl b/tests/out/shadow.msl index 420dfda576..17f1c82eaf 100644 --- a/tests/out/shadow.msl +++ b/tests/out/shadow.msl @@ -30,7 +30,7 @@ float fetch_shadow( if (homogeneous_coords.w <= 0.0) { return 1.0; } - float _e26 = t_shadow.sample_compare(sampler_shadow, ((homogeneous_coords.xy * metal::float2(0.5, -0.5)) / float2(homogeneous_coords.w)) + metal::float2(0.5, 0.5), static_cast(light_id), homogeneous_coords.z / homogeneous_coords.w); + float _e26 = t_shadow.sample_compare(sampler_shadow, ((homogeneous_coords.xy * metal::float2(0.5, -0.5)) / metal::float2(homogeneous_coords.w)) + metal::float2(0.5, 0.5), static_cast(light_id), homogeneous_coords.z / homogeneous_coords.w); return _e26; }