Disable more texcoord math on terrible-precision PowerVR (it's really awful). Fixes #9189.

This commit is contained in:
Henrik Rydgård 2019-02-26 10:39:17 +01:00
parent 64dd4257ad
commit 1f4c1cee2d
2 changed files with 12 additions and 3 deletions

View file

@ -311,8 +311,13 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, uint64_t *uniform
// TODO: Not sure the right way to do this for projection.
// This path destroys resolution on older PowerVR no matter what I do if projection is needed,
// so we disable it on SGX 540 and lesser, and live with the consequences.
bool badPrecision = (gl_extensions.bugs & BUG_PVR_SHADER_PRECISION_TERRIBLE) != 0;
if (needShaderTexClamp && !(doTextureProjection && badPrecision)) {
bool terriblePrecision = (gl_extensions.bugs & BUG_PVR_SHADER_PRECISION_TERRIBLE) != 0;
bool clampDisabled = doTextureProjection && terriblePrecision;
// Also with terrible precision we can't do wrapping without destroying the image. See #9189
if (terriblePrecision && (!id.Bit(FS_BIT_CLAMP_S) || !id.Bit(FS_BIT_CLAMP_T))) {
clampDisabled = true;
}
if (needShaderTexClamp && !clampDisabled) {
// We may be clamping inside a larger surface (tex = 64x64, buffer=480x272).
// We may also be wrapping in such a surface, or either one in a too-small surface.
// Obviously, clamping to a smaller surface won't work. But better to clamp to something.
@ -355,6 +360,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, uint64_t *uniform
} else {
if (doTextureProjection) {
// We don't use textureProj because we need better control and it's probably not much of a savings anyway.
// However it is good for precision on older hardware like PowerVR.
WRITE(p, " vec2 uv = %s.xy/%s.z;\n vec2 uv_round;\n", texcoord, texcoord);
} else {
WRITE(p, " vec2 uv = %s.xy;\n vec2 uv_round;\n", texcoord);

View file

@ -99,7 +99,10 @@ void ProcessGPUFeatures() {
DLOG("Checking for GL driver bugs... vendor=%i model='%s'", (int)gl_extensions.gpuVendor, gl_extensions.model);
if (gl_extensions.gpuVendor == GPU_VENDOR_IMGTEC) {
if (!strcmp(gl_extensions.model, "PowerVR SGX 543") ||
if (!strcmp(gl_extensions.model, "PowerVR SGX 545") ||
!strcmp(gl_extensions.model, "PowerVR SGX 544") ||
!strcmp(gl_extensions.model, "PowerVR SGX 544MP2") ||
!strcmp(gl_extensions.model, "PowerVR SGX 543") ||
!strcmp(gl_extensions.model, "PowerVR SGX 540") ||
!strcmp(gl_extensions.model, "PowerVR SGX 530") ||
!strcmp(gl_extensions.model, "PowerVR SGX 520") ) {