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

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

Issue 2479513002: Reland of Extend CopyTextureCHROMIUM to more ES 3.0 texture formats. (Closed)
Patch Set: full path Created 4 years, 1 month 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_test_utils.cc
diff --git a/gpu/command_buffer/tests/gl_test_utils.cc b/gpu/command_buffer/tests/gl_test_utils.cc
index 5917bfe6c8e2d843fae1e39836fd388b85356e74..2a76cb9b23f99a259af54330df514e892f9b1fb8 100644
--- a/gpu/command_buffer/tests/gl_test_utils.cc
+++ b/gpu/command_buffer/tests/gl_test_utils.cc
@@ -209,16 +209,18 @@ bool GLTestHelper::CheckPixels(GLint x,
GLsizei width,
GLsizei height,
GLint tolerance,
- const uint8_t* color) {
+ const uint8_t* color,
+ int channel_count) {
GLsizei size = width * height * 4;
std::unique_ptr<uint8_t[]> pixels(new uint8_t[size]);
memset(pixels.get(), kCheckClearValue, size);
glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
int bad_count = 0;
+ channel_count = channel_count > 4 ? 4 : channel_count;
for (GLint yy = 0; yy < height; ++yy) {
for (GLint xx = 0; xx < width; ++xx) {
int offset = yy * width * 4 + xx * 4;
- for (int jj = 0; jj < 4; ++jj) {
+ for (int jj = 0; jj < channel_count; ++jj) {
uint8_t actual = pixels[offset + jj];
uint8_t expected = color[jj];
int diff = actual - expected;

Powered by Google App Engine
This is Rietveld 408576698