ES31: Add missing initialization of MAX_*_SAMPLES on D3D
This patch intends to add missing initialization of MAX_INTEGER_SAMPLES,
MAX_DEPTH_TEXTURE_SAMPLES and MAX_COLOR_TEXTURE_SAMPLES required for
multisampled textures on D3D backends.
Since MAX_*_SAMPLES cannot be queried directly from D3D APIs, these
values are initially assigned a large value in renderer11.cpp and
re-calculated in context::updateCaps().
This patch also adds tests to ensure these values are greater than 1
as required in OpenGL ES3.1 spec.
BUG=angleproject:1592
TEST=angle_end2end_tests
Change-Id: Iba586e311d40d2da4569816902f96e40bbd6935b
Reviewed-on: https://chromium-review.googlesource.com/597411
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/gl_tests/TextureMultisampleTest.cpp b/src/tests/gl_tests/TextureMultisampleTest.cpp
index 92b60af..903b97d 100644
--- a/src/tests/gl_tests/TextureMultisampleTest.cpp
+++ b/src/tests/gl_tests/TextureMultisampleTest.cpp
@@ -140,6 +140,36 @@
ASSERT_GL_ERROR(GL_INVALID_OPERATION);
}
+// Tests the value of MAX_INTEGER_SAMPLES is no less than 1.
+// [OpenGL ES 3.1 SPEC Table 20.40]
+TEST_P(TextureMultisampleTestES31, MaxIntegerSamples)
+{
+ GLint maxIntegerSamples;
+ glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &maxIntegerSamples);
+ EXPECT_GE(maxIntegerSamples, 1);
+ EXPECT_NE(std::numeric_limits<GLint>::max(), maxIntegerSamples);
+}
+
+// Tests the value of MAX_COLOR_TEXTURE_SAMPLES is no less than 1.
+// [OpenGL ES 3.1 SPEC Table 20.40]
+TEST_P(TextureMultisampleTestES31, MaxColorTextureSamples)
+{
+ GLint maxColorTextureSamples;
+ glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &maxColorTextureSamples);
+ EXPECT_GE(maxColorTextureSamples, 1);
+ EXPECT_NE(std::numeric_limits<GLint>::max(), maxColorTextureSamples);
+}
+
+// Tests the value of MAX_DEPTH_TEXTURE_SAMPLES is no less than 1.
+// [OpenGL ES 3.1 SPEC Table 20.40]
+TEST_P(TextureMultisampleTestES31, MaxDepthTextureSamples)
+{
+ GLint maxDepthTextureSamples;
+ glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &maxDepthTextureSamples);
+ EXPECT_GE(maxDepthTextureSamples, 1);
+ EXPECT_NE(std::numeric_limits<GLint>::max(), maxDepthTextureSamples);
+}
+
ANGLE_INSTANTIATE_TEST(TextureMultisampleTest,
ES31_D3D11(),
ES3_OPENGL(),