mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Remove unnecessary scaling and then un-scaling of through-mode Z coordinates
This commit is contained in:
1 parent
382999b013
commit
078197d790
3 files changed
+9
-18
No files matched your search
@@ -125,6 +125,8 @@ class VertexReader {
|
||||
public:
|
||||
VertexReader(const u8 *base, const DecVtxFormat &decFmt, int vtype) : base_(base), data_(base), decFmt_(decFmt), vtype_(vtype) {}
|
||||
|
||||
// TODO: Only reason we might want to still keep the separation of ReadPosThrough and ReadPosNonThrough is
|
||||
// in case we need to do some rounding for through mode. I doubt it's needed though.
|
||||
void ReadPosAuto(float pos[3]) const {
|
||||
// Only DEC_FLOAT_3 is supported.
|
||||
const float *f = (const float *)(data_ + decFmt_.posoff);
|
||||
@@ -134,7 +136,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] = f[2];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,8 +145,8 @@ public:
|
||||
const float *f = (const float *)(data_ + decFmt_.posoff);
|
||||
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);
|
||||
// Integer value passed in a float. Clamped to 0, 65535 (but where?)
|
||||
pos[2] = f[2];
|
||||
}
|
||||
|
||||
void ReadPosNonThrough(float pos[3]) const {
|
||||
@@ -153,12 +155,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) {
|
||||
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 non-through, the viewport has already been applied here.
|
||||
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