radeonsi: fix gl_BaseVertex in non-indexed draws
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 12 Apr 2017 09:01:19 +0000 (11:01 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 13 Apr 2017 15:31:11 +0000 (17:31 +0200)
commit4f7e3fbb50f06ab523594a7ee4693b1a95c0e66a
tree0bc81842e95535939c26a3d8f45c6f99177aba15
parent472c84d1ad0ae9d3e7dbe469ae04e2efe65143fa
radeonsi: fix gl_BaseVertex in non-indexed draws

gl_BaseVertex is supposed to be 0 in non-indexed draws. Unfortunately, the
way they're implemented, the VGT always generates indices starting at 0,
and the VS prolog adds the start index.

There's a VGT_INDX_OFFSET register which causes the VGT to start at a
driver-defined index. However, this register cannot be written from
indirect draws.

So fix this unlikely case by setting a bit to tell the VS whether the
draw is indexed or not, so that gl_BaseVertex can be adjusted accordingly
when used.

Fixes a bug in
KHR-GL45.shader_draw_parameters_tests.ShaderMultiDrawArraysParameters.*

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_state_draw.c