<div dir="ltr"><div class="gmail_extra"><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" target="_blank">nroberts@igalia.com</a>><br>
<br>
The base vertex in Vulkan is different from GL in that for non-indexed<br>
primitives the value is taken from the firstVertex parameter instead<br>
of being set to zero. This coincides with the new SYSTEM_VALUE_FIRST_VERTEX<br>
instead of BASE_VERTEX.<br>
<br>
Reviewed-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com" target="_blank">ian.d.romanick@intel.com</a>><br>
---<br>
 src/compiler/spirv/vtn_variab<wbr>les.c |  2 +-<br>
 src/intel/vulkan/genX_cmd_buf<wbr>fer.c | 16 ++++++++++++----<br>
 src/intel/vulkan/genX_pipelin<wbr>e.c   |  2 ++<br>
 3 files changed, 15 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/vtn_varia<wbr>bles.c b/src/compiler/spirv/vtn_varia<wbr>bles.c<br>
index b2897407fb1..9bb7d5a575e 100644<br>
--- a/src/compiler/spirv/vtn_varia<wbr>bles.c<br>
+++ b/src/compiler/spirv/vtn_varia<wbr>bles.c<br>
@@ -1296,7 +1296,7 @@ vtn_get_builtin_location(struc<wbr>t vtn_builder *b,<br>
       set_mode_system_value(b, mode);<br>
       break;<br>
    case SpvBuiltInBaseVertex:<br>
-      *location = SYSTEM_VALUE_BASE_VERTEX;<br>
+      *location = SYSTEM_VALUE_FIRST_VERTEX;<br></blockquote><div><br></div><div>Given that we are taking something called BaseVertex and using the FIRST_VERTEX location when there is a location called BASE_VERTEX, I think a comment is in order.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
       set_mode_system_value(b, mode);<br>
       break;<br>
    case SpvBuiltInBaseInstance:<br>
diff --git a/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c b/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c<br>
index 3c703f6be44..7d190a4d5cf 100644<br>
--- a/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_bu<wbr>ffer.c<br>
@@ -2673,7 +2673,9 @@ void genX(CmdDraw)(<br>
<br>
    genX(cmd_buffer_flush_state)(c<wbr>md_buffer);<br>
<br>
-   if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstanc<wbr>e)<br>
+   if (vs_prog_data->uses_firstverte<wbr>x ||<br>
+       vs_prog_data->uses_basevertex ||<br>
+       vs_prog_data->uses_baseinstan<wbr>ce)<br></blockquote><div><br></div><div>I was going to ask if this was needed.  Then I saw patch 5.<br><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
       emit_base_vertex_instance(<wbr>cmd_buffer, firstVertex, firstInstance);<br>
    if (vs_prog_data->uses_drawid)<br>
       emit_draw_index(cmd_buffer, 0);<br>
@@ -2711,7 +2713,9 @@ void genX(CmdDrawIndexed)(<br>
<br>
    genX(cmd_buffer_flush_state)(c<wbr>md_buffer);<br>
<br>
-   if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstanc<wbr>e)<br>
+   if (vs_prog_data->uses_firstverte<wbr>x ||<br>
+       vs_prog_data->uses_basevertex ||<br>
+       vs_prog_data->uses_baseinstan<wbr>ce)<br>
       emit_base_vertex_instance(<wbr>cmd_buffer, vertexOffset, firstInstance);<br>
    if (vs_prog_data->uses_drawid)<br>
       emit_draw_index(cmd_buffer, 0);<br>
@@ -2850,7 +2854,9 @@ void genX(CmdDrawIndirect)(<br>
       struct anv_bo *bo = buffer->bo;<br>
       uint32_t bo_offset = buffer->offset + offset;<br>
<br>
-      if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstanc<wbr>e)<br>
+      if (vs_prog_data->uses_firstverte<wbr>x ||<br>
+          vs_prog_data->uses_basevertex ||<br>
+          vs_prog_data->uses_baseinstanc<wbr>e)<br>
          emit_base_vertex_instance_bo(c<wbr>md_buffer, bo, bo_offset + 8);<br>
       if (vs_prog_data->uses_drawid)<br>
          emit_draw_index(cmd_buffer, i);<br>
@@ -2889,7 +2895,9 @@ void genX(CmdDrawIndexedIndirect)(<br>
       uint32_t bo_offset = buffer->offset + offset;<br>
<br>
       /* TODO: We need to stomp base vertex to 0 somehow */<br>
-      if (vs_prog_data->uses_basevertex || vs_prog_data->uses_baseinstanc<wbr>e)<br>
+      if (vs_prog_data->uses_firstverte<wbr>x ||<br>
+          vs_prog_data->uses_basevertex ||<br>
+          vs_prog_data->uses_baseinstanc<wbr>e)<br>
          emit_base_vertex_instance_bo(c<wbr>md_buffer, bo, bo_offset + 12);<br>
       if (vs_prog_data->uses_drawid)<br>
          emit_draw_index(cmd_buffer, i);<br>
diff --git a/src/intel/vulkan/genX_pipeli<wbr>ne.c b/src/intel/vulkan/genX_pipeli<wbr>ne.c<br>
index eb2d4147357..a473f42c7e1 100644<br>
--- a/src/intel/vulkan/genX_pipeli<wbr>ne.c<br>
+++ b/src/intel/vulkan/genX_pipeli<wbr>ne.c<br>
@@ -98,6 +98,7 @@ emit_vertex_input(struct anv_pipeline *pipeline,<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_baseinstan<wbr>ce;<br>
<br>
    uint32_t elem_count = __builtin_popcount(elements) -<br>
@@ -178,6 +179,7 @@ emit_vertex_input(struct anv_pipeline *pipeline,<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>
                             vs_prog_data->uses_baseinstan<wbr>ce) ?<br>
                            VFCOMP_STORE_SRC : VFCOMP_STORE_0;<br>
<span class="m_5578902140959636086HOEnZb"><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" target="_blank">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></div>