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 "gpu/command_buffer/service/test_helper.h" | 5 #include "gpu/command_buffer/service/test_helper.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 void TestHelper::SetupContextGroupInitExpectations( | 242 void TestHelper::SetupContextGroupInitExpectations( |
243 ::gfx::MockGLInterface* gl, | 243 ::gfx::MockGLInterface* gl, |
244 const DisallowedFeatures& disallowed_features, | 244 const DisallowedFeatures& disallowed_features, |
245 const char* extensions, | 245 const char* extensions, |
246 const char* gl_version, | 246 const char* gl_version, |
247 bool bind_generates_resource) { | 247 bool bind_generates_resource) { |
248 InSequence sequence; | 248 InSequence sequence; |
249 | 249 |
250 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", gl_version); | 250 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", gl_version); |
251 | 251 |
252 std::string l_version(StringToLowerASCII(std::string(gl_version))); | 252 std::string l_version(base::StringToLowerASCII(std::string(gl_version))); |
253 bool is_es3 = (l_version.substr(0, 12) == "opengl es 3."); | 253 bool is_es3 = (l_version.substr(0, 12) == "opengl es 3."); |
254 | 254 |
255 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, _)) | 255 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, _)) |
256 .WillOnce(SetArgumentPointee<1>(kMaxRenderbufferSize)) | 256 .WillOnce(SetArgumentPointee<1>(kMaxRenderbufferSize)) |
257 .RetiresOnSaturation(); | 257 .RetiresOnSaturation(); |
258 if (strstr(extensions, "GL_EXT_framebuffer_multisample") || | 258 if (strstr(extensions, "GL_EXT_framebuffer_multisample") || |
259 strstr(extensions, "GL_EXT_multisampled_render_to_texture") || is_es3) { | 259 strstr(extensions, "GL_EXT_multisampled_render_to_texture") || is_es3) { |
260 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES, _)) | 260 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES, _)) |
261 .WillOnce(SetArgumentPointee<1>(kMaxSamples)) | 261 .WillOnce(SetArgumentPointee<1>(kMaxSamples)) |
262 .RetiresOnSaturation(); | 262 .RetiresOnSaturation(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 EXPECT_CALL(*gl, GetString(GL_EXTENSIONS)) | 312 EXPECT_CALL(*gl, GetString(GL_EXTENSIONS)) |
313 .WillOnce(Return(reinterpret_cast<const uint8*>(extensions))) | 313 .WillOnce(Return(reinterpret_cast<const uint8*>(extensions))) |
314 .RetiresOnSaturation(); | 314 .RetiresOnSaturation(); |
315 EXPECT_CALL(*gl, GetString(GL_RENDERER)) | 315 EXPECT_CALL(*gl, GetString(GL_RENDERER)) |
316 .WillOnce(Return(reinterpret_cast<const uint8*>(gl_renderer))) | 316 .WillOnce(Return(reinterpret_cast<const uint8*>(gl_renderer))) |
317 .RetiresOnSaturation(); | 317 .RetiresOnSaturation(); |
318 EXPECT_CALL(*gl, GetString(GL_VERSION)) | 318 EXPECT_CALL(*gl, GetString(GL_VERSION)) |
319 .WillOnce(Return(reinterpret_cast<const uint8*>(gl_version))) | 319 .WillOnce(Return(reinterpret_cast<const uint8*>(gl_version))) |
320 .RetiresOnSaturation(); | 320 .RetiresOnSaturation(); |
321 | 321 |
322 std::string l_version(StringToLowerASCII(std::string(gl_version))); | 322 std::string l_version(base::StringToLowerASCII(std::string(gl_version))); |
323 bool is_es3 = (l_version.substr(0, 12) == "opengl es 3."); | 323 bool is_es3 = (l_version.substr(0, 12) == "opengl es 3."); |
324 | 324 |
325 if (strstr(extensions, "GL_ARB_texture_float") || | 325 if (strstr(extensions, "GL_ARB_texture_float") || |
326 (is_es3 && strstr(extensions, "GL_EXT_color_buffer_float"))) { | 326 (is_es3 && strstr(extensions, "GL_EXT_color_buffer_float"))) { |
327 static const GLuint gl_ids[] = {101, 102}; | 327 static const GLuint gl_ids[] = {101, 102}; |
328 const GLsizei width = 16; | 328 const GLsizei width = 16; |
329 EXPECT_CALL(*gl, GetIntegerv(GL_FRAMEBUFFER_BINDING, _)) | 329 EXPECT_CALL(*gl, GetIntegerv(GL_FRAMEBUFFER_BINDING, _)) |
330 .WillOnce(SetArgumentPointee<1>(gl_ids[0])) | 330 .WillOnce(SetArgumentPointee<1>(gl_ids[0])) |
331 .RetiresOnSaturation(); | 331 .RetiresOnSaturation(); |
332 EXPECT_CALL(*gl, GetIntegerv(GL_TEXTURE_BINDING_2D, _)) | 332 EXPECT_CALL(*gl, GetIntegerv(GL_TEXTURE_BINDING_2D, _)) |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 gfx::SetGLImplementation(implementation); | 646 gfx::SetGLImplementation(implementation); |
647 } | 647 } |
648 | 648 |
649 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { | 649 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { |
650 gfx::SetGLImplementation(old_implementation_); | 650 gfx::SetGLImplementation(old_implementation_); |
651 } | 651 } |
652 | 652 |
653 } // namespace gles2 | 653 } // namespace gles2 |
654 } // namespace gpu | 654 } // namespace gpu |
655 | 655 |
OLD | NEW |