Mesa (master): st/mesa: add some debug code in st_choose_format()

Brian Paul brianp at kemper.freedesktop.org
Thu Jan 25 19:22:33 UTC 2018


Module: Mesa
Branch: master
Commit: 5092610f29b9e10d3835af8b4ed1ca13809657b5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5092610f29b9e10d3835af8b4ed1ca13809657b5

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Jan 11 11:53:02 2018 -0700

st/mesa: add some debug code in st_choose_format()

To aid in debugging gallium surface format selection issues.

Reviewed-by: Roland Scheidegger <sroland at vmware.com>

---

 src/mesa/state_tracker/st_format.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 3f7e55eed9..cc72ba406e 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -2128,8 +2128,9 @@ st_choose_format(struct st_context *st, GLenum internalFormat,
    pf = find_exact_format(internalFormat, format, type);
    if (pf != PIPE_FORMAT_NONE &&
        screen->is_format_supported(screen, pf,
-                                   target, sample_count, bindings))
-      return pf;
+                                   target, sample_count, bindings)) {
+      goto success;
+   }
 
    /* search table for internalFormat */
    for (i = 0; i < ARRAY_SIZE(format_map); i++) {
@@ -2139,15 +2140,27 @@ st_choose_format(struct st_context *st, GLenum internalFormat,
             /* Found the desired internal format.  Find first pipe format
              * which is supported by the driver.
              */
-            return find_supported_format(screen, mapping->pipeFormats,
-                                         target, sample_count, bindings,
-                                         allow_dxt);
+            pf = find_supported_format(screen, mapping->pipeFormats,
+                                       target, sample_count, bindings,
+                                       allow_dxt);
+            goto success;
          }
       }
    }
 
    _mesa_problem(NULL, "unhandled format!\n");
    return PIPE_FORMAT_NONE;
+
+success:
+   if (0) {
+      debug_printf("%s(fmt=%s, type=%s, intFmt=%s) = %s\n",
+                   __FUNCTION__,
+                   _mesa_enum_to_string(format),
+                   _mesa_enum_to_string(type),
+                   _mesa_enum_to_string(internalFormat),
+                   util_format_name(pf));
+   }
+   return pf;
 }
 
 




More information about the mesa-commit mailing list