[Mesa-dev] [PATCH 02/14] i965: Reduce scope of vertex access type

Topi Pohjolainen topi.pohjolainen at intel.com
Thu Feb 25 09:46:07 UTC 2016


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_draw.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 323253e..c8a083c 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -185,7 +185,6 @@ brw_emit_prim(struct brw_context *brw,
               uint32_t hw_prim)
 {
    int verts_per_instance;
-   int vertex_access_type;
 
    DBG("PRIM: %s %d %d\n", _mesa_enum_to_string(prim->mode),
        prim->start, prim->count);
@@ -194,15 +193,9 @@ brw_emit_prim(struct brw_context *brw,
    int base_vertex_location = prim->basevertex;
 
    if (prim->indexed) {
-      vertex_access_type = brw->gen >= 7 ?
-         GEN7_3DPRIM_VERTEXBUFFER_ACCESS_RANDOM :
-         GEN4_3DPRIM_VERTEXBUFFER_ACCESS_RANDOM;
       start_vertex_location += brw->ib.start_vertex_offset;
       base_vertex_location += brw->vb.start_vertex_bias;
    } else {
-      vertex_access_type = brw->gen >= 7 ?
-         GEN7_3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL :
-         GEN4_3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL;
       start_vertex_location += brw->vb.start_vertex_bias;
    }
 
@@ -268,10 +261,16 @@ brw_emit_prim(struct brw_context *brw,
          ? GEN7_3DPRIM_PREDICATE_ENABLE : 0;
       const int indirect_flag = 
          prim->is_indirect ? GEN7_3DPRIM_INDIRECT_PARAMETER_ENABLE : 0;
+      const int vertex_access_type = prim->indexed ?
+         GEN7_3DPRIM_VERTEXBUFFER_ACCESS_RANDOM :
+         GEN7_3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL;
 
       OUT_BATCH(CMD_3D_PRIM << 16 | (7 - 2) | indirect_flag | predicate_enable);
       OUT_BATCH(hw_prim | vertex_access_type);
    } else {
+      const int vertex_access_type = prim->indexed ?
+         GEN4_3DPRIM_VERTEXBUFFER_ACCESS_RANDOM :
+         GEN4_3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL;
       OUT_BATCH(CMD_3D_PRIM << 16 | (6 - 2) |
                 hw_prim << GEN4_3DPRIM_TOPOLOGY_TYPE_SHIFT |
                 vertex_access_type);
-- 
2.5.0



More information about the mesa-dev mailing list