direct3d - Strange D3D11 Error when creatng shader [SharpDX/MONOGAME] -


i'm true beginner in shader programming , i'm using monogame framework . i'm trying follow along examples in book

packtpub 3d graphics xna game studio 4.0

but i've been hitting wall past 4 days trying make prelighting renderer works (chapter 3 if of know book) https://www.packtpub.com/books/content/advanced-lighting-3d-graphics-xna-game-studio-40

  1. the code compiles fine , mesh le prelighting shader applied fails display 2.when drilling down shader in vs2013 locals , find kind of exceptions

vertexshader 'this.depthnormaleffect._shaders[0].vertexshader' threw exception of type 'system.runtime.interopservices.sehexception' sharpdx.direct3d11.vertexshader {system.runtime.interopservices.sehexception}

which dx native debugger tranlates

d3d11 error: id3d11device::createvertexshader: shader must vs_4_0, vs_4_1, or vs_5_0. shader version provided: ps_4_0 [ state_creation error #167: createvertexshader_invalidshadertype] d3d11: break enabled previous message, was: [ error state_creation #167: createvertexshader_invalidshadertype ] first-chance exception @ 0x75fac41f (kernelbase.dll) in 3dtest.exe: 0x0000087a (parameters: 0x00000001, 0x003db5d0, 0x003dc328). d3d11 error: id3d11device::createpixelshader: shader must ps_4_0, ps_4_1, or ps_5_0. shader version provided: vs_4_0 [ state_creation error #193: createpixelshader_invalidshadertype] d3d11: break enabled previous message, was: [ error state_creation #193: createpixelshader_invalidshadertype ]

the baffling thing being (to me) library seems link wrong compiled shader function either vertex or pixel shader

d3d11 error: id3d11device::createpixelshader: shader must ps_4_0, ps_4_1, or ps_5_0. shader version provided: vs_4_0 [ state_creation error #193: createpixelshader_invalidshadertype]


here of shader code ( effect spans on 3 shaders 2 rendering render targets third can use final pass)

float4x4 world; float4x4 view; float4x4 projection;  struct vertexshaderinput {     float4 position : sv_position;     float3 normal : normal0; };  struct vertexshaderoutput {     float4 position : sv_position;     float2 depth : texcoord0;     float3 normal : texcoord1; };  vertexshaderoutput vertexshaderfunction(vertexshaderinput input) {     vertexshaderoutput output;     float4x4 viewprojection = mul(view, projection);         float4x4 worldviewprojection = mul(world, viewprojection);          output.position = mul(input.position, worldviewprojection);         output.normal = mul(input.normal, world);          //les composante z et w de position correspondent la distance % camera et % plan lointain         output.depth.xy = output.position.zw;          return output; }  struct pixelshaderoutput {     float4 normal : color0;     float4 depth : color1; };  pixelshaderoutput pixelshaderfunction(vertexshaderoutput input) {     pixelshaderoutput output;      output.depth = input.depth.x / input.depth.y;     output.normal.xyz = (normalize(input.normal).xyz/ 2) + .5;      output.depth.a = 1;     output.normal.a = 1;     return output; }  technique technique0 {     pass pass0     {         vertexshader = compile vs_4_0 vertexshaderfunction();         pixelshader = compile ps_4_0 pixelshaderfunction();     } }; 

well , searches on google left me dry on issue makes me think i'm doing absolutly stupid wihtout realizing (shader n00b remember :d) .

any ideas ??


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -