• entries
    316
  • comments
    485
  • views
    322231

Geometry in D3D11

Sign in to follow this  

137 views


Geometry in D3D11


I have a bit of a time crunch to get some additional functionality built into my D3D11 renderer - so I spent today porting over my geometry classes from the D3D9 side. The general design is that a 'GeometryDX9' class serves as the top level container for a group of 'VertexElementDX9'. Each 'VertexElementDX9' is a dynamically sized array that corresponds to one portion of a vertex, such as position, normal, texture coordinates and so on. The 'GeometryDX9' also contains dynamic arrays to receive indices for either triangles, lines, or points.

When all of the vertex elements and the primitives are added to the geometry instance, there is a method that formats and copies the data into vertex and index buffers for rendering later on. Then the whole geometry object can be referenced by whatever application level objects need to be able to render geometry.

This system worked great for my past applications in D3D9, but I think I will eventually rework the resource handling for the D3D11 renderer. In particular, I want to incorporate a common resource reference counting system for releasing unused textures and buffers. I already do this at the geometry object level, but it should also be done at the lower level to ensure that if the textures or buffers are shared across multiple objects that there won't be issues with releasing resources too early.

There is still quite a bit of design work to do - but I have been kicking around the concept of using proxy objects instead of smart pointers for the reference counting scheme. Smart pointers have always seemed like a gimmick to me, especially since you have to be so careful in how you implement them. I'd like to develop something a little more specialized to resource management and see what I can come up with...
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now