Mesa (main): r600: Allow eight bit, three channel formats for vertex buffers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 2 12:45:56 UTC 2022


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

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Sun May  1 22:49:01 2022 +0200

r600: Allow eight bit, three channel formats for vertex buffers

While using three component texture formats results in CTs failures,
three component vertex attributes are fine, and not allowing them
results in significant performance regressisons.

Fixes: e41958e344cb4b15d01008140a1ee08817104334
   r600: Disable eight bit three channel formats

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6399

v2: rename function to is_buffer_format_supported (Emma)

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16267>

---

 src/gallium/drivers/r600/evergreen_state.c | 4 ++--
 src/gallium/drivers/r600/r600_formats.h    | 6 +++---
 src/gallium/drivers/r600/r600_state.c      | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index e3f80929b03..65a4fd8b3cc 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -273,7 +273,7 @@ bool evergreen_is_format_supported(struct pipe_screen *screen,
 
 	if (usage & PIPE_BIND_SAMPLER_VIEW) {
 		if (target == PIPE_BUFFER) {
-			if (r600_is_vertex_format_supported(format))
+			if (r600_is_buffer_format_supported(format, false))
 				retval |= PIPE_BIND_SAMPLER_VIEW;
 		} else {
 			if (r600_is_sampler_format_supported(screen, format))
@@ -303,7 +303,7 @@ bool evergreen_is_format_supported(struct pipe_screen *screen,
 	}
 
 	if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
-	    r600_is_vertex_format_supported(format)) {
+	    r600_is_buffer_format_supported(format, true)) {
 		retval |= PIPE_BIND_VERTEX_BUFFER;
 	}
 
diff --git a/src/gallium/drivers/r600/r600_formats.h b/src/gallium/drivers/r600/r600_formats.h
index 3ff12ddf8c7..c5899424c6c 100644
--- a/src/gallium/drivers/r600/r600_formats.h
+++ b/src/gallium/drivers/r600/r600_formats.h
@@ -82,7 +82,7 @@ static inline unsigned r600_endian_swap(unsigned size)
 	}
 }
 
-static inline bool r600_is_vertex_format_supported(enum pipe_format format)
+static inline bool r600_is_buffer_format_supported(enum pipe_format format, bool for_vbo)
 {
 	const struct util_format_description *desc = util_format_description(format);
 	unsigned i;
@@ -115,9 +115,9 @@ static inline bool r600_is_vertex_format_supported(enum pipe_format format)
 	     desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED))
 		return false;
 
-	/* No 8 bit 3 channel formats */
+    /* No 8 bit 3 channel formats for TBOs */
 	if (desc->channel[i].size == 8 && desc->nr_channels == 3)
-		return false;
+		return for_vbo;
 
 	return true;
 }
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 274978e5f85..144ef549be8 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -202,7 +202,7 @@ bool r600_is_format_supported(struct pipe_screen *screen,
 
 	if (usage & PIPE_BIND_SAMPLER_VIEW) {
 		if (target == PIPE_BUFFER) {
-			if (r600_is_vertex_format_supported(format))
+			if (r600_is_buffer_format_supported(format, false))
 				retval |= PIPE_BIND_SAMPLER_VIEW;
 		} else {
 			if (r600_is_sampler_format_supported(screen, format))
@@ -232,7 +232,7 @@ bool r600_is_format_supported(struct pipe_screen *screen,
 	}
 
 	if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
-	    r600_is_vertex_format_supported(format)) {
+	    r600_is_buffer_format_supported(format, true)) {
 		retval |= PIPE_BIND_VERTEX_BUFFER;
 	}
 



More information about the mesa-commit mailing list