Texture fixes by Koolsmoky
This commit is contained in:
@@ -1579,11 +1579,19 @@ FxU32
|
||||
_grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod,
|
||||
GrAspectRatio_t aspect, GrTextureFormat_t format,
|
||||
FxU32 evenOdd,
|
||||
FxBool roundP )
|
||||
FxBool roundP,
|
||||
FxBool systemMem )
|
||||
{
|
||||
#define FN_NAME "_grTexTextureMemRequired"
|
||||
FxU32 memrequired;
|
||||
|
||||
GDBG_INFO(80,"_grTexTextureMemRequired(%d,%d, %d,%d, %d, %d, %d)\n",
|
||||
small_lod, large_lod,
|
||||
aspect, format,
|
||||
evenOdd,
|
||||
roundP,
|
||||
systemMem);
|
||||
|
||||
GR_CHECK_W(FN_NAME,
|
||||
small_lod > large_lod,
|
||||
"small_lod bigger than large_lod" );
|
||||
@@ -1594,7 +1602,6 @@ _grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod,
|
||||
|
||||
switch(format) {
|
||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
/* In this case, do not mirror the aspect ratios, as the minimum
|
||||
* size of a mipmap level is 8x4, so the tables are not symmetric
|
||||
* w.r.t. sign of the aspect ratio, so keep the sign. */
|
||||
@@ -1617,6 +1624,48 @@ _grTexTextureMemRequired( GrLOD_t small_lod, GrLOD_t large_lod,
|
||||
}
|
||||
break;
|
||||
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1: /* XXX check this! */
|
||||
if(systemMem) {
|
||||
/* calculating for system memory */
|
||||
/* In this case, do not mirror the aspect ratios, as the minimum
|
||||
* size of a mipmap level is 8x4, so the tables are not symmetric
|
||||
* w.r.t. sign of the aspect ratio, so keep the sign. */
|
||||
if ( evenOdd == GR_MIPMAPLEVELMASK_BOTH ) {
|
||||
memrequired = _grMipMapOffsetCmp4Bit[G3_ASPECT_TRANSLATE(aspect)][small_lod];
|
||||
memrequired -= _grMipMapOffsetCmp4Bit[G3_ASPECT_TRANSLATE(aspect)][large_lod+1];
|
||||
} else {
|
||||
memrequired = 0;
|
||||
/* construct XOR mask */
|
||||
evenOdd = (evenOdd == GR_MIPMAPLEVELMASK_EVEN) ? 1 : 0;
|
||||
while (large_lod >= small_lod) { /* sum up all the mipmap levels */
|
||||
if ((large_lod ^ evenOdd) & 1) { /* that match the XOR mask */
|
||||
memrequired += _grMipMapSizeCmp4Bit[G3_ASPECT_TRANSLATE(aspect)][large_lod];
|
||||
}
|
||||
large_lod--;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* for texture memory on hardware */
|
||||
/* allows us to mirror the aspect ratios because the table entries are the same */
|
||||
if (aspect < GR_ASPECT_LOG2_1x1) {
|
||||
aspect = -aspect;
|
||||
}
|
||||
if ( evenOdd == GR_MIPMAPLEVELMASK_BOTH ) {
|
||||
memrequired = _grMipMapOffsetDXT[G3_ASPECT_TRANSLATE(aspect)][small_lod];
|
||||
memrequired -= _grMipMapOffsetDXT[G3_ASPECT_TRANSLATE(aspect)][large_lod+1];
|
||||
} else {
|
||||
memrequired = 0;
|
||||
/* construct XOR mask */
|
||||
evenOdd = (evenOdd == GR_MIPMAPLEVELMASK_EVEN) ? 1 : 0;
|
||||
while (large_lod >= small_lod) { /* sum up all the mipmap levels */
|
||||
if ((large_lod ^ evenOdd) & 1) { /* that match the XOR mask */
|
||||
memrequired += _grMipMapSizeDXT[G3_ASPECT_TRANSLATE(aspect)][large_lod];
|
||||
}
|
||||
large_lod--;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_CMP_DXT2:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT4:
|
||||
@@ -1709,7 +1758,6 @@ _grTexCalcBaseAddress( FxU32 start, GrLOD_t large_lod,
|
||||
|
||||
switch(format) {
|
||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
/* FXT1 format: Don't mirror the aspect ratios, because of the 8x4 limit */
|
||||
if ( odd_even_mask == GR_MIPMAPLEVELMASK_BOTH ) {
|
||||
sum_of_lod_sizes = _grMipMapOffsetCmp4Bit[aspect]
|
||||
@@ -1726,6 +1774,7 @@ _grTexCalcBaseAddress( FxU32 start, GrLOD_t large_lod,
|
||||
}
|
||||
break;
|
||||
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1: /* XXX check this! */
|
||||
case GR_TEXFMT_ARGB_CMP_DXT2:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT4:
|
||||
@@ -1793,7 +1842,8 @@ GR_DIENTRY(grTexCalcMemRequired, FxU32,
|
||||
memrequired = _grTexTextureMemRequired(small_lod, large_lod,
|
||||
aspect, format,
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
FXTRUE);
|
||||
FXTRUE,
|
||||
FXFALSE);
|
||||
GDBG_INFO(88,"grTexCalcMemRequired(%d,%d,%d,%d) => 0x%x(%d)\n",
|
||||
small_lod,large_lod,aspect,format,memrequired,memrequired);
|
||||
return memrequired;
|
||||
@@ -1986,7 +2036,8 @@ GR_DIENTRY(grTexTextureMemRequired, FxU32,
|
||||
info->aspectRatioLog2,
|
||||
info->format,
|
||||
evenOdd,
|
||||
FXTRUE );
|
||||
FXTRUE,
|
||||
FXFALSE );
|
||||
|
||||
GDBG_INFO(88,"grTexTextureMemRequired(%d,0x%x) => 0x%x(%d)\n",
|
||||
evenOdd,info,memrequired,memrequired);
|
||||
@@ -2189,7 +2240,7 @@ GR_DIENTRY(grTexDownloadMipMapLevel, void,
|
||||
|
||||
/* Note: Unlike in other places, we put DXT1 here because it's min size
|
||||
* according to the app is actually 4x4 like the other DXTC mode
|
||||
*/
|
||||
*/
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT2:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||
|
||||
@@ -1803,7 +1803,7 @@ typedef struct GrGC_s
|
||||
FxI32 roomToReadPtr;/* Bytes until last known hw ptr */
|
||||
FxI32 roomToEnd; /* # of bytes until last usable address before fifoEnd */
|
||||
|
||||
FxBool lfbLockCount; /* Have we done an lfb lock? Count of the locks. */
|
||||
FxU32 lfbLockCount; /* Have we done an lfb lock? Count of the locks. */
|
||||
|
||||
#if GLIDE_INIT_HWC
|
||||
GrStateBuffer*
|
||||
@@ -2130,7 +2130,6 @@ struct _GlideRoot_s {
|
||||
FxU32 oglLfbLockHack; /* Enables disable hack to get around forced 32bit problems in OpenGL */
|
||||
FxU32 useHwcAAforLfbRead; /* Specifies whether to use HwcAAReadRegion for read Locks and LfbReadRegion calls */
|
||||
FxU32 ditherHwcAA; /* Specifies whether to use HwcAAReadRegion should dither */
|
||||
FxI32 lockCounter;
|
||||
} environment;
|
||||
|
||||
GrHwConfiguration hwConfig;
|
||||
@@ -2942,7 +2941,8 @@ FxU32
|
||||
_grTexTextureMemRequired(GrLOD_t small_lod, GrLOD_t large_lod,
|
||||
GrAspectRatio_t aspect, GrTextureFormat_t format,
|
||||
FxU32 evenOdd,
|
||||
FxBool roundP);
|
||||
FxBool roundP,
|
||||
FxBool systemMem);
|
||||
void FX_CSTYLE
|
||||
_grUpdateParamIndex(void);
|
||||
|
||||
|
||||
@@ -543,7 +543,8 @@ GR_DIENTRY(gu3dfGetInfo, FxBool,
|
||||
Info->header.aspect_ratio,
|
||||
Info->header.format,
|
||||
GR_MIPMAPLEVELMASK_BOTH,
|
||||
FXFALSE);
|
||||
FXFALSE,
|
||||
FXTRUE);
|
||||
}
|
||||
|
||||
GDBG_INFO(81,"gu3dfGetInfo(%s,0x%x) -> %i tex memory required\n",FileName,Info, Info->mem_required);
|
||||
|
||||
@@ -2659,9 +2659,6 @@ GR_ENTRY(grBufferSwap, void, (FxU32 swapInterval))
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME,86);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d)\n",swapInterval);
|
||||
|
||||
// First thing first. Decrement the lockCounter
|
||||
if (_GlideRoot.environment.lockCounter > -10) _GlideRoot.environment.lockCounter--;
|
||||
|
||||
#ifdef FX_GLIDE_NAPALM
|
||||
#if !(GLIDE_PLATFORM & GLIDE_OS_UNIX) && !defined(__DJGPP__)
|
||||
/* Window hacky stuff */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1220,9 +1220,9 @@ _grSstDetectResources(void)
|
||||
|
||||
/* Clear the tmu state */
|
||||
for (tmu = 0; tmu < GC.num_tmu; tmu++) {
|
||||
memset(&GC.tmu_state[0], 0, sizeof(GC.tmu_state[0]));
|
||||
GC.tmu_state[0].total_mem = (0x2 << 20);
|
||||
GC.tmu_state[0].ncc_mmids[0] = GC.tmu_state[0].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE;
|
||||
memset(&GC.tmu_state[tmu], 0, sizeof(GC.tmu_state[0]));
|
||||
GC.tmu_state[tmu].total_mem = (0x2 << 20);
|
||||
GC.tmu_state[tmu].ncc_mmids[0] = GC.tmu_state[tmu].ncc_mmids[1] = GR_NULL_MIPMAP_HANDLE;
|
||||
}
|
||||
|
||||
} /* iterate through boards found */
|
||||
@@ -1738,7 +1738,12 @@ _GlideInitEnvironment(int which)
|
||||
** AJB- This lets Joe bag-o-donuts force 32bpp & AA rendering
|
||||
** for apps that call grSstWinOpen.
|
||||
*/
|
||||
_GlideRoot.environment.outputBpp = GLIDE_GETENV("FX_GLIDE_BPP", GC.bInfo->RegPath, 0L) ;
|
||||
_GlideRoot.environment.outputBpp = GLIDE_GETENV("FX_GLIDE_BPP", GC.bInfo->RegPath, 0L);
|
||||
/* check for a valid value */
|
||||
if(_GlideRoot.environment.outputBpp != 32 ||
|
||||
_GlideRoot.environment.outputBpp != 15) {
|
||||
_GlideRoot.environment.outputBpp = 0;
|
||||
}
|
||||
|
||||
/* Note- If the old school Glide env. vars for AA sample & Num chips
|
||||
* are active, they should ALWAYS override the control panel variable
|
||||
@@ -1808,8 +1813,8 @@ _GlideInitEnvironment(int which)
|
||||
_GlideRoot.environment.oglLfbLockHack = GLIDE_GETENV("FX_GL_LFBLOCK_HACK", GC.bInfo->RegPath, 1L) ;
|
||||
GDBG_INFO(80," oglLfbLockHack: %d\n",_GlideRoot.environment.oglLfbLockHack );
|
||||
|
||||
/* 0 = None, 1 = grLfbReadRegion(), 2 = grLfbLock(), 3 = Both (default) */
|
||||
_GlideRoot.environment.useHwcAAforLfbRead = GLIDE_GETENV("FX_GLIDE_USE_HWC_AA_FOR_LFB_READ", GC.bInfo->RegPath, 3L) ;
|
||||
/* 0 = None (default), 1 = grLfbReadRegion(), 2 = grLfbLock(), 3 = Both */
|
||||
_GlideRoot.environment.useHwcAAforLfbRead = GLIDE_GETENV("FX_GLIDE_USE_HWC_AA_FOR_LFB_READ", GC.bInfo->RegPath, 0L) ;
|
||||
GDBG_INFO(80," useHwcAAforLfbRead: %d\n",_GlideRoot.environment.useHwcAAforLfbRead );
|
||||
|
||||
/* 0 = No dithering when doing HWC AA dumps, 1 = error diffusion dithering enabled (default) */
|
||||
|
||||
@@ -997,9 +997,9 @@ GR_EXT_ENTRY(grSurfaceCalcTextureWHD, FxBool , (GrTexInfo *tInfo, FxU32 *w,
|
||||
|
||||
switch(tInfo->format) {
|
||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
fmtType = 1;
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1: /* XXX check this! */
|
||||
case GR_TEXFMT_ARGB_CMP_DXT2:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT4:
|
||||
|
||||
@@ -1204,8 +1204,8 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
},
|
||||
},
|
||||
},
|
||||
{ /* FXT1, DXT1 texture format */
|
||||
{ /* 8:1 aspect ratio; FXT1, DXT1 texture format */
|
||||
{ /* FXT1 texture format */
|
||||
{ /* 8:1 aspect ratio; FXT1 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 8, 4},
|
||||
{ 0, 0},
|
||||
@@ -1375,7 +1375,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{2048, 256},
|
||||
},
|
||||
},
|
||||
{ /* 4:1 aspect ratio; FXT1, DXT1 texture format */
|
||||
{ /* 4:1 aspect ratio; FXT1 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 8, 4},
|
||||
{ 0, 0},
|
||||
@@ -1475,7 +1475,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{ 0, 0},
|
||||
},
|
||||
{ /* largeLod: 7 */
|
||||
{ 128, 52},/* KoolSmoky - is this correct? */
|
||||
{ 128, 52},
|
||||
{ 128, 48},
|
||||
{ 128, 48},
|
||||
{ 128, 48},
|
||||
@@ -1545,7 +1545,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{2048, 512},
|
||||
},
|
||||
},
|
||||
{ /* 2:1 aspect ratio; FXT1, DXT1 texture format */
|
||||
{ /* 2:1 aspect ratio; FXT1 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 8, 4},
|
||||
{ 0, 0},
|
||||
@@ -1715,7 +1715,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{2048,1024},
|
||||
},
|
||||
},
|
||||
{ /* 1:1 aspect ratio; FXT1, DXT1 texture format */
|
||||
{ /* 1:1 aspect ratio; FXT1 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 8, 4},
|
||||
{ 0, 0},
|
||||
@@ -1885,7 +1885,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{2048,2048},
|
||||
},
|
||||
},
|
||||
{ /* 1:2 aspect ratio; FXT1, DXT1 texture format */
|
||||
{ /* 1:2 aspect ratio; FXT1 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 8, 4},
|
||||
{ 0, 0},
|
||||
@@ -2055,7 +2055,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{1024,2048},
|
||||
},
|
||||
},
|
||||
{ /* 1:4 aspect ratio; FXT1, DXT1 texture format */
|
||||
{ /* 1:4 aspect ratio; FXT1 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 8, 4},
|
||||
{ 0, 0},
|
||||
@@ -2225,7 +2225,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{ 512,2048},
|
||||
},
|
||||
},
|
||||
{ /* 1:8 aspect ratio; FXT1, DXT1 texture format */
|
||||
{ /* 1:8 aspect ratio; FXT1 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 8, 4},
|
||||
{ 0, 0},
|
||||
@@ -2396,8 +2396,8 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
},
|
||||
},
|
||||
},
|
||||
{ /* DXT2,3,4,5 texture format */
|
||||
{ /* 8:1 aspect ratio; DXT2,3,4,5 texture format */
|
||||
{ /* DXT1,2,3,4,5 texture format */
|
||||
{ /* 8:1 aspect ratio; DXT1,2,3,4,5 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 4, 4},
|
||||
{ 0, 0},
|
||||
@@ -2567,7 +2567,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{2048, 256},
|
||||
},
|
||||
},
|
||||
{ /* 4:1 aspect ratio; DXT2,3,4,5 texture format */
|
||||
{ /* 4:1 aspect ratio; DXT1,2,3,4,5 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 4, 4},
|
||||
{ 0, 0},
|
||||
@@ -2667,7 +2667,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{ 0, 0},
|
||||
},
|
||||
{ /* largeLod: 7 */
|
||||
{ 128, 52}, /* KoolSmoky - is this correct? */
|
||||
{ 128, 52},
|
||||
{ 128, 48},
|
||||
{ 128, 48},
|
||||
{ 128, 48},
|
||||
@@ -2737,7 +2737,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{2048, 512},
|
||||
},
|
||||
},
|
||||
{ /* 2:1 aspect ratio; DXT2,3,4,5 texture format */
|
||||
{ /* 2:1 aspect ratio; DXT1,2,3,4,5 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 4, 4},
|
||||
{ 0, 0},
|
||||
@@ -2907,7 +2907,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{2048,1024},
|
||||
},
|
||||
},
|
||||
{ /* 1:1 aspect ratio; DXT2,3,4,5 texture format */
|
||||
{ /* 1:1 aspect ratio; DXT1,2,3,4,5 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 4, 4},
|
||||
{ 0, 0},
|
||||
@@ -3077,7 +3077,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{2048,2048},
|
||||
},
|
||||
},
|
||||
{ /* 1:2 aspect ratio; DXT2,3,4,5 texture format */
|
||||
{ /* 1:2 aspect ratio; DXT1,2,3,4,5 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 4, 4},
|
||||
{ 0, 0},
|
||||
@@ -3247,7 +3247,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{1024,2048},
|
||||
},
|
||||
},
|
||||
{ /* 1:4 aspect ratio; DXT2,3,4,5 texture format */
|
||||
{ /* 1:4 aspect ratio; DXT1,2,3,4,5 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 4, 4},
|
||||
{ 0, 0},
|
||||
@@ -3417,7 +3417,7 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{ 512,2048},
|
||||
},
|
||||
},
|
||||
{ /* 1:8 aspect ratio; DXT2,3,4,5 texture format */
|
||||
{ /* 1:8 aspect ratio; DXT1,2,3,4,5 texture format */
|
||||
{ /* largeLod: 0 */
|
||||
{ 4, 4},
|
||||
{ 0, 0},
|
||||
@@ -3517,11 +3517,11 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{ 0, 0},
|
||||
},
|
||||
{ /* largeLod: 7 */
|
||||
{ 16, 192},
|
||||
{ 16, 192},
|
||||
{ 16, 192},
|
||||
{ 16, 192},
|
||||
{ 16, 192},
|
||||
{ 20, 192},
|
||||
{ 20, 192},
|
||||
{ 20, 192},
|
||||
{ 20, 192},
|
||||
{ 20, 192},
|
||||
{ 16, 192},
|
||||
{ 16, 192},
|
||||
{ 16, 128},
|
||||
@@ -3531,11 +3531,11 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{ 0, 0},
|
||||
},
|
||||
{ /* largeLod: 8 */
|
||||
{ 48, 256},
|
||||
{ 48, 256},
|
||||
{ 48, 256},
|
||||
{ 48, 256},
|
||||
{ 48, 256},
|
||||
{ 52, 256},
|
||||
{ 52, 256},
|
||||
{ 52, 256},
|
||||
{ 52, 256},
|
||||
{ 52, 256},
|
||||
{ 48, 256},
|
||||
{ 48, 256},
|
||||
{ 48, 256},
|
||||
@@ -3545,11 +3545,11 @@ static const FxU16 boundingBoxWH[3][7][12][12][2] =
|
||||
{ 0, 0},
|
||||
},
|
||||
{ /* largeLod: 9 */
|
||||
{ 112, 512},
|
||||
{ 112, 512},
|
||||
{ 112, 512},
|
||||
{ 112, 512},
|
||||
{ 112, 512},
|
||||
{ 116, 512},
|
||||
{ 116, 512},
|
||||
{ 116, 512},
|
||||
{ 116, 512},
|
||||
{ 116, 512},
|
||||
{ 112, 512},
|
||||
{ 112, 512},
|
||||
{ 112, 512},
|
||||
|
||||
@@ -1206,7 +1206,7 @@ initGC ( GrGC *gc )
|
||||
#endif /* defined(DRI_BUILD) */
|
||||
gc->backBuffer = (gc->grColBuf > 2) ? 2 : gc->curBuffer;
|
||||
|
||||
for (t = 0; t < 7; t++) {
|
||||
for (t = 0; t < MAX_BUFF_PENDING; t++) {
|
||||
gc->bufferSwaps[t] = 0xffffffff;
|
||||
}
|
||||
|
||||
@@ -1669,51 +1669,49 @@ GR_EXT_ENTRY(grSstWinOpenExt, GrContext_t, ( FxU32 hWnd,
|
||||
/* rendering since we don't want to scale down the */
|
||||
/* apps Z or W values to fit in a 16 bit depth buffer. */
|
||||
|
||||
if (_GlideRoot.environment.outputBpp == 32 || pixelformat == GR_PIXFMT_ARGB_8888) {
|
||||
|
||||
if (_GlideRoot.environment.outputBpp == 32 || pixelformat == GR_PIXFMT_ARGB_8888) {
|
||||
// App requested 16 bit, but we are giving 32. Need to remember for framebuffer access
|
||||
if (pixelformat == GR_PIXFMT_ARGB_1555 || pixelformat == GR_PIXFMT_AA_2_ARGB_1555 ||
|
||||
pixelformat == GR_PIXFMT_AA_4_ARGB_1555 || pixelformat == GR_PIXFMT_AA_8_ARGB_1555) {
|
||||
if (pixelformat == GR_PIXFMT_ARGB_1555 ||
|
||||
pixelformat == GR_PIXFMT_AA_2_ARGB_1555 ||
|
||||
pixelformat == GR_PIXFMT_AA_4_ARGB_1555 ||
|
||||
pixelformat == GR_PIXFMT_AA_8_ARGB_1555) {
|
||||
gc->state.forced32BPP = 15;
|
||||
}
|
||||
else if (pixelformat == GR_PIXFMT_RGB_565 || pixelformat == GR_PIXFMT_AA_2_RGB_565 ||
|
||||
pixelformat == GR_PIXFMT_AA_4_RGB_565 || pixelformat == GR_PIXFMT_AA_8_RGB_565) {
|
||||
} else if (pixelformat == GR_PIXFMT_RGB_565 ||
|
||||
pixelformat == GR_PIXFMT_AA_2_RGB_565 ||
|
||||
pixelformat == GR_PIXFMT_AA_4_RGB_565 ||
|
||||
pixelformat == GR_PIXFMT_AA_8_RGB_565) {
|
||||
gc->state.forced32BPP = 16;
|
||||
}
|
||||
|
||||
if ((_GlideRoot.environment.aaSample == 8) && /* 8xaa */
|
||||
(gc->chipCount > 2))
|
||||
pixelformat = GR_PIXFMT_AA_8_ARGB_8888 ;
|
||||
else if ((_GlideRoot.environment.aaSample == 4) &&
|
||||
(gc->chipCount > 1))
|
||||
pixelformat = GR_PIXFMT_AA_4_ARGB_8888 ;
|
||||
else if (_GlideRoot.environment.aaSample == 2)
|
||||
pixelformat = GR_PIXFMT_AA_2_ARGB_8888 ;
|
||||
else
|
||||
pixelformat = GR_PIXFMT_ARGB_8888 ;
|
||||
}
|
||||
else if (_GlideRoot.environment.outputBpp == 15 || pixelformat == GR_PIXFMT_ARGB_1555) {
|
||||
if ((_GlideRoot.environment.aaSample == 8) && /* 8xaa */
|
||||
(gc->chipCount > 2))
|
||||
pixelformat = GR_PIXFMT_AA_8_ARGB_1555 ;
|
||||
else if ((_GlideRoot.environment.aaSample == 4) &&
|
||||
(gc->chipCount > 1))
|
||||
pixelformat = GR_PIXFMT_AA_4_ARGB_1555 ;
|
||||
else if (_GlideRoot.environment.aaSample == 2)
|
||||
pixelformat = GR_PIXFMT_AA_2_ARGB_1555 ;
|
||||
else
|
||||
pixelformat = GR_PIXFMT_ARGB_1555 ;
|
||||
}
|
||||
else if (pixelformat == GR_PIXFMT_RGB_565) {
|
||||
if ((_GlideRoot.environment.aaSample == 8) && /* 8xaa */
|
||||
(gc->chipCount > 2))
|
||||
if ((_GlideRoot.environment.aaSample == 8) && /* 8xaa */ (gc->chipCount > 2)) {
|
||||
pixelformat = GR_PIXFMT_AA_8_ARGB_8888;
|
||||
} else if ((_GlideRoot.environment.aaSample == 4) && (gc->chipCount > 1)) {
|
||||
pixelformat = GR_PIXFMT_AA_4_ARGB_8888;
|
||||
} else if (_GlideRoot.environment.aaSample == 2) {
|
||||
pixelformat = GR_PIXFMT_AA_2_ARGB_8888;
|
||||
} else {
|
||||
pixelformat = GR_PIXFMT_ARGB_8888;
|
||||
}
|
||||
} else if (_GlideRoot.environment.outputBpp == 15 || pixelformat == GR_PIXFMT_ARGB_1555) {
|
||||
if ((_GlideRoot.environment.aaSample == 8) && /* 8xaa */ (gc->chipCount > 2)) {
|
||||
pixelformat = GR_PIXFMT_AA_8_ARGB_1555;
|
||||
} else if ((_GlideRoot.environment.aaSample == 4) && (gc->chipCount > 1)) {
|
||||
pixelformat = GR_PIXFMT_AA_4_ARGB_1555;
|
||||
} else if (_GlideRoot.environment.aaSample == 2) {
|
||||
pixelformat = GR_PIXFMT_AA_2_ARGB_1555;
|
||||
} else {
|
||||
pixelformat = GR_PIXFMT_ARGB_1555;
|
||||
}
|
||||
} else if (pixelformat == GR_PIXFMT_RGB_565) {
|
||||
if ((_GlideRoot.environment.aaSample == 8) && /* 8xaa */ (gc->chipCount > 2)) {
|
||||
pixelformat = GR_PIXFMT_AA_8_RGB_565;
|
||||
else if ((_GlideRoot.environment.aaSample == 4) &&
|
||||
(gc->chipCount > 1))
|
||||
pixelformat = GR_PIXFMT_AA_4_RGB_565 ;
|
||||
else
|
||||
if (_GlideRoot.environment.aaSample == 2)
|
||||
pixelformat = GR_PIXFMT_AA_2_RGB_565 ;
|
||||
} else if ((_GlideRoot.environment.aaSample == 4) && (gc->chipCount > 1)) {
|
||||
pixelformat = GR_PIXFMT_AA_4_RGB_565;
|
||||
} else if (_GlideRoot.environment.aaSample == 2) {
|
||||
pixelformat = GR_PIXFMT_AA_2_RGB_565;
|
||||
} else {
|
||||
pixelformat = GR_PIXFMT_RGB_565;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3219,6 +3217,7 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
|
||||
}
|
||||
if (gc->sliCount > 1)
|
||||
_grDisableSliCtrl();
|
||||
|
||||
/* Idle the 3D pipe. */
|
||||
grFinish();
|
||||
}
|
||||
|
||||
@@ -702,12 +702,12 @@ _grTexCalcMipmapLevelOffsetTiled(GrChipID_t tmu,
|
||||
{
|
||||
switch(fmt) {
|
||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
/* For these, we offset the LOD height * texture stride */
|
||||
if (evenOdd & GR_MIPMAPLEVELMASK_ODD) {
|
||||
tileY += HEIGHT_BY_ASPECT_LOD_FXT1(aspect, GR_LOD_LOG2_16);
|
||||
}
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT2:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT4:
|
||||
@@ -732,12 +732,12 @@ _grTexCalcMipmapLevelOffsetTiled(GrChipID_t tmu,
|
||||
{
|
||||
switch(fmt) {
|
||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
/* For these, we offset the LOD height * texture stride */
|
||||
if (evenOdd & GR_MIPMAPLEVELMASK_EVEN) {
|
||||
tileY += HEIGHT_BY_ASPECT_LOD_FXT1(aspect, GR_LOD_LOG2_8);
|
||||
}
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT2:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT4:
|
||||
@@ -762,12 +762,12 @@ _grTexCalcMipmapLevelOffsetTiled(GrChipID_t tmu,
|
||||
{
|
||||
switch(fmt) {
|
||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
/* For these, we offset the LOD height * texture stride */
|
||||
if (evenOdd & GR_MIPMAPLEVELMASK_ODD) {
|
||||
tileY += HEIGHT_BY_ASPECT_LOD_FXT1(aspect, GR_LOD_LOG2_4);
|
||||
}
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT2:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT4:
|
||||
@@ -792,12 +792,12 @@ _grTexCalcMipmapLevelOffsetTiled(GrChipID_t tmu,
|
||||
{
|
||||
switch(fmt) {
|
||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
/* For these, we offset the LOD height * texture stride */
|
||||
if (evenOdd & GR_MIPMAPLEVELMASK_EVEN) {
|
||||
tileY += HEIGHT_BY_ASPECT_LOD_FXT1(aspect, GR_LOD_LOG2_2);
|
||||
}
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT2:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT4:
|
||||
@@ -2785,7 +2785,8 @@ GR_ENTRY(grTexSource, void,
|
||||
info->aspectRatioLog2,
|
||||
info->format,
|
||||
evenOdd,
|
||||
FXTRUE)
|
||||
FXTRUE,
|
||||
FXFALSE)
|
||||
> gc->tmu_state[tmu].total_mem)),
|
||||
"insufficient texture ram at startAddress");
|
||||
GR_CHECK_F(FN_NAME, evenOdd > 0x3 || evenOdd == 0, "evenOdd mask invalid");
|
||||
@@ -3495,7 +3496,8 @@ GR_DIENTRY(grTextureBuffer, void,
|
||||
else
|
||||
offset = _grTexTextureMemRequired( thisLOD+1, largeLOD,
|
||||
aspectRatio, format,
|
||||
odd_even_mask, FXTRUE);
|
||||
odd_even_mask, FXTRUE,
|
||||
FXFALSE );
|
||||
|
||||
/* How do we deal with UMA?
|
||||
The tmu only makes sense when the UMA is not turned on.
|
||||
@@ -3594,7 +3596,8 @@ GR_DIENTRY(grTextureAuxBuffer, void,
|
||||
else
|
||||
offset = _grTexTextureMemRequired( thisLOD+1, largeLOD,
|
||||
aspectRatio, format,
|
||||
odd_even_mask, FXTRUE);
|
||||
odd_even_mask, FXTRUE,
|
||||
FXFALSE );
|
||||
|
||||
/* How do we deal with UMA?
|
||||
The tmu only makes sense when the UMA is not turned on.
|
||||
|
||||
@@ -731,57 +731,26 @@ _grTexDownloadMipMapLevelPartialTiled(GrChipID_t tmu,
|
||||
const FxU32
|
||||
texelSize = _grBitsPerTexel[format],
|
||||
texStrideBytes = memInfo->texStrideBytes;
|
||||
FxU32 minS = 0, maxS = 0;
|
||||
FxU32 maxS = 0;
|
||||
FxU32 texOffset = 0x00UL;
|
||||
|
||||
switch(format) {
|
||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||
minS = 0;
|
||||
if (!maxS) maxS = WIDTH_BY_ASPECT_LOD_FXT1(aspectRatio, thisLod);
|
||||
else if (maxS < 8) maxS = 8;
|
||||
maxS = WIDTH_BY_ASPECT_LOD_FXT1(aspectRatio, thisLod);
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
minS = 0;
|
||||
if (!maxS) maxS = WIDTH_BY_ASPECT_LOD_DXT(aspectRatio, thisLod);
|
||||
else if (maxS < 8) maxS = 4;
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_CMP_DXT2:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT4:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT5:
|
||||
minS = 0;
|
||||
if (!maxS) maxS = WIDTH_BY_ASPECT_LOD_DXT(aspectRatio, thisLod);
|
||||
else if (maxS < 8) maxS = 4;
|
||||
maxS = WIDTH_BY_ASPECT_LOD_DXT(aspectRatio, thisLod);
|
||||
break;
|
||||
default:
|
||||
if (!maxS) maxS = WIDTH_BY_ASPECT_LOD(aspectRatio, thisLod);
|
||||
|
||||
// 32bit Align minS
|
||||
if (texelSize == 8) minS &= 4;
|
||||
else if (texelSize == 16) minS &= 2;
|
||||
|
||||
maxS -= minS;
|
||||
|
||||
// 32bit Align maxS, and add minS to offset
|
||||
if (texelSize == 8)
|
||||
{
|
||||
if (maxS>4) maxS = (maxS+3)&4;
|
||||
texOffset+=minS;
|
||||
}
|
||||
else if (texelSize == 16)
|
||||
{
|
||||
if (maxS>2) maxS = (maxS+1)&2;
|
||||
texOffset+=minS*2;
|
||||
}
|
||||
else
|
||||
{
|
||||
texOffset+=minS*4;
|
||||
}
|
||||
maxS = WIDTH_BY_ASPECT_LOD(aspectRatio, thisLod);
|
||||
break;
|
||||
}
|
||||
data = texOffset+(char*)data;
|
||||
|
||||
if (thisLod < largeLod) {
|
||||
if (thisLod < largeLod) {
|
||||
texOffset = _grTexCalcMipmapLevelOffsetTiled(tmu,
|
||||
thisLod, largeLod,
|
||||
aspectRatio,
|
||||
@@ -789,7 +758,8 @@ _grTexDownloadMipMapLevelPartialTiled(GrChipID_t tmu,
|
||||
evenOdd,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
texOffset += memInfo->tramLfbAddr;
|
||||
|
||||
GR_CHECK_F(FN_NAME, texelSize == 0, "invalid texture format");
|
||||
@@ -797,20 +767,18 @@ _grTexDownloadMipMapLevelPartialTiled(GrChipID_t tmu,
|
||||
switch(texelSize) {
|
||||
case 4: /* 4-bit textures */
|
||||
{
|
||||
const FxU32
|
||||
*src32 = (const FxU32*)data;
|
||||
|
||||
switch(maxS) {
|
||||
case 4:
|
||||
#if 0 /* come back to this !!!! */
|
||||
case 4: /* XXX need to test! */
|
||||
{
|
||||
const FxU16
|
||||
*src16 = (const FxU16*)data;
|
||||
const FxU16 *src16 = (const FxU16*)data;
|
||||
|
||||
src16++;
|
||||
for(; t <= maxT; t+=4) {
|
||||
FxU32
|
||||
texAddress = texOffset + t * texStrideBytes, s;
|
||||
texAddress = texOffset + t * texStrideBytes,
|
||||
s;
|
||||
|
||||
LINEAR_WRITE_BEGIN(2, SSTCP_PKT5_LFB, texAddress, 0x00UL, 0x00UL);
|
||||
for (s = 0; s < 2; s++) {
|
||||
LINEAR_WRITE_SET(texAddress, (FxU32)(*src16));
|
||||
@@ -821,10 +789,11 @@ _grTexDownloadMipMapLevelPartialTiled(GrChipID_t tmu,
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
const FxU32 *src32 = (const FxU32*)data;
|
||||
|
||||
texOffset += (t * texStrideBytes);
|
||||
for (; t <= maxT; t++) {
|
||||
LINEAR_WRITE_BEGIN(1, SSTCP_PKT5_LFB, texOffset, 0x0UL, 0x0UL);
|
||||
@@ -837,6 +806,8 @@ _grTexDownloadMipMapLevelPartialTiled(GrChipID_t tmu,
|
||||
break;
|
||||
default:
|
||||
{
|
||||
const FxU32 *src32 = (const FxU32*)data;
|
||||
|
||||
for (; t <= maxT; t++) {
|
||||
FxU32
|
||||
texAddress = texOffset + t * texStrideBytes,
|
||||
@@ -910,7 +881,7 @@ _grTexDownloadMipMapLevelPartialTiled(GrChipID_t tmu,
|
||||
case 16: /* 16-bit textures */
|
||||
{
|
||||
const FxU16
|
||||
*src16 = minS + (const FxU16*)data;
|
||||
*src16 = (const FxU16*)data;
|
||||
|
||||
switch(maxS) {
|
||||
case 1:
|
||||
@@ -1063,7 +1034,8 @@ GR_ENTRY(grTexDownloadMipMapLevelPartial,
|
||||
(startAddress + _grTexTextureMemRequired(thisLod, largeLod,
|
||||
aspectRatio,
|
||||
format, evenOdd,
|
||||
FXTRUE)
|
||||
FXTRUE,
|
||||
FXFALSE)
|
||||
> gc->tmu_state[tmu].total_mem)),
|
||||
"insufficient texture ram at startAddress");
|
||||
GR_CHECK_F(FN_NAME, startAddress & SST_TEXTURE_ALIGN_MASK,
|
||||
@@ -1105,11 +1077,11 @@ GR_ENTRY(grTexDownloadMipMapLevelPartial,
|
||||
#ifdef FX_GLIDE_NAPALM
|
||||
switch(format) {
|
||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
GR_CHECK_F(FN_NAME, max_t >=
|
||||
_grMipMapHostWHCmp4Bit[G3_ASPECT_TRANSLATE(aspectRatio)]
|
||||
[thisLod][1], "invalid end row for fxt1, dxt1");
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT2:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT4:
|
||||
@@ -1188,9 +1160,9 @@ GR_ENTRY(grTexDownloadMipMapLevelPartial,
|
||||
* restriction.
|
||||
* same for DXT1 ((4x4x1/2)x2) minimum level size is 16 bytes
|
||||
*/
|
||||
if(format != GR_TEXFMT_ARGB_CMP_FXT1 && format != GR_TEXFMT_ARGB_CMP_DXT1 &&
|
||||
format != GR_TEXFMT_ARGB_CMP_DXT2 && format != GR_TEXFMT_ARGB_CMP_DXT3 &&
|
||||
format != GR_TEXFMT_ARGB_CMP_DXT4 && format != GR_TEXFMT_ARGB_CMP_DXT5 ) {
|
||||
if(format != GR_TEXFMT_ARGB_CMP_FXT1 && format != GR_TEXFMT_ARGB_CMP_DXT1 &&
|
||||
format != GR_TEXFMT_ARGB_CMP_DXT2 && format != GR_TEXFMT_ARGB_CMP_DXT3 &&
|
||||
format != GR_TEXFMT_ARGB_CMP_DXT4 && format != GR_TEXFMT_ARGB_CMP_DXT5 ) {
|
||||
const FxU32
|
||||
aspectIndex = ((aspectRatio < GR_ASPECT_LOG2_1x1)
|
||||
? -aspectRatio
|
||||
@@ -1243,6 +1215,7 @@ GR_ENTRY(grTexDownloadMipMapLevelPartial,
|
||||
aspectRatio,
|
||||
format,
|
||||
evenOdd,
|
||||
FXFALSE,
|
||||
FXFALSE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user