Mesa (main): nouveau: explicitly advertise index buffer format support

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 4 18:08:39 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Jun  2 07:02:17 2021 -0400

nouveau: explicitly advertise index buffer format support

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11132>

---

 src/gallium/drivers/nouveau/nv30/nv30_screen.c | 8 ++++++++
 src/gallium/drivers/nouveau/nv50/nv50_screen.c | 8 ++++++++
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 8 ++++++++
 3 files changed, 24 insertions(+)

diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index ddc0ced1244..cc2859384f7 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -463,6 +463,14 @@ nv30_screen_is_format_supported(struct pipe_screen *pscreen,
    /* shared is always supported */
    bindings &= ~PIPE_BIND_SHARED;
 
+   if (bindings & PIPE_BIND_INDEX_BUFFER) {
+      if (format != PIPE_FORMAT_R8_UINT &&
+          format != PIPE_FORMAT_R16_UINT &&
+          format != PIPE_FORMAT_R32_UINT)
+         return false;
+      bindings &= ~PIPE_BIND_INDEX_BUFFER;
+   }
+
    return (nv30_format_info(pscreen, format)->bindings & bindings) == bindings;
 }
 
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index 7948a6d37cc..b23602152f9 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -88,6 +88,14 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
    bindings &= ~(PIPE_BIND_LINEAR |
                  PIPE_BIND_SHARED);
 
+   if (bindings & PIPE_BIND_INDEX_BUFFER) {
+      if (format != PIPE_FORMAT_R8_UINT &&
+          format != PIPE_FORMAT_R16_UINT &&
+          format != PIPE_FORMAT_R32_UINT)
+         return false;
+      bindings &= ~PIPE_BIND_INDEX_BUFFER;
+   }
+
    return (( nv50_format_table[format].usage |
             nv50_vertex_format[format].usage) & bindings) == bindings;
 }
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 0c95332a933..d1e901c4820 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -99,6 +99,14 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen,
       }
    }
 
+   if (bindings & PIPE_BIND_INDEX_BUFFER) {
+      if (format != PIPE_FORMAT_R8_UINT &&
+          format != PIPE_FORMAT_R16_UINT &&
+          format != PIPE_FORMAT_R32_UINT)
+         return false;
+      bindings &= ~PIPE_BIND_INDEX_BUFFER;
+   }
+
    return (( nvc0_format_table[format].usage |
             nvc0_vertex_format[format].usage) & bindings) == bindings;
 }



More information about the mesa-commit mailing list