Geeks With Blogs
Timo Hein├Ąpurola

Just recently I bumped into a bug that looked a bit odd at first. I was wondering why our line rendering was outputting only a single line for some wireframe meshes. This happened only on an AMD Radeon graphics card. After some digging into this I found out that the reason was that NVIDIA and AMD drivers map buffer memory in a slightly different manner. AMD seems to reuse system memory regions for buffer mapping while NVIDIA seems to prefer allocating new regions for this purpose.

I realized this as I had mapped an index buffer into which I read the mesh index data and had then accidentally unmapped it. After this I had mapped another buffer that would contain the line indices that were generated from the previously mapped index buffer. The driver, however, mapped the second buffer into the same memory region resulting in me modifying the source information while I was generating the line information. Because the first indices in the triangle buffer were 1, 0 this meant that I would generate lines 1, 0, 0, 0 and so on.

The lesson of all this? Be careful with your buffer mappings and you might even want to null out your pointers after unmapping to at least catch a null pointer exception.

Posted on Wednesday, August 10, 2011 11:47 PM | Back to top


Comments on this post: Forgot to test on multiple GPUs?

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © raccoon_tim | Powered by: GeeksWithBlogs.net