init(named:in:constantValues:uniformsSize:)
Creates a descriptor for a geometry modifier that accepts a custom uniforms argument buffer.
Declaration
init(named name: String, in library: any MTLLibrary, constantValues: MTLFunctionConstantValues = .init(), uniformsSize: Int)Parameters
- name:
The name of the Metal function in the library.
- library:
The Metal library that contains the function.
- constantValues:
The Metal function constant values to specialize the function with.
- uniformsSize:
The size of the custom uniforms buffer, in bytes.
Discussion
Use this initializer when your Metal geometry modifier function reads per-draw parameters through a custom uniforms argument buffer, using the same mechanism as withMutableUniforms(ofType:stage:_:). The function must be [[stitchable]] and declare the uniforms as a second constant T &customParams parameter:
[[stitchable]]
void myGeometryModifier(realitykit::geometry_parameters params,
constant MyUniforms &customParams) { ... }The renderer sizes the uniforms buffer to uniformsSize bytes and configures the argument table automatically.