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

Side by Side Diff: gpu/command_buffer/service/texture_manager_unittest.cc

Issue 2444813002: Remove unsafe mode to enable es3 api by default for WebGL2 and ES3 context (Closed)
Patch Set: fix a bug Created 4 years, 1 month 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) 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/texture_manager.h" 5 #include "gpu/command_buffer/service/texture_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "gpu/command_buffer/service/error_state_mock.h" 15 #include "gpu/command_buffer/service/error_state_mock.h"
16 #include "gpu/command_buffer/service/feature_info.h" 16 #include "gpu/command_buffer/service/feature_info.h"
17 #include "gpu/command_buffer/service/framebuffer_manager.h" 17 #include "gpu/command_buffer/service/framebuffer_manager.h"
18 #include "gpu/command_buffer/service/gl_stream_texture_image.h" 18 #include "gpu/command_buffer/service/gl_stream_texture_image.h"
19 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" 19 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
20 #include "gpu/command_buffer/service/gpu_service_test.h" 20 #include "gpu/command_buffer/service/gpu_service_test.h"
21 #include "gpu/command_buffer/service/mailbox_manager.h" 21 #include "gpu/command_buffer/service/mailbox_manager.h"
22 #include "gpu/command_buffer/service/memory_tracking.h" 22 #include "gpu/command_buffer/service/memory_tracking.h"
23 #include "gpu/command_buffer/service/mocks.h" 23 #include "gpu/command_buffer/service/mocks.h"
24 #include "gpu/command_buffer/service/test_helper.h" 24 #include "gpu/command_buffer/service/test_helper.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 #include "ui/gl/gl_image_stub.h" 26 #include "ui/gl/gl_image_stub.h"
27 #include "ui/gl/gl_mock.h" 27 #include "ui/gl/gl_mock.h"
28 #include "ui/gl/gl_switches.h" 28 #include "ui/gl/gl_switches.h"
29 29
30 using ::testing::AnyNumber;
30 using ::testing::AtLeast; 31 using ::testing::AtLeast;
31 using ::testing::Pointee; 32 using ::testing::Pointee;
32 using ::testing::Return; 33 using ::testing::Return;
33 using ::testing::SetArgPointee; 34 using ::testing::SetArgPointee;
34 using ::testing::StrictMock; 35 using ::testing::StrictMock;
35 using ::testing::_; 36 using ::testing::_;
36 37
37 namespace gpu { 38 namespace gpu {
38 namespace gles2 { 39 namespace gles2 {
39 40
(...skipping 24 matching lines...) Expand all
64 static const GLint kMax2dLevels = 6; 65 static const GLint kMax2dLevels = 6;
65 static const GLint kMaxCubeMapLevels = 4; 66 static const GLint kMaxCubeMapLevels = 4;
66 static const GLint kMaxExternalLevels = 1; 67 static const GLint kMaxExternalLevels = 1;
67 static const GLint kMax3dLevels = 10; 68 static const GLint kMax3dLevels = 10;
68 static const bool kUseDefaultTextures = false; 69 static const bool kUseDefaultTextures = false;
69 70
70 TextureManagerTest() { 71 TextureManagerTest() {
71 // Always run with this command line, but the ES3 features are not 72 // Always run with this command line, but the ES3 features are not
72 // enabled without FeatureInfo::EnableES3Validators(). 73 // enabled without FeatureInfo::EnableES3Validators().
73 base::CommandLine command_line(0, nullptr); 74 base::CommandLine command_line(0, nullptr);
74 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs);
75 GpuDriverBugWorkarounds gpu_driver_bug_workaround(&command_line); 75 GpuDriverBugWorkarounds gpu_driver_bug_workaround(&command_line);
76 feature_info_ = new FeatureInfo(command_line, gpu_driver_bug_workaround); 76 feature_info_ = new FeatureInfo(command_line, gpu_driver_bug_workaround);
77 } 77 }
78 78
79 ~TextureManagerTest() override {} 79 ~TextureManagerTest() override {}
80 80
81 protected: 81 protected:
82 void SetUp() override { 82 void SetUp() override {
83 GpuServiceTest::SetUp(); 83 GpuServiceTest::SetUp();
84 manager_.reset(new TextureManager( 84 manager_.reset(new TextureManager(
(...skipping 19 matching lines...) Expand all
104 gl_.get(), error_state_.get(), manager_.get(), 104 gl_.get(), error_state_.get(), manager_.get(),
105 texture_ref, pname, value, error); 105 texture_ref, pname, value, error);
106 } 106 }
107 107
108 void SetupFeatureInfo(const char* gl_extensions, 108 void SetupFeatureInfo(const char* gl_extensions,
109 const char* gl_version, 109 const char* gl_version,
110 bool enable_es3) { 110 bool enable_es3) {
111 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( 111 TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
112 gl_.get(), gl_extensions, "", gl_version, 112 gl_.get(), gl_extensions, "", gl_version,
113 feature_info_->context_type(), enable_es3); 113 feature_info_->context_type(), enable_es3);
114 feature_info_->InitializeForTesting(); 114 if (enable_es3) {
115 EXPECT_CALL(*gl_, GetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, _))
116 .Times(1)
117 .RetiresOnSaturation();
118 EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _))
119 .Times(AnyNumber())
120 .RetiresOnSaturation();
121 }
122 feature_info_->InitializeForTesting(
123 enable_es3 ? CONTEXT_TYPE_OPENGLES3 : CONTEXT_TYPE_OPENGLES2);
115 if (enable_es3) { 124 if (enable_es3) {
116 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS, _)) 125 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS, _))
117 .WillOnce(SetArgPointee<1>(8)) 126 .WillOnce(SetArgPointee<1>(8))
118 .RetiresOnSaturation(); 127 .RetiresOnSaturation();
119 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _)) 128 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _))
120 .WillOnce(SetArgPointee<1>(8)) 129 .WillOnce(SetArgPointee<1>(8))
121 .RetiresOnSaturation(); 130 .RetiresOnSaturation();
122 feature_info_->EnableES3Validators(); 131 feature_info_->EnableES3Validators();
123 } 132 }
124 } 133 }
(...skipping 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 ExpectValid( 2703 ExpectValid(
2695 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8); 2704 true, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8);
2696 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 2705 ExpectValid(true, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
2697 GL_DEPTH32F_STENCIL8); 2706 GL_DEPTH32F_STENCIL8);
2698 2707
2699 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8); 2708 ExpectInvalid(true, GL_RGB_INTEGER, GL_INT, GL_RGBA8);
2700 } 2709 }
2701 2710
2702 } // namespace gles2 2711 } // namespace gles2
2703 } // namespace gpu 2712 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_preferences.h ('k') | gpu/command_buffer/tests/es3_misc_functions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698