Jump to content

  • Log In with Google      Sign In   
  • Create Account

DXGI vertex buffer format problem


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
5 replies to this topic

#1 randall68000   Members   -  Reputation: 124

Like
0Likes
Like

Posted 29 June 2013 - 05:07 AM

Hi,

 

I have a problem with a vertex format in my DX11 engine. If I create a vertex buffer using the formats DXGI_FORMAT_R16G16B16A16_UINT or DXGI_FORMAT_R16G16B16A16_SINT for position (DX9 is SHORT4) I get zero for every component in the position passed into the shader (other componets are fine R8G8B8A8 colour and R16G16_SNORM for uv). I have ran pix and checked the inputs to the mesh on the Draw() command and confirmed they are all zero. If I pass in UNORM, SNORM or FLOAT I get reasonable data passed in for the position.

 

Is there any steps I have missed? ie. I don't create a ShaderResourceView but that doesn't seem to matter if I don't use the 16bit formats.

 

Thanks

 

Randall68000



Sponsor:

#2 kauna   Crossbones+   -  Reputation: 2848

Like
0Likes
Like

Posted 30 June 2013 - 07:03 AM

Can you show some vertex buffer / vertex declaration code?

 

I'm a little confused of your question since I don't define any particular format for the vertex buffer. The CreateBuffer doesn't even expect any particular format to be defined.

 

Cheers!



#3 cephalo   Members   -  Reputation: 575

Like
0Likes
Like

Posted 30 June 2013 - 07:18 AM

Do all DX11 devices support 64 bit formats?



#4 MJP   Moderators   -  Reputation: 11737

Like
0Likes
Like

Posted 30 June 2013 - 12:37 PM

Does your vertex shader use uint4/int4 types for elements with that format? If I remember correctly UINT/SINT formats won't work correctly if your shader expects them as a float, although that would be something that the debug device would warn you about. Do you create your device with D3D11_CREATE_DEVICE_DEBUG?



#5 randall68000   Members   -  Reputation: 124

Like
0Likes
Like

Posted 30 June 2013 - 03:13 PM

Kauna

 

I build a vertex description using a series of vertex flags like this (BuildVertexElement just fills in an array of D3D11_INPUT_ELEMENT_DESC)

 

if(params.mTypeMask&VertexBufferParams::kTypeXYZ32)
{
BuildVertexElement(vertexElements,element,"POSITION",0,DXGI_FORMAT_R32G32B32_FLOAT,0,offset,D3D11_INPUT_PER_VERTEX_DATA,0);
offset+=12;
}
 
if(params.mTypeMask&VertexBufferParams::kTypeXYZRHW16)
{
BuildVertexElement(vertexElements,element,"POSITIONT",0,DXGI_FORMAT_R16G16B16A16_UINT,0,offset,D3D11_INPUT_PER_VERTEX_DATA,0);
offset+=8;
}
 
And I use this to create the input layout (you are right CreateBuffer doesn't expect a format - this is my mistake).
 
MJP
 
I support Short4 positions in my DX9 code - I would like to support them in DX11 hence using DXGI_FORMAT_R16G16B16A16_SINT/UINT. Ah well there's the rub - I've got problems with the debug layers dll on my machines for some reason and I can't create the device in debug mode. I haven't got round to fixing the issue yet.
 
Cheers guys.


#6 randall68000   Members   -  Reputation: 124

Like
0Likes
Like

Posted 30 June 2013 - 03:18 PM

MJP - I have just changed the shaders to use int4's and I am getting the correct positions through now.

 

Thanks for pointing that out!






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