• Advertisement
Sign in to follow this  

SLIMDX: Effectpool E_FAIL, directX10

This topic is 3407 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I don't have an idea what I'm doing exactly, but something goes wrong. That is for sure. I'm trying to figuere out the effect system in DX10. I wrote a simple vertexshader to transform with the worldprojection matrix. I've put my "common" variables in a seperate include file and I would like to use an effectPool. If I don't use the effectpool everything works fine. I pass the Indentity Matrix and I can run and view the MiniTri from the Samples. When I switch the code to use a Effectpool, the application crashes at the construction of the layout. SlimDX.Direct3D10.EffectPool ep = SlimDX.Direct3D10.EffectPool.FromFile(Device, "Common.fxh", "fx_4_0", SlimDX.Direct3D10.ShaderFlags.None, SlimDX.Direct3D10.EffectFlags.None); Effect = D3D10.Effect.FromFile(Device, "MiniTri.fx", "fx_4_0", D3D10.ShaderFlags.None, D3D10.EffectFlags.ChildEffect , ep, null, out s); Technique = Effect.GetTechniqueByIndex(0); Pass = Technique.GetPassByIndex(0); D3D10.InputElement[] inputElements = new SlimDX.Direct3D10.InputElement[] { new D3D10.InputElement("POSITION",0,DXGI.Format.R32G32B32A32_Float,0,0), new D3D10.InputElement("COLOR",0,DXGI.Format.R8G8B8A8_UNorm,16,0) }; Layout = new D3D10.InputLayout(Device, inputElements, Pass.Description.Signature); << Here goes kaboom... Anybody has an idea? #include "Common.fxh" //shared cbuffer Common { //float4x4 ViewProjection; //}; struct VS_IN { float4 Pos : POSITION; float4 Col : COLOR; }; struct PS_IN { float4 Pos : SV_POSITION; float4 Col : COLOR; }; PS_IN VS( VS_IN aInput ){ PS_IN Output; Output.Pos = mul( aInput.Pos, ViewProjection ); Output.Col = aInput.Col; return Output; } float4 PS( PS_IN aInput ) : SV_Target{ return aInput.Col; } technique10 Render{ pass P0{ SetVertexShader( CompileShader( vs_4_0, VS() ) ); SetGeometryShader( NULL ); SetPixelShader( CompileShader( ps_4_0, PS() ) ); } }

Share this post


Link to post
Share on other sites
Advertisement
I'm doing something wrong in my include file.

If I do this

SlimDX.Direct3D10.EffectPool ep = SlimDX.Direct3D10.EffectPool.FromFile(Device,
"common.fxh", "fx_4_0", SlimDX.Direct3D10.ShaderFlags.None, SlimDX.Direct3D10.EffectFlags.None, out s);

SlimDX.Direct3D10.EffectVariable ev = ep.AsEffect().GetVariableByName("ViewProjection");
xxx = ev.AsMatrix();

The "ev" parameter is assigned, but is stated as Invalid. The xxx variabele on the other hand remains null.

this is how my common.fxh file looks like

//bof
shared cbuffer cbShared {
matrix ViewProjection;
};
//eof

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement