Jump to content

  • Log In with Google      Sign In   
  • Create Account

[SlimDX] DirectX11 InputLayout failure..


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Andrew48   Members   -  Reputation: 100

Like
0Likes
Like

Posted 30 July 2011 - 07:12 PM

I'm trying my first DX11 SlimDX render engine, and followed the example on the SlimDX site, but it failes at the InputLayout and says, invalid argument passed to return function:

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

Any help is appreciated! I've included the verticie creation portion

-Andrew

this.vertices = new DataStream(12 * 3, true, true); 
            vertices.Write(new Vector3(0.0f, 0.5f, 0.5f)); 
            vertices.Write(new Vector3(0.5f, -0.5f, 0.5f)); 
            vertices.Write(new Vector3(-0.5f, -0.5f, 0.5f));
     vertices.Position = 0;[/color][/size][/color][/size]

      this.vertexBuffer = new SlimDX.Direct3D11.Buffer(this.device, vertices, 12 * 3, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);

         this.elements = new InputElement[] { new InputElement("POSITION", 0, SlimDX.DXGI.Format.R32G32B32_Float, 0) };
            this.inputSignature = new SlimDX.D3DCompiler.ShaderSignature(this.vertices);
            this.inputSignature.Data.Position = 0;
            this.layout = new InputLayout(this.device, this.inputSignature, this.elements);


And here's the shader code

float4 VShader(float4 position : POSITION) : SV_POSITION 
{ 
    return position; 
}

float4 PShader(float4 position : SV_POSITION) : SV_Target 
{ 
    return float4(1.0f, 1.0f, 0.0f, 1.0f); 
}


[/size]

Sponsor:

#2 MJP   Moderators   -  Reputation: 11311

Like
0Likes
Like

Posted 31 July 2011 - 11:59 AM

An input layout requires the input signature of the vertex shader you're going to use. I'm not too familiar with SlimDX, but it looks like you're using the ShaderSignature class wrong by giving it a reference to your vertex buffer.

#3 Starnick   Members   -  Reputation: 1203

Like
0Likes
Like

Posted 31 July 2011 - 07:47 PM

Giving the shader signature a data stream that contains your vertex buffer doesn't make any sense, as it's just a chunk of bytes. The signature isn't data, it specifies how that data is laid out per vertex. The shader signature needs to be taken from the shader you'll be using.

E.g. Using the effect classes, each effect pass will have a signature (for the vertex shader used) in its effect description you can use to create the input layout.

You can re-use these layouts with other shaders that have identical signatures.

#4 Andrew48   Members   -  Reputation: 100

Like
0Likes
Like

Posted 01 August 2011 - 02:04 PM

Thanks, that helps, I was following the tutorials on the SlimDX web site and got a little lost. I didn't know Effects existed for DX11 SlimDX.

-Andrew




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS