2016-09-18 101 views

回答

0

在典型的使用中,数据被存储在组的四个特征通道,我将称之为一个四方。 MTLTexture会把这些叫做texel,可能会想象它们是r,g,b,a,但实际上这些都是feature_channels [some_offset + {0,1,2,3}]

MPSImages通常是MTLTexture2DArrays。像素[0,0]的第一个四元组(特征通道0-3)出现在图像切片0的坐标{0,0}处。像素[0,0]的第二个四元组(特征通道4-7)出现在坐标图像片段1中的{0,0},等等。

// loads the set of 4 contiguous aligned feature channels containing channel 
float4 loadQuartet(texture2d_array<float, access::sample> src, 
        uint2 position, 
        ushort channel) 
{ 
    return src.read(position, firstChannel >> 2); 
}