mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Don't convert to float with prescale off.
Since we assume we need to normalize, it seems.
This commit is contained in:
parent
ff802a983a
commit
ebce8d2753
3 changed files with 76 additions and 13 deletions
|
@ -405,6 +405,51 @@ void VertexDecoder::Step_TcFloatPrescale() const {
|
|||
}
|
||||
|
||||
void VertexDecoder::Step_TcU8Morph() const {
|
||||
float uv[2] = { 0, 0 };
|
||||
for (int n = 0; n < morphcount; n++) {
|
||||
float w = gstate_c.morphWeights[n];
|
||||
const u8 *uvdata = (const u8 *)(ptr_ + onesize_*n + tcoff);
|
||||
|
||||
uv[0] += (float)uvdata[0] * w;
|
||||
uv[1] += (float)uvdata[1] * w;
|
||||
}
|
||||
|
||||
u8 *out = decoded_ + decFmt.uvoff;
|
||||
out[0] = (int)uv[0];
|
||||
out[1] = (int)uv[1];
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_TcU16Morph() const {
|
||||
float uv[2] = { 0, 0 };
|
||||
for (int n = 0; n < morphcount; n++) {
|
||||
float w = gstate_c.morphWeights[n];
|
||||
const u16_le *uvdata = (const u16_le *)(ptr_ + onesize_*n + tcoff);
|
||||
|
||||
uv[0] += (float)uvdata[0] * w;
|
||||
uv[1] += (float)uvdata[1] * w;
|
||||
}
|
||||
|
||||
u16_le *out = (u16_le *)(decoded_ + decFmt.uvoff);
|
||||
out[0] = (int)uv[0];
|
||||
out[1] = (int)uv[1];
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_TcU16DoubleMorph() const {
|
||||
float uv[2] = { 0, 0 };
|
||||
for (int n = 0; n < morphcount; n++) {
|
||||
float w = gstate_c.morphWeights[n];
|
||||
const u16_le *uvdata = (const u16_le *)(ptr_ + onesize_*n + tcoff);
|
||||
|
||||
uv[0] += (float)uvdata[0] * w;
|
||||
uv[1] += (float)uvdata[1] * w;
|
||||
}
|
||||
|
||||
u16_le *out = (u16_le *)(decoded_ + decFmt.uvoff);
|
||||
out[0] = (int)(uv[0] * 2.0f);
|
||||
out[1] = (int)(uv[1] * 2.0f);
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_TcU8MorphToFloat() const {
|
||||
float uv[2] = { 0, 0 };
|
||||
for (int n = 0; n < morphcount; n++) {
|
||||
float w = gstate_c.morphWeights[n];
|
||||
|
@ -419,7 +464,7 @@ void VertexDecoder::Step_TcU8Morph() const {
|
|||
out[1] = uv[1];
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_TcU16Morph() const {
|
||||
void VertexDecoder::Step_TcU16MorphToFloat() const {
|
||||
float uv[2] = { 0, 0 };
|
||||
for (int n = 0; n < morphcount; n++) {
|
||||
float w = gstate_c.morphWeights[n];
|
||||
|
@ -434,7 +479,7 @@ void VertexDecoder::Step_TcU16Morph() const {
|
|||
out[1] = uv[1];
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_TcU16DoubleMorph() const {
|
||||
void VertexDecoder::Step_TcU16DoubleMorphToFloat() const {
|
||||
float uv[2] = { 0, 0 };
|
||||
for (int n = 0; n < morphcount; n++) {
|
||||
float w = gstate_c.morphWeights[n];
|
||||
|
@ -914,6 +959,20 @@ static const StepFunction tcstep_morph_remaster[4] = {
|
|||
&VertexDecoder::Step_TcFloatMorph,
|
||||
};
|
||||
|
||||
static const StepFunction tcstep_morphToFloat[4] = {
|
||||
0,
|
||||
&VertexDecoder::Step_TcU8MorphToFloat,
|
||||
&VertexDecoder::Step_TcU16MorphToFloat,
|
||||
&VertexDecoder::Step_TcFloatMorph,
|
||||
};
|
||||
|
||||
static const StepFunction tcstep_morph_remasterToFloat[4] = {
|
||||
0,
|
||||
&VertexDecoder::Step_TcU8MorphToFloat,
|
||||
&VertexDecoder::Step_TcU16DoubleMorphToFloat,
|
||||
&VertexDecoder::Step_TcFloatMorph,
|
||||
};
|
||||
|
||||
static const StepFunction tcstep_through[4] = {
|
||||
0,
|
||||
&VertexDecoder::Step_TcU8,
|
||||
|
@ -1120,18 +1179,19 @@ void VertexDecoder::SetVertexType(u32 fmt, const VertexDecoderOptions &options,
|
|||
else
|
||||
steps_[numSteps_++] = morphcount == 1 ? tcstep_prescale[tc] : tcstep_prescale_morph[tc];
|
||||
decFmt.uvfmt = DEC_FLOAT_2;
|
||||
} else if (morphcount != 1 && !throughmode) {
|
||||
steps_[numSteps_++] = g_DoubleTextureCoordinates ? tcstep_morph_remaster[tc] : tcstep_morph[tc];
|
||||
decFmt.uvfmt = DEC_FLOAT_2;
|
||||
} else {
|
||||
if (options.expandAllUVtoFloat) {
|
||||
if (g_DoubleTextureCoordinates)
|
||||
if (morphcount != 1 && !throughmode)
|
||||
steps_[numSteps_++] = g_DoubleTextureCoordinates ? tcstep_morph_remasterToFloat[tc] : tcstep_morphToFloat[tc];
|
||||
else if (g_DoubleTextureCoordinates)
|
||||
steps_[numSteps_++] = throughmode ? tcstep_through_remasterToFloat[tc] : tcstep_remasterToFloat[tc];
|
||||
else
|
||||
steps_[numSteps_++] = throughmode ? tcstep_throughToFloat[tc] : tcstepToFloat[tc];
|
||||
decFmt.uvfmt = DEC_FLOAT_2;
|
||||
} else {
|
||||
if (g_DoubleTextureCoordinates)
|
||||
if (morphcount != 1 && !throughmode)
|
||||
steps_[numSteps_++] = g_DoubleTextureCoordinates ? tcstep_morph_remaster[tc] : tcstep_morph[tc];
|
||||
else if (g_DoubleTextureCoordinates)
|
||||
steps_[numSteps_++] = throughmode ? tcstep_through_remaster[tc] : tcstep_remaster[tc];
|
||||
else
|
||||
steps_[numSteps_++] = throughmode ? tcstep_through[tc] : tcstep[tc];
|
||||
|
|
|
@ -498,6 +498,9 @@ public:
|
|||
void Step_TcU8Morph() const;
|
||||
void Step_TcU16Morph() const;
|
||||
void Step_TcU16DoubleMorph() const;
|
||||
void Step_TcU8MorphToFloat() const;
|
||||
void Step_TcU16MorphToFloat() const;
|
||||
void Step_TcU16DoubleMorphToFloat() const;
|
||||
void Step_TcFloatMorph() const;
|
||||
void Step_TcU8PrescaleMorph() const;
|
||||
void Step_TcU16PrescaleMorph() const;
|
||||
|
@ -638,8 +641,8 @@ public:
|
|||
void Jit_TcFloatPrescale();
|
||||
|
||||
void Jit_TcAnyMorph(int bits);
|
||||
void Jit_TcU8Morph();
|
||||
void Jit_TcU16Morph();
|
||||
void Jit_TcU8MorphToFloat();
|
||||
void Jit_TcU16MorphToFloat();
|
||||
void Jit_TcFloatMorph();
|
||||
void Jit_TcU8PrescaleMorph();
|
||||
void Jit_TcU16PrescaleMorph();
|
||||
|
|
|
@ -105,8 +105,8 @@ static const JitLookup jitLookup[] = {
|
|||
{&VertexDecoder::Step_TcU16Prescale, &VertexDecoderJitCache::Jit_TcU16Prescale},
|
||||
{&VertexDecoder::Step_TcFloatPrescale, &VertexDecoderJitCache::Jit_TcFloatPrescale},
|
||||
|
||||
{&VertexDecoder::Step_TcU8Morph, &VertexDecoderJitCache::Jit_TcU8Morph},
|
||||
{&VertexDecoder::Step_TcU16Morph, &VertexDecoderJitCache::Jit_TcU16Morph},
|
||||
{&VertexDecoder::Step_TcU8MorphToFloat, &VertexDecoderJitCache::Jit_TcU8MorphToFloat},
|
||||
{&VertexDecoder::Step_TcU16MorphToFloat, &VertexDecoderJitCache::Jit_TcU16MorphToFloat},
|
||||
{&VertexDecoder::Step_TcFloatMorph, &VertexDecoderJitCache::Jit_TcFloatMorph},
|
||||
{&VertexDecoder::Step_TcU8PrescaleMorph, &VertexDecoderJitCache::Jit_TcU8PrescaleMorph},
|
||||
{&VertexDecoder::Step_TcU16PrescaleMorph, &VertexDecoderJitCache::Jit_TcU16PrescaleMorph},
|
||||
|
@ -810,14 +810,14 @@ void VertexDecoderJitCache::Jit_TcAnyMorph(int bits) {
|
|||
}
|
||||
}
|
||||
|
||||
void VertexDecoderJitCache::Jit_TcU8Morph() {
|
||||
void VertexDecoderJitCache::Jit_TcU8MorphToFloat() {
|
||||
Jit_TcAnyMorph(8);
|
||||
// They were all added (weighted) pre-normalize, we normalize once here.
|
||||
MULPS(fpScratchReg, M(&by128));
|
||||
MOVQ_xmm(MDisp(dstReg, dec_->decFmt.uvoff), fpScratchReg);
|
||||
}
|
||||
|
||||
void VertexDecoderJitCache::Jit_TcU16Morph() {
|
||||
void VertexDecoderJitCache::Jit_TcU16MorphToFloat() {
|
||||
Jit_TcAnyMorph(16);
|
||||
// They were all added (weighted) pre-normalize, we normalize once here.
|
||||
MULPS(fpScratchReg, M(&by32768));
|
||||
|
|
Loading…
Add table
Reference in a new issue