Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(813)

Unified Diff: gpu/command_buffer/tests/gl_apply_screen_space_antialiasing_CHROMIUM_unittest.cc

Issue 2697503002: CMAA: Avoid DCHECK failure for unsupported internalformats (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/tests/gl_apply_screen_space_antialiasing_CHROMIUM_unittest.cc
diff --git a/gpu/command_buffer/tests/gl_apply_screen_space_antialiasing_CHROMIUM_unittest.cc b/gpu/command_buffer/tests/gl_apply_screen_space_antialiasing_CHROMIUM_unittest.cc
index 9a516a2db0f4241119d9d243cd4ff8afbbb6095f..274d337caff048c6a743713d2d59c0fceda34298 100644
--- a/gpu/command_buffer/tests/gl_apply_screen_space_antialiasing_CHROMIUM_unittest.cc
+++ b/gpu/command_buffer/tests/gl_apply_screen_space_antialiasing_CHROMIUM_unittest.cc
@@ -9,6 +9,7 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
+#include <GLES3/gl3.h>
#include <stddef.h>
#include <stdint.h>
@@ -41,11 +42,7 @@ class GLApplyScreenSpaceAntialiasingCHROMIUMTest : public testing::Test {
textures_, 0);
}
- void SetUp() override {
- base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
- GLManager::Options options;
- gl_.InitializeWithCommandLine(options, command_line);
-
+ void CheckStatus() {
available_ =
GLTestHelper::HasExtension("GL_CHROMIUM_screen_space_antialiasing");
if (!available_) {
@@ -77,6 +74,13 @@ class GLApplyScreenSpaceAntialiasingCHROMIUMTest : public testing::Test {
DeleteResources();
}
+ void SetUp() override {
+ base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
+ GLManager::Options options;
+ gl_.InitializeWithCommandLine(options, command_line);
+ CheckStatus();
+ }
+
void TearDown() override {
if (available_)
DeleteResources();
@@ -94,6 +98,18 @@ class GLApplyScreenSpaceAntialiasingCHROMIUMTest : public testing::Test {
bool available_ = false;
};
+class GLApplyScreenSpaceAntialiasingCHROMIUMES3Test
+ : public GLApplyScreenSpaceAntialiasingCHROMIUMTest {
+ protected:
+ void SetUp() override {
+ base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
+ GLManager::Options options;
+ options.context_type = gles2::CONTEXT_TYPE_OPENGLES3;
+ gl_.InitializeWithCommandLine(options, command_line);
+ CheckStatus();
+ }
+};
+
// TODO(dongseong.hwang): This test fails on the Nexus 9 GPU fyi bot.
// crbug.com/659638
#if defined(OS_ANDROID)
@@ -164,6 +180,72 @@ TEST_F(GLApplyScreenSpaceAntialiasingCHROMIUMTest, InternalFormat) {
}
}
+struct FormatType {
+ GLenum internal_format;
+ GLenum format;
+ GLenum type;
+};
+
+TEST_F(GLApplyScreenSpaceAntialiasingCHROMIUMES3Test, InternalFormat) {
+ if (!available_)
+ return;
+
+ FormatType format_types[] = {
+ {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE},
+ };
+
+ for (auto format_type : format_types) {
+ uint8_t pixels[1 * 4] = {0u, 255u, 0u, 255u};
Zhenyao Mo 2017/02/13 18:36:18 Shouldn't this be part of the format_types structu
qiankun 2017/02/14 08:08:17 Done.
+ glTexImage2D(GL_TEXTURE_2D, 0, format_type.internal_format, 1, 1, 0,
+ format_type.format, format_type.type, pixels);
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
+
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ textures_, 0);
+
+ // Only if the format is supported by FBO, supported by this extension.
+ if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
+ continue;
+
+ glApplyScreenSpaceAntialiasingCHROMIUM();
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError())
+ << "internal_format: "
+ << gles2::GLES2Util::GetStringEnum(format_type.internal_format);
+
+ GLTestHelper::CheckPixels(0, 0, 1, 1, 0, pixels, nullptr);
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
+ }
+}
+
+TEST_F(GLApplyScreenSpaceAntialiasingCHROMIUMES3Test,
+ InternalFormatNotSupported) {
+ if (!available_)
+ return;
+
+ FormatType format_types[] = {
+ {GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT},
+ };
+
+ for (auto format_type : format_types) {
+ uint8_t pixels[1 * 4] = {0u, 255u, 0u, 255u};
Zhenyao Mo 2017/02/13 18:36:18 This looks wrong to me as it doesn't fit the forma
qiankun 2017/02/14 08:08:17 Done.
+ glTexImage2D(GL_TEXTURE_2D, 0, format_type.internal_format, 1, 1, 0,
+ format_type.format, format_type.type, pixels);
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError());
+
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ textures_, 0);
+
+ // Only if the format is supported by FBO, supported by this extension.
+ if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
+ continue;
+
+ glApplyScreenSpaceAntialiasingCHROMIUM();
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError())
+ << "internal_format: "
+ << gles2::GLES2Util::GetStringEnum(format_type.internal_format);
+ }
+}
+
TEST_F(GLApplyScreenSpaceAntialiasingCHROMIUMTest, ImmutableTexture) {
if (!available_)
return;

Powered by Google App Engine
This is Rietveld 408576698