ilo: avoid ilo_ib_state in genX_3DPRIMITIVE()
authorChia-I Wu <olvaffe@gmail.com>
Fri, 19 Jun 2015 16:34:29 +0000 (00:34 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Sat, 20 Jun 2015 03:18:30 +0000 (11:18 +0800)
ilo_ib_state is not in core.

src/gallium/drivers/ilo/core/ilo_builder_3d.h
src/gallium/drivers/ilo/ilo_render_gen.h

index 6cf1732ee1cd7a14c56678b4a6e006418502e8b5..8d8a79599bd77e72927f0f5a672377bd36b7f2ee 100644 (file)
 static inline void
 gen6_3DPRIMITIVE(struct ilo_builder *builder,
                  const struct pipe_draw_info *info,
-                 const struct ilo_ib_state *ib)
+                 int64_t start_offset)
 {
    const uint8_t cmd_len = 6;
    const int prim = gen6_3d_translate_pipe_prim(info->mode);
    const int vb_access = (info->indexed) ?
       GEN6_3DPRIM_DW0_ACCESS_RANDOM : GEN6_3DPRIM_DW0_ACCESS_SEQUENTIAL;
-   const uint32_t vb_start = info->start +
-      ((info->indexed) ? ib->draw_start_offset : 0);
    uint32_t *dw;
 
    ILO_DEV_ASSERT(builder->dev, 6, 6);
@@ -57,7 +55,7 @@ gen6_3DPRIMITIVE(struct ilo_builder *builder,
            prim << GEN6_3DPRIM_DW0_TYPE__SHIFT |
            (cmd_len - 2);
    dw[1] = info->count;
-   dw[2] = vb_start;
+   dw[2] = info->start + start_offset;
    dw[3] = info->instance_count;
    dw[4] = info->start_instance;
    dw[5] = info->index_bias;
@@ -66,14 +64,12 @@ gen6_3DPRIMITIVE(struct ilo_builder *builder,
 static inline void
 gen7_3DPRIMITIVE(struct ilo_builder *builder,
                  const struct pipe_draw_info *info,
-                 const struct ilo_ib_state *ib)
+                 int64_t start_offset)
 {
    const uint8_t cmd_len = 7;
    const int prim = gen6_3d_translate_pipe_prim(info->mode);
    const int vb_access = (info->indexed) ?
       GEN7_3DPRIM_DW1_ACCESS_RANDOM : GEN7_3DPRIM_DW1_ACCESS_SEQUENTIAL;
-   const uint32_t vb_start = info->start +
-      ((info->indexed) ? ib->draw_start_offset : 0);
    uint32_t *dw;
 
    ILO_DEV_ASSERT(builder->dev, 7, 8);
@@ -83,7 +79,7 @@ gen7_3DPRIMITIVE(struct ilo_builder *builder,
    dw[0] = GEN6_RENDER_CMD(3D, 3DPRIMITIVE) | (cmd_len - 2);
    dw[1] = vb_access | prim;
    dw[2] = info->count;
-   dw[3] = vb_start;
+   dw[3] = info->start + start_offset;
    dw[4] = info->instance_count;
    dw[5] = info->start_instance;
    dw[6] = info->index_bias;
index 6bbc0a8e3f1bd447805ef8e47e9f55c73c7b9bb7..00c8113a45d2b12e85c245540fc8318bb743fcbd 100644 (file)
@@ -389,6 +389,8 @@ ilo_render_3dprimitive(struct ilo_render *r,
                        const struct pipe_draw_info *info,
                        const struct ilo_ib_state *ib)
 {
+   const int64_t start_offset = (info->indexed) ? ib->draw_start_offset : 0;
+
    ILO_DEV_ASSERT(r->dev, 6, 8);
 
    if (r->state.deferred_pipe_control_dw1)
@@ -396,9 +398,9 @@ ilo_render_3dprimitive(struct ilo_render *r,
 
    /* 3DPRIMITIVE */
    if (ilo_dev_gen(r->dev) >= ILO_GEN(7))
-      gen7_3DPRIMITIVE(r->builder, info, ib);
+      gen7_3DPRIMITIVE(r->builder, info, start_offset);
    else
-      gen6_3DPRIMITIVE(r->builder, info, ib);
+      gen6_3DPRIMITIVE(r->builder, info, start_offset);
 
    r->state.current_pipe_control_dw1 = 0;
    assert(!r->state.deferred_pipe_control_dw1);