I was just playing around with shaders in my little project and first I got an compiling error, that my PixelShader doesn’t support reading from position semantics.
So I changed the compiler version to ps_4_0, which supports that.
Well done, no compiling error!
But now on starting the game, when loading my effect, there occures an exception:
An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll
Additional information: HRESULT: [0x80070057], Module: [General],
ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.
How can I solve this problem now? I need the position in pixel shader for calculating light and fog based on pixel.
Installed DirectX version is 12
Suggestions I found, like effect = new Effect(this.GraphicsDevice, (byte)File.ReadAllBytes(Content.RootDirectory + "\\Brightener.mgfx"));
for loading the effect don’t work, since I got .xnb files there, no mgfx…
For any target above 4_0_level_9_3 you need the HiDef profile. The Reach vs HiDef profile in XNA exists there because not all platforms can handle some more advanced features. Basically if you set Reach the game should run on all supported platforms for XNA. Now in MonoGame things are a bit more complicated because it runs on more hardware that may be able to run some HiDef features and support higher shader models, but not all. So there has been some discussion in the GitHub repo on some more granular GraphicsProfile system. I’m not sure if there is some benefit/value to the system as is in MonoGame.