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

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

Issue 2163493002: Break glScheduleCALayerCHROMIUM into smaller functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp37_cleanup_calayeroverlay
Patch Set: Comments from piman. Created 4 years, 5 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 4695 matching lines...) Expand 10 before | Expand all | Expand 10 after
4706 display_bounds.x(), 4706 display_bounds.x(),
4707 display_bounds.y(), 4707 display_bounds.y(),
4708 display_bounds.width(), 4708 display_bounds.width(),
4709 display_bounds.height(), 4709 display_bounds.height(),
4710 uv_rect.x(), 4710 uv_rect.x(),
4711 uv_rect.y(), 4711 uv_rect.y(),
4712 uv_rect.width(), 4712 uv_rect.width(),
4713 uv_rect.height()); 4713 uv_rect.height());
4714 } 4714 }
4715 4715
4716 void GLES2Implementation::ScheduleCALayerSharedStateCHROMIUM(
4717 GLfloat opacity,
4718 GLboolean is_clipped,
4719 const GLfloat* clip_rect,
4720 GLint sorting_context_id,
4721 const GLfloat* transform) {
4722 size_t shm_size = 20 * sizeof(GLfloat);
4723 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_);
4724 if (!buffer.valid() || buffer.size() < shm_size) {
4725 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleCALayerSharedStateCHROMIUM",
4726 "out of memory");
4727 return;
4728 }
4729 GLfloat* mem = static_cast<GLfloat*>(buffer.address());
4730 memcpy(mem + 0, clip_rect, 4 * sizeof(GLfloat));
4731 memcpy(mem + 4, transform, 16 * sizeof(GLfloat));
4732 helper_->ScheduleCALayerSharedStateCHROMIUM(opacity, is_clipped,
4733 sorting_context_id,
4734 buffer.shm_id(), buffer.offset());
4735 }
4736
4716 void GLES2Implementation::ScheduleCALayerCHROMIUM(GLuint contents_texture_id, 4737 void GLES2Implementation::ScheduleCALayerCHROMIUM(GLuint contents_texture_id,
4717 const GLfloat* contents_rect, 4738 const GLfloat* contents_rect,
4718 GLfloat opacity,
4719 GLuint background_color, 4739 GLuint background_color,
4720 GLuint edge_aa_mask, 4740 GLuint edge_aa_mask,
4721 const GLfloat* bounds_rect, 4741 const GLfloat* bounds_rect,
4722 GLboolean is_clipped,
4723 const GLfloat* clip_rect,
4724 GLint sorting_context_id,
4725 const GLfloat* transform,
4726 GLuint filter) { 4742 GLuint filter) {
4727 size_t shm_size = 28 * sizeof(GLfloat); 4743 size_t shm_size = 8 * sizeof(GLfloat);
4728 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_); 4744 ScopedTransferBufferPtr buffer(shm_size, helper_, transfer_buffer_);
4729 if (!buffer.valid() || buffer.size() < shm_size) { 4745 if (!buffer.valid() || buffer.size() < shm_size) {
4730 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleCALayerCHROMIUM", 4746 SetGLError(GL_OUT_OF_MEMORY, "GLES2::ScheduleCALayerCHROMIUM",
4731 "out of memory"); 4747 "out of memory");
4732 return; 4748 return;
4733 } 4749 }
4734 GLfloat* mem = static_cast<GLfloat*>(buffer.address()); 4750 GLfloat* mem = static_cast<GLfloat*>(buffer.address());
4735 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat)); 4751 memcpy(mem + 0, contents_rect, 4 * sizeof(GLfloat));
4736 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat)); 4752 memcpy(mem + 4, bounds_rect, 4 * sizeof(GLfloat));
4737 memcpy(mem + 8, clip_rect, 4 * sizeof(GLfloat)); 4753 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, background_color,
4738 memcpy(mem + 12, transform, 16 * sizeof(GLfloat)); 4754 edge_aa_mask, filter, buffer.shm_id(),
4739 helper_->ScheduleCALayerCHROMIUM(contents_texture_id, opacity,
4740 background_color, edge_aa_mask, is_clipped,
4741 sorting_context_id, filter, buffer.shm_id(),
4742 buffer.offset()); 4755 buffer.offset());
4743 } 4756 }
4744 4757
4745 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() { 4758 void GLES2Implementation::CommitOverlayPlanesCHROMIUM() {
4746 GPU_CLIENT_SINGLE_THREAD_CHECK(); 4759 GPU_CLIENT_SINGLE_THREAD_CHECK();
4747 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()"); 4760 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CommitOverlayPlanesCHROMIUM()");
4748 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM"); 4761 TRACE_EVENT0("gpu", "GLES2::CommitOverlayPlanesCHROMIUM");
4749 4762
4750 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). 4763 // Same flow control as GLES2Implementation::SwapBuffers (see comments there).
4751 swap_buffers_tokens_.push(helper_->InsertToken()); 4764 swap_buffers_tokens_.push(helper_->InsertToken());
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
6828 cached_extensions_.clear(); 6841 cached_extensions_.clear();
6829 } 6842 }
6830 6843
6831 // Include the auto-generated part of this file. We split this because it means 6844 // Include the auto-generated part of this file. We split this because it means
6832 // we can easily edit the non-auto generated parts right here in this file 6845 // we can easily edit the non-auto generated parts right here in this file
6833 // instead of having to edit some template or the code generator. 6846 // instead of having to edit some template or the code generator.
6834 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 6847 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
6835 6848
6836 } // namespace gles2 6849 } // namespace gles2
6837 } // namespace gpu 6850 } // 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