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

Author: Brian Paul <bri...@vmware.com>
Date:   Mon Apr  1 16:44:50 2013 -0600

gallium/hud: try L8 texture for font if I8 format isn't supported

---

 src/gallium/auxiliary/hud/font.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/hud/font.c b/src/gallium/auxiliary/hud/font.c
index 5c4a4d0..6747874 100644
--- a/src/gallium/auxiliary/hud/font.c
+++ b/src/gallium/auxiliary/hud/font.c
@@ -377,17 +377,26 @@ util_font_create_fixed_8x13(struct pipe_context *pipe,
    struct pipe_resource tex_templ, *tex;
    struct pipe_transfer *transfer = NULL;
    char *map;
+   enum pipe_format tex_format;
    int i;
 
-   if (!screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM,
-                                    PIPE_TEXTURE_RECT, 0,
-                                    PIPE_BIND_SAMPLER_VIEW)) {
+   if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM,
+                                   PIPE_TEXTURE_RECT, 0,
+                                   PIPE_BIND_SAMPLER_VIEW)) {
+      tex_format = PIPE_FORMAT_I8_UNORM;
+   }
+   else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM,
+                                   PIPE_TEXTURE_RECT, 0,
+                                   PIPE_BIND_SAMPLER_VIEW)) {
+      tex_format = PIPE_FORMAT_L8_UNORM;
+   }
+   else {
       return FALSE;
    }
 
    memset(&tex_templ, 0, sizeof(tex_templ));
    tex_templ.target = PIPE_TEXTURE_RECT;
-   tex_templ.format = PIPE_FORMAT_I8_UNORM;
+   tex_templ.format = tex_format;
    tex_templ.width0 = 128;
    tex_templ.height0 = 256;
    tex_templ.depth0 = 1;

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to