Geometry shader support

looking for Geometry shader support in monogame? when are we going to get the latest update on geometry shader support.

Obviously, its not likely to happen any time soon

I’m working on supporting GLSL natively. That way we can drop MojoShader and look at implementing ‘newer’ shader features. There are still some complexities because we want to be able to automatically translate HLSL source to GLSL so you only have to write HLSL if you want (rather than translating bytecode like MojoShader does) and we need to optimize GLSL, the translator and optimizer we plan to use do not support GS I think, so we’ll have to extend those. Still if it’s for desktop you can probably do without optimization and if you write the shader in GLSL you don’t need the translator, so you’d be able to use geometry shaders when I’m done.

wat if i using hlsl target on DX platform?

Right now we don’t support GS because of MojoShader, so once we drop that we can implement them for OpenGL and DirectX

For now, can i compile my own shader through dx shader compiler turn it to byte and set to monogame without going though monogame content compiler. will it work?

No, not directly because MonoGame loads the effects from a specific format with metadata about the shaders, samplers, techniques and constantbuffers in the xnb’s. You can’t just give it bytecode. If you want to integrate GS nicely with MonoGame you’ll also have to edit the effect reading code as well as technique code, linking and probably some other stuff. You can maybe somehow hack it in if you have the GS in a seperate file and modify just the linking code.

I had some time to work on the GLSL stuff and I’m getting pretty close. Effect building is pretty far along, so it’s mostly runtime stuff now. If you decide to implement GS so they integrate nicely, let me know! We could probably use the code when implementing the runtime side of GS.

2 Likes

ok, Thanks for your time :slight_smile:

@Jjagg any news on this?

Also, would it be possible to use say, OpenGL.Net and a window handle to use the geometry shader for only one thing? Say I have low poly water,
and I want to use a geometry shader to do all the vertex movements and to calculate all of the normals in the Geometry Shader instead of doing this in C#, can I use OpenGL.Net or another opengl wrapper to do this?

Use whatever wrapper MonoGame is already using, but you should be able to do that as long as you restore all of the state that MonoGame believes things to be in. That’s how I’ve dealt with for point expansion in the GS (SharpDX) for a while, only recently adding support to 2MGFX and everything else (for DX only, flatly don’t care about OpenGL).

1 Like