Mesa (staging/22.0): r600: Allow eight bit, three channel formats for vertex buffers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 2 17:43:46 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: 9a3b3531c37029589c043aeb36407cf2494f3151
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a3b3531c37029589c043aeb36407cf2494f3151

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>
(cherry picked from commit 4a2ff9eb86acdc0b5cc35ca2c2f6ec5cfe9671a9)

---

 .pick_status.json                          | 2 +-
 src/gallium/drivers/r600/evergreen_state.c | 4 ++--
 src/gallium/drivers/r600/r600_formats.h    | 6 +++---
 src/gallium/drivers/r600/r600_state.c      | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 8ccf3beeed8..d01498a3f10 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -236,7 +236,7 @@
         "description": "r600: Allow eight bit, three channel formats for vertex buffers",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "because_sha": "e41958e344cb4b15d01008140a1ee08817104334"
     },
     {
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index e4716817f30..264fe2bd1ea 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 99b195b557f..3b56fe60eae 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