获取 MTLArgument 的函数常量索引
MTLRenderPipelineReflection
包含 MTLArgument
的列表,其中包含有关名称、索引、类型、访问等的信息,但有关函数常量绑定的任何信息除外。 有 MTLFunction
及其字典 var functionConstantsDictionary: [String : MTLFunctionConstant]
,由函数常量名称作为键(感觉多余,因为 MTLFunctionConstant 已经包含名称)。我没有找到任何有关使用参数的函数常量的信息。 结果应该类似于表 [FunctionArgumentName: FunctionConstant] 是否有任何有关管道的信息可以帮助计算该绑定?
UPD:
fragment float4 fragment_main(VertexOut in [[stage_in]],
texture2d<float> baseColorTexture [[texture(BaseColorTexture), function_constant(hasColorTexture)]],
texture2d<float> normalTexture [[texture(NormalTexture), function_constant(hasNormalTexture)]],
texture2d<float> aoTexture [[texture(AOTexture), function_constant(hasAOTexture)]],
texturecube<float> reflectionTextureCube [[texture(ReflectionTextureCube), function_constant(hasReflectionTextureCube)]]) {
/// Shader code
}
换句话说,我需要从 swift 代码访问此着色器函数的 baseColorTexture
参数的函数常量名称
MTLRenderPipelineReflection
contain lists of MTLArgument
's that contains info about name, index, type, access, e.t.c. except any info about function constant binding.
There are MTLFunction
and it's dictionary var functionConstantsDictionary: [String : MTLFunctionConstant]
, that keyed by function constant name(it feels excess because MTLFunctionConstant already contains name). I did not found any info about function constants that in use of argument.
As a result should be something like table [FunctionArgumentName: FunctionConstant]
Is there any info about pipeline that helps to calculate that bindings?
UPD:
fragment float4 fragment_main(VertexOut in [[stage_in]],
texture2d<float> baseColorTexture [[texture(BaseColorTexture), function_constant(hasColorTexture)]],
texture2d<float> normalTexture [[texture(NormalTexture), function_constant(hasNormalTexture)]],
texture2d<float> aoTexture [[texture(AOTexture), function_constant(hasAOTexture)]],
texturecube<float> reflectionTextureCube [[texture(ReflectionTextureCube), function_constant(hasReflectionTextureCube)]]) {
/// Shader code
}
In other words I need to access name of function constant for baseColorTexture
argument of this shader function from swift code
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论