From f92226931b90c005eace6dd9cb675c83b1e58cb0 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 4 Oct 2018 02:41:26 +0100 Subject: [PATCH] st/mesa: Prefer R8 for bitmap textures MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/mesa/state_tracker/st_cb_bitmap.c | 9 ++------- src/mesa/state_tracker/st_program.c | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index d3b7353fb72..676fb12be55 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -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); diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index f3143cef95c..3c9597e1c6f 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -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); } -- 2.30.2