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/context_group.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 EGLSurface Display::CreateWindowSurface(EGLConfig config, | 101 EGLSurface Display::CreateWindowSurface(EGLConfig config, |
102 EGLNativeWindowType win, | 102 EGLNativeWindowType win, |
103 const EGLint* attrib_list) { | 103 const EGLint* attrib_list) { |
104 if (surface_ != NULL) { | 104 if (surface_ != NULL) { |
105 // We do not support more than one window surface. | 105 // We do not support more than one window surface. |
106 return EGL_NO_SURFACE; | 106 return EGL_NO_SURFACE; |
107 } | 107 } |
108 | 108 |
109 using gpu::GpuScheduler; | 109 using gpu::GpuScheduler; |
110 std::vector<int32> attribs; | 110 std::vector<int32> attribs; |
111 gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup()); | 111 gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup(true)); |
112 scoped_ptr<GpuScheduler> gpu_scheduler( | 112 scoped_ptr<GpuScheduler> gpu_scheduler( |
113 GpuScheduler::Create(command_buffer_.get(), | 113 GpuScheduler::Create(command_buffer_.get(), |
114 NULL, | 114 NULL, |
115 group.get())); | 115 group.get())); |
116 if (!gpu_scheduler->Initialize( | 116 if (!gpu_scheduler->Initialize( |
117 win, gfx::Size(), false, gpu::gles2::DisallowedExtensions(), NULL, | 117 win, gfx::Size(), false, gpu::gles2::DisallowedExtensions(), NULL, |
118 attribs, NULL)) | 118 attribs, NULL)) |
119 return EGL_NO_SURFACE; | 119 return EGL_NO_SURFACE; |
120 | 120 |
121 command_buffer_->SetPutOffsetChangeCallback( | 121 command_buffer_->SetPutOffsetChangeCallback( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 DCHECK(transfer_buffer_id_ != -1); | 153 DCHECK(transfer_buffer_id_ != -1); |
154 gpu::Buffer buffer = command_buffer_->GetTransferBuffer(transfer_buffer_id_); | 154 gpu::Buffer buffer = command_buffer_->GetTransferBuffer(transfer_buffer_id_); |
155 DCHECK(buffer.ptr != NULL); | 155 DCHECK(buffer.ptr != NULL); |
156 bool share_resources = share_ctx != NULL; | 156 bool share_resources = share_ctx != NULL; |
157 using gpu::gles2::GLES2Implementation; | 157 using gpu::gles2::GLES2Implementation; |
158 context_.reset(new GLES2Implementation( | 158 context_.reset(new GLES2Implementation( |
159 gles2_cmd_helper_.get(), | 159 gles2_cmd_helper_.get(), |
160 buffer.size, | 160 buffer.size, |
161 buffer.ptr, | 161 buffer.ptr, |
162 transfer_buffer_id_, | 162 transfer_buffer_id_, |
163 share_resources)); | 163 share_resources, |
| 164 true)); |
164 | 165 |
165 context_->EnableFeatureCHROMIUM( | 166 context_->EnableFeatureCHROMIUM( |
166 "pepper3d_allow_buffers_on_multiple_targets"); | 167 "pepper3d_allow_buffers_on_multiple_targets"); |
167 context_->EnableFeatureCHROMIUM( | 168 context_->EnableFeatureCHROMIUM( |
168 "pepper3d_support_fixed_attribs"); | 169 "pepper3d_support_fixed_attribs"); |
169 | 170 |
170 return context_.get(); | 171 return context_.get(); |
171 } | 172 } |
172 | 173 |
173 void Display::DestroyContext(EGLContext ctx) { | 174 void Display::DestroyContext(EGLContext ctx) { |
174 DCHECK(IsValidContext(ctx)); | 175 DCHECK(IsValidContext(ctx)); |
175 context_.reset(); | 176 context_.reset(); |
176 } | 177 } |
177 | 178 |
178 bool Display::MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx) { | 179 bool Display::MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx) { |
179 if (ctx == EGL_NO_CONTEXT) { | 180 if (ctx == EGL_NO_CONTEXT) { |
180 gles2::SetGLContext(NULL); | 181 gles2::SetGLContext(NULL); |
181 } else { | 182 } else { |
182 DCHECK(IsValidSurface(draw)); | 183 DCHECK(IsValidSurface(draw)); |
183 DCHECK(IsValidSurface(read)); | 184 DCHECK(IsValidSurface(read)); |
184 DCHECK(IsValidContext(ctx)); | 185 DCHECK(IsValidContext(ctx)); |
185 gles2::SetGLContext(context_.get()); | 186 gles2::SetGLContext(context_.get()); |
186 } | 187 } |
187 return true; | 188 return true; |
188 } | 189 } |
189 | 190 |
190 } // namespace egl | 191 } // namespace egl |
OLD | NEW |