| 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/gles2_conform_support/egl/display.h" | 5 #include "gpu/gles2_conform_support/egl/display.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "gpu/command_buffer/client/gles2_lib.h" | 10 #include "gpu/command_buffer/client/gles2_lib.h" |
| 11 #include "gpu/command_buffer/client/transfer_buffer.h" | 11 #include "gpu/command_buffer/client/transfer_buffer.h" |
| 12 #include "gpu/command_buffer/service/context_group.h" | 12 #include "gpu/command_buffer/service/context_group.h" |
| 13 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
| 13 #include "gpu/gles2_conform_support/egl/config.h" | 14 #include "gpu/gles2_conform_support/egl/config.h" |
| 14 #include "gpu/gles2_conform_support/egl/surface.h" | 15 #include "gpu/gles2_conform_support/egl/surface.h" |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 const int32 kCommandBufferSize = 1024 * 1024; | 18 const int32 kCommandBufferSize = 1024 * 1024; |
| 18 const int32 kTransferBufferSize = 512 * 1024; | 19 const int32 kTransferBufferSize = 512 * 1024; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace egl { | 22 namespace egl { |
| 22 | 23 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 76 } |
| 76 | 77 |
| 77 EGLSurface Display::CreateWindowSurface(EGLConfig config, | 78 EGLSurface Display::CreateWindowSurface(EGLConfig config, |
| 78 EGLNativeWindowType win, | 79 EGLNativeWindowType win, |
| 79 const EGLint* attrib_list) { | 80 const EGLint* attrib_list) { |
| 80 if (surface_ != NULL) { | 81 if (surface_ != NULL) { |
| 81 // We do not support more than one window surface. | 82 // We do not support more than one window surface. |
| 82 return EGL_NO_SURFACE; | 83 return EGL_NO_SURFACE; |
| 83 } | 84 } |
| 84 | 85 |
| 86 { |
| 87 gpu::TransferBufferManager* manager = new gpu::TransferBufferManager(); |
| 88 transfer_buffer_manager_.reset(manager); |
| 89 manager->Initialize(); |
| 90 } |
| 85 scoped_ptr<gpu::CommandBufferService> command_buffer( | 91 scoped_ptr<gpu::CommandBufferService> command_buffer( |
| 86 new gpu::CommandBufferService); | 92 new gpu::CommandBufferService(transfer_buffer_manager_.get())); |
| 87 if (!command_buffer->Initialize()) | 93 if (!command_buffer->Initialize()) |
| 88 return NULL; | 94 return NULL; |
| 89 | 95 |
| 90 gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup(NULL, true)); | 96 gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup(NULL, true)); |
| 91 | 97 |
| 92 decoder_.reset(gpu::gles2::GLES2Decoder::Create(group.get())); | 98 decoder_.reset(gpu::gles2::GLES2Decoder::Create(group.get())); |
| 93 if (!decoder_.get()) | 99 if (!decoder_.get()) |
| 94 return EGL_NO_SURFACE; | 100 return EGL_NO_SURFACE; |
| 95 | 101 |
| 96 gpu_scheduler_.reset(new gpu::GpuScheduler(command_buffer.get(), | 102 gpu_scheduler_.reset(new gpu::GpuScheduler(command_buffer.get(), |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } else { | 215 } else { |
| 210 DCHECK(IsValidSurface(draw)); | 216 DCHECK(IsValidSurface(draw)); |
| 211 DCHECK(IsValidSurface(read)); | 217 DCHECK(IsValidSurface(read)); |
| 212 DCHECK(IsValidContext(ctx)); | 218 DCHECK(IsValidContext(ctx)); |
| 213 gles2::SetGLContext(context_.get()); | 219 gles2::SetGLContext(context_.get()); |
| 214 } | 220 } |
| 215 return true; | 221 return true; |
| 216 } | 222 } |
| 217 | 223 |
| 218 } // namespace egl | 224 } // namespace egl |
| OLD | NEW |