Why is GPU function reflection tied to pipeline state?

The MTLRenderPipelineReflection contains vertexArguments and fragmentArguments. It seems that these are entirely defined by the fragment and vertex function (MTLFunction).

Why can the reflection not be obtained directly from the MTLFunction objects?

Is there anything in the pipeline state object that affects the reflection data - except the MTLFunction objects?

Replies

+1


I've tried having a poke at getting the reflection myself through

-[MTLRenderPipelineReflectionInternal initWithVertexData:fragmentData:serializedVertexDescriptor:device:options:flags:]

but unknown enums and lack of source make it hard to get anywhere.


An alternative would be to parse the bitcode manually, but that sounds like even more of a time sink...

Old question, but still relevant.

Is the reflection in any way effected by the pipeline state besides obviously by changing the shader functions? Is creating a temporary pso without any real data just to get the reflection information an option?

I assume that at least some bits of this information can potentially change with different pipeline configuration (e.g. index?). Also stuff like blending state is usually backed into the pipeline state as well (meaning that it can affect shader code and/or optimizations).