| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (options.virtual_manager) { | 100 if (options.virtual_manager) { |
| 101 real_gl_context = options.virtual_manager->context(); | 101 real_gl_context = options.virtual_manager->context(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 mailbox_manager_ = | 104 mailbox_manager_ = |
| 105 mailbox_manager ? mailbox_manager : new gles2::MailboxManager; | 105 mailbox_manager ? mailbox_manager : new gles2::MailboxManager; |
| 106 share_group_ = | 106 share_group_ = |
| 107 share_group ? share_group : new gfx::GLShareGroup; | 107 share_group ? share_group : new gfx::GLShareGroup; |
| 108 | 108 |
| 109 gfx::GpuPreference gpu_preference(gfx::PreferDiscreteGpu); | 109 gfx::GpuPreference gpu_preference(gfx::PreferDiscreteGpu); |
| 110 const char* allowed_extensions = "*"; | |
| 111 std::vector<int32> attribs; | 110 std::vector<int32> attribs; |
| 112 gles2::ContextCreationAttribHelper attrib_helper; | 111 gles2::ContextCreationAttribHelper attrib_helper; |
| 113 attrib_helper.red_size_ = 8; | 112 attrib_helper.red_size_ = 8; |
| 114 attrib_helper.green_size_ = 8; | 113 attrib_helper.green_size_ = 8; |
| 115 attrib_helper.blue_size_ = 8; | 114 attrib_helper.blue_size_ = 8; |
| 116 attrib_helper.alpha_size_ = 8; | 115 attrib_helper.alpha_size_ = 8; |
| 117 attrib_helper.depth_size_ = 16; | 116 attrib_helper.depth_size_ = 16; |
| 118 attrib_helper.Serialize(&attribs); | 117 attrib_helper.Serialize(&attribs); |
| 119 | 118 |
| 120 if (!context_group) { | 119 if (!context_group) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 ASSERT_TRUE(context_.get() != NULL) << "could not create GL context"; | 164 ASSERT_TRUE(context_.get() != NULL) << "could not create GL context"; |
| 166 | 165 |
| 167 ASSERT_TRUE(context_->MakeCurrent(surface_.get())); | 166 ASSERT_TRUE(context_->MakeCurrent(surface_.get())); |
| 168 | 167 |
| 169 ASSERT_TRUE(decoder_->Initialize( | 168 ASSERT_TRUE(decoder_->Initialize( |
| 170 surface_.get(), | 169 surface_.get(), |
| 171 context_.get(), | 170 context_.get(), |
| 172 true, | 171 true, |
| 173 options.size, | 172 options.size, |
| 174 ::gpu::gles2::DisallowedFeatures(), | 173 ::gpu::gles2::DisallowedFeatures(), |
| 175 allowed_extensions, | |
| 176 attribs)) << "could not initialize decoder"; | 174 attribs)) << "could not initialize decoder"; |
| 177 | 175 |
| 178 command_buffer_->SetPutOffsetChangeCallback( | 176 command_buffer_->SetPutOffsetChangeCallback( |
| 179 base::Bind(&GLManager::PumpCommands, base::Unretained(this))); | 177 base::Bind(&GLManager::PumpCommands, base::Unretained(this))); |
| 180 command_buffer_->SetGetBufferChangeCallback( | 178 command_buffer_->SetGetBufferChangeCallback( |
| 181 base::Bind(&GLManager::GetBufferChanged, base::Unretained(this))); | 179 base::Bind(&GLManager::GetBufferChanged, base::Unretained(this))); |
| 182 | 180 |
| 183 // Create the GLES2 helper, which writes the command buffer protocol. | 181 // Create the GLES2 helper, which writes the command buffer protocol. |
| 184 gles2_helper_.reset(new gles2::GLES2CmdHelper(command_buffer_.get())); | 182 gles2_helper_.reset(new gles2::GLES2CmdHelper(command_buffer_.get())); |
| 185 ASSERT_TRUE(gles2_helper_->Initialize(kCommandBufferSize)); | 183 ASSERT_TRUE(gles2_helper_->Initialize(kCommandBufferSize)); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 if (!context_lost_allowed_) { | 257 if (!context_lost_allowed_) { |
| 260 ASSERT_EQ(::gpu::error::kNoError, state.error); | 258 ASSERT_EQ(::gpu::error::kNoError, state.error); |
| 261 } | 259 } |
| 262 } | 260 } |
| 263 | 261 |
| 264 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { | 262 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { |
| 265 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); | 263 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); |
| 266 } | 264 } |
| 267 | 265 |
| 268 } // namespace gpu | 266 } // namespace gpu |
| OLD | NEW |