glthread: add specialized versions of unmarshal_Draw funcs without user buffers
authorMarek Olšák <marek.olsak@amd.com>
Wed, 23 Dec 2020 11:21:57 +0000 (06:21 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 21 Jan 2021 00:12:35 +0000 (00:12 +0000)
commit0b4be5baaadfbb1e40470f07db68c1b74b5f4f15
tree84827aafe8f51cfcc9e05d94b0b8d52942691aa3
parent8f53b54a3bfe2b5e74b62ec8edcc958b83fbe958
glthread: add specialized versions of unmarshal_Draw funcs without user buffers

This decreases CPU time spent in the unmarshal_DrawElements function
from 0.44% to 0.26% if no user buffers are present.

Instead of converting all calls to either unmarshal_DrawArraysInstanced-
BaseInstance or unmarshal_DrawElementsInstancedBaseVertexBaseInstance,
which both also conditionally bind uploaded user buffers if needed and
call one of:
- DrawArraysInstancedBaseInstance
- DrawElementsInstancedBaseVertexBaseInstance
- DrawRangeElementsBaseVertex,
add 3 unmarshal draw variants that are specialized version of the above that
never bind uploaded user buffers. This removes all conditionals from
the unmarshal functions for the common case when there are no user buffers.

Unused function enums are used for the various draw variants. For example,
CMD_DrawArrays is used to dispatch DrawArraysInstacedBaseInstance without
user buffers, while CMD_DrawArraysInstacedBaseInstance is used to dispatch
the same with user buffers. glthread isn't flexible enough to do it cleanly.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>
src/mesa/main/glthread_draw.c