简体   繁体   中英

Metal shader texture read vs sample

在金属着色语言中,读取和示例函数之间用于访问纹理像素的确切区别是什么,以及何时应该使用哪一个?

A few differences:

  • You can sample outside the bounds of the texture. But you should not read outside the texture.
  • Sampling can use normalized coordinates (between 0 and 1). Reading always uses pixel coordinates.
  • Samplers can interpolate between pixel values (for example if you're sampling in between two pixels). Reading always gives you the exact pixel value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM