mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
GPU: Move Z/W equal hack to bugs from supports.
It's really a bug (might even ideally cap the version?), and we already have other bugs handled the same way.
This commit is contained in:
parent
5e6f54033e
commit
7b00c4a572
5 changed files with 10 additions and 7 deletions
|
@ -818,6 +818,11 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit)
|
|||
} else if (caps_.vendor == GPUVendor::VENDOR_INTEL) {
|
||||
// Workaround for Intel driver bug. TODO: Re-enable after some driver version
|
||||
bugs_.Infest(Bugs::DUAL_SOURCE_BLENDING_BROKEN);
|
||||
} else if (caps_.vendor == GPUVendor::VENDOR_ARM) {
|
||||
// These GPUs (up to some certain hardware version?) have a bug where draws where gl_Position.w == .z
|
||||
// corrupt the depth buffer. This is easily worked around by simply scaling Z down a tiny bit when this case
|
||||
// is detected. See: https://github.com/hrydgard/ppsspp/issues/11937
|
||||
bugs_.Infest(Bugs::EQUAL_WZ_CORRUPTS_DEPTH);
|
||||
}
|
||||
|
||||
caps_.deviceID = deviceProps.deviceID;
|
||||
|
|
|
@ -317,6 +317,7 @@ public:
|
|||
BROKEN_NAN_IN_CONDITIONAL = 4,
|
||||
COLORWRITEMASK_BROKEN_WITH_DEPTHTEST = 5,
|
||||
BROKEN_FLAT_IN_SHADER = 6,
|
||||
EQUAL_WZ_CORRUPTS_DEPTH = 7,
|
||||
};
|
||||
|
||||
protected:
|
||||
|
|
|
@ -159,6 +159,7 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
|||
bool doShadeMapping = uvGenMode == GE_TEXMAP_ENVIRONMENT_MAP;
|
||||
|
||||
bool flatBug = bugs.Has(Draw::Bugs::BROKEN_FLAT_IN_SHADER) && g_Config.bVendorBugChecksEnabled;
|
||||
bool needsZWHack = bugs.Has(Draw::Bugs::EQUAL_WZ_CORRUPTS_DEPTH) && g_Config.bVendorBugChecksEnabled;
|
||||
bool doFlatShading = id.Bit(VS_BIT_FLATSHADE) && !flatBug;
|
||||
|
||||
bool useHWTransform = id.Bit(VS_BIT_USE_HW_TRANSFORM);
|
||||
|
@ -1134,8 +1135,8 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
|
|||
// We've named the output gl_Position in HLSL as well.
|
||||
WRITE(p, " %sgl_Position = outPos;\n", compat.vsOutPrefix);
|
||||
|
||||
if (gstate_c.Supports(GPU_NEEDS_Z_EQUAL_W_HACK)) {
|
||||
// See comment in GPU_Vulkan.cpp.
|
||||
if (needsZWHack) {
|
||||
// See comment in thin3d_vulkan.cpp.
|
||||
WRITE(p, " if (%sgl_Position.z == %sgl_Position.w) %sgl_Position.z *= 0.999999;\n",
|
||||
compat.vsOutPrefix, compat.vsOutPrefix, compat.vsOutPrefix);
|
||||
}
|
||||
|
|
|
@ -492,7 +492,7 @@ enum {
|
|||
GPU_SUPPORTS_FRAMEBUFFER_BLIT = FLAG_BIT(26),
|
||||
GPU_SUPPORTS_FRAMEBUFFER_BLIT_TO_DEPTH = FLAG_BIT(27),
|
||||
GPU_SUPPORTS_TEXTURE_NPOT = FLAG_BIT(28),
|
||||
GPU_NEEDS_Z_EQUAL_W_HACK = FLAG_BIT(29),
|
||||
// Free bit: 29
|
||||
// Free bit: 30
|
||||
GPU_PREFER_REVERSE_COLOR_ORDER = FLAG_BIT(31),
|
||||
};
|
||||
|
|
|
@ -206,10 +206,6 @@ void GPU_Vulkan::CheckGPUFeatures() {
|
|||
if (!PSP_CoreParameter().compat.flags().DisableAccurateDepth || driverTooOld) {
|
||||
features |= GPU_SUPPORTS_ACCURATE_DEPTH;
|
||||
}
|
||||
// These GPUs (up to some certain hardware version?) has a bug where draws where gl_Position.w == .z
|
||||
// corrupt the depth buffer. This is easily worked around by simply scaling Z down a tiny bit when this case
|
||||
// is detected. See: https://github.com/hrydgard/ppsspp/issues/11937
|
||||
features |= GPU_NEEDS_Z_EQUAL_W_HACK;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
Loading…
Add table
Reference in a new issue