diff --git a/gxtest/cgx.cpp b/gxtest/cgx.cpp index 9f6177e..3469b0b 100644 --- a/gxtest/cgx.cpp +++ b/gxtest/cgx.cpp @@ -85,7 +85,7 @@ void CGX_Init() void CGX_SetViewport(float origin_x, float origin_y, float width, float height, float near, f32 far) { - CGX_BEGIN_LOAD_XF_REGS(0x101a, 6); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETVIEWPORT, 6); wgPipe->F32 = width * 0.5f; wgPipe->F32 = -height * 0.5f; wgPipe->F32 = (far - near) * 16777215.0f; @@ -105,7 +105,7 @@ void CGX_LoadPosMatrixDirect(f32 mt[3][4], u32 index) void CGX_LoadProjectionMatrixPerspective(float mtx[4][4]) { // Untested - /* CGX_BEGIN_LOAD_XF_REGS(0x1020, 7); + /* CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETPROJECTION, 7); wgPipe->F32 = mtx[0][0]; wgPipe->F32 = mtx[0][2]; wgPipe->F32 = mtx[1][1]; @@ -119,7 +119,7 @@ void CGX_LoadProjectionMatrixPerspective(float mtx[4][4]) void CGX_LoadProjectionMatrixOrthographic(float mtx[4][4]) { // Untested - /* CGX_BEGIN_LOAD_XF_REGS(0x1020, 7); + /* CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETPROJECTION, 7); wgPipe->F32 = mtx[0][0]; wgPipe->F32 = mtx[0][3]; wgPipe->F32 = mtx[1][1]; diff --git a/gxtest/clipping.cpp b/gxtest/clipping.cpp index 0b03af3..088533b 100644 --- a/gxtest/clipping.cpp +++ b/gxtest/clipping.cpp @@ -19,15 +19,15 @@ void ClipTest() CGX_LOAD_BP_REG(CGXDefault(0).hex); - CGX_BEGIN_LOAD_XF_REGS(0x1009, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETNUMCHAN, 1); wgPipe->U32 = 1; // 1 color channel LitChannel chan; chan.hex = 0; chan.matsource = MatSource::Vertex; - CGX_BEGIN_LOAD_XF_REGS(0x100e, 1); // color channel 1 + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_COLOR, 1); wgPipe->U32 = chan.hex; - CGX_BEGIN_LOAD_XF_REGS(0x1010, 1); // alpha channel 1 + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_ALPHA, 1); wgPipe->U32 = chan.hex; CGX_LOAD_BP_REG(CGXDefault(0).hex); @@ -79,7 +79,7 @@ void ClipTest() CGX_LOAD_BP_REG(tevreg.ra.hex); CGX_LOAD_BP_REG(tevreg.bg.hex); - CGX_BEGIN_LOAD_XF_REGS(0x1005, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_CLIPDISABLE, 1); wgPipe->U32 = 0; // 0 = enable clipping, 1 = disable clipping bool expect_quad_to_be_drawn = true; @@ -157,7 +157,7 @@ void ClipTest() // Depth clipping tests case 7: // Everything behind z=w plane, depth clipping enabled case 8: // Everything behind z=w plane, depth clipping disabled - CGX_BEGIN_LOAD_XF_REGS(0x1005, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_CLIPDISABLE, 1); wgPipe->U32 = step - 7; // 0 = enable clipping, 1 = disable clipping test_quad.AtDepth(1.1); @@ -166,7 +166,7 @@ void ClipTest() case 9: // Everything in front of z=0 plane, depth clipping enabled case 10: // Everything in front of z=0 plane, depth clipping disabled - CGX_BEGIN_LOAD_XF_REGS(0x1005, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_CLIPDISABLE, 1); wgPipe->U32 = step - 9; // 0 = enable clipping, 1 = disable clipping test_quad.AtDepth(-0.00001); @@ -181,7 +181,7 @@ void ClipTest() // number, which by IEEE would be non-zero but which in fact is // treated as zero. // In particular, the value by IEEE is -0.00000011920928955078125. - CGX_BEGIN_LOAD_XF_REGS(0x1005, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_CLIPDISABLE, 1); wgPipe->U32 = step - 11; // 0 = enable clipping, 1 = disable clipping test_quad.AtDepth(1.0000001); @@ -189,7 +189,7 @@ void ClipTest() case 13: // One vertex behind z=w plane, depth clipping enabled case 14: // One vertex behind z=w plane, depth clipping disabled - CGX_BEGIN_LOAD_XF_REGS(0x1005, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_CLIPDISABLE, 1); wgPipe->U32 = step - 13; // 0 = enable clipping, 1 = disable clipping test_quad.VertexTopLeft(-1.0f, 1.0f, 1.5f); @@ -200,7 +200,7 @@ void ClipTest() break; case 15: // Three vertices with a very large value for z, depth clipping disabled - CGX_BEGIN_LOAD_XF_REGS(0x1005, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_CLIPDISABLE, 1); wgPipe->U32 = 1; // 0 = enable clipping, 1 = disable clipping test_quad.VertexTopLeft(-1.0f, 1.0f, 65537.f); diff --git a/gxtest/lighting.cpp b/gxtest/lighting.cpp index 37fb835..d005a0d 100644 --- a/gxtest/lighting.cpp +++ b/gxtest/lighting.cpp @@ -19,7 +19,7 @@ void LightingTest() CGX_LOAD_BP_REG(CGXDefault(0).hex); - CGX_BEGIN_LOAD_XF_REGS(0x1009, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETNUMCHAN, 1); wgPipe->U32 = 1; // 1 color channel LitChannel chan; @@ -27,9 +27,9 @@ void LightingTest() chan.matsource = MatSource::MatColorRegister; chan.ambsource = AmbSource::AmbColorRegister; chan.enablelighting = true; - CGX_BEGIN_LOAD_XF_REGS(0x100e, 1); // color channel 1 + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_COLOR, 1); wgPipe->U32 = chan.hex; - CGX_BEGIN_LOAD_XF_REGS(0x1010, 1); // alpha channel 1 + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_ALPHA, 1); wgPipe->U32 = chan.hex; CGX_LOAD_BP_REG(CGXDefault(0).hex); @@ -62,13 +62,13 @@ void LightingTest() CGX_LOAD_BP_REG(tevreg.ra.hex); CGX_LOAD_BP_REG(tevreg.bg.hex); - CGX_BEGIN_LOAD_XF_REGS(0x1005, 1); - wgPipe->U32 = 0; // 0 = enable clipping, 1 = disable clipping + CGX_BEGIN_LOAD_XF_REGS(XFMEM_CLIPDISABLE, 1); + wgPipe->U32 = 0; // enable clipping - CGX_BEGIN_LOAD_XF_REGS(0x100a, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_AMBCOLOR, 1); wgPipe->U32 = (ambcolor << 24) | 255; - CGX_BEGIN_LOAD_XF_REGS(0x100c, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_MATCOLOR, 1); wgPipe->U32 = (matcolor << 24) | 255; int test_x = 125, test_y = 25; // Somewhere within the viewport diff --git a/gxtest/rasterization.cpp b/gxtest/rasterization.cpp index e435784..b7351b6 100644 --- a/gxtest/rasterization.cpp +++ b/gxtest/rasterization.cpp @@ -19,15 +19,15 @@ void CoordinatePrecisionTest() CGX_LOAD_BP_REG(CGXDefault(0).hex); - CGX_BEGIN_LOAD_XF_REGS(0x1009, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETNUMCHAN, 1); wgPipe->U32 = 1; // 1 color channel LitChannel chan; chan.hex = 0; chan.matsource = MatSource::Vertex; - CGX_BEGIN_LOAD_XF_REGS(0x100e, 1); // color channel 1 + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_COLOR, 1); wgPipe->U32 = chan.hex; - CGX_BEGIN_LOAD_XF_REGS(0x1010, 1); // alpha channel 1 + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_ALPHA, 1); wgPipe->U32 = chan.hex; auto ac = CGXDefault(0); @@ -99,7 +99,7 @@ void CoordinatePrecisionTest() // For this size, values of xpos from 0.583297729492 to 0.583328247070 will yield a covered // pixel float vp_width = 2.0e-5f; - CGX_BEGIN_LOAD_XF_REGS(0x101a, 6); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETVIEWPORT, 6); wgPipe->F32 = vp_width; wgPipe->F32 = -50.0f; wgPipe->F32 = 16777215.0f; diff --git a/gxtest/tev.cpp b/gxtest/tev.cpp index 981aafd..1360392 100644 --- a/gxtest/tev.cpp +++ b/gxtest/tev.cpp @@ -41,15 +41,15 @@ void TevCombinerTest() CGX_LOAD_BP_REG(CGXDefault(0).hex); - CGX_BEGIN_LOAD_XF_REGS(0x1009, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETNUMCHAN, 1); wgPipe->U32 = 1; // 1 color channel LitChannel chan; chan.hex = 0; chan.matsource = MatSource::Vertex; - CGX_BEGIN_LOAD_XF_REGS(0x100e, 1); // color channel 1 + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_COLOR, 1); wgPipe->U32 = chan.hex; - CGX_BEGIN_LOAD_XF_REGS(0x1010, 1); // alpha channel 1 + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_ALPHA, 1); wgPipe->U32 = chan.hex; auto ac = CGXDefault(0); @@ -240,7 +240,7 @@ void KonstTest() CGX_LOAD_BP_REG(CGXDefault(0).hex); - CGX_BEGIN_LOAD_XF_REGS(0x1009, 1); + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETNUMCHAN, 1); wgPipe->U32 = 1; // 1 color channel LitChannel chan; @@ -248,9 +248,9 @@ void KonstTest() chan.matsource = MatSource::MatColorRegister; chan.ambsource = AmbSource::AmbColorRegister; chan.enablelighting = false; - CGX_BEGIN_LOAD_XF_REGS(0x100e, 1); // color channel 1 + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_COLOR, 1); wgPipe->U32 = chan.hex; - CGX_BEGIN_LOAD_XF_REGS(0x1010, 1); // alpha channel 1 + CGX_BEGIN_LOAD_XF_REGS(XFMEM_SETCHAN0_ALPHA, 1); wgPipe->U32 = chan.hex; auto genmode = CGXDefault(); @@ -264,8 +264,8 @@ void KonstTest() ctrl.early_ztest = false; CGX_LOAD_BP_REG(ctrl.hex); - CGX_BEGIN_LOAD_XF_REGS(0x1005, 1); - wgPipe->U32 = 0; // 0 = enable clipping, 1 = disable clipping + CGX_BEGIN_LOAD_XF_REGS(XFMEM_CLIPDISABLE, 1); + wgPipe->U32 = 0; // enable clipping // Set up "konst" colors with recognizable values. for (int i = 0; i < 4; ++i)