Mesa (master): nvc0: force vertex data through FIFO if we need to convert it

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Wed Feb 16 14:48:35 UTC 2011


Module: Mesa
Branch: master
Commit: 17d680cc537acf8a967d9e36f7006afab560122a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=17d680cc537acf8a967d9e36f7006afab560122a

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Sat Feb 12 19:18:19 2011 +0100

nvc0: force vertex data through FIFO if we need to convert it

We may want to put the converted vertex buffer in persistent
storage instead, but these are rare corner cases.

---

 src/gallium/drivers/nvc0/nvc0_stateobj.h |    1 +
 src/gallium/drivers/nvc0/nvc0_vbo.c      |    9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/nvc0/nvc0_stateobj.h b/src/gallium/drivers/nvc0/nvc0_stateobj.h
index 752e927..5b15e28 100644
--- a/src/gallium/drivers/nvc0/nvc0_stateobj.h
+++ b/src/gallium/drivers/nvc0/nvc0_stateobj.h
@@ -67,6 +67,7 @@ struct nvc0_vertex_stateobj {
    unsigned num_elements;
    uint32_t instance_elts;
    uint32_t instance_bufs;
+   boolean need_conversion; /* e.g. VFETCH cannot convert f64 to f32 */
    unsigned vtx_size;
    unsigned vtx_per_packet_max;
    struct nvc0_vertex_element element[0];
diff --git a/src/gallium/drivers/nvc0/nvc0_vbo.c b/src/gallium/drivers/nvc0/nvc0_vbo.c
index fb13572..19fd852 100644
--- a/src/gallium/drivers/nvc0/nvc0_vbo.c
+++ b/src/gallium/drivers/nvc0/nvc0_vbo.c
@@ -60,6 +60,7 @@ nvc0_vertex_state_create(struct pipe_context *pipe,
     so->num_elements = num_elements;
     so->instance_elts = 0;
     so->instance_bufs = 0;
+    so->need_conversion = FALSE;
 
     transkey.nr_elements = 0;
     transkey.output_stride = 0;
@@ -83,6 +84,7 @@ nvc0_vertex_state_create(struct pipe_context *pipe,
                 return NULL;
             }
             so->element[i].state = nvc0_format_table[fmt].vtx;
+            so->need_conversion = TRUE;
         }
         so->element[i].state |= i;
 
@@ -263,7 +265,12 @@ nvc0_vertex_arrays_validate(struct nvc0_context *nvc0)
    struct nvc0_vertex_element *ve;
    unsigned i;
 
-   nvc0_prevalidate_vbufs(nvc0);
+   if (unlikely(vertex->need_conversion)) {
+      nvc0->vbo_fifo = ~0;
+      nvc0->vbo_user = 0;
+   } else {
+      nvc0_prevalidate_vbufs(nvc0);
+   }
 
    BEGIN_RING(chan, RING_3D(VERTEX_ATTRIB_FORMAT(0)), vertex->num_elements);
    for (i = 0; i < vertex->num_elements; ++i) {




More information about the mesa-commit mailing list