SoftGPU: Refactor out texture format logic.

This could actually be shared, nothing x86 specific...
This commit is contained in:
Unknown W. Brackets committed 2017-05-30 22:57:38 -07:00
1 parent 94920ec156
commit fd4c64d43d
2 files changed
+23 -18

No files matched your search

+1
View File
@@ -100,6 +100,7 @@ public:
private:
NearestFunc Compile(const SamplerID &id);
bool Jit_ReadTextureFormat(const SamplerID &id);
bool Jit_GetTexData(const SamplerID &id, int bitsPerTexel);
bool Jit_Decode5650();
bool Jit_Decode5551();
+22 -18
View File
@@ -64,6 +64,27 @@ NearestFunc SamplerJitCache::Compile(const SamplerID &id) {
FixupBranch zeroSrc = J(true);
SetJumpTarget(nonZeroSrc);
if (!Jit_ReadTextureFormat(id)) {
EndWrite();
SetCodePtr(const_cast<u8 *>(start));
return nullptr;
}
SetJumpTarget(zeroSrc);
MOVUPS(XMM4, MDisp(ESP, 0));
MOVUPS(XMM5, MDisp(ESP, 16));
MOVUPS(XMM6, MDisp(ESP, 32));
MOVUPS(XMM7, MDisp(ESP, 48));
ADD(PTRBITS, R(ESP), Imm8(64));
RET();
EndWrite();
return (NearestFunc)start;
}
bool SamplerJitCache::Jit_ReadTextureFormat(const SamplerID &id) {
GETextureFormat fmt = (GETextureFormat)id.texfmt;
bool success = true;
switch (fmt) {
@@ -125,24 +146,7 @@ NearestFunc SamplerJitCache::Compile(const SamplerID &id) {
success = false;
}
if (!success) {
EndWrite();
SetCodePtr(const_cast<u8 *>(start));
return nullptr;
}
SetJumpTarget(zeroSrc);
MOVUPS(XMM4, MDisp(ESP, 0));
MOVUPS(XMM5, MDisp(ESP, 16));
MOVUPS(XMM6, MDisp(ESP, 32));
MOVUPS(XMM7, MDisp(ESP, 48));
ADD(PTRBITS, R(ESP), Imm8(64));
RET();
EndWrite();
return (NearestFunc)start;
return success;
}
bool SamplerJitCache::Jit_GetTexData(const SamplerID &id, int bitsPerTexel) {