textureGrad函数 - Metal (MSL)等效

3
1个回答

3

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);
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接