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

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

Issue 1203793003: Remove flip_y, premultiply_alpha, unmultiply_alpha support in command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 6 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_copy_texture_CHROMIUM_unittest.cc
diff --git a/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc b/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc
index cce89431f2b379aa6a95c7230784272cba55b351..a256fff89ef563a2bf3c393d475b94187e2aeaa4 100644
--- a/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc
+++ b/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc
@@ -265,207 +265,6 @@ TEST_F(GLCopyTextureCHROMIUMTest, RedefineDestinationTexture) {
EXPECT_TRUE(GL_NO_ERROR == glGetError());
}
-// Test that the extension respects the flip-y pixel storage setting.
-TEST_P(GLCopyTextureCHROMIUMTest, FlipY) {
- CopyType copy_type = GetParam();
- uint8 pixels[2][2][4];
- for (int x = 0; x < 2; ++x) {
- for (int y = 0; y < 2; ++y) {
- pixels[y][x][0] = x + y;
- pixels[y][x][1] = x + y;
- pixels[y][x][2] = x + y;
- pixels[y][x][3] = 255u;
- }
- }
-
- glBindTexture(GL_TEXTURE_2D, textures_[0]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- pixels);
-
- glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE);
-
- if (copy_type == TexImage) {
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA,
- GL_UNSIGNED_BYTE, true, false, false);
- } else {
- glBindTexture(GL_TEXTURE_2D, textures_[1]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- nullptr);
- glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0,
- 0, 2, 2, true, false, false);
- }
- EXPECT_TRUE(GL_NO_ERROR == glGetError());
-
- uint8 copied_pixels[2][2][4] = {{{0}}};
- glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels);
- for (int x = 0; x < 2; ++x) {
- for (int y = 0; y < 2; ++y) {
- EXPECT_EQ(pixels[1-y][x][0], copied_pixels[y][x][0]);
- EXPECT_EQ(pixels[1-y][x][1], copied_pixels[y][x][1]);
- EXPECT_EQ(pixels[1-y][x][2], copied_pixels[y][x][2]);
- EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]);
- }
- }
-
- EXPECT_TRUE(GL_NO_ERROR == glGetError());
-}
-
-// Test that the extension respects the GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM
-// storage setting.
-TEST_P(GLCopyTextureCHROMIUMTest, PremultiplyAlpha) {
- CopyType copy_type = GetParam();
- uint8 pixels[1 * 4] = { 2, 2, 2, 128 };
-
- glBindTexture(GL_TEXTURE_2D, textures_[0]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- pixels);
-
- glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE);
- if (copy_type == TexImage) {
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA,
- GL_UNSIGNED_BYTE, false, true, false);
- } else {
- glBindTexture(GL_TEXTURE_2D, textures_[1]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- nullptr);
- glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0,
- 0, 1, 1, false, true, false);
- }
- EXPECT_TRUE(GL_NO_ERROR == glGetError());
-
- uint8 copied_pixels[1 * 4] = {0};
- glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels);
- EXPECT_EQ(1u, copied_pixels[0]);
- EXPECT_EQ(1u, copied_pixels[1]);
- EXPECT_EQ(1u, copied_pixels[2]);
- EXPECT_EQ(128u, copied_pixels[3]);
-
- EXPECT_TRUE(GL_NO_ERROR == glGetError());
-}
-
-// Test that the extension respects the GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM
-// storage setting.
-TEST_P(GLCopyTextureCHROMIUMTest, UnpremultiplyAlpha) {
- CopyType copy_type = GetParam();
- uint8 pixels[1 * 4] = { 16, 16, 16, 128 };
-
- glBindTexture(GL_TEXTURE_2D, textures_[0]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- pixels);
-
- glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE);
- if (copy_type == TexImage) {
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA,
- GL_UNSIGNED_BYTE, false, false, true);
- } else {
- glBindTexture(GL_TEXTURE_2D, textures_[1]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- nullptr);
- glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0,
- 0, 1, 1, false, false, true);
- }
- EXPECT_TRUE(GL_NO_ERROR == glGetError());
-
- uint8 copied_pixels[1 * 4] = {0};
- glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels);
- EXPECT_EQ(32u, copied_pixels[0]);
- EXPECT_EQ(32u, copied_pixels[1]);
- EXPECT_EQ(32u, copied_pixels[2]);
- EXPECT_EQ(128u, copied_pixels[3]);
-
- EXPECT_TRUE(GL_NO_ERROR == glGetError());
-}
-
-TEST_P(GLCopyTextureCHROMIUMTest, FlipYAndPremultiplyAlpha) {
- CopyType copy_type = GetParam();
- uint8 pixels[2][2][4];
- for (int x = 0; x < 2; ++x) {
- for (int y = 0; y < 2; ++y) {
- uint8 color = 16 * x + 16 * y;
- pixels[y][x][0] = color;
- pixels[y][x][1] = color;
- pixels[y][x][2] = color;
- pixels[y][x][3] = 128u;
- }
- }
-
- glBindTexture(GL_TEXTURE_2D, textures_[0]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- pixels);
-
- glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE);
- glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE);
- if (copy_type == TexImage) {
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA,
- GL_UNSIGNED_BYTE, true, true, false);
- } else {
- glBindTexture(GL_TEXTURE_2D, textures_[1]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- nullptr);
- glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0,
- 0, 2, 2, true, true, false);
- }
- EXPECT_TRUE(GL_NO_ERROR == glGetError());
-
- uint8 copied_pixels[2][2][4] = {{{0}}};
- glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels);
- for (int x = 0; x < 2; ++x) {
- for (int y = 0; y < 2; ++y) {
- EXPECT_EQ(pixels[1-y][x][0] / 2, copied_pixels[y][x][0]);
- EXPECT_EQ(pixels[1-y][x][1] / 2, copied_pixels[y][x][1]);
- EXPECT_EQ(pixels[1-y][x][2] / 2, copied_pixels[y][x][2]);
- EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]);
- }
- }
-
- EXPECT_TRUE(GL_NO_ERROR == glGetError());
-}
-
-TEST_P(GLCopyTextureCHROMIUMTest, FlipYAndUnpremultiplyAlpha) {
- CopyType copy_type = GetParam();
- uint8 pixels[2][2][4];
- for (int x = 0; x < 2; ++x) {
- for (int y = 0; y < 2; ++y) {
- uint8 color = 16 * x + 16 * y;
- pixels[y][x][0] = color;
- pixels[y][x][1] = color;
- pixels[y][x][2] = color;
- pixels[y][x][3] = 128u;
- }
- }
-
- glBindTexture(GL_TEXTURE_2D, textures_[0]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- pixels);
-
- glPixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE);
- glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE);
- if (copy_type == TexImage) {
- glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA,
- GL_UNSIGNED_BYTE, true, false, true);
- } else {
- glBindTexture(GL_TEXTURE_2D, textures_[1]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- nullptr);
- glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0,
- 0, 2, 2, true, false, true);
- }
- EXPECT_TRUE(GL_NO_ERROR == glGetError());
-
- uint8 copied_pixels[2][2][4] = {{{0}}};
- glReadPixels(0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, copied_pixels);
- for (int x = 0; x < 2; ++x) {
- for (int y = 0; y < 2; ++y) {
- EXPECT_EQ(pixels[1-y][x][0] * 2, copied_pixels[y][x][0]);
- EXPECT_EQ(pixels[1-y][x][1] * 2, copied_pixels[y][x][1]);
- EXPECT_EQ(pixels[1-y][x][2] * 2, copied_pixels[y][x][2]);
- EXPECT_EQ(pixels[1-y][x][3], copied_pixels[y][x][3]);
- }
- }
-
- EXPECT_TRUE(GL_NO_ERROR == glGetError());
-}
-
namespace {
void glEnableDisable(GLint param, GLboolean value) {
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h ('k') | media/blink/skcanvas_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698