From ecddabfa76aeac282c1a5c365708cd0a79e3b80d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Sep 2019 15:48:58 -0700 Subject: r100/r200: factor out txformat/txfilter setup from the TFP path. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (v1) --- src/mesa/drivers/dri/r200/r200_texstate.c | 16 +++++----------- src/mesa/drivers/dri/radeon/radeon_texstate.c | 16 +++++----------- 2 files changed, 10 insertions(+), 22 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 60a20071d97..8826a9bd7e7 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -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, diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 47eac855c66..1cfca191375 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -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, -- cgit v1.2.3