Mesa (main): mesa/st: enable calling st_choose_format() purely for translation
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jul 28 17:31:53 UTC 2021
Module: Mesa
Branch: main
Commit: 25788721c1bc80bb1fea6178c1561c7e74d56118
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=25788721c1bc80bb1fea6178c1561c7e74d56118
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Apr 22 16:09:19 2021 -0400
mesa/st: enable calling st_choose_format() purely for translation
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11982>
---
src/mesa/state_tracker/st_format.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 0698f797c13..fe399561ceb 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -1084,7 +1084,7 @@ find_supported_format(struct pipe_screen *screen,
{
uint i;
for (i = 0; formats[i]; i++) {
- if (screen->is_format_supported(screen, formats[i], target,
+ if (!bindings || screen->is_format_supported(screen, formats[i], target,
sample_count, storage_sample_count,
bindings)) {
if (!allow_dxt && util_format_is_s3tc(formats[i])) {
@@ -1106,6 +1106,7 @@ find_supported_format(struct pipe_screen *screen,
* The bindings parameter typically has PIPE_BIND_SAMPLER_VIEW set, plus
* either PIPE_BINDING_RENDER_TARGET or PIPE_BINDING_DEPTH_STENCIL if
* we want render-to-texture ability.
+ * If bindings is zero, the driver doesn't need to support the returned format.
*
* \param internalFormat the user value passed to glTexImage2D
* \param target one of PIPE_TEXTURE_x
@@ -1144,8 +1145,8 @@ st_choose_format(struct st_context *st, GLenum internalFormat,
swap_bytes);
if (pf != PIPE_FORMAT_NONE &&
- screen->is_format_supported(screen, pf, target, sample_count,
- storage_sample_count, bindings) &&
+ (!bindings || screen->is_format_supported(screen, pf, target, sample_count,
+ storage_sample_count, bindings)) &&
_mesa_get_format_base_format(st_pipe_format_to_mesa_format(pf)) ==
internalFormat) {
goto success;
@@ -1263,7 +1264,7 @@ st_choose_matching_format(struct st_context *st, unsigned bind,
struct pipe_screen *screen = st->screen;
enum pipe_format pformat = st_choose_matching_format_noverify(st, format, type, swapBytes);
if (pformat != PIPE_FORMAT_NONE &&
- screen->is_format_supported(screen, pformat, PIPE_TEXTURE_2D, 0, 0, bind))
+ (!bind || screen->is_format_supported(screen, pformat, PIPE_TEXTURE_2D, 0, 0, bind)))
return pformat;
return PIPE_FORMAT_NONE;
More information about the mesa-commit
mailing list