diff options
author | Michel Dänzer <daenzer@vmware.com> | 2009-08-27 09:52:10 +0200 |
---|---|---|
committer | Michel Dänzer <daenzer@vmware.com> | 2009-08-27 09:52:10 +0200 |
commit | 27d9664f8862d1948dd32021f8e9bcb94f23e4ef (patch) | |
tree | 4eecbe5bf8db1137bd2816d5c11704b788845038 | |
parent | 9b5517fcf7f2397a1a814d396fc9dc24769a6d9f (diff) |
EXA: RENDER repeat cleanups.
We can't rely on the server setting pPict->repeatType to something sensible
when pPict->repeat is FALSE, but we can do it ourselves.
-rw-r--r-- | src/r600_exa.c | 43 | ||||
-rw-r--r-- | src/radeon_exa_render.c | 62 |
2 files changed, 56 insertions, 49 deletions
diff --git a/src/r600_exa.c b/src/r600_exa.c index 3e77515..57867f1 100644 --- a/src/r600_exa.c +++ b/src/r600_exa.c @@ -1258,30 +1258,29 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix, tex_samp.id = unit; tex_samp.border_color = SQ_TEX_BORDER_COLOR_TRANS_BLACK; - if (pPict->repeat) { - switch (pPict->repeatType) { - case RepeatNormal: - tex_samp.clamp_x = SQ_TEX_WRAP; - tex_samp.clamp_y = SQ_TEX_WRAP; - break; - case RepeatPad: - tex_samp.clamp_x = SQ_TEX_CLAMP_LAST_TEXEL; - tex_samp.clamp_y = SQ_TEX_CLAMP_LAST_TEXEL; - break; - case RepeatReflect: - tex_samp.clamp_x = SQ_TEX_MIRROR; - tex_samp.clamp_y = SQ_TEX_MIRROR; - break; - case RepeatNone: - tex_samp.clamp_x = SQ_TEX_CLAMP_BORDER; - tex_samp.clamp_y = SQ_TEX_CLAMP_BORDER; - break; - default: - RADEON_FALLBACK(("Bad repeat 0x%x\n", pPict->repeatType)); - } - } else { + /* Unfortunately we can't rely on the X server doing this for us */ + if (!pPict->repeat) + pPict->repeatType = RepeatNone; + + switch (pPict->repeatType) { + case RepeatNormal: + tex_samp.clamp_x = SQ_TEX_WRAP; + tex_samp.clamp_y = SQ_TEX_WRAP; + break; + case RepeatPad: + tex_samp.clamp_x = SQ_TEX_CLAMP_LAST_TEXEL; + tex_samp.clamp_y = SQ_TEX_CLAMP_LAST_TEXEL; + break; + case RepeatReflect: + tex_samp.clamp_x = SQ_TEX_MIRROR; + tex_samp.clamp_y = SQ_TEX_MIRROR; + break; + case RepeatNone: tex_samp.clamp_x = SQ_TEX_CLAMP_BORDER; tex_samp.clamp_y = SQ_TEX_CLAMP_BORDER; + break; + default: + RADEON_FALLBACK(("Bad repeat 0x%x\n", pPict->repeatType)); } switch (pPict->filter) { diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index 4dbdc14..cc97760 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -410,6 +410,10 @@ static Bool FUNC_NAME(R100TextureSetup)(PicturePtr pPict, PixmapPtr pPix, RADEON_FALLBACK(("Bad filter 0x%x\n", pPict->filter)); } + /* Unfortunately we can't rely on the X server doing this for us */ + if (!pPict->repeat) + pPict->repeatType = RepeatNone; + switch (pPict->repeatType) { case RepeatNormal: txfilter |= RADEON_CLAMP_S_WRAP | RADEON_CLAMP_T_WRAP; @@ -793,6 +797,10 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix, RADEON_FALLBACK(("Bad filter 0x%x\n", pPict->filter)); } + /* Unfortunately we can't rely on the X server doing this for us */ + if (!pPict->repeat) + pPict->repeatType = RepeatNone; + switch (pPict->repeatType) { case RepeatNormal: txfilter |= R200_CLAMP_S_WRAP | R200_CLAMP_T_WRAP; @@ -1171,36 +1179,36 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix, txfilter = (unit << R300_TX_ID_SHIFT); - if (pPict->repeat) { - switch (pPict->repeatType) { - case RepeatNormal: - if (unit != 0 || !info->accel_state->need_src_tile_x) - txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_WRAP); - else - txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_GL); + /* Unfortunately we can't rely on the X server doing this for us */ + if (!pPict->repeat) + pPict->repeatType = RepeatNone; - if (unit != 0 || !info->accel_state->need_src_tile_y) - txfilter |= R300_TX_CLAMP_T(R300_TX_CLAMP_WRAP); - else - txfilter |= R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_GL); + switch (pPict->repeatType) { + case RepeatNormal: + if (unit != 0 || !info->accel_state->need_src_tile_x) + txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_WRAP); + else + txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_GL); + + if (unit != 0 || !info->accel_state->need_src_tile_y) + txfilter |= R300_TX_CLAMP_T(R300_TX_CLAMP_WRAP); + else + txfilter |= R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_GL); - break; - case RepeatPad: - txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_LAST) | - R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_LAST); - break; - case RepeatReflect: - txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_MIRROR) | - R300_TX_CLAMP_T(R300_TX_CLAMP_MIRROR); - break; - case RepeatNone: - txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_GL) | - R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_GL); - break; - } - } else + break; + case RepeatPad: + txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_LAST) | + R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_LAST); + break; + case RepeatReflect: + txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_MIRROR) | + R300_TX_CLAMP_T(R300_TX_CLAMP_MIRROR); + break; + case RepeatNone: txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_GL) | - R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_GL); + R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_GL); + break; + } switch (pPict->filter) { case PictFilterNearest: |