'metal::texturecube' 中没有名为 'read' 的成员
No member named 'read' in 'metal::texturecube'
根据Apple's Metal shading language specification,纹理立方体有一个读取方法,
read(uint2 coord, uint face, uint lod = 0) const
但是,当我尝试构建此着色器时,出现编译错误,
fragment half4 passFragment(VertexInOut inFrag [[stage_in]],
texturecube<float, access::read> tex [[ texture(0) ]])
{
float4 out = tex.read(uint2(0,0), uint(0));
return half4(out);
}
错误是,
No member named 'read' in 'metal::texturecube<float, metal::access::read>'
如果我删除访问限定符,那么我得到,
No member named 'read' in 'metal::texturecube<float, metal::access::sample>'
我也试过将类型从 float 更改为 int 或 short,但我得到了同样的错误。令人沮丧的是没有 header 可以看...
有什么想法吗?
看来 texturecube::read()
仅适用于 macOS。
事实上,有 header 可用。在 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/lib/clang/3.5/include/metal.
中查找
在 metal_texture header 中,您会看到 read()
的声明位于预处理器条件 (#if
) 内,并且仅在宏 __HAVE_TEXTURE_CUBE_READ__
已定义。在 macOS 上,它在 metal_config header 中定义。在 iOS 上,它未定义。
根据Apple's Metal shading language specification,纹理立方体有一个读取方法,
read(uint2 coord, uint face, uint lod = 0) const
但是,当我尝试构建此着色器时,出现编译错误,
fragment half4 passFragment(VertexInOut inFrag [[stage_in]],
texturecube<float, access::read> tex [[ texture(0) ]])
{
float4 out = tex.read(uint2(0,0), uint(0));
return half4(out);
}
错误是,
No member named 'read' in 'metal::texturecube<float, metal::access::read>'
如果我删除访问限定符,那么我得到,
No member named 'read' in 'metal::texturecube<float, metal::access::sample>'
我也试过将类型从 float 更改为 int 或 short,但我得到了同样的错误。令人沮丧的是没有 header 可以看...
有什么想法吗?
看来 texturecube::read()
仅适用于 macOS。
事实上,有 header 可用。在 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/lib/clang/3.5/include/metal.
中查找在 metal_texture header 中,您会看到 read()
的声明位于预处理器条件 (#if
) 内,并且仅在宏 __HAVE_TEXTURE_CUBE_READ__
已定义。在 macOS 上,它在 metal_config header 中定义。在 iOS 上,它未定义。