diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2008-04-03 14:43:55 -0400 |
---|---|---|
committer | Alex Deucher <alex@t41p.hsd1.va.comcast.net> | 2008-04-03 14:43:55 -0400 |
commit | c40a7aa3989576a8144213e2f31b892d21df8686 (patch) | |
tree | 43807e540f54a307b4282387f29a14d7e646a7f6 | |
parent | a8593482c1f2e0f2dbac06c2e5325ba8c83ed9ff (diff) |
R3xx/R5xx: Fix pitch and clamp mode for repeating textures
- We can always use TXPITCH on a R300 even when repeating,
(previous check for pitch matching width was also wrong)
- Fix clamp mode for repeating textures to be WRAP
-rw-r--r-- | src/radeon_exa_render.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index 9496bb66..4e5ab81f 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -870,6 +870,7 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix, if ((txpitch & 0x1f) != 0) RADEON_FALLBACK(("Bad texture pitch 0x%x\n", (int)txpitch)); + /* TXPITCH = pixels (texels) per line - 1 */ pixel_shift = pPix->drawable.bitsPerPixel >> 4; txpitch >>= pixel_shift; txpitch -= 1; @@ -894,20 +895,21 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix, if (IS_R500_3D && ((h - 1) & 0x800)) txpitch |= R500_TXHEIGHT_11; - if (pPict->repeat) { - if ((h != 1) && - (((w * pPix->drawable.bitsPerPixel / 8 + 31) & ~31) != txpitch)) - RADEON_FALLBACK(("Width %d and pitch %u not compatible for repeat\n", - w, (unsigned)txpitch)); - } else - txformat0 |= R300_TXPITCH_EN; - + /* Use TXPITCH instead of TXWIDTH for address computations: we could + * omit this if there is no padding, but there is no apparent advantage + * in doing so. + */ + txformat0 |= R300_TXPITCH_EN; info->texW[unit] = w; info->texH[unit] = h; - txfilter = (R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_LAST) | - R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_LAST)); + if (pPict->repeat) + txfilter = (R300_TX_CLAMP_S(R300_TX_CLAMP_WRAP) | + R300_TX_CLAMP_T(R300_TX_CLAMP_WRAP)); + else + txfilter = (R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_LAST) | + R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_LAST)); txfilter |= (unit << R300_TX_ID_SHIFT); |