st/mesa: Prefer R8 for bitmap textures
authorDave Airlie <airlied@redhat.com>
Thu, 4 Oct 2018 01:41:26 +0000 (02:41 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 9 Oct 2019 07:56:00 +0000 (09:56 +0200)
If it's not available, we fall back to A8. This should work on all drivers,
because we depend on it in the display-list code already.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_cb_bitmap.c
src/mesa/state_tracker/st_program.c

index d3b7353fb72e9a03a27555612926bfad20f6eb90..676fb12be55a942d6a17f5bc2cf02144b66370af 100644 (file)
@@ -564,21 +564,16 @@ init_bitmap_state(struct st_context *st)
    st->bitmap.rasterizer.depth_clip_far = 1;
 
    /* find a usable texture format */
-   if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM,
+   if (screen->is_format_supported(screen, PIPE_FORMAT_R8_UNORM,
                                    st->internal_target, 0, 0,
                                    PIPE_BIND_SAMPLER_VIEW)) {
-      st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM;
+      st->bitmap.tex_format = PIPE_FORMAT_R8_UNORM;
    }
    else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM,
                                         st->internal_target, 0, 0,
                                         PIPE_BIND_SAMPLER_VIEW)) {
       st->bitmap.tex_format = PIPE_FORMAT_A8_UNORM;
    }
-   else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM,
-                                        st->internal_target, 0, 0,
-                                        PIPE_BIND_SAMPLER_VIEW)) {
-      st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM;
-   }
    else {
       /* XXX support more formats */
       assert(0);
index f3143cef95c14f5d1f984a14cec426cdd1ce1c7a..3c9597e1c6f8c10052025aed3a94a75aa587a098 100644 (file)
@@ -1183,7 +1183,7 @@ st_create_fp_variant(struct st_context *st,
 
          variant->bitmap_sampler = ffs(~stfp->Base.SamplersUsed) - 1;
          options.sampler = variant->bitmap_sampler;
-         options.swizzle_xxxx = (st->bitmap.tex_format == PIPE_FORMAT_L8_UNORM);
+         options.swizzle_xxxx = st->bitmap.tex_format == PIPE_FORMAT_R8_UNORM;
 
          NIR_PASS_V(tgsi.ir.nir, nir_lower_bitmap, &options);
       }