mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Remove unnecessary scaling and then un-scaling of through-mode Z coordinates
This commit is contained in:
@@ -134,7 +134,7 @@ public:
|
||||
pos[2] = f[2];
|
||||
} else {
|
||||
// Integer value passed in a float. Clamped to 0, 65535.
|
||||
pos[2] = (int)f[2] * (1.0f / 65535.0f);
|
||||
pos[2] = (int)f[2];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
pos[0] = f[0];
|
||||
pos[1] = f[1];
|
||||
// Integer value passed in a float. Clamped to 0, 65535.
|
||||
pos[2] = (int)f[2] * (1.0f / 65535.0f);
|
||||
pos[2] = (int)f[2];
|
||||
}
|
||||
|
||||
void ReadPosNonThrough(float pos[3]) const {
|
||||
@@ -153,12 +153,6 @@ public:
|
||||
memcpy(pos, f, 12);
|
||||
}
|
||||
|
||||
void ReadPosThroughZ16(float pos[3]) const {
|
||||
// Only DEC_FLOAT_3 is supported.
|
||||
const float *f = (const float *)(data_ + decFmt_.posoff);
|
||||
memcpy(pos, f, 12);
|
||||
}
|
||||
|
||||
void ReadNrm(float nrm[3]) const {
|
||||
switch (decFmt_.nrmfmt) {
|
||||
case DEC_FLOAT_3:
|
||||
|
||||
@@ -760,13 +760,9 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
||||
}
|
||||
}
|
||||
WRITE(p, " %sv_fogdepth = fog;\n", compat.vsOutPrefix);
|
||||
if (isModeThrough) {
|
||||
|
||||
// If non-through, the viewport has already been applied here.
|
||||
WRITE(p, " vec4 outPos = position;\n");
|
||||
WRITE(p, " outPos.z *= 65536.0;\n"); // TODO: This multiplication should be moved to the vertex decoders for through mode.
|
||||
} else {
|
||||
// The viewport has already been applied here, along with the division.
|
||||
WRITE(p, " vec4 outPos = position;\n");
|
||||
}
|
||||
|
||||
if (fsMinmaxDiscard || fsDepthClamp) {
|
||||
WRITE(p, " %sv_zw = vec2(outPos.z * outPos.w, outPos.w);\n", compat.vsOutPrefix);
|
||||
|
||||
@@ -350,8 +350,7 @@ ClipVertexData TransformUnit::ReadVertex(const VertexReader &vreader, const Tran
|
||||
ClipVertexData vertex;
|
||||
|
||||
ModelCoords pos;
|
||||
// VertexDecoder normally scales z, but we want it unscaled.
|
||||
vreader.ReadPosThroughZ16(pos.AsArray());
|
||||
vreader.ReadPosThrough(pos.AsArray());
|
||||
|
||||
static Vec3Packedf lastTC;
|
||||
if (state.readUV) {
|
||||
|
||||
Reference in New Issue
Block a user