[英]textureGrad function – Metal (MSL) equivalent
我目前正在嘗試在 Metal 中重新實現這種技術,用於平鋪紋理重復的變化 - https://www.iquilezles.org/www/articles/texturerepetition/texturerepetition.htm 。
代碼的某些部分引用了 textureGrad 函數( https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/textureGrad.xhtml )。 由於我並不完全清楚這是如何在幕后實現的,我想問一下是否有我還沒有找到的 MSL 等效項,或者也許有人可以給我一個關於如何重新實現它的提示。
謝謝!
MSL 等效:
fragment float4 Fragment(ColorInOut in [[stage_in]],
texture2d<float> texture [[texture(0)]])
{
constexpr sampler sampleFilter(mip_filter::linear, mag_filter::linear, min_filter::linear);
float4 color = texture.sample(sampleFilter, in.texCoord.xy, gradient2d(0, 0));
return float4(color);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.