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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 | 8 |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
(...skipping 4282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4293 | 4293 |
4294 void GLES2Implementation::Swap() { | 4294 void GLES2Implementation::Swap() { |
4295 SwapBuffers(); | 4295 SwapBuffers(); |
4296 } | 4296 } |
4297 | 4297 |
4298 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) { | 4298 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) { |
4299 PostSubBufferCHROMIUM( | 4299 PostSubBufferCHROMIUM( |
4300 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height()); | 4300 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height()); |
4301 } | 4301 } |
4302 | 4302 |
4303 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { | 4303 void GLES2Implementation::CommitOverlayPlanes() { |
4304 // TODO(watk): crbug.com/560592 | 4304 CommitOverlayPlanesCHROMIUM(); |
4305 NOTIMPLEMENTED(); | |
4306 } | 4305 } |
4307 | 4306 |
4308 static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) { | 4307 static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) { |
4309 switch (plane_transform) { | 4308 switch (plane_transform) { |
4310 case gfx::OVERLAY_TRANSFORM_INVALID: | 4309 case gfx::OVERLAY_TRANSFORM_INVALID: |
4311 break; | 4310 break; |
4312 case gfx::OVERLAY_TRANSFORM_NONE: | 4311 case gfx::OVERLAY_TRANSFORM_NONE: |
4313 return GL_OVERLAY_TRANSFORM_NONE_CHROMIUM; | 4312 return GL_OVERLAY_TRANSFORM_NONE_CHROMIUM; |
4314 case gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL: | 4313 case gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL: |
4315 return GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM; | 4314 return GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4360 } | 4359 } |
4361 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); | 4360 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); |
4362 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); | 4361 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); |
4363 memcpy(mem + 4, bounds_size, 2 * sizeof(GLfloat)); | 4362 memcpy(mem + 4, bounds_size, 2 * sizeof(GLfloat)); |
4364 memcpy(mem + 6, transform, 16 * sizeof(GLfloat)); | 4363 memcpy(mem + 6, transform, 16 * sizeof(GLfloat)); |
4365 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, opacity, | 4364 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, opacity, |
4366 background_color, buffer.shm_id(), | 4365 background_color, buffer.shm_id(), |
4367 buffer.offset()); | 4366 buffer.offset()); |
4368 } | 4367 } |
4369 | 4368 |
| 4369 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { |
| 4370 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 4371 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); |
| 4372 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); |
| 4373 |
| 4374 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). |
| 4375 swap_buffers_tokens_.push(helper_->InsertToken()); |
| 4376 helper_->CommitOverlayPlanesCHROMIUM(); |
| 4377 helper_->CommandBufferHelper::Flush(); |
| 4378 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { |
| 4379 helper_->WaitForToken(swap_buffers_tokens_.front()); |
| 4380 swap_buffers_tokens_.pop(); |
| 4381 } |
| 4382 } |
| 4383 |
4370 GLboolean GLES2Implementation::EnableFeatureCHROMIUM( | 4384 GLboolean GLES2Implementation::EnableFeatureCHROMIUM( |
4371 const char* feature) { | 4385 const char* feature) { |
4372 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 4386 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
4373 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnableFeatureCHROMIUM(" | 4387 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnableFeatureCHROMIUM(" |
4374 << feature << ")"); | 4388 << feature << ")"); |
4375 TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM"); | 4389 TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM"); |
4376 typedef cmds::EnableFeatureCHROMIUM::Result Result; | 4390 typedef cmds::EnableFeatureCHROMIUM::Result Result; |
4377 Result* result = GetResultAs<Result*>(); | 4391 Result* result = GetResultAs<Result*>(); |
4378 if (!result) { | 4392 if (!result) { |
4379 return false; | 4393 return false; |
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6397 CheckGLError(); | 6411 CheckGLError(); |
6398 } | 6412 } |
6399 | 6413 |
6400 // Include the auto-generated part of this file. We split this because it means | 6414 // Include the auto-generated part of this file. We split this because it means |
6401 // we can easily edit the non-auto generated parts right here in this file | 6415 // we can easily edit the non-auto generated parts right here in this file |
6402 // instead of having to edit some template or the code generator. | 6416 // instead of having to edit some template or the code generator. |
6403 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6417 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6404 | 6418 |
6405 } // namespace gles2 | 6419 } // namespace gles2 |
6406 } // namespace gpu | 6420 } // namespace gpu |
OLD | NEW |