| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gl2ext.h> | 6 #include <GLES2/gl2ext.h> |
| 7 | 7 |
| 8 #include "gpu/command_buffer/tests/gl_manager.h" | 8 #include "gpu/command_buffer/tests/gl_manager.h" |
| 9 #include "gpu/command_buffer/tests/gl_test_utils.h" | 9 #include "gpu/command_buffer/tests/gl_test_utils.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); | 33 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); |
| 34 GLTestHelper::CheckGLError("no errors", __LINE__); | 34 GLTestHelper::CheckGLError("no errors", __LINE__); |
| 35 } | 35 } |
| 36 | 36 |
| 37 TEST_F(GLTest, BasicFBO) { | 37 TEST_F(GLTest, BasicFBO) { |
| 38 GLuint tex = 0; | 38 GLuint tex = 0; |
| 39 glGenTextures(1, &tex); | 39 glGenTextures(1, &tex); |
| 40 GLuint fbo = 0; | 40 GLuint fbo = 0; |
| 41 glGenFramebuffers(1, &fbo); | 41 glGenFramebuffers(1, &fbo); |
| 42 glBindTexture(GL_TEXTURE_2D, tex); | 42 glBindTexture(GL_TEXTURE_2D, tex); |
| 43 scoped_array<uint8> pixels(new uint8 [16*16*4]); | 43 scoped_ptr<uint8[]> pixels(new uint8 [16*16*4]); |
| 44 memset(pixels.get(), 0, 16*16*4); | 44 memset(pixels.get(), 0, 16*16*4); |
| 45 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 45 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 46 pixels.get()); | 46 pixels.get()); |
| 47 glGenerateMipmap(GL_TEXTURE_2D); | 47 glGenerateMipmap(GL_TEXTURE_2D); |
| 48 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 48 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 49 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 49 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 50 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 50 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 51 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 51 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 52 glBindFramebuffer(GL_FRAMEBUFFER, fbo); | 52 glBindFramebuffer(GL_FRAMEBUFFER, fbo); |
| 53 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 53 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 EXPECT_STREQ( | 102 EXPECT_STREQ( |
| 103 "Chromium", | 103 "Chromium", |
| 104 reinterpret_cast<const char*>(glGetString(GL_RENDERER))); | 104 reinterpret_cast<const char*>(glGetString(GL_RENDERER))); |
| 105 EXPECT_STREQ( | 105 EXPECT_STREQ( |
| 106 "Chromium", | 106 "Chromium", |
| 107 reinterpret_cast<const char*>(glGetString(GL_VENDOR))); | 107 reinterpret_cast<const char*>(glGetString(GL_VENDOR))); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace gpu | 110 } // namespace gpu |
| 111 | 111 |
| OLD | NEW |