1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

Rewrite gSPSetOtherMode_H and gSPSetOtherMode_L

This commit is contained in:
Sergey Lipskiy 2015-03-28 14:25:46 +06:00
parent 5464a434ea
commit 5c605a130c
5 changed files with 7 additions and 202 deletions

View File

@ -131,9 +131,8 @@ void OGLVideo::restart()
void OGLVideo::swapBuffers()
{
_swapBuffers();
gDPSetRenderMode(0, 0);
gDP.otherMode.l = 0;
gDPSetTextureLUT(G_TT_NONE);
gDPSetAlphaCompare(G_AC_NONE);
++RSP.DList;
}

16
RSP.cpp
View File

@ -150,7 +150,6 @@ void RSP_ProcessDList()
gSP.matrix.modelViewi = 0;
gSP.changed &= ~CHANGED_CPU_FB_WRITE;
gSP.changed |= CHANGED_MATRIX;
gDPSetDepthSource(G_ZS_PIXEL);
gDPSetTexturePersp(G_TP_PERSP);
u32 uc_start = *(u32*)&DMEM[0x0FD0];
@ -251,20 +250,7 @@ void RSP_SetDefaultState()
gSP.matrix.modelView[0][2][2] = 1.0f;
gSP.matrix.modelView[0][3][3] = 1.0f;
gDPSetAlphaCompare(G_AC_NONE);
gDPSetDepthSource(G_ZS_PIXEL);
gDPSetRenderMode(0, 0);
gDPSetAlphaDither(G_AD_DISABLE);
gDPSetColorDither(G_CD_DISABLE);
gDPSetCombineKey(G_CK_NONE);
gDPSetTextureConvert(G_TC_FILT);
gDPSetTextureFilter(G_TF_POINT);
gDPSetTextureLUT(G_TT_NONE);
gDPSetTextureLOD(G_TL_TILE);
gDPSetTextureDetail(G_TD_CLAMP);
gDPSetTexturePersp(G_TP_PERSP);
gDPSetCycleType(G_CYC_1CYCLE);
gDPPipelineMode(G_PM_NPRIMITIVE);
gDP.otherMode._u64 = 0U;
}
u32 DepthClearColor = 0xfffcfffc;

135
gDP.cpp
View File

@ -71,28 +71,6 @@ void gDPSetPrimDepth( u16 z, u16 dz )
#endif
}
void gDPPipelineMode( u32 mode )
{
gDP.otherMode.pipelineMode = mode;
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPPipelineMode( %s );\n",
PipelineModeText[gDP.otherMode.pipelineMode] );
#endif
}
void gDPSetCycleType( u32 type )
{
gDP.otherMode.cycleType = type & 3;
gDP.changed |= CHANGED_CYCLETYPE;
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetCycleType( %s );\n",
CycleTypeText[gDP.otherMode.cycleType] );
#endif
}
void gDPSetTexturePersp( u32 enable )
{
gDP.otherMode.texturePersp = enable & 1;
@ -103,26 +81,6 @@ void gDPSetTexturePersp( u32 enable )
#endif
}
void gDPSetTextureDetail( u32 type )
{
gDP.otherMode.textureDetail = type & 3;
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPSetTextureDetail( %s );\n",
TextureDetailText[gDP.otherMode.textureDetail] );
#endif
}
void gDPSetTextureLOD( u32 mode )
{
gDP.otherMode.textureLOD = mode & 1;
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPSetTextureLOD( %s );\n",
TextureLODText[gDP.otherMode.textureLOD] );
#endif
}
void gDPSetTextureLUT( u32 mode )
{
gDP.otherMode.textureLUT = mode & 3;
@ -133,99 +91,6 @@ void gDPSetTextureLUT( u32 mode )
#endif
}
void gDPSetTextureFilter( u32 type )
{
gDP.otherMode.textureFilter = type & 3;
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPSetTextureFilter( %s );\n",
TextureFilterText[gDP.otherMode.textureFilter] );
#endif
}
void gDPSetTextureConvert( u32 type )
{
gDP.otherMode.textureConvert = type & 7;
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_TEXTURE, "gDPSetTextureConvert( %s );\n",
TextureConvertText[gDP.otherMode.textureConvert] );
#endif
}
void gDPSetCombineKey( u32 type )
{
gDP.otherMode.combineKey = type & 1;
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED | DEBUG_COMBINE, "gDPSetCombineKey( %s );\n",
CombineKeyText[gDP.otherMode.combineKey] );
#endif
}
void gDPSetColorDither( u32 type )
{
gDP.otherMode.colorDither = type & 3;
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetColorDither( %s );\n",
ColorDitherText[gDP.otherMode.colorDither] );
#endif
}
void gDPSetAlphaDither( u32 type )
{
gDP.otherMode.alphaDither = type & 3;
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetAlphaDither( %s );\n",
AlphaDitherText[gDP.otherMode.alphaDither] );
#endif
}
void gDPSetAlphaCompare( u32 mode )
{
gDP.otherMode.alphaCompare = mode & 3;
gDP.changed |= CHANGED_ALPHACOMPARE;
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetAlphaCompare( %s );\n",
AlphaCompareText[gDP.otherMode.alphaCompare] );
#endif
}
void gDPSetDepthSource( u32 source )
{
gDP.otherMode.depthSource = source & 1;
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetDepthSource( %s );\n",
DepthSourceText[gDP.otherMode.depthSource] );
#endif
}
void gDPSetRenderMode( u32 mode1, u32 mode2 )
{
gDP.otherMode.l |= mode1 | mode2;
gDP.changed |= CHANGED_RENDERMODE;
#ifdef DEBUG
// THIS IS INCOMPLETE!!!
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetRenderMode( %s%s%s%s%s | %s | %s%s%s );\n",
gDP.otherMode.AAEnable ? "AA_EN | " : "",
gDP.otherMode.depthCompare ? "Z_CMP | " : "",
gDP.otherMode.depthUpdate ? "Z_UPD | " : "",
gDP.otherMode.imageRead ? "IM_RD | " : "",
CvgDestText[gDP.otherMode.cvgDest],
DepthModeText[gDP.otherMode.depthMode],
gDP.otherMode.cvgXAlpha ? "CVG_X_ALPHA | " : "",
gDP.otherMode.alphaCvgSel ? "ALPHA_CVG_SEL | " : "",
gDP.otherMode.forceBlender ? "FORCE_BL" : "" );
#endif
}
void gDPSetCombine( s32 muxs0, s32 muxs1 )
{
gDP.combine.muxs0 = muxs0;

12
gDP.h
View File

@ -246,20 +246,8 @@ extern gDPInfo gDP;
void gDPSetOtherMode( u32 mode0, u32 mode1 );
void gDPSetPrimDepth( u16 z, u16 dz );
void gDPPipelineMode( u32 mode );
void gDPSetCycleType( u32 type );
void gDPSetTexturePersp( u32 enable );
void gDPSetTextureDetail( u32 type );
void gDPSetTextureLOD( u32 mode );
void gDPSetTextureLUT( u32 mode );
void gDPSetTextureFilter( u32 type );
void gDPSetTextureConvert( u32 type );
void gDPSetCombineKey( u32 type );
void gDPSetColorDither( u32 type );
void gDPSetAlphaDither( u32 type );
void gDPSetAlphaCompare( u32 mode );
void gDPSetDepthSource( u32 source );
void gDPSetRenderMode( u32 mode1, u32 mode2 );
void gDPSetCombine( s32 muxs0, s32 muxs1 );
void gDPSetColorImage( u32 format, u32 size, u32 width, u32 address );
void gDPSetTextureImage( u32 format, u32 size, u32 width, u32 address );

43
gSP.cpp
View File

@ -1786,55 +1786,22 @@ void gSPClearGeometryMode( u32 mode )
void gSPSetOtherMode_H(u32 _length, u32 _shift, u32 _data)
{
const u32 mask = (((u64)1 << _length) - 1) << _shift;
if (mask & 0x00000030) // alpha dither mode
gDPSetAlphaDither(_data >> G_MDSFT_ALPHADITHER);
if (mask & 0x000000C0) // rgb dither mode
gDPSetColorDither(_data >> G_MDSFT_RGBDITHER);
if (mask & 0x00000100) // Combine Key
gDPSetCombineKey(_data >> G_MDSFT_COMBKEY);
if (mask & 0x00000E00) // Texture convert
gDPSetTextureConvert(_data >> G_MDSFT_TEXTCONV);
if (mask & 0x00003000) // filter mode
gDPSetTextureFilter(_data >> G_MDSFT_TEXTFILT);
if (mask & 0x0000C000) // tlut mode
gDPSetTextureLUT(_data >> G_MDSFT_TEXTLUT);
if (mask & 0x00010000) // LOD enable
gDPSetTextureLOD(_data >> G_MDSFT_TEXTLOD);
if (mask & 0x00060000) // Texture detail mode
gDPSetTextureDetail(_data >> G_MDSFT_TEXTDETAIL);
if (mask & 0x00080000) // Persp enable
gDPSetTexturePersp(_data >> G_MDSFT_TEXTPERSP);
gDP.otherMode.h = (gDP.otherMode.h&(~mask)) | _data;
if (mask & 0x00300000) // cycle type
gDPSetCycleType(_data >> G_MDSFT_CYCLETYPE);
if (mask & 0x00800000) // Pipeline mode
gDPPipelineMode(_data >> G_MDSFT_PIPELINE);
gDP.changed |= CHANGED_CYCLETYPE;
}
void gSPSetOtherMode_L(u32 _length, u32 _shift, u32 _data)
{
u32 mask = (((u64)1 << _length) - 1) << _shift;
_data &= mask;
gDP.otherMode.l &= ~mask;
gDP.otherMode.l = (gDP.otherMode.l&(~mask)) | _data;
if (mask & 0x00000003) // alpha compare
gDPSetAlphaCompare(_data >> G_MDSFT_ALPHACOMPARE);
if (mask & 0x00000004) // z-src selection
gDPSetDepthSource(_data >> G_MDSFT_ZSRCSEL);
gDP.changed |= CHANGED_ALPHACOMPARE;
if (mask & 0xFFFFFFF8) // rendermode / blender bits
gDPSetRenderMode(_data & 0xCCCCFFFF, _data & 0x3333FFFF);
gDP.changed |= CHANGED_RENDERMODE;
}
void gSPLine3D( s32 v0, s32 v1, s32 flag )