Shader InputElement constructor layout

49 views
Skip to first unread message

David Karlaš

unread,
Aug 21, 2011, 4:23:46 AM8/21/11
to slimdx...@googlegroups.com
Hello everyone,

today(and yesterday :P) i had problem with porting some code from c++ to C# because different parameters layout.

var elements = new InputElement[] {
new InputElement( "POSITION", 0, Format.R32G32B32_Float,  0, 0, InputClassification.PerVertexData, 0 ),
new InputElement( "TEXCOORD", 0, Format.R32G32_Float,     12,0, InputClassification.PerVertexData, 0),
new InputElement( "NORMAL",   0, Format.R32G32B32_Float,  20, 0,InputClassification.PerVertexData, 0)
};

const D3D11_INPUT_ELEMENT_DESC tangentspacevertexlayout[] = {
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0,  D3D11_INPUT_PER_VERTEX_DATA, 0 },
        { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT,    0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
        { "NORMAL",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }
}

Problem is in parameters 4 and 5 which are inverted. I know it's hard to change this now since all applications would have to change this but some meaningful warning would be welcom for new users. 
For example if slot parameter are greater then 15 to say something like: Check parameters 4 and 5 :P or every time when it fails to create InputLayout it should say check paramters 4 and 5 since its different then in native API.

P.S: Amazing job SlimDX team!

Cya,
David

Promit Roy

unread,
Aug 21, 2011, 1:23:22 PM8/21/11
to slimdx...@googlegroups.com
Hm, yeah. This is a mistake, but I'm not sure there's anything particularly good for us to do about it.

-- Promit


--
You received this message because you are subscribed to the Google Groups "slimdx-devel" group.
To view this discussion on the web visit https://groups.google.com/d/msg/slimdx-devel/-/0J8biqhlDvUJ.
To post to this group, send email to slimdx...@googlegroups.com.
To unsubscribe from this group, send email to slimdx-devel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/slimdx-devel?hl=en.

Josh Petrie

unread,
Aug 21, 2011, 2:39:15 PM8/21/11
to slimdx...@googlegroups.com, slimdx...@googlegroups.com
I'm pretty sure I did this explicitly, because I remember making a decision that I knew would cause this but made more sense in terms of the overload options. I'm still in Germany but will investigate when I return.

We aren't likely going to be able to do anything meaningful about the issue though; it will not be a problem in v2.

-- jmp

Richard

unread,
Aug 22, 2011, 1:03:45 PM8/22/11
to slimdx...@googlegroups.com

In article <CAFTw8an_nUSfVV7mUJMG2+jV...@mail.gmail.com>,
Promit Roy <promi...@gmail.com> writes:

> Hm, yeah. This *is* a mistake, but I'm not sure there's anything


> particularly good for us to do about it.

Breaking change in vNext?
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

Reply all
Reply to author
Forward
0 new messages