Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2736643004: Add DCLayerOverlayProcessor and supporting DCLayer structures. (Closed)
Patch Set: split CALayerOverlay into DCLayerOverlay Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 4967 matching lines...) Expand 10 before | Expand all | Expand 10 after
4978 return; 4978 return;
4979 } 4979 }
4980 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); 4980 GLfloat* mem = static_cast<GLfloat*>(buffer.address());
4981 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); 4981 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat));
4982 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); 4982 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat));
4983 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, background_color, 4983 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, background_color,
4984 edge_aa_mask, filter, buffer.shm_id(), 4984 edge_aa_mask, filter, buffer.shm_id(),
4985 buffer.offset()); 4985 buffer.offset());
4986 } 4986 }
4987 4987
4988 void GLES2Implementation::ScheduleDCLayerSharedStateCHROMIUM(
4989 GLfloat opacity,
4990 GLboolean is_clipped,
4991 const GLfloat* clip_rect,
4992 GLint z_order,
4993 const GLfloat* transform) {
4994 size_t shm_size = 20 * sizeof(GLfloat);
4995 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_);
4996 if (!buffer.valid() || buffer.size() < shm_size) {
4997 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleDCLayerSharedStateCHROMIUM",
4998 "out of memory");
4999 return;
5000 }
5001 GLfloat* mem = static_cast<GLfloat*>(buffer.address());
5002 memcpy(mem + 0, clip_rect, 4 * sizeof(GLfloat));
5003 memcpy(mem + 4, transform, 16 * sizeof(GLfloat));
5004 helper_->ScheduleDCLayerSharedStateCHROMIUM(opacity, is_clipped, z_order,
5005 buffer.shm_id(), buffer.offset());
5006 }
5007
5008 void GLES2Implementation::ScheduleDCLayerCHROMIUM(GLuint contents_texture_id,
5009 const GLfloat* contents_rect,
5010 GLuint background_color,
5011 GLuint edge_aa_mask,
5012 const GLfloat* bounds_rect,
5013 GLuint filter) {
5014 size_t shm_size = 8 * sizeof(GLfloat);
5015 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_);
5016 if (!buffer.valid() || buffer.size() < shm_size) {
5017 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleDCLayerCHROMIUM",
5018 "out of memory");
5019 return;
5020 }
5021 GLfloat* mem = static_cast<GLfloat*>(buffer.address());
5022 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat));
5023 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat));
5024 helper_->ScheduleDCLayerCHROMIUM(contents_texture_id, background_color,
5025 edge_aa_mask, filter, buffer.shm_id(),
5026 buffer.offset());
5027 }
5028
4988 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { 5029 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() {
4989 GPU_CLIENT_SINGLE_THREAD_CHECK(); 5030 GPU_CLIENT_SINGLE_THREAD_CHECK();
4990 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); 5031 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()");
4991 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); 5032 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM");
4992 5033
4993 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). 5034 // Same flow control as GLES2Implementation::SwapBuffers (see comments there).
4994 swap_buffers_tokens_.push(helper_->InsertToken()); 5035 swap_buffers_tokens_.push(helper_->InsertToken());
4995 helper_->CommitOverlayPlanesCHROMIUM(); 5036 helper_->CommitOverlayPlanesCHROMIUM();
4996 helper_->CommandBufferHelper::Flush(); 5037 helper_->CommandBufferHelper::Flush();
4997 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { 5038 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) {
(...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after
7023 CheckGLError(); 7064 CheckGLError();
7024 } 7065 }
7025 7066
7026 // Include the auto-generated part of this file. We split this because it means 7067 // Include the auto-generated part of this file. We split this because it means
7027 // we can easily edit the non-auto generated parts right here in this file 7068 // we can easily edit the non-auto generated parts right here in this file
7028 // instead of having to edit some template or the code generator. 7069 // instead of having to edit some template or the code generator.
7029 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 7070 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
7030 7071
7031 } // namespace gles2 7072 } // namespace gles2
7032 } // namespace gpu 7073 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_cmd_helper_autogen.h ('k') | gpu/command_buffer/client/gles2_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698