nir: Offset vertex_id by first_vertex instead of base_vertex
base_vertex will be zero for non-indexed calls and in that case we need vertex_id to be offset by the ‘first’ parameter instead. That is what we get with first_vertex. This is true for both GL and Vulkan. The freedreno driver is also setting vertex_id_zero_based on nir_options. In order to avoid breakage this patch switches the relevant code to handle SYSTEM_VALUE_FIRST_VERTEX so that it can retain the same behavior. v2: change a3xx/fd3_emit.c and a4xx/fd4_emit.c from SYSTEM_VALUE_BASE_VERTEX to SYSTEM_VALUE_FIRST_VERTEX (Kenneth). Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Cc: Rob Clark <robdclark@gmail.com> Acked-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:

committed by
Ian Romanick

parent
c4f30a9100
commit
c366f422f0
@@ -2674,7 +2674,6 @@ void genX(CmdDraw)(
|
||||
genX(cmd_buffer_flush_state)(cmd_buffer);
|
||||
|
||||
if (vs_prog_data->uses_firstvertex ||
|
||||
vs_prog_data->uses_basevertex ||
|
||||
vs_prog_data->uses_baseinstance)
|
||||
emit_base_vertex_instance(cmd_buffer, firstVertex, firstInstance);
|
||||
if (vs_prog_data->uses_drawid)
|
||||
@@ -2714,7 +2713,6 @@ void genX(CmdDrawIndexed)(
|
||||
genX(cmd_buffer_flush_state)(cmd_buffer);
|
||||
|
||||
if (vs_prog_data->uses_firstvertex ||
|
||||
vs_prog_data->uses_basevertex ||
|
||||
vs_prog_data->uses_baseinstance)
|
||||
emit_base_vertex_instance(cmd_buffer, vertexOffset, firstInstance);
|
||||
if (vs_prog_data->uses_drawid)
|
||||
@@ -2855,7 +2853,6 @@ void genX(CmdDrawIndirect)(
|
||||
uint32_t bo_offset = buffer->offset + offset;
|
||||
|
||||
if (vs_prog_data->uses_firstvertex ||
|
||||
vs_prog_data->uses_basevertex ||
|
||||
vs_prog_data->uses_baseinstance)
|
||||
emit_base_vertex_instance_bo(cmd_buffer, bo, bo_offset + 8);
|
||||
if (vs_prog_data->uses_drawid)
|
||||
@@ -2896,7 +2893,6 @@ void genX(CmdDrawIndexedIndirect)(
|
||||
|
||||
/* TODO: We need to stomp base vertex to 0 somehow */
|
||||
if (vs_prog_data->uses_firstvertex ||
|
||||
vs_prog_data->uses_basevertex ||
|
||||
vs_prog_data->uses_baseinstance)
|
||||
emit_base_vertex_instance_bo(cmd_buffer, bo, bo_offset + 12);
|
||||
if (vs_prog_data->uses_drawid)
|
||||
|
Reference in New Issue
Block a user