From df1bd64662d01d195db242d2e09b2a94d27f7765 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 16 Feb 2023 18:39:14 -0800 Subject: [PATCH] riscv: Add morph+skin to vertexjit. --- GPU/Common/VertexDecoderCommon.h | 8 +++++ GPU/Common/VertexDecoderRiscV.cpp | 60 ++++++++++++++++++++++++++----- 2 files changed, 59 insertions(+), 9 deletions(-) diff --git a/GPU/Common/VertexDecoderCommon.h b/GPU/Common/VertexDecoderCommon.h index 2c1055935f4e..423dbd918d48 100644 --- a/GPU/Common/VertexDecoderCommon.h +++ b/GPU/Common/VertexDecoderCommon.h @@ -563,10 +563,18 @@ class VertexDecoderJitCache : public VERTEXDECODER_JIT_BACKEND { void Jit_NormalS16Morph(); void Jit_NormalFloatMorph(); + void Jit_NormalS8MorphSkin(); + void Jit_NormalS16MorphSkin(); + void Jit_NormalFloatMorphSkin(); + void Jit_PosS8Morph(); void Jit_PosS16Morph(); void Jit_PosFloatMorph(); + void Jit_PosS8MorphSkin(); + void Jit_PosS16MorphSkin(); + void Jit_PosFloatMorphSkin(); + void Jit_Color8888Morph(); void Jit_Color4444Morph(); void Jit_Color565Morph(); diff --git a/GPU/Common/VertexDecoderRiscV.cpp b/GPU/Common/VertexDecoderRiscV.cpp index ffbdd8e8d813..accaebcc45fa 100644 --- a/GPU/Common/VertexDecoderRiscV.cpp +++ b/GPU/Common/VertexDecoderRiscV.cpp @@ -161,6 +161,9 @@ static const JitLookup jitLookup[] = { {&VertexDecoder::Step_NormalS8Morph, &VertexDecoderJitCache::Jit_NormalS8Morph}, {&VertexDecoder::Step_NormalS16Morph, &VertexDecoderJitCache::Jit_NormalS16Morph}, {&VertexDecoder::Step_NormalFloatMorph, &VertexDecoderJitCache::Jit_NormalFloatMorph}, + {&VertexDecoder::Step_NormalS8MorphSkin, &VertexDecoderJitCache::Jit_NormalS8MorphSkin}, + {&VertexDecoder::Step_NormalS16MorphSkin, &VertexDecoderJitCache::Jit_NormalS16MorphSkin}, + {&VertexDecoder::Step_NormalFloatMorphSkin, &VertexDecoderJitCache::Jit_NormalFloatMorphSkin}, {&VertexDecoder::Step_PosS8, &VertexDecoderJitCache::Jit_PosS8}, {&VertexDecoder::Step_PosS16, &VertexDecoderJitCache::Jit_PosS16}, @@ -176,6 +179,9 @@ static const JitLookup jitLookup[] = { {&VertexDecoder::Step_PosS8Morph, &VertexDecoderJitCache::Jit_PosS8Morph}, {&VertexDecoder::Step_PosS16Morph, &VertexDecoderJitCache::Jit_PosS16Morph}, {&VertexDecoder::Step_PosFloatMorph, &VertexDecoderJitCache::Jit_PosFloatMorph}, + {&VertexDecoder::Step_PosS8MorphSkin, &VertexDecoderJitCache::Jit_PosS8MorphSkin}, + {&VertexDecoder::Step_PosS16MorphSkin, &VertexDecoderJitCache::Jit_PosS16MorphSkin}, + {&VertexDecoder::Step_PosFloatMorphSkin, &VertexDecoderJitCache::Jit_PosFloatMorphSkin}, {&VertexDecoder::Step_Color8888, &VertexDecoderJitCache::Jit_Color8888}, {&VertexDecoder::Step_Color4444, &VertexDecoderJitCache::Jit_Color4444}, @@ -792,6 +798,21 @@ void VertexDecoderJitCache::Jit_NormalFloatMorph() { Jit_AnyFloatMorph(dec_->nrmoff, dec_->decFmt.nrmoff); } +void VertexDecoderJitCache::Jit_NormalS8MorphSkin() { + Jit_AnyS8Morph(dec_->nrmoff, -1); + Jit_WriteMatrixMul(dec_->decFmt.nrmoff, false); +} + +void VertexDecoderJitCache::Jit_NormalS16MorphSkin() { + Jit_AnyS16Morph(dec_->nrmoff, -1); + Jit_WriteMatrixMul(dec_->decFmt.nrmoff, false); +} + +void VertexDecoderJitCache::Jit_NormalFloatMorphSkin() { + Jit_AnyFloatMorph(dec_->nrmoff, -1); + Jit_WriteMatrixMul(dec_->decFmt.nrmoff, false); +} + void VertexDecoderJitCache::Jit_PosS8() { Jit_AnyS8ToFloat(dec_->posoff); FS(32, fpSrc[0], dstReg, dec_->decFmt.posoff + 0); @@ -881,6 +902,21 @@ void VertexDecoderJitCache::Jit_PosFloatMorph() { Jit_AnyFloatMorph(dec_->posoff, dec_->decFmt.posoff); } +void VertexDecoderJitCache::Jit_PosS8MorphSkin() { + Jit_AnyS8Morph(dec_->posoff, -1); + Jit_WriteMatrixMul(dec_->decFmt.nrmoff, true); +} + +void VertexDecoderJitCache::Jit_PosS16MorphSkin() { + Jit_AnyS16Morph(dec_->posoff, -1); + Jit_WriteMatrixMul(dec_->decFmt.nrmoff, true); +} + +void VertexDecoderJitCache::Jit_PosFloatMorphSkin() { + Jit_AnyFloatMorph(dec_->posoff, -1); + Jit_WriteMatrixMul(dec_->decFmt.nrmoff, true); +} + void VertexDecoderJitCache::Jit_Color8888() { LWU(tempReg1, srcReg, dec_->coloff); @@ -1285,9 +1321,11 @@ void VertexDecoderJitCache::Jit_AnyS8Morph(int srcoff, int dstoff) { FMADD(32, fpSrc[2], fpScratchReg3, fpScratchReg4, fpSrc[2]); } - FS(32, fpSrc[0], dstReg, dstoff + 0); - FS(32, fpSrc[1], dstReg, dstoff + 4); - FS(32, fpSrc[2], dstReg, dstoff + 8); + if (dstoff >= 0) { + FS(32, fpSrc[0], dstReg, dstoff + 0); + FS(32, fpSrc[1], dstReg, dstoff + 4); + FS(32, fpSrc[2], dstReg, dstoff + 8); + } } void VertexDecoderJitCache::Jit_AnyS16Morph(int srcoff, int dstoff) { @@ -1315,9 +1353,11 @@ void VertexDecoderJitCache::Jit_AnyS16Morph(int srcoff, int dstoff) { FMADD(32, fpSrc[2], fpScratchReg3, fpScratchReg4, fpSrc[2]); } - FS(32, fpSrc[0], dstReg, dstoff + 0); - FS(32, fpSrc[1], dstReg, dstoff + 4); - FS(32, fpSrc[2], dstReg, dstoff + 8); + if (dstoff >= 0) { + FS(32, fpSrc[0], dstReg, dstoff + 0); + FS(32, fpSrc[1], dstReg, dstoff + 4); + FS(32, fpSrc[2], dstReg, dstoff + 8); + } } void VertexDecoderJitCache::Jit_AnyFloatMorph(int srcoff, int dstoff) { @@ -1339,9 +1379,11 @@ void VertexDecoderJitCache::Jit_AnyFloatMorph(int srcoff, int dstoff) { FMADD(32, fpSrc[2], fpScratchReg3, fpScratchReg4, fpSrc[2]); } - FS(32, fpSrc[0], dstReg, dstoff + 0); - FS(32, fpSrc[1], dstReg, dstoff + 4); - FS(32, fpSrc[2], dstReg, dstoff + 8); + if (dstoff >= 0) { + FS(32, fpSrc[0], dstReg, dstoff + 0); + FS(32, fpSrc[1], dstReg, dstoff + 4); + FS(32, fpSrc[2], dstReg, dstoff + 8); + } } void VertexDecoderJitCache::Jit_WriteMatrixMul(int dstoff, bool pos) {