12 #include "ShaderCombiner.h"
13 #include "DepthBuffer.h"
18 //#define PRINT_DISPLAYLIST
19 //#define PRINT_DISPLAYLIST_NUM 1
23 void RSP_LoadMatrix( f32 mtx[4][4], u32 address )
26 f32 recip = 1.5258789e-05f;
32 } *n64Mat = (struct _N64Matrix *)&RDRAM[address];
34 for (int i = 0; i < 4; i++)
35 for (int j = 0; j < 4; j++)
36 mtx[i][j] = (GLfloat)(n64Mat->integer[i][j^1]) + (GLfloat)(n64Mat->fraction[i][j^1]) * recip;
39 void RSP_ProcessDList()
43 TextureCache_ActivateNoise(2);
45 RSP.PC[0] = *(u32*)&DMEM[0x0FF0];
52 #ifdef __TRIBUFFER_OPT
56 gSP.matrix.stackSize = min( 32, *(u32*)&DMEM[0x0FE4] >> 6 );
57 gSP.matrix.modelViewi = 0;
58 gSP.changed |= CHANGED_MATRIX;
60 for (int i = 0; i < 4; i++)
61 for (int j = 0; j < 4; j++)
62 gSP.matrix.modelView[0][i][j] = 0.0f;
64 gSP.matrix.modelView[0][0][0] = 1.0f;
65 gSP.matrix.modelView[0][1][1] = 1.0f;
66 gSP.matrix.modelView[0][2][2] = 1.0f;
67 gSP.matrix.modelView[0][3][3] = 1.0f;
69 u32 uc_start = *(u32*)&DMEM[0x0FD0];
70 u32 uc_dstart = *(u32*)&DMEM[0x0FD8];
71 u32 uc_dsize = *(u32*)&DMEM[0x0FDC];
73 if ((uc_start != RSP.uc_start) || (uc_dstart != RSP.uc_dstart))
74 gSPLoadUcodeEx( uc_start, uc_dstart, uc_dsize );
76 gDPSetAlphaCompare(G_AC_NONE);
77 gDPSetDepthSource(G_ZS_PIXEL);
78 gDPSetRenderMode(0, 0);
79 gDPSetAlphaDither(G_AD_DISABLE);
80 gDPSetColorDither(G_CD_DISABLE);
81 gDPSetCombineKey(G_CK_NONE);
82 gDPSetTextureConvert(G_TC_FILT);
83 gDPSetTextureFilter(G_TF_POINT);
84 gDPSetTextureLUT(G_TT_NONE);
85 gDPSetTextureLOD(G_TL_TILE);
86 gDPSetTextureDetail(G_TD_CLAMP);
87 gDPSetTexturePersp(G_TP_PERSP);
88 gDPSetCycleType(G_CYC_1CYCLE);
89 gDPPipelineMode(G_PM_NPRIMITIVE);
91 #ifdef PRINT_DISPLAYLIST
92 if ((RSP.DList%PRINT_DISPLAYLIST_NUM) == 0) LOG(LOG_VERBOSE, "BEGIN DISPLAY LIST %i \n", RSP.DList);
97 u32 pc = RSP.PC[RSP.PCi];
99 if ((pc + 8) > RDRAMSize)
102 DebugMsg( DEBUG_LOW | DEBUG_ERROR, "ATTEMPTING TO EXECUTE RSP COMMAND AT INVALID RDRAM LOCATION\n" );
108 u32 w0 = *(u32*)&RDRAM[pc];
109 u32 w1 = *(u32*)&RDRAM[pc+4];
110 RSP.nextCmd = _SHIFTR( *(u32*)&RDRAM[pc+8], 24, 8 );
111 RSP.cmd = _SHIFTR( w0, 24, 8 );
112 RSP.PC[RSP.PCi] += 8;
115 GBI_ProfileBegin(RSP.cmd);
118 #ifdef PRINT_DISPLAYLIST
119 if ((RSP.DList%PRINT_DISPLAYLIST_NUM) == 0) LOG(LOG_VERBOSE, "%s: w0=0x%x w1=0x%x\n", GBI_GetFuncName(GBI.current->type, RSP.cmd), w0, w1);
122 GBI.cmd[RSP.cmd]( w0, w1 );
125 GBI_ProfileEnd(RSP.cmd);
129 #ifdef PRINT_DISPLAYLIST
130 if ((RSP.DList%PRINT_DISPLAYLIST_NUM) == 0) LOG(LOG_VERBOSE, "END DISPLAY LIST %i \n", RSP.DList);
135 gSP.changed |= CHANGED_COLORBUFFER;
140 RDRAMSize = 1024 * 1024 * 8;
142 RSP.uc_start = RSP.uc_dstart = 0;
143 gDP.loadTile = &gDP.tiles[7];
144 gSP.textureTile[0] = &gDP.tiles[0];
145 gSP.textureTile[1] = &gDP.tiles[1];