mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-26 19:58:36 +01:00
Hopefully fix UV scaling properly this time.
Check the faces in Hexyz Force please.
This commit is contained in:
1 parent
f5e7a33c68
commit
628bf497dd
2 files changed
+13
-16
No files matched your search
@@ -433,18 +433,12 @@ void LinkedShader::UpdateUniforms(u32 vertType) {
|
||||
// These two work the same whether or not we prescale UV.
|
||||
|
||||
case GE_TEXMAP_TEXTURE_MATRIX:
|
||||
// UV coords (that need "factor") are only used here if the getUVProjMode == 1.
|
||||
// Otherwise we just use it to scale the coordinates to the texture.
|
||||
// Factor is used even if prescale is enabled, because prescale doesn't apply if the mode
|
||||
// is texture_matrix.
|
||||
if (gstate.getUVProjMode() == GE_PROJMAP_UV) {
|
||||
uvscaleoff[0] = widthFactor * factor;
|
||||
uvscaleoff[1] = heightFactor * factor;
|
||||
} else {
|
||||
// In these other modes we only use uvscaleoff to scale to the texture size.
|
||||
uvscaleoff[0] = widthFactor;
|
||||
uvscaleoff[1] = heightFactor;
|
||||
}
|
||||
// We cannot bake the UV coord scale factor in here, as we apply a matrix multiplication
|
||||
// before this is applied, and the matrix multiplication may contain translation. In this case
|
||||
// the translation will be scaled which breaks faces in Hexyz Force for example.
|
||||
// So I've gone back to applying the scale factor in the shader.
|
||||
uvscaleoff[0] = widthFactor;
|
||||
uvscaleoff[1] = heightFactor;
|
||||
uvscaleoff[2] = 0.0f;
|
||||
uvscaleoff[3] = 0.0f;
|
||||
break;
|
||||
|
||||
@@ -110,6 +110,9 @@ void ComputeVertexShaderID(VertexShaderID *id, u32 vertType, int prim, bool useH
|
||||
id->d[1] |= gstate.isLightingEnabled() << 24;
|
||||
id->d[1] |= (vertTypeGetWeightMask(vertType) >> GE_VTYPE_WEIGHT_SHIFT) << 25;
|
||||
id->d[1] |= gstate.areNormalsReversed() << 26;
|
||||
if (doTextureProjection && gstate.getUVProjMode() == GE_PROJMAP_UV) {
|
||||
id->d[1] |= ((vertType & GE_VTYPE_TC_MASK) >> GE_VTYPE_TC_SHIFT) << 27; // two bits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,10 +556,10 @@ void GenerateVertexShader(int prim, u32 vertType, char *buffer, bool useHWTransf
|
||||
break;
|
||||
case GE_PROJMAP_UV: // Use unscaled UV as source
|
||||
{
|
||||
// As we rescale the texcoord to compensate for texture size anyway,
|
||||
// we bake the UV format scale factor into u_uvscaleoffset. So no need to apply
|
||||
// the factor here too.
|
||||
temp_tc = "vec4(texcoord.xy, 0.0, 1.0)";
|
||||
// prescale is false here.
|
||||
static const char *rescaleuv[4] = {"", " * 1.9921875", " * 1.999969482421875", ""}; // 2*127.5f/128.f, 2*32767.5f/32768.f, 1.0f};
|
||||
const char *factor = rescaleuv[(vertType & GE_VTYPE_TC_MASK) >> GE_VTYPE_TC_SHIFT];
|
||||
temp_tc = StringFromFormat("vec4(texcoord.xy %s, 0.0, 1.0)", factor);
|
||||
}
|
||||
break;
|
||||
case GE_PROJMAP_NORMALIZED_NORMAL: // Use normalized transformed normal as source
|
||||
|
||||
Reference in new issue
Block a user