Как мне прочитать текущий цвет буфера кадра в моем шейдере для приложения Mac.Мне очень легко сделать то же самое в приложении ios, используя [[color (0)]].
Я попытался использовать текстуру, как показано ниже, некоторые пиксели пропускаются.
texture2d_array normal_1 [[texture (0)]]
SampleCode
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]
В прикрепленном файле вывода проблема связана с белой полосой.