How to define vertex shader and fragment shader code for vision

Hello experts, I have implemented 3d guassian splating rendering through the CompositorServices framework, but I want to port it to the RealityKit framework. I am not sure whether RealityKit meets the requirements.

In order to port the code, I need to render a large number of instanced planes (it is necessary to support instantiated Mesh), and completely custom vertex shader and fragment shader code, including using instance_id and discarding pixels (Call the discard_fragment method).

Some Metal code snippets:

vertex ColorInOut splatVertexShader(uint vertexID [[vertex_id]],
          uint instanceID [[instance_id]],
          ushort amp_id [[amplification_id]],
          constant Splat* splatArray [[ buffer(BufferIndexSplat) ]],
          constant UniformsArray & uniformsArray [[ buffer(BufferIndexUniforms) ]],
         constant int32_t* splatIndices [[ buffer(BufferIndexSplatIndex) ]]) 
{
   // ... (do some calculations)
}

fragment half4 splatFragmentShader(ColorInOut in [[stage_in]])
{
   // ...
   if (/* a certain condition */) {
      discard_fragment();
   }
}

I have learned that CustomMaterial does not support vision, and Shader Graph does not support custom vertex/fragment shader code. I also noticed the LowLevelMesh interface, but I didn't find any sample code with custom shader code, so it's not clear whether it would be able to achieve what I need.

Can these requirements be met using reality?

How to define vertex shader and fragment shader code for vision
 
 
Q