Skip to main content
GameDev.net gamedev.net
🔒 Locked

Another Input layout question...

Started by Firelark Nov 12, 2013 at 7:39 AM 1 replies 1.3k views
Original Post
Firelark
Firelark

Hello

In directX 11, if I have a shader that takes vertices with POSITION defined as float3:


float3 pos : POSITION

Am I then allowed to use that shader with an input layout where the POSITION is defined to be a four component float using DXGI_FORMAT_R32G32B32A32_FLOAT? In essence am I allowed to use an input layout with more components (float3 < float4) in the input than the shader requires?

Also am I allowed to use an input layout where the POSITION is defined to be a two component float using DXGI_FORMAT_R32G32_FLOAT or a one component float using DXGI_FORMAT_R32_FLOAT? In essence am I allowed to use an input layout with fewer components in the input than what is defined in the shader.

Is there any kind of flexibility like this or do I have to provide an input layout where the POSITION is defined to be exactly a three component float?

Thanks for any help!

Karl

21st Century Moose
21st Century Moose

Yes.

The input will be expanded to 4 component by adding the missing components, so a missing second component will get 0, third will get 0 and fourth will get 1.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
Firelark
Firelark

Thanks mhagain, that's what i wanted to know :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.