| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gpu_processor.h" | 5 #include "gpu/command_buffer/service/gpu_processor.h" |
| 6 | 6 |
| 7 #include "app/gfx/gl/gl_bindings.h" | 7 #include "app/gfx/gl/gl_bindings.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 45 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 46 DCHECK(command_buffer); | 46 DCHECK(command_buffer); |
| 47 decoder_.reset(decoder); | 47 decoder_.reset(decoder); |
| 48 parser_.reset(parser); | 48 parser_.reset(parser); |
| 49 } | 49 } |
| 50 | 50 |
| 51 GPUProcessor::~GPUProcessor() { | 51 GPUProcessor::~GPUProcessor() { |
| 52 Destroy(); | 52 Destroy(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool GPUProcessor::InitializeCommon(gfx::GLContext* context, | 55 bool GPUProcessor::InitializeCommon( |
| 56 const gfx::Size& size, | 56 gfx::GLContext* context, |
| 57 const char* allowed_extensions, | 57 const gfx::Size& size, |
| 58 const std::vector<int32>& attribs, | 58 const gles2::DisallowedExtensions& disallowed_extensions, |
| 59 gles2::GLES2Decoder* parent_decoder, | 59 const char* allowed_extensions, |
| 60 uint32 parent_texture_id) { | 60 const std::vector<int32>& attribs, |
| 61 gles2::GLES2Decoder* parent_decoder, |
| 62 uint32 parent_texture_id) { |
| 61 DCHECK(context); | 63 DCHECK(context); |
| 62 | 64 |
| 63 if (!context->MakeCurrent()) | 65 if (!context->MakeCurrent()) |
| 64 return false; | 66 return false; |
| 65 | 67 |
| 66 // If the NV_fence extension is present, use fences to defer the issue of | 68 // If the NV_fence extension is present, use fences to defer the issue of |
| 67 // commands once a certain fixed number of frames have been rendered. | 69 // commands once a certain fixed number of frames have been rendered. |
| 68 num_throttle_fences_ = | 70 num_throttle_fences_ = |
| 69 context->HasExtension("GL_NV_fence") ? kNumThrottleFences : 0; | 71 context->HasExtension("GL_NV_fence") ? kNumThrottleFences : 0; |
| 70 | 72 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 83 0, | 85 0, |
| 84 decoder_.get())); | 86 decoder_.get())); |
| 85 } else { | 87 } else { |
| 86 parser_.reset(new CommandParser(NULL, 0, 0, 0, 0, | 88 parser_.reset(new CommandParser(NULL, 0, 0, 0, 0, |
| 87 decoder_.get())); | 89 decoder_.get())); |
| 88 } | 90 } |
| 89 | 91 |
| 90 // Initialize the decoder with either the view or pbuffer GLContext. | 92 // Initialize the decoder with either the view or pbuffer GLContext. |
| 91 if (!decoder_->Initialize(context, | 93 if (!decoder_->Initialize(context, |
| 92 size, | 94 size, |
| 95 disallowed_extensions, |
| 93 allowed_extensions, | 96 allowed_extensions, |
| 94 attribs, | 97 attribs, |
| 95 parent_decoder, | 98 parent_decoder, |
| 96 parent_texture_id)) { | 99 parent_texture_id)) { |
| 97 LOG(ERROR) << "GPUProcessor::InitializeCommon failed because decoder " | 100 LOG(ERROR) << "GPUProcessor::InitializeCommon failed because decoder " |
| 98 << "failed to initialize."; | 101 << "failed to initialize."; |
| 99 Destroy(); | 102 Destroy(); |
| 100 return false; | 103 return false; |
| 101 } | 104 } |
| 102 | 105 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 234 |
| 232 void GPUProcessor::SetSwapBuffersCallback( | 235 void GPUProcessor::SetSwapBuffersCallback( |
| 233 Callback0::Type* callback) { | 236 Callback0::Type* callback) { |
| 234 wrapped_swap_buffers_callback_.reset(callback); | 237 wrapped_swap_buffers_callback_.reset(callback); |
| 235 decoder_->SetSwapBuffersCallback( | 238 decoder_->SetSwapBuffersCallback( |
| 236 NewCallback(this, | 239 NewCallback(this, |
| 237 &GPUProcessor::WillSwapBuffers)); | 240 &GPUProcessor::WillSwapBuffers)); |
| 238 } | 241 } |
| 239 | 242 |
| 240 } // namespace gpu | 243 } // namespace gpu |
| OLD | NEW |