Elsewhere in the forum under a discussion of WWDC 23 "Discover Metal for Spatial Computing" there is a link to some GitHub sample code provided by indie developers.
In particular, this sample illustrates how to pass eye-specific parameters to a shader:
github.com/musesum/SpatialMetal2
My recommendation is to modify the Uniforms struct in ShaderTypes.h to include whatever eye specific data you require:
struct Uniforms {
matrix_float4x4 projection;
matrix_float4x4 viewModel;
};
struct UniformEyes {
Uniforms eye[2];
};
Unfortunately this sample code uses parallel declarations of these structs which, to my knowledge, is not the correct way to pass structs from Swift to Metal. Structs that are destined for use in Metal must be declared in the C-language and imported into Swift using the Bridging header. Swift can reorder struct members and may use different rules for padding and alignment.
To that end your solution should probably be based off the Xcode template with modifications which have the same functionality as this sample.