This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Best approach for instancing

I have to decide which approach we use for instancing.

- Vertex attribute instancing
- UBO
- SSBO

According to the docs, on the one hand they say:

Do
- Use a single interleaved vertex buffer for all instance data.
- Use instanced attributes to work around limitation of 16KB uniform buffers.
- If feasible, try to use a power-of-two divisor, i.e. number of vertices per instance should be power-of-two.
- Prefer indexed lookups using gl_InstanceID into uniform buffers or shader storage buffers if the suggestions here cannot be followed.
- Prefer instanced attributes if instance data can be represented with smaller data types, as uniform buffers and shader storage buffers cannot utilize these denser data types.

So it seems to say that vertex attributes ARE preferred IF we meet the requirements.



However, on another place of the website it says this:

- Prefer indexed lookups using gl_InstanceID into uniform buffers or shader storage buffers. Rather than per-instance attribute data.

Unconditionally, like UBOs and SSBOs are always preferred to vertex attributes.

What is the preferred approach even if we meet the requirements above?

Thanks!

Parents
  • I suspect the best answer is situational, depending on GPU and exactly what the content is doing with it.

    For any modern Arm GPU, personally I would always use a UBO/SSBO array lookup. I can't think of any situation where it would be substantially worse than a per-instance attribute lookup, unless you are doing something pathological.

Reply
  • I suspect the best answer is situational, depending on GPU and exactly what the content is doing with it.

    For any modern Arm GPU, personally I would always use a UBO/SSBO array lookup. I can't think of any situation where it would be substantially worse than a per-instance attribute lookup, unless you are doing something pathological.

Children