Switch from 32-bit floats to 16-bit half-floats.
Massive bandwidth savings, or so I'm told. Yay?
This commit is contained in:
parent
ebbb7fb634
commit
48b09ca40c
4 changed files with 673 additions and 646 deletions
1284
src/bicubic_table.h
1284
src/bicubic_table.h
File diff suppressed because it is too large
Load diff
|
|
@ -2,6 +2,32 @@
|
|||
|
||||
import struct
|
||||
|
||||
def half(i):
|
||||
fs, fe, fm = ((i >> 31) & 0x1, (i >> 23) & 0xff, i & 0x7fffff)
|
||||
s, e, m = (fs, 0, 0)
|
||||
|
||||
if (fe == 0x0):
|
||||
pass
|
||||
if ((fe == 0xff) and (fm == 0x0)):
|
||||
e = 31
|
||||
elif (fe == 0xff):
|
||||
m = 1
|
||||
e = 31
|
||||
else:
|
||||
exp = fe - 127;
|
||||
if (exp < -24):
|
||||
pass
|
||||
elif (exp < -14):
|
||||
temp = 10 - (-14 - exp)
|
||||
m = 2**temp + (m >> (23 - temp))
|
||||
elif (exp > 15):
|
||||
e = 31
|
||||
else:
|
||||
e = exp + 15
|
||||
m = fm >> 13
|
||||
|
||||
return ((s << 15) | (e << 10) | m)
|
||||
|
||||
def texgen(pix):
|
||||
|
||||
tex = []
|
||||
|
|
@ -26,14 +52,15 @@ def texgen(pix):
|
|||
|
||||
def printrow(l, offset):
|
||||
|
||||
seq = [ hex(struct.unpack('<I',struct.pack('f',i))[0]) for i in l[offset:offset+4] ]
|
||||
seq = [ struct.unpack('<I',struct.pack('f',i))[0] for i in l[offset:offset+4] ]
|
||||
seq = [ hex(half(i)) for i in seq ]
|
||||
return "\t" + ", ".join(seq) + ","
|
||||
|
||||
def maketable(pix):
|
||||
|
||||
l = texgen(pix)
|
||||
|
||||
print "static const uint32_t bicubic_tex_" + str(pix) + "[] = {"
|
||||
print "static const uint16_t bicubic_tex_" + str(pix) + "[] = {"
|
||||
|
||||
for i in range(0, pix, 4):
|
||||
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
|
|||
|
||||
/* Upload bicubic filter tex */
|
||||
if (pPriv->bicubic_enabled)
|
||||
RADEONCopyData(pScrn, (uint8_t *)bicubic_tex_512, (uint8_t *)(info->FB + pPriv->bicubic_offset), 2048, 2048, 1, 512, 4);
|
||||
RADEONCopyData(pScrn, (uint8_t *)bicubic_tex_512, (uint8_t *)(info->FB + pPriv->bicubic_offset), 1024, 1024, 1, 512, 2);
|
||||
|
||||
/* update cliplist */
|
||||
if (!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) {
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
|
|||
(0x0 << R300_TXHEIGHT_SHIFT) |
|
||||
R300_TXPITCH_EN;
|
||||
/* Format is 32-bit floats, 4bpp */
|
||||
txformat1 = R300_EASY_TX_FORMAT(Z, Y, X, W, FL_R32G32B32A32);
|
||||
txformat1 = R300_EASY_TX_FORMAT(Z, Y, X, W, FL_R16G16B16A16);
|
||||
/* Pitch is 127 (128-1) */
|
||||
txpitch = 0x7f;
|
||||
/* Tex filter */
|
||||
|
|
|
|||
Loading…
Reference in a new issue