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

Side by Side Diff: gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc

Issue 2602563002: Refactor DrawTextureQuad and CheckPixels in gl_tests util (Closed)
Patch Set: git cl format Created 3 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <GLES2/gl2.h> 5 #include <GLES2/gl2.h>
6 #include <GLES2/gl2chromium.h> 6 #include <GLES2/gl2chromium.h>
7 #include <GLES2/gl2ext.h> 7 #include <GLES2/gl2ext.h>
8 #include <GLES2/gl2extchromium.h> 8 #include <GLES2/gl2extchromium.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 glUniform1i(sampler_location, 0); 227 glUniform1i(sampler_location, 0);
228 228
229 GLuint vbo = 229 GLuint vbo =
230 GLTestHelper::SetupUnitQuad(glGetAttribLocation(program, "a_position")); 230 GLTestHelper::SetupUnitQuad(glGetAttribLocation(program, "a_position"));
231 ASSERT_NE(0u, vbo); 231 ASSERT_NE(0u, vbo);
232 glViewport(0, 0, kImageWidth, kImageHeight); 232 glViewport(0, 0, kImageWidth, kImageHeight);
233 glDrawArrays(GL_TRIANGLES, 0, 6); 233 glDrawArrays(GL_TRIANGLES, 0, 6);
234 ASSERT_TRUE(glGetError() == GL_NO_ERROR); 234 ASSERT_TRUE(glGetError() == GL_NO_ERROR);
235 235
236 // Check if pixels match the values that were assigned to the mapped buffer. 236 // Check if pixels match the values that were assigned to the mapped buffer.
237 GLTestHelper::CheckPixels(0, 0, kImageWidth, kImageHeight, 0, pixel); 237 GLTestHelper::CheckPixels(0, 0, kImageWidth, kImageHeight, 0, pixel, nullptr);
238 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 238 EXPECT_TRUE(GL_NO_ERROR == glGetError());
239 239
240 // Release the image. 240 // Release the image.
241 glReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id); 241 glReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id);
242 242
243 // Clean up. 243 // Clean up.
244 glDeleteProgram(program); 244 glDeleteProgram(program);
245 glDeleteShader(vertex_shader); 245 glDeleteShader(vertex_shader);
246 glDeleteShader(fragment_shader); 246 glDeleteShader(fragment_shader);
247 glDeleteBuffers(1, &vbo); 247 glDeleteBuffers(1, &vbo);
248 glDestroyImageCHROMIUM(image_id); 248 glDestroyImageCHROMIUM(image_id);
249 glDeleteTextures(1, &texture_id); 249 glDeleteTextures(1, &texture_id);
250 } 250 }
251 251
252 INSTANTIATE_TEST_CASE_P(GpuMemoryBufferTests, 252 INSTANTIATE_TEST_CASE_P(GpuMemoryBufferTests,
253 GpuMemoryBufferTest, 253 GpuMemoryBufferTest,
254 ::testing::Values(gfx::BufferFormat::R_8, 254 ::testing::Values(gfx::BufferFormat::R_8,
255 gfx::BufferFormat::BGR_565, 255 gfx::BufferFormat::BGR_565,
256 gfx::BufferFormat::RGBA_4444, 256 gfx::BufferFormat::RGBA_4444,
257 gfx::BufferFormat::RGBA_8888, 257 gfx::BufferFormat::RGBA_8888,
258 gfx::BufferFormat::BGRA_8888)); 258 gfx::BufferFormat::BGRA_8888));
259 259
260 } // namespace gles2 260 } // namespace gles2
261 } // namespace gpu 261 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698