| 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" |
| 11 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 11 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 12 #include "gpu/command_buffer/service/gpu_scheduler.h" | 12 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 13 #include "gpu/GLES2/gles2_command_buffer.h" | |
| 14 #include "gpu/gles2_conform_support/egl/config.h" | 13 #include "gpu/gles2_conform_support/egl/config.h" |
| 15 #include "gpu/gles2_conform_support/egl/surface.h" | 14 #include "gpu/gles2_conform_support/egl/surface.h" |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 const int32 kCommandBufferSize = 1024 * 1024; | 17 const int32 kCommandBufferSize = 1024 * 1024; |
| 19 const int32 kTransferBufferSize = 512 * 1024; | 18 const int32 kTransferBufferSize = 512 * 1024; |
| 20 } | 19 } |
| 21 | 20 |
| 22 namespace egl { | 21 namespace egl { |
| 23 | 22 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 DCHECK(buffer.ptr != NULL); | 155 DCHECK(buffer.ptr != NULL); |
| 157 bool share_resources = share_ctx != NULL; | 156 bool share_resources = share_ctx != NULL; |
| 158 using gpu::gles2::GLES2Implementation; | 157 using gpu::gles2::GLES2Implementation; |
| 159 context_.reset(new GLES2Implementation( | 158 context_.reset(new GLES2Implementation( |
| 160 gles2_cmd_helper_.get(), | 159 gles2_cmd_helper_.get(), |
| 161 buffer.size, | 160 buffer.size, |
| 162 buffer.ptr, | 161 buffer.ptr, |
| 163 transfer_buffer_id_, | 162 transfer_buffer_id_, |
| 164 share_resources)); | 163 share_resources)); |
| 165 | 164 |
| 166 context_->CommandBufferEnableCHROMIUM( | 165 context_->EnableFeatureCHROMIUM( |
| 167 PEPPER3D_ALLOW_BUFFERS_ON_MULTIPLE_TARGETS); | 166 "pepper3d_allow_buffers_on_multiple_targets"); |
| 168 context_->CommandBufferEnableCHROMIUM( | 167 context_->EnableFeatureCHROMIUM( |
| 169 PEPPER3D_SUPPORT_FIXED_ATTRIBS); | 168 "pepper3d_support_fixed_attribs"); |
| 170 | 169 |
| 171 return context_.get(); | 170 return context_.get(); |
| 172 } | 171 } |
| 173 | 172 |
| 174 void Display::DestroyContext(EGLContext ctx) { | 173 void Display::DestroyContext(EGLContext ctx) { |
| 175 DCHECK(IsValidContext(ctx)); | 174 DCHECK(IsValidContext(ctx)); |
| 176 context_.reset(); | 175 context_.reset(); |
| 177 } | 176 } |
| 178 | 177 |
| 179 bool Display::MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx) { | 178 bool Display::MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx) { |
| 180 if (ctx == EGL_NO_CONTEXT) { | 179 if (ctx == EGL_NO_CONTEXT) { |
| 181 gles2::SetGLContext(NULL); | 180 gles2::SetGLContext(NULL); |
| 182 } else { | 181 } else { |
| 183 DCHECK(IsValidSurface(draw)); | 182 DCHECK(IsValidSurface(draw)); |
| 184 DCHECK(IsValidSurface(read)); | 183 DCHECK(IsValidSurface(read)); |
| 185 DCHECK(IsValidContext(ctx)); | 184 DCHECK(IsValidContext(ctx)); |
| 186 gles2::SetGLContext(context_.get()); | 185 gles2::SetGLContext(context_.get()); |
| 187 } | 186 } |
| 188 return true; | 187 return true; |
| 189 } | 188 } |
| 190 | 189 |
| 191 } // namespace egl | 190 } // namespace egl |
| OLD | NEW |