OpenSceneGraph icon indicating copy to clipboard operation
OpenSceneGraph copied to clipboard

osg::createTexturedQuadGeometry uses DrawElementsUByte

Open AnyOldName3 opened this issue 5 years ago • 0 comments

When using GL_UNSIGNED_BYTE as the index type for glDrawElements on a modern AMD system with OpenGL debug messages enabled, the following message is emitted:

OpenGL PERFORMANCE [API]: glDrawElements uses element index type 'GL_UNSIGNED_BYTE' that is not optimal for the current hardware configuration; consider using 'GL_UNSIGNED_SHORT' instead

As the message implies, short indices should be faster on modern GPUs than byte ones. For that reason, and also to suppress the message, it's probably a good idea for osg::createTexturedQuadGeometry to use DrawElementsUShort instead.

I'm not sure of the relative performance impact on older and mobile GPUs, but if it's negligible, it's potentially worth accepting to suppress the message. As the driver generates the message for every call it's not happy with, it doesn't take many textured quad geometries to swamp more useful messages from calls generating errors or that take longer on account of having more vertices.

AnyOldName3 avatar Oct 03 '20 17:10 AnyOldName3