1
\$\begingroup\$

Why are most game engines like unity limiting their meshes to 65k indices by default, or enforcing to use uint16 as the default datatype for indexbuffers?

I know that its better for performance to use uint16 indexbuffers, but I think there might be more reasons, because webGL 1.0 specification allows only uint16 vertexbuffers. I know that it's possible to use uint32 indexbuffers in webGL if the "OES_element_index_uint" extension is available in webGL 1.0 devices.

How big is the performance impact when using uint32 indexbuffers instead of uint16 indexbuffers? I think the only difference is in the memory bandwidth during the initial upload of the indices and should not matter much during runtime.

\$\endgroup\$
1
  • 3
    \$\begingroup\$ "How big is the performance impact when using uint32 indexbuffers instead of uint16 indexbuffers?" Did you try running a test with one, then the other, to compare them and find out for yourself? "I think the only difference is in the memory bandwidth during the initial upload" what about memory bandwidth when reading, and cache efficiency? Is the upload pipe really the only part of the flow that has limits? \$\endgroup\$
    – DMGregory
    Jun 15, 2019 at 15:40

1 Answer 1

2
\$\begingroup\$

I think DMGregory has answered part of this, timing test of 16 vs 32 definitely needs to be done. BUT, the performance is also dependent on the needs of your scene also. The 65536 indice limitation does mean that now you may need to deal with multiple objects to composite a more complicated > 65536 indice model. Which means different different calculations and logic to handle various components. Which means switching out buffers for different buffers, which all impacts the time to render.

It's not a simple 16 is smaller and faster, this only holds true in the purest of examples. If like myself, you use > 65536 indices then you may feel the trade off is worth it in terms of performance. The other thing, modern GPUs are using more the 32 bit aligned space, meaning that in some cases you feed in a 16 bit, its converted to a 32 bit index anyway.

At the end of the day, benchmark it and understand that your purest test may not reflect the real world needs you have.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .