Limit infinity support to GLSL 3.3 and above.

isinf() exists in GLSL 1.3 and above, but hardware without proper IEEE
support is allowed to always return false, so it's potentially
meaningless. In GLSL 3.3 and GLSL ES3+, isinf() is required to actually
identify infinite values. (GPUs are not required to _produce_ infinite
values via operations like `num / 0.0` until GLSL 4.1.)

Change-Id: I6d8cd70f47f653402d9eb2a0aed0773e54cfa61b
Bug: skia:12716
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506878
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Christopher Dalton <csmartdalton@google.com>
Commit-Queue: Christopher Dalton <csmartdalton@google.com>
This commit is contained in:
John Stiles 2022-02-10 11:28:47 -05:00 committed by SkCQ
parent 1df7393e44
commit 2332138185

View File

@ -1022,11 +1022,16 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli
shaderCaps->fVertexIDSupport = ctxInfo.glslGeneration() >= SkSL::GLSLGeneration::k330;
}
// isinf() exists in GLSL 1.3 and above, but hardware without proper IEEE support is allowed to
// always return false, so it's potentially meaningless. In GLSL 3.3 and GLSL ES3+, isinf() is
// required to actually identify infinite values. (GPUs are not required to _produce_ infinite
// values via operations like `num / 0.0` until GLSL 4.1.)
shaderCaps->fInfinitySupport = (ctxInfo.glslGeneration() >= SkSL::GLSLGeneration::k330);
if (GR_IS_GR_GL(standard)) {
shaderCaps->fInfinitySupport = shaderCaps->fNonconstantArrayIndexSupport = true;
shaderCaps->fNonconstantArrayIndexSupport = true;
} else if (GR_IS_GR_GL_ES(standard) || GR_IS_GR_WEBGL(standard)) {
// Desktop GLSL 3.30 == ES GLSL 3.00.
shaderCaps->fInfinitySupport = shaderCaps->fNonconstantArrayIndexSupport =
shaderCaps->fNonconstantArrayIndexSupport =
(ctxInfo.glslGeneration() >= SkSL::GLSLGeneration::k330);
}