Mesa (9.1): nv50: handle pure integer vertex attributes

Carl Worth cworth at kemper.freedesktop.org
Thu Oct 3 05:00:10 UTC 2013


Module: Mesa
Branch: 9.1
Commit: 7b4b012c497fc52ae71fde516484f4fb4b6b30dc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b4b012c497fc52ae71fde516484f4fb4b6b30dc

Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Fri Jun 21 18:04:55 2013 +0100

nv50: handle pure integer vertex attributes

And as a side effect fix a crash in the following piglit test:
general/attribs GL3

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
Cc: "9.2 and 9.1" mesa-stable at lists.freedesktop.org
(cherry picked from commit 07c8f7a6f8dfe724c1ae92ec45dd04532b6fd453)

---

 src/gallium/drivers/nv30/nv30_vbo.c |    4 +++-
 src/gallium/drivers/nv50/nv50_vbo.c |   12 +++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c
index 128457f..0c0d021 100644
--- a/src/gallium/drivers/nv30/nv30_vbo.c
+++ b/src/gallium/drivers/nv30/nv30_vbo.c
@@ -40,13 +40,15 @@ nv30_emit_vtxattr(struct nv30_context *nv30, struct pipe_vertex_buffer *vb,
    const unsigned nc = util_format_get_nr_components(ve->src_format);
    struct nouveau_pushbuf *push = nv30->base.pushbuf;
    struct nv04_resource *res = nv04_resource(vb->buffer);
+   const struct util_format_description *desc =
+      util_format_description(ve->src_format);
    const void *data;
    float v[4];
 
    data = nouveau_resource_map_offset(&nv30->base, res, vb->buffer_offset +
                                       ve->src_offset, NOUVEAU_BO_RD);
 
-   util_format_read_4f(ve->src_format, v, 0, data, 0, 0, 0, 1, 1);
+   desc->unpack_rgba_float(v, 0, data, 0, 1, 1);
 
    switch (nc) {
    case 4:
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index 6e81b7b..f66a866 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -139,10 +139,20 @@ nv50_emit_vtxattr(struct nv50_context *nv50, struct pipe_vertex_buffer *vb,
    const void *data = (const uint8_t *)vb->user_buffer + ve->src_offset;
    float v[4];
    const unsigned nc = util_format_get_nr_components(ve->src_format);
+   const struct util_format_description *desc =
+      util_format_description(ve->src_format);
 
    assert(vb->user_buffer);
 
-   util_format_read_4f(ve->src_format, v, 0, data, 0, 0, 0, 1, 1);
+   if (desc->channel[0].pure_integer) {
+      if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) {
+         desc->unpack_rgba_sint((int32_t *)v, 0, data, 0, 1, 1);
+      } else {
+         desc->unpack_rgba_uint((uint32_t *)v, 0, data, 0, 1, 1);
+      }
+   } else {
+      desc->unpack_rgba_float(v, 0, data, 0, 1, 1);
+   }
 
    switch (nc) {
    case 4:




More information about the mesa-commit mailing list