Jump to content
  • Advertisement
Sign in to follow this  
parroteye

Driver crash on creation of vertex buffer (D3D11)

This topic is 958 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am starting working on my first D3D11 "framework" but I get a driver crash (in nvwgf2um.dll) when creating a buffer. I have latest NVIDIA driver 
 
ID3D11Buffer* CreateVertexBufferFromGeometry(Mesh& mesh) const{


      [cut unrelated stuff]


ID3D11Buffer* buffer;


D3D11_BUFFER_DESC bd;
ZeroMemory(&bd, sizeof(bd));
bd.Usage = D3D11_USAGE_DEFAULT;
bd.ByteWidth = sizeof(float) * mesh.NumberOfFloatsPerVertex * mesh.vertexData.size();
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = 0;
bd.MiscFlags = 0;
D3D11_SUBRESOURCE_DATA InitData;
ZeroMemory(&InitData, sizeof(InitData));
InitData.pSysMem = mesh.vertexData.data();
RenderDevice->CreateBuffer(&bd, &InitData, &buffer);


return buffer;
}
 
I have Debug layer on and nothing pops out, the HRESULT is pointless since the app crashes inside CreateBuffer (does not return) just get this crash in debug and release mode. 
 
What can it be? How can I go on to get more info? 
 
The obj I am trying to read is not ill-formed (it read fine with any viewer). 
RenderDevice is a wrapper around ID3D11Device , it is NOT null and it works in creating other things 
 
Thanks
 
 
EDIT: Got problem with warp as well 
Edited by parroteye

Share this post


Link to post
Share on other sites
Advertisement

Reading / writing what address?

 

It changes everytime IIRC (don't have the code with me atm), but is not 0xcccccc or 0x00000 or any usual null/known address

Share this post


Link to post
Share on other sites
Sounds like you're passing an invalid pointer into that function.
What is mesh.vertexData? It would be my first suspect.
 
Off topic, but FWIW below, #1 is the same as #2, but less efficient, more verbose, and prone to human error:
//#1
D3D11_BUFFER_DESC bd;
ZeroMemory(&bd, sizeof(bd));
//#2
D3D11_BUFFER_DESC bd = {};

Share this post


Link to post
Share on other sites

If it's a violation *reading* from a valid looking address (one that looks like it comes some sane number of bytes after the start of vertexData.data()) then I would assume vertexData doesn't contain enough bytes to fulfil filling the buffer in its entirety. Check mesh.NumberOfFloatsPerVertex is correct.

Edited by Adam Miles

Share this post


Link to post
Share on other sites

If it's a violation *reading* from a valid looking address (one that looks like it comes some sane number of bytes after the start of vertexData.data()) then I would assume vertexData doesn't contain enough bytes to fulfil filling the buffer in its entirety. Check mesh.NumberOfFloatsPerVertex is correct.

This was it! There was an error in the calculation of floatsPerVertex, Thank you!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!