From 04a5b59db5b460eab06c07bc6a44391fac5d0806 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Thu, 7 Nov 2024 14:24:48 -0500 Subject: [PATCH] GX work --- .vscode/settings.json | 1 + configure.py | 6 +- include/JSystem/JMath/JMath.h | 3 +- include/dolphin/gx/GX.h | 82 +++++++++++++++++++ include/dolphin/gx/GXEnum.h | 2 +- include/dolphin/gx/GXInit.h | 14 +++- include/dolphin/gx/GXTexture.h | 2 +- include/dolphin/gx/GXTransform.h | 2 + include/global.h | 1 + src/JSystem/JParticle/JPAMath.cpp | 2 +- .../MSL/MSL_C/MSL_Common/Src/abort_exit.c | 4 +- src/d/actor/d_a_title.cpp | 13 ++- src/dolphin/gx/GXBump.c | 30 ++----- src/dolphin/gx/GXInit.c | 49 ++--------- src/dolphin/gx/GXTransform.c | 64 +++++++++++---- 15 files changed, 183 insertions(+), 92 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 35525029c..01bb1bcf6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -24,6 +24,7 @@ "search.exclude": { "build/*/config.json": true, "build/**/*.MAP": true, + "build/*/include/assets/**": true, "build.ninja": true, ".ninja_*": true, "objdiff.json": true, diff --git a/configure.py b/configure.py index 0c72c126c..a8058669e 100644 --- a/configure.py +++ b/configure.py @@ -1143,20 +1143,20 @@ config.libs = [ DolphinLib( "gx", [ - Object(NonMatching, "dolphin/gx/GXInit.c"), + Object(NonMatching, "dolphin/gx/GXInit.c", extra_cflags=["-opt nopeephole"]), Object(NonMatching, "dolphin/gx/GXFifo.c"), Object(NonMatching, "dolphin/gx/GXAttr.c"), Object(NonMatching, "dolphin/gx/GXMisc.c"), Object(NonMatching, "dolphin/gx/GXGeometry.c"), Object(NonMatching, "dolphin/gx/GXFrameBuf.c"), - Object(NonMatching, "dolphin/gx/GXLight.c"), + Object(NonMatching, "dolphin/gx/GXLight.c", extra_cflags=["-fp_contract off"]), Object(NonMatching, "dolphin/gx/GXTexture.c"), Object(NonMatching, "dolphin/gx/GXBump.c"), Object(NonMatching, "dolphin/gx/GXTev.c"), Object(NonMatching, "dolphin/gx/GXPixel.c"), Object(NonMatching, "dolphin/gx/GXStubs.c"), Object(NonMatching, "dolphin/gx/GXDisplayList.c"), - Object(NonMatching, "dolphin/gx/GXTransform.c"), + Object(NonMatching, "dolphin/gx/GXTransform.c", extra_cflags=["-fp_contract off"]), Object(NonMatching, "dolphin/gx/GXPerf.c"), ], ), diff --git a/include/JSystem/JMath/JMath.h b/include/JSystem/JMath/JMath.h index 759d94612..ef217058e 100644 --- a/include/JSystem/JMath/JMath.h +++ b/include/JSystem/JMath/JMath.h @@ -1,7 +1,8 @@ #ifndef JMATH_H #define JMATH_H -#include "dolphin/mtx/mtx.h" +#include "dolphin/mtx/quat.h" +#include "math.h" bool JMANewSinTable(u8 numBits); void JMAEulerToQuat(s16 x, s16 y, s16 z, Quaternion* out); diff --git a/include/dolphin/gx/GX.h b/include/dolphin/gx/GX.h index f263c5637..ffc578489 100644 --- a/include/dolphin/gx/GX.h +++ b/include/dolphin/gx/GX.h @@ -205,6 +205,88 @@ inline void GFWriteBPCmd(u32 x) { inline void GXEnd() {} +#define GX_WRITE_U8(ub) \ + GXFIFO.u8 = (u8)(ub) + +#define GX_WRITE_U16(us) \ + GXFIFO.u16 = (u16)(us) + +#define GX_WRITE_U32(ui) \ + GXFIFO.u32 = (u32)(ui) + +#define GX_WRITE_F32(f) \ + GXFIFO.f32 = (f32)(f); + +#define GX_WRITE_XF_REG(addr, value) \ +do { \ + GX_WRITE_U8(0x10); \ + GX_WRITE_U32(0x1000 + (addr)); \ + GX_WRITE_U32(value); \ + VERIF_XF_REG(addr, value); \ +} while (0) + +#if DEBUG +#define GX_WRITE_XF_REG_2(addr, value) \ +do { \ + u32 xfData = (value); &xfData; \ + GX_WRITE_U32(value); \ + VERIF_XF_REG_alt(addr, xfData); \ +} while (0) +#define GX_WRITE_XF_REG_F(addr, value) \ +do { \ + f32 xfData = (value); \ + GX_WRITE_F32(value); \ + VERIF_XF_REG_alt(addr, *(u32 *)&xfData); \ +} while (0) +#else +#define GX_WRITE_XF_REG_2(addr, value) \ +do { \ + GX_WRITE_U32(value); \ +} while (0) +#define GX_WRITE_XF_REG_F(addr, value) \ +do { \ + GX_WRITE_F32(value); \ +} while (0) +#endif + +#define GX_WRITE_RAS_REG(value) \ +do { \ + GX_WRITE_U8(0x61); \ + GX_WRITE_U32(value); \ + VERIF_RAS_REG(value); \ +} while (0) + +#define GX_WRITE_SOME_REG2(a, b, c, addr) \ +do { \ + long regAddr; \ + GX_WRITE_U8(a); \ + GX_WRITE_U8(b); \ + GX_WRITE_U32(c); \ + regAddr = addr; \ + if (regAddr >= 0 && regAddr < 4) { \ + gx->indexBase[regAddr] = c; \ + } \ +} while (0) +#define GX_WRITE_SOME_REG3(a, b, c, addr) \ +do { \ + long regAddr; \ + GX_WRITE_U8(a); \ + GX_WRITE_U8(b); \ + GX_WRITE_U32(c); \ + regAddr = addr; \ + if (regAddr >= 0 && regAddr < 4) { \ + gx->indexStride[regAddr] = c; \ + } \ +} while (0) +#define GX_WRITE_SOME_REG4(a, b, c, addr) \ +do { \ + long regAddr; \ + GX_WRITE_U8(a); \ + GX_WRITE_U8(b); \ + GX_WRITE_U32(c); \ + regAddr = addr; \ +} while (0) + #ifdef __cplusplus }; #endif diff --git a/include/dolphin/gx/GXEnum.h b/include/dolphin/gx/GXEnum.h index 2ee0c019b..35c4d6c81 100644 --- a/include/dolphin/gx/GXEnum.h +++ b/include/dolphin/gx/GXEnum.h @@ -454,7 +454,7 @@ typedef enum _GXAnisotropy { typedef enum _GXCITexFmt { /* 0x8 */ GX_TF_C4 = 8, - /* 0x8 */ GX_TF_C8, + /* 0x9 */ GX_TF_C8, /* 0xA */ GX_TF_C14X2 } GXCITexFmt; diff --git a/include/dolphin/gx/GXInit.h b/include/dolphin/gx/GXInit.h index 5acdfc83d..3a076df89 100644 --- a/include/dolphin/gx/GXInit.h +++ b/include/dolphin/gx/GXInit.h @@ -81,8 +81,8 @@ typedef struct _GXData { // Texture regions /* 0x208 */ GXTexRegion TexRegions0[GX_MAX_TEXMAP]; /* 0x288 */ GXTexRegion TexRegions1[4]; - /* 0x2C8 */ u32 m2C8; - /* 0x2C8 */ u32 m2CC; + /* 0x2C8 */ u32 nextTexRgn; + /* 0x2C8 */ u32 nextTexRgnCI; // Texture lookup table regions /* 0x2D0 */ GXTlutRegion TlutRegions[GX_MAX_TLUT_ALL]; @@ -140,6 +140,16 @@ extern u16* __cpReg; extern u16* __peReg; extern vu16* __memReg; +#define GX_GET_MEM_REG(offset) (*(vu16*)((vu16*)(__memReg) + (offset))) +#define GX_GET_CP_REG(offset) (*(vu16*)((vu16*)(__cpReg) + (offset))) +#define GX_GET_PE_REG(offset) (*(vu16*)((vu16*)(__peReg) + (offset))) +#define GX_GET_PI_REG(offset) (*(vu32*)((vu32*)(__piReg) + (offset))) + +#define GX_SET_MEM_REG(offset, val) (*(vu16*)((vu16*)(__memReg) + (offset)) = val) +#define GX_SET_CP_REG(offset, val) (*(vu16*)((vu16*)(__cpReg) + (offset)) = val) +#define GX_SET_PE_REG(offset, val) (*(vu16*)((vu16*)(__peReg) + (offset)) = val) +#define GX_SET_PI_REG(offset, val) (*(vu32*)((vu32*)(__piReg) + (offset)) = val) + inline void GXSetWasteFlags() { GXData* data = __GXData; data->dirtyState |= GX_DIRTY_SU_TEX | GX_DIRTY_BP_MASK; diff --git a/include/dolphin/gx/GXTexture.h b/include/dolphin/gx/GXTexture.h index 3c1013060..9e3739fcf 100644 --- a/include/dolphin/gx/GXTexture.h +++ b/include/dolphin/gx/GXTexture.h @@ -40,7 +40,7 @@ void GXSetTexCoordBias(GXTexCoordID coord, GXBool s_enable, GXBool t_enable); void __SetSURegs(); void __GXSetSUTexRegs(); -void __GXSetTmemConfig(); +void __GXSetTmemConfig(u32); #ifdef __cplusplus }; diff --git a/include/dolphin/gx/GXTransform.h b/include/dolphin/gx/GXTransform.h index af4b1ccd4..4a88e560f 100644 --- a/include/dolphin/gx/GXTransform.h +++ b/include/dolphin/gx/GXTransform.h @@ -23,6 +23,8 @@ void GXGetScissor(u32* left, u32* top, u32* width, u32* height); void GXSetScissorBoxOffset(s32 x, s32 y); void GXSetClipMode(GXClipMode mode); +void __GXSetMatrixIndex(GXAttr index); + #ifdef __cplusplus }; #endif diff --git a/include/global.h b/include/global.h index 09227b728..863466a0d 100644 --- a/include/global.h +++ b/include/global.h @@ -41,6 +41,7 @@ #endif extern int __cntlzw(uint); +extern int __rlwimi(int, int, int, int, int); extern void __dcbz(void*, int); #define VERSION_JPN 0 diff --git a/src/JSystem/JParticle/JPAMath.cpp b/src/JSystem/JParticle/JPAMath.cpp index efeb0f1a3..93b6fa9a8 100644 --- a/src/JSystem/JParticle/JPAMath.cpp +++ b/src/JSystem/JParticle/JPAMath.cpp @@ -6,7 +6,7 @@ #include "JSystem/JParticle/JPAMath.h" #include "JSystem/JMath/JMath.h" #include "JSystem/JMath/JMATrigonometric.h" -#include "dolphin/types.h" +#include "dolphin/mtx/mtx.h" static f32 dummy() { return 1.0f; diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c index 8c59895b3..d735816ea 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c @@ -1,6 +1,8 @@ #include "abort_exit.h" -#include "critical_regions.h" #include "stddef.h" +#include "NMWException.h" + +void _ExitProcess(); extern void (*_dtors[])(void); diff --git a/src/d/actor/d_a_title.cpp b/src/d/actor/d_a_title.cpp index e77ef93bd..e35a9aaaa 100644 --- a/src/d/actor/d_a_title.cpp +++ b/src/d/actor/d_a_title.cpp @@ -4,9 +4,6 @@ // #include "d/actor/d_a_title.h" -#include "d/res/res_tlogo.h" -#include "d/res/res_tlogoe.h" -#include "d/res/res_tlogoe0.h" #include "d/d_procname.h" #include "f_op/f_op_overlap_mng.h" #include "f_op/f_op_scene_mng.h" @@ -18,6 +15,16 @@ #include "JSystem/JKernel/JKRExpHeap.h" #include "stdio.h" +#if VERSION == VERSION_JPN +#include "d/res/res_tlogo.h" +#endif +#if VERSION == VERSION_USA +#include "d/res/res_tlogoe.h" +#endif +#if VERSION == VERSION_PAL +#include "d/res/res_tlogoe0.h" +#endif + // Note: For VERSION_PAL the "TlogoE0" string literal is modified at runtime. #define ARCNAME VERSION_SELECT("Tlogo", "TlogoE", "TlogoE0") diff --git a/src/dolphin/gx/GXBump.c b/src/dolphin/gx/GXBump.c index 8c1084df4..8a5284b2a 100644 --- a/src/dolphin/gx/GXBump.c +++ b/src/dolphin/gx/GXBump.c @@ -127,36 +127,22 @@ void GXSetIndTexCoordScale(GXIndTexStageID texStage, GXIndTexScale scaleS, GXInd } void GXSetIndTexOrder(GXIndTexStageID stage, GXTexCoordID coord, GXTexMapID map) { - GXData* data; - - if (map == 0xFF) { - map = GX_TEXMAP0; - } - - if (coord == 0xFF) { - coord = GX_TEXCOORD0; - } - switch (stage) { case GX_INDTEXSTAGE0: - data = __GXData; - GX_BITFIELD_SET(data->iref, 29, 3, map); - GX_BITFIELD_SET(data->iref, 26, 3, coord); + GX_BITFIELD_SET(__GXData->iref, 29, 3, map); + GX_BITFIELD_SET(__GXData->iref, 26, 3, coord); break; case GX_INDTEXSTAGE1: - data = __GXData; - GX_BITFIELD_SET(data->iref, 23, 3, map); - GX_BITFIELD_SET(data->iref, 20, 3, coord); + GX_BITFIELD_SET(__GXData->iref, 23, 3, map); + GX_BITFIELD_SET(__GXData->iref, 20, 3, coord); break; case GX_INDTEXSTAGE2: - data = __GXData; - GX_BITFIELD_SET(data->iref, 17, 3, map); - GX_BITFIELD_SET(data->iref, 14, 3, coord); + GX_BITFIELD_SET(__GXData->iref, 17, 3, map); + GX_BITFIELD_SET(__GXData->iref, 14, 3, coord); break; case GX_INDTEXSTAGE3: - data = __GXData; - GX_BITFIELD_SET(data->iref, 11, 3, map); - GX_BITFIELD_SET(data->iref, 8, 3, coord); + GX_BITFIELD_SET(__GXData->iref, 11, 3, map); + GX_BITFIELD_SET(__GXData->iref, 8, 3, coord); break; } diff --git a/src/dolphin/gx/GXInit.c b/src/dolphin/gx/GXInit.c index d05c8ab4d..b9d3c126d 100644 --- a/src/dolphin/gx/GXInit.c +++ b/src/dolphin/gx/GXInit.c @@ -4,37 +4,21 @@ char* __GXVersion = "<< Dolphin SDK - GX release build: Nov 10 2004 06:27:12 (0x2301) >>"; -static GXFifoObj FifoObj; - static GXData gxData; +static GXFifoObj FifoObj; + GXData* const __GXData = &gxData; GXTexRegion* __GXDefaultTexRegionCallback(const GXTexObj* obj, GXTexMapID id) { - GXTexFmt format; // r31 - GXBool isMipMap; // r3 + GXTexFmt format; format = GXGetTexObjFmt(obj); - isMipMap = GXGetTexObjMipMap(obj); - id = (GXTexMapID)(id % GX_MAX_TEXMAP); - switch (format) { - case GX_TF_RGBA8: - // if (isMipMap) { - // return &__GXData->TexRegions2[id]; - // } - return &__GXData->TexRegions1[id]; - - case GX_TF_C4: - case GX_TF_C8: - case GX_TF_C14X2: - return &__GXData->TexRegions0[id]; - - default: - if (isMipMap) { - return &__GXData->TexRegions1[id]; - } - return &__GXData->TexRegions0[id]; + if (format != GX_TF_C4 && format != GX_TF_C8 && format != GX_TF_C14X2) { + return &__GXData->TexRegions0[__GXData->nextTexRgn++ % GX_MAX_TEXMAP]; + } else { + return &__GXData->TexRegions1[__GXData->nextTexRgnCI++ % 4]; } } @@ -168,11 +152,6 @@ GXFifoObj* GXInit(void* base, u32 size) { GXSetCPUFifo(&FifoObj); GXSetGPFifo(&FifoObj); - if (!resetFuncRegistered) { - // OSRegisterResetFunction(&GXResetFuncInfo); - resetFuncRegistered = 1; - } - __GXPEInit(); EnableWriteGatherPipe(); @@ -280,7 +259,6 @@ GXFifoObj* GXInit(void* base, u32 size) { GFWriteBPCmd(0x67000000); - __GXSetIndirectMask(0); __GXSetTmemConfig(2); __GXInitGX(); @@ -289,7 +267,6 @@ GXFifoObj* GXInit(void* base, u32 size) { void __GXInitGX(void) { GXRenderModeObj* renderObj; - GXTexObj texObj; Mtx ident; GXColor clearColor = {64, 64, 64, 255}; GXColor ambColor = {0, 0, 0, 0}; @@ -395,19 +372,11 @@ void __GXInitGX(void) { GXSetChanMatColor(GX_COLOR1A1, matColor); GXInvalidateTexAll(); + __GXData->nextTexRgn = 0; + __GXData->nextTexRgnCI = 0; GXSetTexRegionCallback(__GXDefaultTexRegionCallback); GXSetTlutRegionCallback(__GXDefaultTlutRegionCallback); - GXInitTexObj(&texObj, DefaultTexData, 4, 4, GX_TF_IA8, GX_CLAMP, GX_CLAMP, GX_FALSE); - GXLoadTexObj(&texObj, GX_TEXMAP0); - GXLoadTexObj(&texObj, GX_TEXMAP1); - GXLoadTexObj(&texObj, GX_TEXMAP2); - GXLoadTexObj(&texObj, GX_TEXMAP3); - GXLoadTexObj(&texObj, GX_TEXMAP4); - GXLoadTexObj(&texObj, GX_TEXMAP5); - GXLoadTexObj(&texObj, GX_TEXMAP6); - GXLoadTexObj(&texObj, GX_TEXMAP7); - GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP1, GX_COLOR0A0); GXSetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD2, GX_TEXMAP2, GX_COLOR0A0); diff --git a/src/dolphin/gx/GXTransform.c b/src/dolphin/gx/GXTransform.c index 890379744..a8ca4c714 100644 --- a/src/dolphin/gx/GXTransform.c +++ b/src/dolphin/gx/GXTransform.c @@ -1,13 +1,12 @@ #include "dolphin/gx/GXTransform.h" #include "dolphin/gx/GX.h" -#include "dolphin/os/OS.h" - -void __GXSetMatrixIndex(); +#include "dolphin/gx/GXInit.h" static void Copy6Floats(register f32 src[6], register f32 dst[6]) { register f32 ps_0, ps_1, ps_2; // clang-format off +#ifdef __MWERKS__ asm { psq_l ps_0, 0(src), 0, 0 psq_l ps_1, 8(src), 0, 0 @@ -16,6 +15,7 @@ static void Copy6Floats(register f32 src[6], register f32 dst[6]) { psq_st ps_1, 8(dst), 0, 0 psq_st ps_2, 16(dst), 0, 0 } +#endif // clang-format on } @@ -23,6 +23,7 @@ static void WriteProjPS(const register f32 src[6], register volatile void* dst) register f32 ps_0, ps_1, ps_2; // clang-format off +#ifdef __MWERKS__ asm { psq_l ps_0, 0(src), 0, 0 psq_l ps_1, 8(src), 0, 0 @@ -31,6 +32,7 @@ static void WriteProjPS(const register f32 src[6], register volatile void* dst) psq_st ps_1, 0(dst), 0, 0 psq_st ps_2, 0(dst), 0, 0 } +#endif // clang-format on } @@ -42,8 +44,6 @@ void GXProject(f32 model_x, f32 model_y, f32 model_z, Mtx model_mtx, f32* proj_m f32 var_f28; f32 var_f31; - ASSERTMSG(proj_mtx != NULL && viewpoint != NULL && screen_x != NULL && screen_y != NULL && screen_z != NULL, "GXGet*: invalid null pointer"); - sp10[0] = (model_mtx[0][0] * model_x) + (model_mtx[0][1] * model_y) + (model_mtx[0][2] * model_z) + model_mtx[0][3]; sp10[1] = (model_mtx[1][0] * model_x) + (model_mtx[1][1] * model_y) + @@ -68,14 +68,9 @@ void GXProject(f32 model_x, f32 model_y, f32 model_z, Mtx model_mtx, f32* proj_m *screen_z = viewpoint[5] + (var_f31 * (var_f28 * (viewpoint[5] - viewpoint[4]))); } -void __GXSetProjection(void) { - GX_XF_LOAD_REGS(6, GX_XF_REG_PROJECTIONA); - WriteProjPS(__GXData->projMtx, (volatile void*)GXFIFO_ADDR); - GXFIFO.u32 = __GXData->projType; -} - void GXSetProjection(const Mtx44 proj, GXProjectionType type) { volatile void* fifo; + u32 reg; __GXData->projType = type; __GXData->projMtx[0] = proj[0][0]; @@ -91,28 +86,58 @@ void GXSetProjection(const Mtx44 proj, GXProjectionType type) { __GXData->projMtx[3] = proj[1][2]; } - __GXSetProjection(); + + reg = 0x00061020; + GX_WRITE_U8(0x10); + GX_WRITE_U32(reg); + GX_WRITE_XF_REG_F(32, __GXData->projMtx[0]); + GX_WRITE_XF_REG_F(33, __GXData->projMtx[1]); + GX_WRITE_XF_REG_F(34, __GXData->projMtx[2]); + GX_WRITE_XF_REG_F(35, __GXData->projMtx[3]); + GX_WRITE_XF_REG_F(36, __GXData->projMtx[4]); + GX_WRITE_XF_REG_F(37, __GXData->projMtx[5]); + GX_WRITE_XF_REG_2(38, __GXData->projType); __GXData->bpSentNot = GX_TRUE; } void GXSetProjectionv(f32* proj) { - __GXData->projType = proj[0] == 0.0f ? GX_PERSPECTIVE : GX_ORTHOGRAPHIC; - Copy6Floats(&proj[1], __GXData->projMtx); + __GXData->projType = proj[0]; + __GXData->projMtx[0] = proj[1]; + __GXData->projMtx[1] = proj[2]; + __GXData->projMtx[2] = proj[3]; + __GXData->projMtx[3] = proj[4]; + __GXData->projMtx[4] = proj[5]; + __GXData->projMtx[5] = proj[6]; - __GXSetProjection(); + + GX_WRITE_U8(0x10); + GX_WRITE_U32(0x00061020); + GX_WRITE_XF_REG_F(32, __GXData->projMtx[0]); + GX_WRITE_XF_REG_F(33, __GXData->projMtx[1]); + GX_WRITE_XF_REG_F(34, __GXData->projMtx[2]); + GX_WRITE_XF_REG_F(35, __GXData->projMtx[3]); + GX_WRITE_XF_REG_F(36, __GXData->projMtx[4]); + GX_WRITE_XF_REG_F(37, __GXData->projMtx[5]); + GX_WRITE_XF_REG_2(38, __GXData->projType); __GXData->bpSentNot = GX_TRUE; } void GXGetProjectionv(f32* proj) { - *proj = (u32)__GXData->projType != GX_PERSPECTIVE ? 1.0f : 0.0f; - Copy6Floats(__GXData->projMtx, &proj[1]); + proj[0] = __GXData->projType; + proj[1] = __GXData->projMtx[0]; + proj[2] = __GXData->projMtx[1]; + proj[3] = __GXData->projMtx[2]; + proj[4] = __GXData->projMtx[3]; + proj[5] = __GXData->projMtx[4]; + proj[6] = __GXData->projMtx[5]; } static void WriteMTXPS4x3(register volatile void* dst, register const Mtx src) { register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5; // clang-format off +#ifdef __MWERKS__ asm { psq_l ps_0, 0(src), 0, 0 psq_l ps_1, 8(src), 0, 0 @@ -128,6 +153,7 @@ static void WriteMTXPS4x3(register volatile void* dst, register const Mtx src) { psq_st ps_4, 0(dst), 0, 0 psq_st ps_5, 0(dst), 0, 0 } +#endif // clang-format on } @@ -140,6 +166,7 @@ static void WriteMTXPS3x3(register volatile void* dst, register const Mtx src) { register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5; // clang-format off +#ifdef __MWERKS__ asm { psq_l ps_0, 0(src), 0, 0 lfs ps_1, 8(src) @@ -155,6 +182,7 @@ static void WriteMTXPS3x3(register volatile void* dst, register const Mtx src) { psq_st ps_4, 0(dst), 0, 0 stfs ps_5, 0(dst) } +#endif // clang-format on } @@ -172,6 +200,7 @@ static void WriteMTXPS4x2(register volatile void* dst, register const Mtx src) { register f32 ps_0, ps_1, ps_2, ps_3; // clang-format off +#ifdef __MWERKS__ asm { psq_l ps_0, 0(src), 0, 0 psq_l ps_1, 8(src), 0, 0 @@ -183,6 +212,7 @@ static void WriteMTXPS4x2(register volatile void* dst, register const Mtx src) { psq_st ps_2, 0(dst), 0, 0 psq_st ps_3, 0(dst), 0, 0 } +#endif // clang-format on }