From cc99c1c762e4db2990259eb51ebd0f5ba2974e2d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 2 Jun 2021 07:02:17 -0400 Subject: [PATCH] nouveau: explicitly advertise index buffer format support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Erik Faye-Lund Reviewed-by: Ilia Mirkin Reviewed-by: Marek Olšák Part-of: --- 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; }