| 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/tests/gl_manager.h" | 5 #include "gpu/command_buffer/tests/gl_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 namespace gpu { | 29 namespace gpu { |
| 30 | 30 |
| 31 int GLManager::use_count_; | 31 int GLManager::use_count_; |
| 32 scoped_refptr<gfx::GLShareGroup>* GLManager::base_share_group_; | 32 scoped_refptr<gfx::GLShareGroup>* GLManager::base_share_group_; |
| 33 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_; | 33 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_; |
| 34 scoped_refptr<gfx::GLContext>* GLManager::base_context_; | 34 scoped_refptr<gfx::GLContext>* GLManager::base_context_; |
| 35 | 35 |
| 36 GLManager::Options::Options() | 36 GLManager::Options::Options() |
| 37 : size(4, 4), | 37 : size(4, 4), |
| 38 stencil_size(-1), |
| 38 share_group_manager(NULL), | 39 share_group_manager(NULL), |
| 39 share_mailbox_manager(NULL), | 40 share_mailbox_manager(NULL), |
| 40 virtual_manager(NULL), | 41 virtual_manager(NULL), |
| 41 bind_generates_resource(false), | 42 bind_generates_resource(false), |
| 42 lose_context_when_out_of_memory(false), | 43 lose_context_when_out_of_memory(false), |
| 43 context_lost_allowed(false), | 44 context_lost_allowed(false), |
| 44 image_manager(NULL) {} | 45 image_manager(NULL) { |
| 46 } |
| 45 | 47 |
| 46 GLManager::GLManager() | 48 GLManager::GLManager() |
| 47 : context_lost_allowed_(false) { | 49 : context_lost_allowed_(false) { |
| 48 SetupBaseContext(); | 50 SetupBaseContext(); |
| 49 } | 51 } |
| 50 | 52 |
| 51 GLManager::~GLManager() { | 53 GLManager::~GLManager() { |
| 52 --use_count_; | 54 --use_count_; |
| 53 if (!use_count_) { | 55 if (!use_count_) { |
| 54 if (base_share_group_) { | 56 if (base_share_group_) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 share_group ? share_group : new gfx::GLShareGroup; | 109 share_group ? share_group : new gfx::GLShareGroup; |
| 108 | 110 |
| 109 gfx::GpuPreference gpu_preference(gfx::PreferDiscreteGpu); | 111 gfx::GpuPreference gpu_preference(gfx::PreferDiscreteGpu); |
| 110 std::vector<int32> attribs; | 112 std::vector<int32> attribs; |
| 111 gles2::ContextCreationAttribHelper attrib_helper; | 113 gles2::ContextCreationAttribHelper attrib_helper; |
| 112 attrib_helper.red_size_ = 8; | 114 attrib_helper.red_size_ = 8; |
| 113 attrib_helper.green_size_ = 8; | 115 attrib_helper.green_size_ = 8; |
| 114 attrib_helper.blue_size_ = 8; | 116 attrib_helper.blue_size_ = 8; |
| 115 attrib_helper.alpha_size_ = 8; | 117 attrib_helper.alpha_size_ = 8; |
| 116 attrib_helper.depth_size_ = 16; | 118 attrib_helper.depth_size_ = 16; |
| 119 attrib_helper.stencil_size_ = options.stencil_size; |
| 117 attrib_helper.Serialize(&attribs); | 120 attrib_helper.Serialize(&attribs); |
| 118 | 121 |
| 119 if (!context_group) { | 122 if (!context_group) { |
| 120 context_group = | 123 context_group = |
| 121 new gles2::ContextGroup(mailbox_manager_.get(), | 124 new gles2::ContextGroup(mailbox_manager_.get(), |
| 122 options.image_manager, | 125 options.image_manager, |
| 123 NULL, | 126 NULL, |
| 124 new gpu::gles2::ShaderTranslatorCache, | 127 new gpu::gles2::ShaderTranslatorCache, |
| 125 NULL, | 128 NULL, |
| 126 options.bind_generates_resource); | 129 options.bind_generates_resource); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 if (!context_lost_allowed_) { | 266 if (!context_lost_allowed_) { |
| 264 ASSERT_EQ(::gpu::error::kNoError, state.error); | 267 ASSERT_EQ(::gpu::error::kNoError, state.error); |
| 265 } | 268 } |
| 266 } | 269 } |
| 267 | 270 |
| 268 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { | 271 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { |
| 269 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); | 272 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); |
| 270 } | 273 } |
| 271 | 274 |
| 272 } // namespace gpu | 275 } // namespace gpu |
| OLD | NEW |