Jump to content
  • Advertisement
Sign in to follow this  
poigwym

d3d11 soa vertex buffer

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

Hellow!!

How to implement soa layout vb in d3d11? 

Is it possible ??

Edited by poigwym

Share this post


Link to post
Share on other sites
Advertisement

Sure.

 

1. Create 1 vertex buffer per element

2. When creating your input layout, set "InputSlot" to the index that corresponds to the vertex buffer containing that element. 

3. When it's time to draw, bind all of your vertex buffers by passing them all as an array to IASetVertexBuffers.

Share this post


Link to post
Share on other sites

Be aware that SoA is likely to be less efficient on GPUs than AoS.

GPU vendors seem to keep flip-flopping from preferring AoS to SoA :(

On a particular platform that everyone was optimizing their games for just a few years ago, the GPU performed large (expensive) fetches from buffers into a local attribute cache, and then small (cheap) fetches from there to the VS registers. This meant that AoS tended to do the least number of expensive "large fetches" (one or two would read an entire AoS vertex structure) and was VS-input bottlenecked less often.

On a particular platform that everyone is optimizing their games for this year, we've moved from vectorized instruction sets to scalar instruction sets, which are run on vectorized (SIMD) hardware in order to achieve paralelism. That means that when the VS tries to fetch attribute #1, you're actually issuing an instruction to fetch attribute #1 64 times for 64 different vertices! To get the best efficiency here, you want those memory reads to coalesce into a smaller number of larger read operations, which can only happen if those 64 values are contiguous in RAM. This means using SoA to keep each individual attribute tightly packed, in order for memory reads to achieve the lowest observable latency, resulting in the VS being memory bottlenecked less often.

Edited by Hodgman

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!