Fix completeness test of OpenGL ES immutable textures

Immutable textures created with glTexStorage*() are always mipmap and
sampler complete. The spec states that

"Array levels k where k < levelbase or k > q arebinsignificant to the
definition ofcompleteness."

Where q is no larger than levelmax, which is in turn limited to
levelimmut - 1 which was specified at glTexStorage.

Change-Id: Ieaa6be856fd35cf2827e753d7c777ebf784027ef
Tests: dEQP-GLES*
Fixes: b/152740217
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43188
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/libGLESv2/Texture.cpp b/src/OpenGL/libGLESv2/Texture.cpp
index c906c75..d35c108 100644
--- a/src/OpenGL/libGLESv2/Texture.cpp
+++ b/src/OpenGL/libGLESv2/Texture.cpp
@@ -720,6 +720,11 @@
 // Tests for 2D texture sampling completeness. [OpenGL ES 3.0.5] section 3.8.13 page 160.
 bool Texture2D::isSamplerComplete(Sampler *sampler) const
 {
+	if(mImmutableFormat == GL_TRUE)
+	{
+		return true;
+	}
+
 	if(!isBaseLevelDefined())
 	{
 		return false;
@@ -1104,6 +1109,11 @@
 // Tests for cube map sampling completeness. [OpenGL ES 3.0.5] section 3.8.13 page 161.
 bool TextureCubeMap::isSamplerComplete(Sampler *sampler) const
 {
+	if(mImmutableFormat == GL_TRUE)
+	{
+		return true;
+	}
+
 	if(!isBaseLevelDefined())
 	{
 		return false;
@@ -1738,6 +1748,11 @@
 // Tests for 3D texture sampling completeness. [OpenGL ES 3.0.5] section 3.8.13 page 160.
 bool Texture3D::isSamplerComplete(Sampler *sampler) const
 {
+	if(mImmutableFormat == GL_TRUE)
+	{
+		return true;
+	}
+
 	if(!isBaseLevelDefined())
 	{
 		return false;