Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use a bicubic sampler in metal?

Tags:

metal

In the compute shader, I can see that bicubic is an option but only if __HAVE_BICUBIC_FILTERING__ is defined. When I set bicubic as the filtering option, I get a syntax error. Linear or Nearest compile fine. I'm building for metal 2 on MacOS.

Another method would be to define the sampler on the CPU with a sampler descriptor but there is no option for bicubic there either.

The comments in this thread discuss their inability to set bicubic.

I've searched the metal shading language specification, and bicubic is not mentioned there at all. Any help would be appreciated.

like image 480
James Whiffin Avatar asked Oct 15 '25 03:10

James Whiffin


1 Answers

It depends on the type of device, operating system (version and type), and processor architecture. The code below can be easy compiled on the following configurations: iOS 15, iPhone 12 / 13, Xcode 13.

#if defined(__HAVE_BICUBIC_FILTERING__)
    constexpr sampler textureSampler (mag_filter::bicubic, min_filter::bicubic);
    const half4 colorSample = colorTexture.sample (textureSampler, in.textureCoordinate);
    return float4(colorSample);
#endif
like image 165
Hamid Yusifli Avatar answered Oct 19 '25 14:10

Hamid Yusifli