st/mesa: Prefer R8 for bitmap textures

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>
This commit is contained in:
Dave Airlie 2018-10-04 02:41:26 +01:00 committed by Erik Faye-Lund
parent ad96c4987c
commit f92226931b
2 changed files with 3 additions and 8 deletions

View 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);

View 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);
}