lima: fix vertex shader uniform buffer size
authorErico Nunes <nunes.erico@gmail.com>
Wed, 9 Sep 2020 22:02:38 +0000 (00:02 +0200)
committerErico Nunes <nunes.erico@gmail.com>
Sat, 19 Sep 2020 09:53:28 +0000 (11:53 +0200)
commit95ee0ba41f0c53fe651b9fc12d57b1eb62eea539
tree7eb796965332d79300de55d10d5b927d72152394
parent6a1926035bd5d0fb39ab3c7de7662cc552a5dc02
lima: fix vertex shader uniform buffer size

In some cases when switching shader programs, mesa does not switch the
currently set pipe_constant_buffer, which keeps pointing to the one
previously set.
If the two shader programs have a different number of uniforms, the size
of the constant buffer may be different and this needs to be considered
while generating the next draw command.
This patch fixes the uniform buffer creation in the lima vertex shader
command to avoid an out of bounds memcpy due to a previously set
pipe_constant_buffer.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6701>
src/gallium/drivers/lima/ir/gp/nir.c
src/gallium/drivers/lima/lima_context.h
src/gallium/drivers/lima/lima_draw.c