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

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

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 4 years, 8 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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>
11 #include <GLES2/gl2extchromium.h> 11 #include <GLES2/gl2extchromium.h>
12 #include <stdint.h> 12 #include <stdint.h>
13 13
14 #include <memory>
15
16 #include "base/memory/ptr_util.h"
14 #include "gpu/command_buffer/tests/gl_manager.h" 17 #include "gpu/command_buffer/tests/gl_manager.h"
15 #include "gpu/command_buffer/tests/gl_test_utils.h" 18 #include "gpu/command_buffer/tests/gl_test_utils.h"
16 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
18 21
19 #define SHADER(src) #src 22 #define SHADER(src) #src
20 23
21 namespace gpu { 24 namespace gpu {
22 25
23 namespace { 26 namespace {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 157
155 TEST_F(GLCompressedCopyTextureCHROMIUMTest, InternalFormat) { 158 TEST_F(GLCompressedCopyTextureCHROMIUMTest, InternalFormat) {
156 struct Image { 159 struct Image {
157 const GLint format; 160 const GLint format;
158 const uint8_t* data; 161 const uint8_t* data;
159 const GLsizei data_size; 162 const GLsizei data_size;
160 163
161 Image(const GLint format, const uint8_t* data, const GLsizei data_size) 164 Image(const GLint format, const uint8_t* data, const GLsizei data_size)
162 : format(format), data(data), data_size(data_size) {} 165 : format(format), data(data), data_size(data_size) {}
163 }; 166 };
164 std::vector<scoped_ptr<Image>> supported_formats; 167 std::vector<std::unique_ptr<Image>> supported_formats;
165 168
166 if (GLTestHelper::HasExtension("GL_AMD_compressed_ATC_texture") || 169 if (GLTestHelper::HasExtension("GL_AMD_compressed_ATC_texture") ||
167 GLTestHelper::HasExtension("GL_ATI_texture_compression_atitc")) { 170 GLTestHelper::HasExtension("GL_ATI_texture_compression_atitc")) {
168 supported_formats.push_back(make_scoped_ptr(new Image( 171 supported_formats.push_back(base::WrapUnique(new Image(
169 GL_ATC_RGB_AMD, 172 GL_ATC_RGB_AMD, kCompressedImageATC, sizeof(kCompressedImageATC))));
170 kCompressedImageATC, 173 supported_formats.push_back(base::WrapUnique(
171 sizeof(kCompressedImageATC)))); 174 new Image(GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD, kCompressedImageATCIA,
172 supported_formats.push_back(make_scoped_ptr(new Image( 175 sizeof(kCompressedImageATCIA))));
173 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD,
174 kCompressedImageATCIA,
175 sizeof(kCompressedImageATCIA))));
176 } 176 }
177 if (GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { 177 if (GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) {
178 supported_formats.push_back(make_scoped_ptr(new Image( 178 supported_formats.push_back(base::WrapUnique(
179 GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 179 new Image(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, kCompressedImageDXT1,
180 kCompressedImageDXT1, 180 sizeof(kCompressedImageDXT1))));
181 sizeof(kCompressedImageDXT1))));
182 } 181 }
183 if (GLTestHelper::HasExtension("GL_ANGLE_texture_compression_dxt5") || 182 if (GLTestHelper::HasExtension("GL_ANGLE_texture_compression_dxt5") ||
184 GLTestHelper::HasExtension("GL_EXT_texture_compression_s3tc")) { 183 GLTestHelper::HasExtension("GL_EXT_texture_compression_s3tc")) {
185 supported_formats.push_back(make_scoped_ptr(new Image( 184 supported_formats.push_back(base::WrapUnique(
186 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 185 new Image(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, kCompressedImageDXT5,
187 kCompressedImageDXT5, 186 sizeof(kCompressedImageDXT5))));
188 sizeof(kCompressedImageDXT5))));
189 } 187 }
190 if (GLTestHelper::HasExtension("GL_OES_compressed_ETC1_RGB8_texture")) { 188 if (GLTestHelper::HasExtension("GL_OES_compressed_ETC1_RGB8_texture")) {
191 supported_formats.push_back(make_scoped_ptr(new Image( 189 supported_formats.push_back(base::WrapUnique(new Image(
192 GL_ETC1_RGB8_OES, 190 GL_ETC1_RGB8_OES, kCompressedImageETC1, sizeof(kCompressedImageETC1))));
193 kCompressedImageETC1,
194 sizeof(kCompressedImageETC1))));
195 } 191 }
196 192
197 for (const auto& image : supported_formats) { 193 for (const auto& image : supported_formats) {
198 glBindTexture(GL_TEXTURE_2D, textures_[0]); 194 glBindTexture(GL_TEXTURE_2D, textures_[0]);
199 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 195 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
200 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 196 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
201 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 197 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
202 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 198 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
203 glCompressedTexImage2D(GL_TEXTURE_2D, 0, image->format, 199 glCompressedTexImage2D(GL_TEXTURE_2D, 0, image->format,
204 4, 4, 0, image->data_size, image->data); 200 4, 4, 0, image->data_size, image->data);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); 391 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture);
396 EXPECT_EQ(texture_ids[0], static_cast<GLuint>(bound_texture)); 392 EXPECT_EQ(texture_ids[0], static_cast<GLuint>(bound_texture));
397 glBindTexture(GL_TEXTURE_2D, 0); 393 glBindTexture(GL_TEXTURE_2D, 0);
398 394
399 glDeleteTextures(2, texture_ids); 395 glDeleteTextures(2, texture_ids);
400 396
401 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 397 EXPECT_TRUE(GL_NO_ERROR == glGetError());
402 } 398 }
403 399
404 } // namespace gpu 400 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698