aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-09-05 15:48:58 -0700
committerEric Anholt <[email protected]>2019-10-20 04:39:48 +0000
commitecddabfa76aeac282c1a5c365708cd0a79e3b80d (patch)
tree2d1926ce344f700ecae50c38c5d4f2cc2282c5d8 /src/mesa
parent7ceafa4b40743f447998915deb83d42939d6faa6 (diff)
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 <[email protected]> (v1)
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r200/r200_texstate.c16
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texstate.c16
2 files changed, 10 insertions, 22 deletions
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,