OLD | NEW |
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 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 namespace gpu { | 31 namespace gpu { |
32 namespace gles2 { | 32 namespace gles2 { |
33 | 33 |
34 static const int kImageWidth = 32; | 34 static const int kImageWidth = 32; |
35 static const int kImageHeight = 32; | 35 static const int kImageHeight = 32; |
36 static const int kImageBytesPerPixel = 4; | 36 static const int kImageBytesPerPixel = 4; |
37 | 37 |
38 class GpuMemoryBufferTest : public testing::Test { | 38 class GpuMemoryBufferTest : public testing::Test { |
39 protected: | 39 protected: |
40 virtual void SetUp() { | 40 void SetUp() override { |
41 gl_.Initialize(GLManager::Options()); | 41 gl_.Initialize(GLManager::Options()); |
42 gl_.MakeCurrent(); | 42 gl_.MakeCurrent(); |
43 | 43 |
44 glGenTextures(2, texture_ids_); | 44 glGenTextures(2, texture_ids_); |
45 glBindTexture(GL_TEXTURE_2D, texture_ids_[1]); | 45 glBindTexture(GL_TEXTURE_2D, texture_ids_[1]); |
46 | 46 |
47 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 47 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
48 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 48 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
49 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 49 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
50 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 50 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
51 | 51 |
52 glGenFramebuffers(1, &framebuffer_id_); | 52 glGenFramebuffers(1, &framebuffer_id_); |
53 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id_); | 53 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id_); |
54 glFramebufferTexture2D(GL_FRAMEBUFFER, | 54 glFramebufferTexture2D(GL_FRAMEBUFFER, |
55 GL_COLOR_ATTACHMENT0, | 55 GL_COLOR_ATTACHMENT0, |
56 GL_TEXTURE_2D, | 56 GL_TEXTURE_2D, |
57 texture_ids_[1], | 57 texture_ids_[1], |
58 0); | 58 0); |
59 } | 59 } |
60 | 60 |
61 virtual void TearDown() { | 61 void TearDown() override { |
62 glDeleteTextures(2, texture_ids_); | 62 glDeleteTextures(2, texture_ids_); |
63 glDeleteFramebuffers(1, &framebuffer_id_); | 63 glDeleteFramebuffers(1, &framebuffer_id_); |
64 | 64 |
65 gl_.Destroy(); | 65 gl_.Destroy(); |
66 } | 66 } |
67 | 67 |
68 GLManager gl_; | 68 GLManager gl_; |
69 GLuint texture_ids_[2]; | 69 GLuint texture_ids_[2]; |
70 GLuint framebuffer_id_; | 70 GLuint framebuffer_id_; |
71 }; | 71 }; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 // Release the image. | 121 // Release the image. |
122 glReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id); | 122 glReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id); |
123 | 123 |
124 // Destroy the image. | 124 // Destroy the image. |
125 glDestroyImageCHROMIUM(image_id); | 125 glDestroyImageCHROMIUM(image_id); |
126 } | 126 } |
127 | 127 |
128 } // namespace gles2 | 128 } // namespace gles2 |
129 } // namespace gpu | 129 } // namespace gpu |
OLD | NEW |