OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "gpu/command_buffer/client/gles2_lib.h" | 8 #include "gpu/command_buffer/client/gles2_lib.h" |
9 #include "gpu/command_buffer/service/command_buffer_service.h" | 9 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 10 #include "gpu/command_buffer/service/context_group.h" |
10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 11 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
11 #include "gpu/command_buffer/service/gpu_scheduler.h" | 12 #include "gpu/command_buffer/service/gpu_scheduler.h" |
12 #include "gpu/GLES2/gles2_command_buffer.h" | 13 #include "gpu/GLES2/gles2_command_buffer.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 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 EGLSurface Display::CreateWindowSurface(EGLConfig config, | 102 EGLSurface Display::CreateWindowSurface(EGLConfig config, |
102 EGLNativeWindowType win, | 103 EGLNativeWindowType win, |
103 const EGLint* attrib_list) { | 104 const EGLint* attrib_list) { |
104 if (surface_ != NULL) { | 105 if (surface_ != NULL) { |
105 // We do not support more than one window surface. | 106 // We do not support more than one window surface. |
106 return EGL_NO_SURFACE; | 107 return EGL_NO_SURFACE; |
107 } | 108 } |
108 | 109 |
109 using gpu::GpuScheduler; | 110 using gpu::GpuScheduler; |
110 std::vector<int32> attribs; | 111 std::vector<int32> attribs; |
| 112 gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup()); |
111 scoped_ptr<GpuScheduler> gpu_scheduler( | 113 scoped_ptr<GpuScheduler> gpu_scheduler( |
112 GpuScheduler::Create(command_buffer_.get(), | 114 GpuScheduler::Create(command_buffer_.get(), |
113 NULL, | 115 NULL, |
114 NULL)); | 116 group.get())); |
115 if (!gpu_scheduler->Initialize( | 117 if (!gpu_scheduler->Initialize( |
116 win, gfx::Size(), false, gpu::gles2::DisallowedExtensions(), NULL, | 118 win, gfx::Size(), false, gpu::gles2::DisallowedExtensions(), NULL, |
117 attribs, NULL)) | 119 attribs, NULL)) |
118 return EGL_NO_SURFACE; | 120 return EGL_NO_SURFACE; |
119 | 121 |
120 command_buffer_->SetPutOffsetChangeCallback( | 122 command_buffer_->SetPutOffsetChangeCallback( |
121 NewCallback(gpu_scheduler.get(), &GpuScheduler::PutChanged)); | 123 NewCallback(gpu_scheduler.get(), &GpuScheduler::PutChanged)); |
122 gpu_scheduler_.reset(gpu_scheduler.release()); | 124 gpu_scheduler_.reset(gpu_scheduler.release()); |
123 surface_.reset(new Surface(win)); | 125 surface_.reset(new Surface(win)); |
124 | 126 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } else { | 182 } else { |
181 DCHECK(IsValidSurface(draw)); | 183 DCHECK(IsValidSurface(draw)); |
182 DCHECK(IsValidSurface(read)); | 184 DCHECK(IsValidSurface(read)); |
183 DCHECK(IsValidContext(ctx)); | 185 DCHECK(IsValidContext(ctx)); |
184 gles2::SetGLContext(context_.get()); | 186 gles2::SetGLContext(context_.get()); |
185 } | 187 } |
186 return true; | 188 return true; |
187 } | 189 } |
188 | 190 |
189 } // namespace egl | 191 } // namespace egl |
OLD | NEW |