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/gles2_cmd_decoder_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
17 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 17 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
18 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 18 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
19 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 19 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
20 #include "gpu/command_buffer/service/context_group.h" | 20 #include "gpu/command_buffer/service/context_group.h" |
21 #include "gpu/command_buffer/service/logger.h" | 21 #include "gpu/command_buffer/service/logger.h" |
22 #include "gpu/command_buffer/service/mailbox_manager.h" | 22 #include "gpu/command_buffer/service/mailbox_manager.h" |
23 #include "gpu/command_buffer/service/program_manager.h" | 23 #include "gpu/command_buffer/service/program_manager.h" |
| 24 #include "gpu/command_buffer/service/service_discardable_manager.h" |
24 #include "gpu/command_buffer/service/test_helper.h" | 25 #include "gpu/command_buffer/service/test_helper.h" |
25 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 26 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
27 #include "ui/gl/gl_mock.h" | 28 #include "ui/gl/gl_mock.h" |
28 #include "ui/gl/init/gl_factory.h" | 29 #include "ui/gl/init/gl_factory.h" |
29 #include "ui/gl/test/gl_surface_test_support.h" | 30 #include "ui/gl/test/gl_surface_test_support.h" |
30 | 31 |
31 using ::gl::MockGLInterface; | 32 using ::gl::MockGLInterface; |
32 using ::testing::_; | 33 using ::testing::_; |
33 using ::testing::AnyNumber; | 34 using ::testing::AnyNumber; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 ::gl::MockGLInterface::SetGLInterface(gl_.get()); | 187 ::gl::MockGLInterface::SetGLInterface(gl_.get()); |
187 | 188 |
188 SetupMockGLBehaviors(); | 189 SetupMockGLBehaviors(); |
189 | 190 |
190 scoped_refptr<FeatureInfo> feature_info = new FeatureInfo; | 191 scoped_refptr<FeatureInfo> feature_info = new FeatureInfo; |
191 if (command_line) { | 192 if (command_line) { |
192 GpuDriverBugWorkarounds gpu_driver_bug_workaround(command_line); | 193 GpuDriverBugWorkarounds gpu_driver_bug_workaround(command_line); |
193 feature_info = new FeatureInfo(*command_line, gpu_driver_bug_workaround); | 194 feature_info = new FeatureInfo(*command_line, gpu_driver_bug_workaround); |
194 } | 195 } |
195 | 196 |
196 group_ = scoped_refptr<ContextGroup>( | 197 group_ = scoped_refptr<ContextGroup>(new ContextGroup( |
197 new ContextGroup(gpu_preferences_, NULL, memory_tracker_, | 198 gpu_preferences_, NULL, memory_tracker_, |
198 new ShaderTranslatorCache(gpu_preferences_), | 199 new ShaderTranslatorCache(gpu_preferences_), |
199 new FramebufferCompletenessCache, feature_info, | 200 new FramebufferCompletenessCache, feature_info, |
200 normalized_init.bind_generates_resource, nullptr, | 201 normalized_init.bind_generates_resource, nullptr, nullptr, |
201 nullptr, GpuFeatureInfo())); | 202 GpuFeatureInfo(), new ServiceDiscardableManager)); |
202 bool use_default_textures = normalized_init.bind_generates_resource; | 203 bool use_default_textures = normalized_init.bind_generates_resource; |
203 | 204 |
204 InSequence sequence; | 205 InSequence sequence; |
205 | 206 |
206 surface_ = new gl::GLSurfaceStub; | 207 surface_ = new gl::GLSurfaceStub; |
207 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight)); | 208 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight)); |
208 surface_->set_supports_draw_rectangle(surface_supports_draw_rectangle_); | 209 surface_->set_supports_draw_rectangle(surface_supports_draw_rectangle_); |
209 | 210 |
210 // Context needs to be created before initializing ContextGroup, which will | 211 // Context needs to be created before initializing ContextGroup, which will |
211 // in turn initialize FeatureInfo, which needs a context to determine | 212 // in turn initialize FeatureInfo, which needs a context to determine |
(...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine::GetGetOffset() { | 2177 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine::GetGetOffset() { |
2177 DCHECK(false); | 2178 DCHECK(false); |
2178 return 0; | 2179 return 0; |
2179 } | 2180 } |
2180 | 2181 |
2181 void GLES2DecoderWithShaderTestBase::SetUp() { | 2182 void GLES2DecoderWithShaderTestBase::SetUp() { |
2182 GLES2DecoderTestBase::SetUp(); | 2183 GLES2DecoderTestBase::SetUp(); |
2183 SetupDefaultProgram(); | 2184 SetupDefaultProgram(); |
2184 } | 2185 } |
2185 | 2186 |
| 2187 void GLES2DecoderTestBase::DoInitializeDiscardableTextureCHROMIUM( |
| 2188 GLuint texture_id) { |
| 2189 scoped_refptr<gpu::Buffer> buffer = |
| 2190 engine_->GetSharedMemoryBuffer(kSharedMemoryId); |
| 2191 ClientDiscardableHandle handle(buffer, 0, kSharedMemoryId); |
| 2192 |
| 2193 cmds::InitializeDiscardableTextureCHROMIUM cmd; |
| 2194 cmd.Init(texture_id, kSharedMemoryId, 0); |
| 2195 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2196 } |
| 2197 |
| 2198 void GLES2DecoderTestBase::DoUnlockDiscardableTextureCHROMIUM( |
| 2199 GLuint texture_id) { |
| 2200 cmds::UnlockDiscardableTextureCHROMIUM cmd; |
| 2201 cmd.Init(texture_id); |
| 2202 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2203 } |
| 2204 |
2186 // Include the auto-generated part of this file. We split this because it means | 2205 // Include the auto-generated part of this file. We split this because it means |
2187 // we can easily edit the non-auto generated parts right here in this file | 2206 // we can easily edit the non-auto generated parts right here in this file |
2188 // instead of having to edit some template or the code generator. | 2207 // instead of having to edit some template or the code generator. |
2189 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 2208 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
2190 | 2209 |
2191 } // namespace gles2 | 2210 } // namespace gles2 |
2192 } // namespace gpu | 2211 } // namespace gpu |
OLD | NEW |