mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-01-19 04:13:24 +00:00
softgpu: Move texenv color into sampler state.
This commit is contained in:
parent
ad3635c82a
commit
c0e85e6170
@ -298,9 +298,7 @@ struct GPUgstate {
|
||||
bool isTextureAlphaUsed() const { return (texfunc & 0x100) != 0; }
|
||||
GETextureFormat getTextureFormat() const { return static_cast<GETextureFormat>(texformat & 0xF); }
|
||||
bool isTextureFormatIndexed() const { return (texformat & 4) != 0; } // GE_TFMT_CLUT4 - GE_TFMT_CLUT32 are 0b1xx.
|
||||
int getTextureEnvColR() const { return texenvcolor&0xFF; }
|
||||
int getTextureEnvColG() const { return (texenvcolor>>8)&0xFF; }
|
||||
int getTextureEnvColB() const { return (texenvcolor>>16)&0xFF; }
|
||||
int getTextureEnvColRGB() const { return texenvcolor & 0x00FFFFFF; }
|
||||
u32 getClutAddress() const { return (clutaddr & 0x00FFFFF0) | ((clutaddrupper << 8) & 0x0F000000); }
|
||||
int getClutLoadBytes() const { return (loadclut & 0x3F) * 32; }
|
||||
int getClutLoadBlocks() const { return (loadclut & 0x3F); }
|
||||
|
@ -427,6 +427,9 @@ void ComputeSamplerID(SamplerID *id_out) {
|
||||
if (id.texFunc > GE_TEXFUNC_ADD)
|
||||
id.texFunc = GE_TEXFUNC_ADD;
|
||||
|
||||
if (id.texFunc == GE_TEXFUNC_BLEND)
|
||||
id.cached.texBlendColor = gstate.getTextureEnvColRGB();
|
||||
|
||||
*id_out = id;
|
||||
}
|
||||
|
||||
|
@ -171,6 +171,7 @@ struct SamplerID {
|
||||
uint16_t w;
|
||||
uint16_t h;
|
||||
} sizes[8];
|
||||
uint32_t texBlendColor;
|
||||
} cached;
|
||||
|
||||
union {
|
||||
|
@ -509,7 +509,7 @@ Vec4IntResult SOFTRAST_CALL GetTextureFunctionOutput(Vec4IntArg prim_color_in, V
|
||||
case GE_TEXFUNC_BLEND:
|
||||
{
|
||||
const Vec3<int> const255(255, 255, 255);
|
||||
const Vec3<int> texenv(gstate.getTextureEnvColR(), gstate.getTextureEnvColG(), gstate.getTextureEnvColB());
|
||||
const Vec3<int> texenv = Vec3<int>::FromRGB(samplerID.cached.texBlendColor);
|
||||
|
||||
// Unlike the others (and even alpha), this one simply always rounds up.
|
||||
const Vec3<int> roundup = Vec3<int>::AssignToAll(255);
|
||||
|
@ -1649,19 +1649,19 @@ bool SamplerJitCache::Jit_ApplyTextureFunc(const SamplerID &id) {
|
||||
// We divide later.
|
||||
}
|
||||
|
||||
X64Reg gstateReg = GetGState();
|
||||
X64Reg idReg = GetSamplerID();
|
||||
X64Reg texEnvReg = regCache_.Alloc(RegCache::VEC_TEMP1);
|
||||
if (cpu_info.bSSE4_1) {
|
||||
PMOVZXBW(texEnvReg, MDisp(gstateReg, offsetof(GPUgstate, texenvcolor)));
|
||||
PMOVZXBW(texEnvReg, MDisp(idReg, offsetof(SamplerID, cached.texBlendColor)));
|
||||
} else {
|
||||
MOVD_xmm(texEnvReg, MDisp(gstateReg, offsetof(GPUgstate, texenvcolor)));
|
||||
MOVD_xmm(texEnvReg, MDisp(idReg, offsetof(SamplerID, cached.texBlendColor)));
|
||||
X64Reg zeroReg = GetZeroVec();
|
||||
PUNPCKLBW(texEnvReg, R(zeroReg));
|
||||
regCache_.Unlock(zeroReg, RegCache::VEC_ZERO);
|
||||
}
|
||||
PMULLW(resultReg, R(texEnvReg));
|
||||
regCache_.Release(texEnvReg, RegCache::VEC_TEMP1);
|
||||
regCache_.Unlock(gstateReg, RegCache::GEN_GSTATE);
|
||||
UnlockSamplerID(idReg);
|
||||
|
||||
// Add in the prim color side and divide.
|
||||
PADDW(resultReg, R(tempReg));
|
||||
|
Loading…
x
Reference in New Issue
Block a user