如何在我的着色器中为 mac 应用程序读取帧缓冲区当前颜色。我很容易使用 [[color(0)]] 在 ios 应用程序中做同样的事情。
我尝试使用如下所示的纹理,一些像素被遗漏了。
texture2d_array normal_1 [[纹理(0)]]
示例代码
fragment float4 funcname(QuadFragIn inFrag [[ stage_in ]],
texture2d_array<float> normal_1 [[texture(0)]])
{
float4 color_0 = float4(normal_1.sample(tex_sampler, inFrag.m_TexCoord, 0));
float4 color_1 = float4(normal_1.sample(tex_sampler, inFrag.m_TexCoord, 1));
float4 color_2 = float4(normal_1.sample(tex_sampler, inFrag.m_TexCoord, 2));
int index = inFrag.index;
if(index == 0)
{
return color_0;
}
else if(index == 1)
{
return color_1;
}
else
{
return color_2;
}
}[![enter image description here][1]][1]
在输出文件附件中,白条是相关问题。