<div dir="ltr"><div><div>The first 5 are<br><br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br><br></div>I meant to just skim and ACK the Vulkan bits but then I did a full review.  Oh, well. :-)<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 6, 2018 at 2:53 PM, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Neil Roberts <<a href="mailto:nroberts@igalia.com">nroberts@igalia.com</a>><br>
<br>
base_vertex will be zero for non-indexed calls and in that case we<br>
need vertex_id to be offset by the ‘first’ parameter instead. That is<br>
what we get with first_vertex. This is true for both GL and Vulkan.<br>
<br>
The freedreno driver is also setting vertex_id_zero_based on<br>
nir_options. In order to avoid breakage this patch switches the<br>
relevant code to handle SYSTEM_VALUE_FIRST_VERTEX so that it can<br>
retain the same behavior.<br>
<br>
v2: change a3xx/fd3_emit.c and a4xx/fd4_emit.c from<br>
SYSTEM_VALUE_BASE_VERTEX to SYSTEM_VALUE_FIRST_VERTEX (Kenneth).<br>
<br>
Reviewed-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
Cc: Rob Clark <<a href="mailto:robdclark@gmail.com">robdclark@gmail.com</a>><br>
Acked-by: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br>
---<br>
 src/compiler/nir/nir_lower_<wbr>system_values.c           | 2 +-<br>
 src/gallium/drivers/freedreno/<wbr>a3xx/fd3_emit.c        | 2 +-<br>
 src/gallium/drivers/freedreno/<wbr>a4xx/fd4_emit.c        | 2 +-<br>
 src/gallium/drivers/freedreno/<wbr>ir3/ir3_compiler_nir.c | 5 ++---<br>
 src/intel/vulkan/genX_cmd_<wbr>buffer.c                   | 4 ----<br>
 src/intel/vulkan/genX_<wbr>pipeline.c                     | 4 +---<br>
 6 files changed, 6 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_lower_<wbr>system_values.c b/src/compiler/nir/nir_lower_<wbr>system_values.c<br>
index fb560ee21bb..96643793a70 100644<br>
--- a/src/compiler/nir/nir_lower_<wbr>system_values.c<br>
+++ b/src/compiler/nir/nir_lower_<wbr>system_values.c<br>
@@ -105,7 +105,7 @@ convert_block(nir_block *block, nir_builder *b)<br>
          if (b->shader->options->vertex_<wbr>id_zero_based) {<br>
             sysval = nir_iadd(b,<br>
                               nir_load_vertex_id_zero_base(<wbr>b),<br>
-                              nir_load_base_vertex(b));<br>
+                              nir_load_first_vertex(b));<br>
          } else {<br>
             sysval = nir_load_vertex_id(b);<br>
          }<br>
diff --git a/src/gallium/drivers/<wbr>freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/<wbr>freedreno/a3xx/fd3_emit.c<br>
index b9e1af00e2c..3419ba86d46 100644<br>
--- a/src/gallium/drivers/<wbr>freedreno/a3xx/fd3_emit.c<br>
+++ b/src/gallium/drivers/<wbr>freedreno/a3xx/fd3_emit.c<br>
@@ -374,7 +374,7 @@ fd3_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd3_emit *emit)<br>
                        continue;<br>
                if (vp->inputs[i].sysval) {<br>
                        switch(vp->inputs[i].slot) {<br>
-                       case SYSTEM_VALUE_BASE_VERTEX:<br>
+                       case SYSTEM_VALUE_FIRST_VERTEX:<br>
                                /* handled elsewhere */<br>
                                break;<br>
                        case SYSTEM_VALUE_VERTEX_ID_ZERO_<wbr>BASE:<br>
diff --git a/src/gallium/drivers/<wbr>freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/<wbr>freedreno/a4xx/fd4_emit.c<br>
index 5fec2b6b08a..42268ceea71 100644<br>
--- a/src/gallium/drivers/<wbr>freedreno/a4xx/fd4_emit.c<br>
+++ b/src/gallium/drivers/<wbr>freedreno/a4xx/fd4_emit.c<br>
@@ -378,7 +378,7 @@ fd4_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd4_emit *emit)<br>
                        continue;<br>
                if (vp->inputs[i].sysval) {<br>
                        switch(vp->inputs[i].slot) {<br>
-                       case SYSTEM_VALUE_BASE_VERTEX:<br>
+                       case SYSTEM_VALUE_FIRST_VERTEX:<br>
                                /* handled elsewhere */<br>
                                break;<br>
                        case SYSTEM_VALUE_VERTEX_ID_ZERO_<wbr>BASE:<br>
diff --git a/src/gallium/drivers/<wbr>freedreno/ir3/ir3_compiler_<wbr>nir.c b/src/gallium/drivers/<wbr>freedreno/ir3/ir3_compiler_<wbr>nir.c<br>
index 174141b7fec..356d1bc44ee 100644<br>
--- a/src/gallium/drivers/<wbr>freedreno/ir3/ir3_compiler_<wbr>nir.c<br>
+++ b/src/gallium/drivers/<wbr>freedreno/ir3/ir3_compiler_<wbr>nir.c<br>
@@ -2182,11 +2182,10 @@ emit_intrinsic(struct ir3_context *ctx, nir_intrinsic_instr *intr)<br>
                        ctx->ir->outputs[n] = src[i];<br>
                }<br>
                break;<br>
-       case nir_intrinsic_load_base_<wbr>vertex:<br>
+       case nir_intrinsic_load_first_<wbr>vertex:<br>
                if (!ctx->basevertex) {<br>
                        ctx->basevertex = create_driver_param(ctx, IR3_DP_VTXID_BASE);<br>
-                       add_sysval_input(ctx, SYSTEM_VALUE_BASE_VERTEX,<br>
-                                       ctx->basevertex);<br>
+                       add_sysval_input(ctx, SYSTEM_VALUE_FIRST_VERTEX, ctx->basevertex);<br>
                }<br>
                dst[0] = ctx->basevertex;<br>
                break;<br>
diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
index 7d190a4d5cf..e945c46dac2 100644<br>
--- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
@@ -2674,7 +2674,6 @@ void genX(CmdDraw)(<br>
    genX(cmd_buffer_flush_state)(<wbr>cmd_buffer);<br>
<br>
    if (vs_prog_data->uses_<wbr>firstvertex ||<br>
-       vs_prog_data->uses_basevertex ||<br>
        vs_prog_data->uses_<wbr>baseinstance)<br>
       emit_base_vertex_instance(cmd_<wbr>buffer, firstVertex, firstInstance);<br>
    if (vs_prog_data->uses_drawid)<br>
@@ -2714,7 +2713,6 @@ void genX(CmdDrawIndexed)(<br>
    genX(cmd_buffer_flush_state)(<wbr>cmd_buffer);<br>
<br>
    if (vs_prog_data->uses_<wbr>firstvertex ||<br>
-       vs_prog_data->uses_basevertex ||<br>
        vs_prog_data->uses_<wbr>baseinstance)<br>
       emit_base_vertex_instance(cmd_<wbr>buffer, vertexOffset, firstInstance);<br>
    if (vs_prog_data->uses_drawid)<br>
@@ -2855,7 +2853,6 @@ void genX(CmdDrawIndirect)(<br>
       uint32_t bo_offset = buffer->offset + offset;<br>
<br>
       if (vs_prog_data->uses_<wbr>firstvertex ||<br>
-          vs_prog_data->uses_basevertex ||<br>
           vs_prog_data->uses_<wbr>baseinstance)<br>
          emit_base_vertex_instance_bo(<wbr>cmd_buffer, bo, bo_offset + 8);<br>
       if (vs_prog_data->uses_drawid)<br>
@@ -2896,7 +2893,6 @@ void genX(CmdDrawIndexedIndirect)(<br>
<br>
       /* TODO: We need to stomp base vertex to 0 somehow */<br>
       if (vs_prog_data->uses_<wbr>firstvertex ||<br>
-          vs_prog_data->uses_basevertex ||<br>
           vs_prog_data->uses_<wbr>baseinstance)<br>
          emit_base_vertex_instance_bo(<wbr>cmd_buffer, bo, bo_offset + 12);<br>
       if (vs_prog_data->uses_drawid)<br>
diff --git a/src/intel/vulkan/genX_<wbr>pipeline.c b/src/intel/vulkan/genX_<wbr>pipeline.c<br>
index a473f42c7e1..d3af9304ba3 100644<br>
--- a/src/intel/vulkan/genX_<wbr>pipeline.c<br>
+++ b/src/intel/vulkan/genX_<wbr>pipeline.c<br>
@@ -97,7 +97,6 @@ emit_vertex_input(struct anv_pipeline *pipeline,<br>
    const uint32_t elements_double = double_inputs_read >> VERT_ATTRIB_GENERIC0;<br>
    const bool needs_svgs_elem = vs_prog_data->uses_vertexid ||<br>
                                 vs_prog_data->uses_instanceid ||<br>
-                                vs_prog_data->uses_basevertex ||<br>
                                 vs_prog_data->uses_firstvertex ||<br>
                                 vs_prog_data->uses_<wbr>baseinstance;<br>
<br>
@@ -178,8 +177,7 @@ emit_vertex_input(struct anv_pipeline *pipeline,<br>
        * This means, that if we have BaseInstance, we need BaseVertex as<br>
        * well.  Just do all or nothing.<br>
        */<br>
-      uint32_t base_ctrl = (vs_prog_data->uses_basevertex ||<br>
-                            vs_prog_data->uses_firstvertex ||<br>
+      uint32_t base_ctrl = (vs_prog_data->uses_<wbr>firstvertex ||<br>
                             vs_prog_data->uses_<wbr>baseinstance) ?<br>
                            VFCOMP_STORE_SRC : VFCOMP_STORE_0;<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.14.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>