Add geometry shader fragment to MShaderInstance

144 views Asked by At

Render items in Maya (MRenderItem) get drawn by shaders (MShaderInstance), which contain fragments (gpu shader pieces) that are compiled to one big shader just before drawing. MShaderInstance allows you to add your own fragments, declaring them first via xml. My question is, how can I insert a geometry shader into the MShaderInstance? I know they are supported, since the xml schema has an element geometryShader, but there are no examples of how to actually define your own. For example, I have this simple geometry shader, just for testing, that actually does not even generate anything:

    layout (points) in;
    layout (points) out;
    layout (max_vertices = 1) out;

    void main()
    {
        gl_Position = gl_in[0].gl_Position;
    }

The relevant methods of MShaderInstance are addOutputFragment and addInputFragment. Neither of them works in my case (both return failure code).

I also can't find any examples of this particular case (geom shaders) in the sdk. Any help appreciated.

0

There are 0 answers