And it works nicely on my high end desktop, but when I test that same code on my low end laptop, it crashes saying that a parameter was incorrect when creating the pixel shader.
Unhandled Exception: SharpDX.SharpDXException: HRESULT: [0x80070057],
Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message:
The parameter is incorrect.
at SharpDX.Result.CheckError()
at SharpDX.Direct3D11.Device.CreatePixelShader(IntPtr shaderByteCodeRef,
PointerSize bytecodeLength, ClassLinkage classLinkageRef, PixelShader
pixelShaderOut)
at SharpDX.Direct3D11.PixelShader..ctor(Device device, Byte[]
shaderByteCode, ClassLinkage linkage)
at Microsoft.Xna.Framework.Graphics.Shader.CreatePixelShader()
at Microsoft.Xna.Framework.Graphics.Effect.ReadEffect(BinaryReader reader)
I donât know how to fix this, nor can I find anything about this.
Might be an issue with the shader level (specified in the technique). The GPU in the low end laptop likely does not support the higher shader levels that the desktop does.
@KonajuGames: I have the same, or a close, issue with some of my code, the point is more likely to be the shader model in use.
4_0_level_9_3 is ok for both MGFX and in SharpDX code
4_0 rise SharpDX exception above (a little different in stack strace) in Shader.DirectX.cs CreatePixelShader method, line 90, which is called from some methods up to LoadContent
3_0 MGFX failed with exception:
error: Processor âEffectProcessorâ had unexpected failure!
System.Exception: Invalid profile âvs_3_0â. Vertex shader âLinShadowMapVertexShaderâ must be SM 4.0 level 9.1 or higher!
Ă TwoMGFX.DirectX11ShaderProfile.ValidateShaderModels(PassInfo pass) dans M:\C#\MonoGame\MonoGame\MonoGame-develop\MonoGame\Tools\2MGFX\ShaderProfile.DirectX.cs:ligne 37
Ă TwoMGFX.EffectObject.CompileEffect(ShaderInfo shaderInfo, String& errorsAndWarnings) dans M:\C#\MonoGame\MonoGame\MonoGame-develop\MonoGame\Tools\2MGFX\EffectObject.cs:ligne 686
Ă Microsoft.Xna.Framework.Content.Pipeline.Processors.EffectProcessor.Process(EffectContent input, ContentProcessorContext context) dans M:\C#\MonoGame\MonoGame\MonoGame-develop\MonoGame\MonoGame.Framework.Content.Pipeline\Processors\EffectProcessor.cs:ligne 92
Ă Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor`2.Microsoft.Xna.Framework.Content.Pipeline.IContentProcessor.Process(Object input, ContentProcessorContext context) dans M:\C#\MonoGame\MonoGame\MonoGame-develop\MonoGame\MonoGame.Framework.Content.Pipeline\ContentProcessor.cs:ligne 60
Ă MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent(PipelineBuildEvent pipelineEvent) dans M:\C#\MonoGame\MonoGame\MonoGame-develop\MonoGame\MonoGame.Framework.Content.Pipeline\Builder\PipelineManager.cs:ligne 696
Just for a try, using HiDef profile rise another exception (âCould not find a graphics device that supports the HiDef profileâ)
Any hints ?
Thanks.
Win 7 64b, winDX platform, Nvidia GeForce GTX 780M and MG dev updated and built today
same thing happened to me when i switched to the newest development build.
Just canât compile FX anymore.
That said I have a pretty powerful computer (but not the newest dx12 gpu, but dx11.2 high end)
It works in an older build for me (specifically I use 3.6.187), so that is a tad annoying.
I donât have installed the very latest drivers, which anyway are more focused on latest hardware too, it may be related, but most likely not.
I never use HiDef profile before with MonoGame (only with XNA).
shader model numbering is quite messy, no thanks to MS or whoever whoâs in charge of this, 3 is > 4_9_x.
It may be something with SharpDX which doesnât list all hardwares or didnât recognize some and fallback to a reasonable and safe default which cause the issue (after all, error comes first from SharpDX !)
I remember a bit something about it, and so ?
What was your issue ? HiDef needed and cannot be used ?
I donât have any error compiling effect with 4 or 5 shader model version, MGFX donât complain at all, but having a working code is another story.
I build my own MG libs from repository, not updating submodule and using whatever SharpDX version provided (the one I have date back April 10th, probably the day I get the MG source tree, just run submodules update).
So to donât forget things: there is HiDef profile which wonât work and pixel shader which also wonât work, both related to SharpDX.
Iâll eventually try with the latest SharpDX source tree.
Update: Iâve tried with MG 3.5.1 release, shader compile without any warning, game run without any exception.
Note that settings HiDef profile looks like to âworkâ (doing nothing would be more accurate).
Same code, same computer, different MG/SharpDX only.
I have no idea, I tried to ask about it on livestream yesterday, but I guess I phrased it very poorly and they thought it was a shader mgfx problem (as in my shader is broken).
The content pipeline is fine with the shader with the newest build, it just crashes upon loading the effect via content.Load
There was no other solution than to switch back to an older monogame branch. I work on 3.6.187 now and itâs fine, but this is mildly infuriating.
If a solution is found that would be greatly appreciated.
On a related topic: Does monogame even care about reach/HiDef any more? For Dx users itâs probably obsolete.
Itâs unfortunate, maybe by setting up the smallest possible test case and try in various config, it may help to narrow down the issue and identify some useful lead, or even find a fix.
Juts loading an effect straight away from the game template, a simple âdo nothingâ (pass trough) effect with SM 2, 3, 4 and 5, try it with various hardwares, config and MG/SharpDX version.
Thatâs disturbing AFAIK and unless doing something wrong (but how to do it right ? I have no idea either), HiDef does not work because some SharpDX issue (at least with the version used by MG dev), and it looks like Iâm forced to use Reach profile, and/so shader model <= 3, or even 2, Iâm no 100% sure.
Anyway I donât think Dx users can just ignore this, ie: my own issue with it.
yes I tried that. A simple ambient shader. Only color. 99.9999% sure there was no shader problem.
Did compile in the content pipeline with mgfx, no errors, no warnings.
Didnât work.
I donât remember however what shader model I was using there.
But honestly I donât want to use anything lower than SM5.0/at least 4.0 anyways. It would be a reason not to upgrade by itself if suddenly dx11 is not supported any more.
All tests ON THE TEST hardware(s) with the TEST softwares; this doesnât mean at all it WILL WORK 100% sure on ALL hardwares available on Earth. Unit tests are good but far to be enough.
We have one system with issue for sure (mine), @komonautgames: you may try again with more care if you get some spare time.
With your PR, Iâm able to run the project and SharpDX is happy now (or at least no longer complains ), shader works the same way as it did with MG 3.5.1. @kosmonautgames: you may give it a shot too with your issue as both HiDef works AND there is no longer exception on CreatePixelShader, and the OP may test too.