mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-17 16:30:30 +02:00
Don't convert texcoords to float either.
This commit is contained in:
1 parent
377c94b125
commit
aaf00e047b
4 files changed
+64
-32
No files matched your search
+22
-13
@@ -77,6 +77,7 @@ int DecFmtSize(u8 fmt) {
|
||||
case DEC_U16_2: return 4;
|
||||
case DEC_U16_3: return 8;
|
||||
case DEC_U16_4: return 8;
|
||||
case DEC_U8A_2: return 4;
|
||||
case DEC_U16A_2: return 4;
|
||||
default:
|
||||
return 0;
|
||||
@@ -143,18 +144,18 @@ void VertexDecoder::Step_WeightsFloat() const
|
||||
|
||||
void VertexDecoder::Step_TcU8() const
|
||||
{
|
||||
float *uv = (float *)(decoded_ + decFmt.uvoff);
|
||||
u8 *uv = (u8*)(decoded_ + decFmt.uvoff);
|
||||
const u8 *uvdata = (const u8*)(ptr_ + tcoff);
|
||||
for (int j = 0; j < 2; j++)
|
||||
uv[j] = (float)uvdata[j] / 128.0f;
|
||||
uv[0] = uvdata[0];
|
||||
uv[1] = uvdata[1];
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_TcU16() const
|
||||
{
|
||||
float *uv = (float *)(decoded_ + decFmt.uvoff);
|
||||
u16 *uv = (u16 *)(decoded_ + decFmt.uvoff);
|
||||
const u16 *uvdata = (const u16*)(ptr_ + tcoff);
|
||||
uv[0] = (float)uvdata[0] / 32768.0f;
|
||||
uv[1] = (float)uvdata[1] / 32768.0f;
|
||||
uv[0] = uvdata[0];
|
||||
uv[1] = uvdata[1];
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_TcU16Through() const
|
||||
@@ -169,15 +170,16 @@ void VertexDecoder::Step_TcFloat() const
|
||||
{
|
||||
float *uv = (float *)(decoded_ + decFmt.uvoff);
|
||||
const float *uvdata = (const float*)(ptr_ + tcoff);
|
||||
memcpy(uv, uvdata, sizeof(float) * 2);
|
||||
uv[0] = uvdata[0] * 0.5f;
|
||||
uv[1] = uvdata[1] * 0.5f;
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_TcFloatThrough() const
|
||||
{
|
||||
float *uv = (float *)(decoded_ + decFmt.uvoff);
|
||||
const float *uvdata = (const float*)(ptr_ + tcoff);
|
||||
uv[0] = uvdata[0];
|
||||
uv[1] = uvdata[1];
|
||||
uv[0] = uvdata[0] * 0.5f;
|
||||
uv[1] = uvdata[1] * 0.5f;
|
||||
}
|
||||
|
||||
void VertexDecoder::Step_Color565() const
|
||||
@@ -588,11 +590,18 @@ void VertexDecoder::SetVertexType(u32 fmt) {
|
||||
|
||||
steps_[numSteps_++] = throughmode ? tcstep_through[tc] : tcstep[tc];
|
||||
|
||||
// All UV except through mode decode to DEC_FLOAT2 currently.
|
||||
if (throughmode && (tc == (GE_VTYPE_TC_16BIT >> GE_VTYPE_TC_SHIFT)))
|
||||
decFmt.uvfmt = DEC_U16A_2;
|
||||
else
|
||||
switch (tc) {
|
||||
case GE_VTYPE_TC_8BIT >> GE_VTYPE_TC_SHIFT:
|
||||
decFmt.uvfmt = throughmode ? DEC_U8A_2 : DEC_U8_2;
|
||||
break;
|
||||
case GE_VTYPE_TC_16BIT >> GE_VTYPE_TC_SHIFT:
|
||||
decFmt.uvfmt = throughmode ? DEC_U16A_2 : DEC_U16_2;
|
||||
break;
|
||||
case GE_VTYPE_TC_FLOAT >> GE_VTYPE_TC_SHIFT:
|
||||
decFmt.uvfmt = DEC_FLOAT_2;
|
||||
break;
|
||||
}
|
||||
|
||||
decFmt.uvoff = decOff;
|
||||
decOff += DecFmtSize(decFmt.uvfmt);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user