Mesa (master): ilo: use native 3-component vertex formats on GEN7.5+

Chia-I Wu olv at kemper.freedesktop.org
Thu Jul 24 07:34:49 UTC 2014


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

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Thu Jul 24 09:39:37 2014 +0800

ilo: use native 3-component vertex formats on GEN7.5+

GEN7.5 gains support for those formats natively.

---

 src/gallium/drivers/ilo/ilo_format.h   |    3 +++
 src/gallium/drivers/ilo/ilo_resource.c |    4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/ilo/ilo_format.h b/src/gallium/drivers/ilo/ilo_format.h
index 7d84c60..dfa682d 100644
--- a/src/gallium/drivers/ilo/ilo_format.h
+++ b/src/gallium/drivers/ilo/ilo_format.h
@@ -93,6 +93,9 @@ ilo_translate_format(const struct ilo_dev_info *dev,
       }
       break;
    case PIPE_BIND_VERTEX_BUFFER:
+      if (dev->gen >= ILO_GEN(7.5))
+         return ilo_translate_color_format(dev, format);
+
       /*
        * Some 3-component formats are not supported as vertex element formats.
        * But since we move between vertices using vb->stride, we should be
diff --git a/src/gallium/drivers/ilo/ilo_resource.c b/src/gallium/drivers/ilo/ilo_resource.c
index 359c635..04dcf8d 100644
--- a/src/gallium/drivers/ilo/ilo_resource.c
+++ b/src/gallium/drivers/ilo/ilo_resource.c
@@ -1419,6 +1419,7 @@ buf_destroy(struct ilo_buffer *buf)
 static struct pipe_resource *
 buf_create(struct pipe_screen *screen, const struct pipe_resource *templ)
 {
+   const struct ilo_screen *is = ilo_screen(screen);
    struct ilo_buffer *buf;
 
    buf = CALLOC_STRUCT(ilo_buffer);
@@ -1442,7 +1443,8 @@ buf_create(struct pipe_screen *screen, const struct pipe_resource *templ)
    if (templ->bind & PIPE_BIND_SAMPLER_VIEW)
       buf->bo_size = align(buf->bo_size, 256) + 16;
 
-   if (templ->bind & PIPE_BIND_VERTEX_BUFFER) {
+   if ((templ->bind & PIPE_BIND_VERTEX_BUFFER) &&
+        is->dev.gen < ILO_GEN(7.5)) {
       /*
        * As noted in ilo_translate_format(), we treat some 3-component formats
        * as 4-component formats to work around hardware limitations.  Imagine




More information about the mesa-commit mailing list