Custom Effects for Windows platform not being compiled for right platform

I responded to a thread on the old forums here but I thought I would also post in the new forums as well in case anybody has additional input.

To summarize the post above, the content pipeline currently builds OpenGL shaders when the target is set to Windows and causes run time problems. Specifically, the MGFX content loader will complain that the effect was compiled for a different platform.

Updating the shader to use SM4 (something I’m not very thrilled about since the other dev on our project doesn’t have a DX11 graphics card) and changing the content pipeline to also compile windows platform as DX11 seems to solve the problem and so I’ve created a pull request (#2916) but if anyone else has any info or progress on this issue I’m all ears.

Ideally, I’d keep DX9 support but from what I understand, SharpDX doesn’t build D3D9 shaders. Any other suggestions?

SharpDX supports DX9… that isn’t the issue really. The issue is the MonoGame only supports DX11. For that reason you need to move to a SM4 profile. However…

You don’t need a DX11 card to run DX11. DX11 has backwards compatibility to DX9 level cards. Just use the vs_4_0_level_9_1 and ps_4_0_level_9_1 profiles in your shader and you can support GPUs all the way back to SM2.0.

See the compiler target docs:

Wonderful! Thanks for the link. I haven’t touched HLSL shaders (or shaders in general) since writing SM2 stuff was back with XNA 3.1.