v3dv: implement vkCmdDispatchBase

This was added with VK_KHR_device_group and allows users to specify
a base offset that will be automatically added to gl_WorkGroupID.

Unfortunately, V3D doesn't support this natively, so we need to add
the base to the workgroup id generated by hardware manually. For this,
we inject add instructions that source from a QUNIFORM that will
retrieve the actual dispatch base from the compute job when it is
dispatched.

Since a compute shader can be dispatched with CmdDispatch and/or
CmdDispatchBase, we always need to add these additional add
instructions and use a base of (0,0,0) for regular dispatches.
Since we don't support any version of OpenGL with this dispatch
base functionality we can avoid the extra instructions there.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11037>
This commit is contained in:
Iago Toral Quiroga
2021-05-27 09:06:00 +02:00
committed by Marge Bot
parent 816be7d46f
commit f07c797e93
5 changed files with 68 additions and 11 deletions

View File

@@ -299,6 +299,11 @@ enum quniform_contents {
*/
QUNIFORM_NUM_WORK_GROUPS,
/* Base workgroup offset passed to vkCmdDispatchBase in the dimension
* selected by the data value.
*/
QUNIFORM_WORK_GROUP_BASE,
/**
* Returns the the offset of the scratch buffer for register spilling.
*/