• Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at \$59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!

Posted 14 April 2013 - 12:23 AM

Hello,

I've spent the day getting a triangle to render in SlimDX and reading up on things. It was all going well until I tried to make the shader a little more complex. I just want to add a per-vertex colour. But when I did my vertex layout broke and I'm not sure why. The exception being thrown is the following:


An unhandled exception of type 'SlimDX.Direct3D11.Direct3D11Exception' occurred in SlimDX.dll

Additional information: E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809)


I managed to find a thread that seems related: http://www.gamedev.net/topic/607455-slimdx-directx11-inputlayout-failure/

I'm not sure if that really helps or not as I don't fully understand it. He seems to be passing his DataStream as the signature which I'm not doing( Or if I am it's in such a way that I don't realise I am. ). I'm using the ShaderByteCode from the vertex program. This all worked for a triangle with only positional data being sent. It breaks on the Layout creation line.


var elements = new[] { new DX.InputElement("POSITION", 0, GI.Format.R32G32B32_Float, 0),
new DX.InputElement("COLOR", 0, GI.Format.R32G32B32A32_Float, DX.InputElement.AppendAligned)
};

//Breaks on this line.
VertexLayout = new DX.InputLayout(CoreComponents.mVideo.mDevice, HLSL.ShaderSignature.GetInputSignature(VPByte), elements);



struct a2v {
float3 p : POSITION;
float4 c : COLOR0;
};

struct v2f {
float4 p : SV_POSITION;
float4 c : TEXCOORD0;
};

v2f vp(a2v a2vin) {
v2f v2fout;

v2fout.p  = float4(a2vin.p, 1);
v2fout.c  = a2vin.c;

return v2fout;
}

float4 fp(v2f v2fin): SV_TARGET {
return v2fin.c;
}


Any help or advice would be appreciated. Thank you.

### #1siri

Posted 11 April 2013 - 07:26 PM

Hello,

I've spent the day getting a triangle to render in SlimDX and reading up on things. It was all going well until I tried to make the shader a little more complex. I just want to add a per-vertex colour. But when I did my vertex layout broke and I'm not sure why. The exception being thrown is the following:


An unhandled exception of type 'SlimDX.Direct3D11.Direct3D11Exception' occurred in SlimDX.dll

Additional information: E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809)


I managed to find a thread that seems related: http://www.gamedev.net/topic/607455-slimdx-directx11-inputlayout-failure/

I'm not sure if that really helps or not as I don't fully understand it. He seems to be passing his DataStream as the signature which I'm not doing( Or if I am it's in such a way that I don't realise I am. ). I'm using the ShaderByteCode from the vertex program. This all worked for a triangle with only positional data being sent. It breaks on the Layout creation line.


var elements = new[] { new DX.InputElement("POSITION", 0, GI.Format.R32G32B32_Float, 0),
new DX.InputElement("COLOR", 0, GI.Format.R32G32B32A32_Float, DX.InputElement.AppendAligned)
};

//Breaks on this line.
VertexLayout = new DX.InputLayout(CoreComponents.mVideo.mDevice, HLSL.ShaderSignature.GetInputSignature(VPByte), elements);



struct a2v {
float3 p : POSITION;
float4 c : COLOR0;
};

struct v2f {
float4 p : SV_POSITION;
float4 c : TEXCOORD0;
};

v2f vp(a2v a2vin) {
v2f v2fout;

v2fout.p  = float4(a2vin.p, 1);
v2fout.c  = a2vin.c;

return v2fout;
}

float4 fp(v2f v2fin): SV_TARGET {
return v2fin.c;
}


Any help or advice would be appreciated. Thank you.

PARTNERS