Commit ac382039 by Jamie Madill Committed by Commit Bot

Allow graceful no-error failure in CastStateValues.

Bug: angleproject:5738 Change-Id: Iecc498b35281b8fd676f1168c3a4ed6b407d18a1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2743668Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 2b7fdb62
......@@ -6612,7 +6612,7 @@ void Context::getFloatvRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GL
void Context::getIntegerv(GLenum pname, GLint *params)
{
GLenum nativeType;
GLenum nativeType = GL_NONE;
unsigned int numParams = 0;
getQueryParameterInfo(pname, &nativeType, &numParams);
......
......@@ -220,7 +220,9 @@ void CastStateValues(const Context *context,
}
}
else
UNREACHABLE();
{
WARN() << "Application querying parameter that does not exist.";
}
}
// Explicit template instantiation (how we export template functions in different files)
......
......@@ -141,6 +141,17 @@ TEST_P(ContextNoErrorTest31, DrawWithPPO)
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
}
// Tests that an incorrect enum to GetInteger does not cause an application crash.
TEST_P(ContextNoErrorTest, InvalidGetIntegerDoesNotCrash)
{
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_KHR_no_error"));
GLint value = 1;
glGetIntegerv(GL_TEXTURE_2D, &value);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(value, 1);
}
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(ContextNoErrorTest);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ContextNoErrorTest31);
......
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