etnaviv: Emit SCALE for vertex attributes
authorWladimir J. van der Laan <laanwj@gmail.com>
Sat, 18 Nov 2017 09:44:26 +0000 (10:44 +0100)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Thu, 30 Nov 2017 06:26:46 +0000 (07:26 +0100)
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@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
src/gallium/drivers/etnaviv/etnaviv_emit.c
src/gallium/drivers/etnaviv/etnaviv_internal.h
src/gallium/drivers/etnaviv/etnaviv_state.c

index 41504ac41fe45a156ed4b657c6c8a87ef6986247..c24831c88bd585f17ef485872e5d4fcf45ee913d 100644 (file)
@@ -350,6 +350,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
index 48dd5bf324aa4fa00b9430eeafae6c1b17d2f7ed..6375ae0428f4d8c677181eb45585bd5312bfd33a 100644 (file)
@@ -216,6 +216,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 */
index 004e3cd132dcb051709d62b2fa79248789278b97..1e0b7548a48b990139891fd5dae3ebdd8b40afdb 100644 (file)
@@ -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;