• Advertisement
Sign in to follow this  

[DX10] Per-instance per-vertex data

This topic is 3665 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

In DX10, there are two types of data when passing input data to a shader: per-vertex (D3D10_INPUT_PER_VERTEX_DATA) and per-instance data (D3D10_INPUT_PER_INSTANCE_DATA). I use per-vertex data to pass in stuff like vertex position, normal, texture coordinates, etc. And per-instance data for things like the world matrix (which allows me to do efficient batching with ID3D10Device::DrawIndexedInstanced()) Here's the thing: - Per instance data is unique to each instance, but the same for each vertex drawn. - Per vertex data is the same for each instance, but unique for each vertex drawn. This is what it looks like:
                             +-[Per-vertex Data 1]
              +-[Instance 1]-|
              |              +-[Per-instance Data 1]
[Draw Call 1]-+
              |              +-[Per-vertex Data 1]
              +-[Instance 2]-|
                             +-[Per-instance Data 2]
In other words, all instances share the same per-vertex data, but different per-instance data. I was wondering, is it possible to have different per-vertex data for each instance drawn? If it was possible, it would allow me to draw two completely different meshes with a single draw call.

Share this post


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

  • Advertisement