r100/r200: factor out txformat/txfilter setup from the TFP path.

No matter what, we deref the texFormat from the table, except for a
mistake in cpp=4 where we pulled a 0 out of the table either way.

v2: Rebase on dropping r200 table deduplication patch.

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
This commit is contained in:
Eric Anholt 2019-09-05 15:48:58 -07:00
parent 7ceafa4b40
commit ecddabfa76
2 changed files with 10 additions and 22 deletions

View file

@ -691,29 +691,23 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format
pitch_val = rb->pitch;
switch (rb->cpp) {
case 4:
if (texture_format == __DRI_TEXTURE_FORMAT_RGB) {
if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
texFormat = MESA_FORMAT_BGR_UNORM8;
t->pp_txformat = tx_table_le[MESA_FORMAT_BGR_UNORM8].format;
}
else {
else
texFormat = MESA_FORMAT_B8G8R8A8_UNORM;
t->pp_txformat = tx_table_le[MESA_FORMAT_B8G8R8A8_UNORM].format;
}
t->pp_txfilter |= tx_table_le[MESA_FORMAT_B8G8R8A8_UNORM].filter;
break;
case 3:
default:
texFormat = MESA_FORMAT_BGR_UNORM8;
t->pp_txformat = tx_table_le[MESA_FORMAT_BGR_UNORM8].format;
t->pp_txfilter |= tx_table_le[MESA_FORMAT_BGR_UNORM8].filter;
break;
case 2:
texFormat = MESA_FORMAT_B5G6R5_UNORM;
t->pp_txformat = tx_table_le[MESA_FORMAT_B5G6R5_UNORM].format;
t->pp_txfilter |= tx_table_le[MESA_FORMAT_B5G6R5_UNORM].filter;
break;
}
t->pp_txformat = tx_table_le[texFormat].format;
t->pp_txfilter |= tx_table_le[texFormat].filter;
_mesa_init_teximage_fields(&radeon->glCtx, texImage,
rb->base.Base.Width, rb->base.Base.Height,
1, 0,

View file

@ -597,29 +597,23 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_form
t->override_offset = 0;
switch (rb->cpp) {
case 4:
if (texture_format == __DRI_TEXTURE_FORMAT_RGB) {
t->pp_txformat = tx_table[MESA_FORMAT_BGR_UNORM8].format;
if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
texFormat = MESA_FORMAT_BGR_UNORM8;
}
else {
t->pp_txformat = tx_table[MESA_FORMAT_B8G8R8A8_UNORM].format;
else
texFormat = MESA_FORMAT_B8G8R8A8_UNORM;
}
t->pp_txfilter |= tx_table[MESA_FORMAT_B8G8R8A8_UNORM].filter;
break;
case 3:
default:
texFormat = MESA_FORMAT_BGR_UNORM8;
t->pp_txformat = tx_table[MESA_FORMAT_BGR_UNORM8].format;
t->pp_txfilter |= tx_table[MESA_FORMAT_BGR_UNORM8].filter;
break;
case 2:
texFormat = MESA_FORMAT_B5G6R5_UNORM;
t->pp_txformat = tx_table[MESA_FORMAT_B5G6R5_UNORM].format;
t->pp_txfilter |= tx_table[MESA_FORMAT_B5G6R5_UNORM].filter;
break;
}
t->pp_txformat = tx_table[texFormat].format;
t->pp_txfilter |= tx_table[texFormat].filter;
_mesa_init_teximage_fields(&radeon->glCtx, texImage,
rb->base.Base.Width, rb->base.Base.Height,
1, 0,