how to compile a monogame shader with fxc effect compiler

hello,

how can i compile a working monogame effect file the Microsoft effect comiler commandline tool fxc.exe ?

Please, please help me, because i really worked hard to get the problem solved an cannot find my bug.

With fxc i compile with Effect target FS_5 an VS_5, PS_5 levels.

I make the corrections to the original fx file by hand and changed e.g. the annotation from Color0 to SV_Target0 for rendertargets, the sampler definition and so on. ( According Microsoft recommandations )

The Effect file then compiles with some warnings with fxc but does not give the expected result.

I use both shaderbyte codes (from original 2MGFX, and the result of the commandline tool ) in the exact same engine code to exclude any other source of error.

The 2MGFX source code uses the sharpdx compile function which should produce the same functionality then fxc tool.

I know from study of the source code that 2MGFX

  • parses the fx source file
  • strips off all effect specific commands
  • parses / collects the information for texture, sampler, constant buffers
    => compiles every VertexShader, PixelShader seperately
  • per SharpDX reflection the samplerslots, textureslots are retrieved
  • then strips off the reflection code and debugging information

When compiling 2MGFX uses the SharpDX option “EnableBackwardsCompatibility”
that is translated in DirectX Language “D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY”

If i understand correctly there should be the possibility to use fxc with corresponding option to compile the original fx file without making changes by hand. Of course then with the same shader level monogame uses.

When i could succesfully compile in monogame shaderlevel with fxc then i could compare the assembly output file when i compile with level 5 and maybe find my bug.

I really need some help from you

The source file is too big to present here. It is the deferedpointlightshader file from kosmonauts deffered playground.

Some files of his engine i have successfully manually changed, compiled with fx2 and load them manually to the engine.

The whole sense of this all is the fact that i need manual control for constantbuffers and structured buffers in my monogames engine.

My last post to add this functionality in monogame in this board was not answered so i implemented this feature by myself an it is working fine. But i can only implement complete shader level 5 features in the engine when i am able to compile all shaders with shader model 5.

Thanks for your patience and thanks for everyone who can give me any hint