Commit 4efe33e3 by Peng Huang Committed by Commit Bot

Fix two GL_OES_texture_half_float related problems with GLES2

* Fix incorrect ASSERT in formatutilsgl.cpp * CheckInternalFormatRenderbufferRenderability() and CheckSizedInternalFormatTextureRenderability() may cause GL errors, we should clear them. Bug: chromium:1174074 Change-Id: Ieef5e79b68f317833b459da34cc2e5362f813304 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2735374 Commit-Queue: Peng Huang <penghuang@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 74562a2d
...@@ -727,13 +727,13 @@ static GLenum GetNativeType(const FunctionsGL *functions, ...@@ -727,13 +727,13 @@ static GLenum GetNativeType(const FunctionsGL *functions,
} }
} }
} }
else if (functions->standard == STANDARD_GL_ES && functions->version == gl::Version(2, 0)) else if (functions->isAtLeastGLES(gl::Version(2, 0)))
{ {
// On ES2, convert GL_HALF_FLOAT to GL_HALF_FLOAT_OES as a convenience for internal // On ES2, convert GL_HALF_FLOAT to GL_HALF_FLOAT_OES as a convenience for internal
// functions. It should not be possible to get here by a normal glTexImage2D call. // functions. It should not be possible to get here by a normal glTexImage2D call.
if (type == GL_HALF_FLOAT) if (type == GL_HALF_FLOAT)
{ {
ASSERT(functions->hasGLExtension("GL_OES_texture_half_float")); ASSERT(functions->hasGLESExtension("GL_OES_texture_half_float"));
result = GL_HALF_FLOAT_OES; result = GL_HALF_FLOAT_OES;
} }
} }
......
...@@ -98,6 +98,8 @@ void ClearErrors(const FunctionsGL *functions, ...@@ -98,6 +98,8 @@ void ClearErrors(const FunctionsGL *functions,
} }
} }
#define ANGLE_GL_CLEAR_ERRORS() ClearErrors(functions, __FILE__, __FUNCTION__, __LINE__)
} // namespace } // namespace
SwapControlData::SwapControlData() SwapControlData::SwapControlData()
...@@ -260,6 +262,12 @@ static bool CheckSizedInternalFormatTextureRenderability(const FunctionsGL *func ...@@ -260,6 +262,12 @@ static bool CheckSizedInternalFormatTextureRenderability(const FunctionsGL *func
functions->deleteTextures(1, &texture); functions->deleteTextures(1, &texture);
functions->bindTexture(GL_TEXTURE_2D, static_cast<GLuint>(oldTextureBinding)); functions->bindTexture(GL_TEXTURE_2D, static_cast<GLuint>(oldTextureBinding));
if (!supported)
{
ANGLE_GL_CLEAR_ERRORS();
}
ASSERT(functions->getError() == GL_NO_ERROR);
return supported; return supported;
} }
...@@ -306,6 +314,12 @@ static bool CheckInternalFormatRenderbufferRenderability(const FunctionsGL *func ...@@ -306,6 +314,12 @@ static bool CheckInternalFormatRenderbufferRenderability(const FunctionsGL *func
functions->deleteRenderbuffers(1, &renderbuffer); functions->deleteRenderbuffers(1, &renderbuffer);
functions->bindRenderbuffer(GL_RENDERBUFFER, static_cast<GLuint>(oldRenderbufferBinding)); functions->bindRenderbuffer(GL_RENDERBUFFER, static_cast<GLuint>(oldRenderbufferBinding));
if (!supported)
{
ANGLE_GL_CLEAR_ERRORS();
}
ASSERT(functions->getError() == GL_NO_ERROR);
return supported; return supported;
} }
...@@ -379,7 +393,7 @@ static gl::TextureCaps GenerateTextureFormatCaps(const FunctionsGL *functions, ...@@ -379,7 +393,7 @@ static gl::TextureCaps GenerateTextureFormatCaps(const FunctionsGL *functions,
queryInternalFormat = GL_RGBA8; queryInternalFormat = GL_RGBA8;
} }
ClearErrors(functions, __FILE__, __FUNCTION__, __LINE__); ANGLE_GL_CLEAR_ERRORS();
GLint numSamples = 0; GLint numSamples = 0;
functions->getInternalformativ(GL_RENDERBUFFER, queryInternalFormat, GL_NUM_SAMPLE_COUNTS, functions->getInternalformativ(GL_RENDERBUFFER, queryInternalFormat, GL_NUM_SAMPLE_COUNTS,
1, &numSamples); 1, &numSamples);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment