[PATCH 04/19] etnaviv: Emit SCALE for vertex attributes

Wladimir J. van der Laan laanwj at gmail.com
Mon Oct 30 16:16:50 UTC 2017


This is used by HALTI2+ (GC3000+) when drawing with DRAW_INSTANCED.

It is also necessary when switching between integer and floating point
vertex element formats.

Signed-off-by: Wladimir J. van der Laan <laanwj at gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_emit.c     | 5 +++++
 src/gallium/drivers/etnaviv/etnaviv_internal.h | 1 +
 src/gallium/drivers/etnaviv/etnaviv_state.c    | 1 +
 3 files changed, 7 insertions(+)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c b/src/gallium/drivers/etnaviv/etnaviv_emit.c
index 707b1e7..6f7ce68 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
@@ -341,6 +341,11 @@ etna_emit_state(struct etna_context *ctx)
       /*00600*/ etna_set_state_multi(stream, VIVS_FE_VERTEX_ELEMENT_CONFIG(0),
          ctx->vertex_elements->num_elements,
          ctx->vertex_elements->FE_VERTEX_ELEMENT_CONFIG);
+      if (ctx->specs.halti >= 2) {
+         /*00780*/ etna_set_state_multi(stream, VIVS_FE_GENERIC_ATTRIB_SCALE(0),
+            ctx->vertex_elements->num_elements,
+            ctx->vertex_elements->NFE_GENERIC_ATTRIB_SCALE);
+      }
    }
 
    /* The following code is originally generated by gen_merge_state.py, to
diff --git a/src/gallium/drivers/etnaviv/etnaviv_internal.h b/src/gallium/drivers/etnaviv/etnaviv_internal.h
index 22264ec..92ae1bf 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_internal.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_internal.h
@@ -214,6 +214,7 @@ struct compiled_framebuffer_state {
 struct compiled_vertex_elements_state {
    unsigned num_elements;
    uint32_t FE_VERTEX_ELEMENT_CONFIG[VIVS_FE_VERTEX_ELEMENT_CONFIG__LEN];
+   uint32_t NFE_GENERIC_ATTRIB_SCALE[VIVS_NFE_GENERIC_ATTRIB__LEN];
 };
 
 /* Compiled context->set_vertex_buffer result */
diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c
index a8b3141..b2feb32 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_state.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_state.c
@@ -550,6 +550,7 @@ etna_vertex_elements_state_create(struct pipe_context *pctx,
          VIVS_FE_VERTEX_ELEMENT_CONFIG_STREAM(elements[idx].vertex_buffer_index) |
          VIVS_FE_VERTEX_ELEMENT_CONFIG_START(elements[idx].src_offset) |
          VIVS_FE_VERTEX_ELEMENT_CONFIG_END(end_offset - start_offset);
+      cs->NFE_GENERIC_ATTRIB_SCALE[idx] = 0x3f800000; /* 1 for integer, 1.0 for float */
    }
 
    return cs;
-- 
2.7.4



More information about the etnaviv mailing list