v3d: delay offset/counter values with primitive restart
authorJuan A. Suarez Romero <jasuarez@igalia.com>
Wed, 26 Apr 2023 14:17:27 +0000 (16:17 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 16 May 2023 20:39:43 +0000 (20:39 +0000)
commit975a2c17a4e8cfd235dddd4c06e0dc49ab7504b3
tree541c7ee2120d27337ddd0517d6f4fca6047e7373
parentb4c4d2826306541ba1dd2145cb30c9fcd3e213a5
v3d: delay offset/counter values with primitive restart

Some values like the transform feedback offset or the number of output
vertices in VS can be obtained knowing how many vertices and primitive
type are used in the drawcall.

But when the primitive restart is enabled, doing this is quite more
complex, as we should parse the vertex buffer to know where is the
restart values, and so on.

In this case, delay this computation after the drawcall is executed, by
querying the GPU to know these values.

Similarly, this delay is also applied to compute the transform feedback
buffer offsets when there is a geometry shader, as we don't know
beforehand how many vertices it is going to output.

This fixes `spec@!opengl 3.1@primitive-restart-xfb flush` and
`spec@!opengl 3.1@primitive-restart-xfb generated`.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22716>
src/broadcom/ci/broadcom-rpi4-fails.txt
src/gallium/drivers/v3d/v3d_context.h
src/gallium/drivers/v3d/v3d_job.c
src/gallium/drivers/v3d/v3dx_draw.c