mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Remove ToScaledDepthFromIntegerScale
This commit is contained in:
parent
805591e493
commit
d40aa17198
@ -548,24 +548,6 @@ float DepthSliceFactor(u32 useFlags) {
|
||||
return DEPTH_SLICE_FACTOR_HIGH;
|
||||
}
|
||||
|
||||
// This is used for float values which might not be integers, but are in the integer scale of 0-65535.
|
||||
float ToScaledDepthFromIntegerScale(u32 useFlags, float z) {
|
||||
if (!(useFlags & GPU_USE_ACCURATE_DEPTH)) {
|
||||
// Old style depth, shortcut.
|
||||
return z * (1.0f / 65535.0f);
|
||||
}
|
||||
|
||||
const float depthSliceFactor = DepthSliceFactor(useFlags);
|
||||
if (useFlags & GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT) {
|
||||
const double doffset = 0.5 * (depthSliceFactor - 1.0) / depthSliceFactor;
|
||||
// Use one bit for each value, rather than 1.0 / (65535.0 * 256.0).
|
||||
return (float)((double)z * (1.0 / 16777215.0) + doffset);
|
||||
} else {
|
||||
const float offset = 0.5f * (depthSliceFactor - 1.0f) / depthSliceFactor;
|
||||
return z / depthSliceFactor * (1.0f / 65535.0f) + offset;
|
||||
}
|
||||
}
|
||||
|
||||
// See class DepthScaleFactors for how to apply.
|
||||
DepthScaleFactors GetDepthScaleFactors(u32 useFlags) {
|
||||
if (!(useFlags & GPU_USE_ACCURATE_DEPTH)) {
|
||||
|
@ -119,8 +119,7 @@ private:
|
||||
|
||||
DepthScaleFactors GetDepthScaleFactors(u32 useFlags);
|
||||
|
||||
// These two will be replaced with just DepthScaleFactors.
|
||||
float ToScaledDepthFromIntegerScale(u32 useFlags, float z);
|
||||
// This will be replaced with just DepthScaleFactors.
|
||||
float DepthSliceFactor(u32 useFlags);
|
||||
|
||||
// These are common to all modern APIs and can be easily converted with a lookup table.
|
||||
|
@ -830,7 +830,6 @@ static bool TestDepthMath() {
|
||||
float encoded = factors.EncodeFromU16(testValue);
|
||||
float decodedU16 = factors.DecodeToU16(encoded);
|
||||
EXPECT_REL_EQ_FLOAT(decodedU16, testValue, 0.0001f);
|
||||
EXPECT_REL_EQ_FLOAT(encoded, ToScaledDepthFromIntegerScale(useFlags, testValue), 0.000001f);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user