| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef GL_GLEXT_PROTOTYPES | 5 #ifndef GL_GLEXT_PROTOTYPES |
| 6 #define GL_GLEXT_PROTOTYPES | 6 #define GL_GLEXT_PROTOTYPES |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 TEST_F(GLIOSurfaceReadbackWorkaroundTest, ReadPixels) { | 45 TEST_F(GLIOSurfaceReadbackWorkaroundTest, ReadPixels) { |
| 46 int width = 1; | 46 int width = 1; |
| 47 int height = 1; | 47 int height = 1; |
| 48 GLuint source_texture = 0; | 48 GLuint source_texture = 0; |
| 49 GLenum source_target = GL_TEXTURE_RECTANGLE_ARB; | 49 GLenum source_target = GL_TEXTURE_RECTANGLE_ARB; |
| 50 glGenTextures(1, &source_texture); | 50 glGenTextures(1, &source_texture); |
| 51 glBindTexture(source_target, source_texture); | 51 glBindTexture(source_target, source_texture); |
| 52 glTexParameteri(source_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 52 glTexParameteri(source_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 53 glTexParameteri(source_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 53 glTexParameteri(source_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 54 GLuint image_id = glCreateGpuMemoryBufferImageCHROMIUM( | 54 std::unique_ptr<gfx::GpuMemoryBuffer> buffer(gl_.CreateGpuMemoryBuffer( |
| 55 width, height, GL_RGBA, GL_READ_WRITE_CHROMIUM); | 55 gfx::Size(width, height), gfx::BufferFormat::RGBA_8888)); |
| 56 GLuint image_id = |
| 57 glCreateImageCHROMIUM(buffer->AsClientBuffer(), width, height, GL_RGBA); |
| 56 ASSERT_NE(0u, image_id); | 58 ASSERT_NE(0u, image_id); |
| 57 glBindTexImage2DCHROMIUM(source_target, image_id); | 59 glBindTexImage2DCHROMIUM(source_target, image_id); |
| 58 | 60 |
| 59 GLuint framebuffer = 0; | 61 GLuint framebuffer = 0; |
| 60 glGenFramebuffers(1, &framebuffer); | 62 glGenFramebuffers(1, &framebuffer); |
| 61 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); | 63 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); |
| 62 glFramebufferTexture2D( | 64 glFramebufferTexture2D( |
| 63 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, source_target, source_texture, 0); | 65 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, source_target, source_texture, 0); |
| 64 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 66 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
| 65 glCheckFramebufferStatus(GL_FRAMEBUFFER)); | 67 glCheckFramebufferStatus(GL_FRAMEBUFFER)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 78 | 80 |
| 79 glReleaseTexImage2DCHROMIUM(source_target, image_id); | 81 glReleaseTexImage2DCHROMIUM(source_target, image_id); |
| 80 glDestroyImageCHROMIUM(image_id); | 82 glDestroyImageCHROMIUM(image_id); |
| 81 glDeleteTextures(1, &source_texture); | 83 glDeleteTextures(1, &source_texture); |
| 82 glDeleteFramebuffers(1, &framebuffer); | 84 glDeleteFramebuffers(1, &framebuffer); |
| 83 } | 85 } |
| 84 | 86 |
| 85 #endif // defined(OS_MACOSX) | 87 #endif // defined(OS_MACOSX) |
| 86 | 88 |
| 87 } // namespace gpu | 89 } // namespace gpu |
| OLD | NEW |