WindowsDX Effect File "The parameter is incorrect." Krypton

Hello,

First of all, i really love monogame, many thanks to everybody who’s involved in the development!

I started porting my xna project to monogame project and everything went fine except one major thing.
I was using The Krypton Lighting Engine 2.0 in my xna project and everything worked very nice there! but when i started the project in monogame, i got into trouble :frowning:
I read alot about effects in monogame and i came to this .fx file which compiles great to .xnb and loads successfully when i run my project: https://www.dropbox.com/s/radxqemh3wdoj3b/KryptonEffect.fx?dl=0

The problem is that whenever i use the “DrawUserIndexedPrimitives” in my project, the application crashes and says “HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.”
I believe this is something that is wrong in the KryptonEffect.fx that i didnt find.

I have two projects to show you the problem, the first one is a working test project made with XNA 4.0 only, and the other one is the same implementation but with Monogame Windows DX only (that doesnt work).

Both of the projects are in this rar: https://www.dropbox.com/s/fi8y8taxmik79n1/Krypton_Implementations.rar?dl=0

I am using Windows 7 x64, Visual Studio 2010 Professional, Monogame 3.2 (WindowsDX Project).

I really want this engine to be implemented in monogame and i believe it is possible!
Please help me find out what am i missing, this may help others to avoid effect problems in the future.

Thanks, Vlad.

Hi!

are you using the latest repository? There was a PR a few days ago which may give you a better error message

I tried the latest repository thanks to you :slight_smile:
but now there is another problem, the content project does’nt compile with the following error (about 10 errors of this type):

KryptonTestDirectX\KryptonContent\KryptonContentContent\KryptonEffect.fx(201,9) : Unexpected token ‘S’ found. Expected CloseBracket

I followed the lines that he complains about and i found that he did’nt like these lines:

  1. StencilEnable = False;
  2. ScissorTestEnable = True;

I tried changing False to false and True to true but the same error occurs…
Does StencilEnable and ScissorTestEnable are supported in monogame content project? if it does then what am i missing?

This is a known issue: it just needs someone to help implement these states in the parser:

Thank you very much! I wish i had the knowledge to support all these…
I commented all the “bad lines”, and i succeded running the project but the screen is full black…
I believe i should change the lighting engine for now, any suggestions?

You can use code to apply those same states before drawing. Depending on which states are causing the issue, you may need to create a custom DepthStencilState (or possibly use one of the built-in ones): XNA Game Studio 4.0 Refresh | Microsoft Learn. Also look at the RasterizerState.

I tried to use the same effect (after i made all the changes) file in a XNA 4.0 test project (with all the “bad lines” commented) and it still works very well…
The same implementation and the same effect file wont work on WinDX Monogame…
What may be the problem?