[ANSWERED] HLSL questions

So a couple quick questions regarding HLSL with MonoGame.
1: does MonoGame support cbuffers for HLSL? If so, can someone point me in the direction of using them? I can’t seem to find any.
2: do MonoGame effects support using custom data structs? I’m not talking about for vertex/pixel rendering, just being able to call .SetParameter(customType). If it can and that’s not the way, I’d like to know.

Both are a no, as far as I am aware. If you need these, monogame may not be a good choice.

Note that for submitting constants monogame does a c# typecheck before submitting, that is hard coded and the reason why you can’t use custom structs. You would have to add your required structures manually to a SetValue() overload.

You can see what the default EffectParameter supports here: https://github.com/MonoGame/MonoGame/blob/develop/MonoGame.Framework/Graphics/Effect/EffectParameter.cs

1 Like

I assumed as much. I’d started just using SharpDX but switched to MonoGame because of the already built base-line. They aren’t a necessity, it’d just be extremely helpful. If I feel it’s too necessary, I may just end up pulling the source and doing a custom build. Thank you though.

Well monogame just passes stuff to sharpdx. If you are familiar with that you can pass anything you’d like, however, the default monogame hlsl compiler does not recognize many features, so that would be the harder part to add.

Something quite a lot of us would love to see worked on, but it’s a bit problematic that directX and OpenGL branches would drift apart then.

Either way, getting cbuffers and UAVs supported would be awesome @Tom @Jjagg @KonajuGames, but yeah.

If you do decide to stick to monogame there’s a lot of help for shaders etc you can expect, and quite a few people here are pretty invested in gfx programming

1 Like

If it’s so widely requested, it’s almost tempting to assist. Maybe one day it’ll happen.

1 Like