Fix textureGather compatibility on macOS 10.13 (#2104)

* Fix textureGather compatibility on macOS 10.13

* Fix tests

* Update src/back/msl/writer.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

Co-authored-by: Jet Spark <lixiaopeng.jetspark@bytedance.com>
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
This commit is contained in:
Xiaopeng Li
2022-10-27 15:28:46 +08:00
committed by GitHub
parent df4e40327c
commit e7fc8e64f2
2 changed files with 2 additions and 2 deletions

View File

@@ -1440,7 +1440,7 @@ impl<W: Write> Writer<W> {
// Offset always comes before the gather, except
// in cube maps where it's not applicable
if offset.is_none() && !is_cube_map {
write!(self.out, ", int2(0)")?;
write!(self.out, ", {}::int2(0)", NAMESPACE)?;
}
let letter = ['x', 'y', 'z', 'w'][component as usize];
write!(self.out, ", {}::component::{}", NAMESPACE, letter)?;

View File

@@ -144,7 +144,7 @@ fragment gatherOutput gather(
, metal::depth2d<float, metal::access::sample> image_2d_depth [[user(fake0)]]
) {
metal::float2 tc_2 = metal::float2(0.5);
metal::float4 s2d_1 = image_2d.gather(sampler_reg, tc_2, int2(0), metal::component::y);
metal::float4 s2d_1 = image_2d.gather(sampler_reg, tc_2, metal::int2(0), metal::component::y);
metal::float4 s2d_offset_1 = image_2d.gather(sampler_reg, tc_2, const_type_9_, metal::component::w);
metal::float4 s2d_depth_1 = 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, const_type_9_);