| Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| index db2c9d22c142c3fa90d8e93ba069e37e30e79b9b..32428d91f754e27597b504a91303ec8724c6fb8b 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| @@ -19,6 +19,7 @@
|
| #include "base/callback.h"
|
| #include "base/callback_helpers.h"
|
| #include "base/logging.h"
|
| +#include "base/macros.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/numerics/safe_math.h"
|
| @@ -1717,6 +1718,7 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
|
| // Wrapper for glSetDrawRectangleCHROMIUM
|
| void DoSetDrawRectangleCHROMIUM(GLint x, GLint y, GLint width, GLint height);
|
|
|
| + void DoSetDCLayerTextureCHROMIUM(GLuint index, GLuint texture_id);
|
| void DoSetEnableDCLayersCHROMIUM(GLboolean enable);
|
|
|
| // Wrapper for glReadBuffer
|
| @@ -2496,6 +2498,10 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
|
|
|
| std::unique_ptr<DCLayerSharedState> dc_layer_shared_state_;
|
|
|
| + // Allow up to 4 planes - Y, U, V, A. Some may be missing, depending on the
|
| + // texture format.
|
| + uint32_t dc_layer_textures_[4] = {};
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl);
|
| };
|
|
|
| @@ -8789,6 +8795,16 @@ void GLES2DecoderImpl::DoSetDrawRectangleCHROMIUM(GLint x,
|
| OnFboChanged();
|
| }
|
|
|
| +void GLES2DecoderImpl::DoSetDCLayerTextureCHROMIUM(GLuint index,
|
| + GLuint texture_id) {
|
| + if (index >= arraysize(dc_layer_textures_)) {
|
| + LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glSetDCLayerTextureCHROMIUM",
|
| + "texture index too large");
|
| + return;
|
| + }
|
| + dc_layer_textures_[index] = texture_id;
|
| +}
|
| +
|
| void GLES2DecoderImpl::DoSetEnableDCLayersCHROMIUM(GLboolean enable) {
|
| Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER);
|
| if (framebuffer) {
|
| @@ -12110,25 +12126,31 @@ error::Error GLES2DecoderImpl::HandleScheduleDCLayerCHROMIUM(
|
| return error::kNoError;
|
| }
|
|
|
| - gl::GLImage* image = nullptr;
|
| - GLuint contents_texture_id = c.contents_texture_id;
|
| - if (contents_texture_id) {
|
| - TextureRef* ref = texture_manager()->GetTexture(contents_texture_id);
|
| - if (!ref) {
|
| - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleDCLayerCHROMIUM",
|
| - "unknown texture");
|
| - return error::kNoError;
|
| - }
|
| - Texture::ImageState image_state;
|
| - image = ref->texture()->GetLevelImage(ref->texture()->target(), 0,
|
| - &image_state);
|
| - if (!image) {
|
| - LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleDCLayerCHROMIUM",
|
| - "unsupported texture format");
|
| - return error::kNoError;
|
| + std::vector<scoped_refptr<gl::GLImage>> images;
|
| +
|
| + for (int contents_texture_id : dc_layer_textures_) {
|
| + scoped_refptr<gl::GLImage> image;
|
| + if (contents_texture_id) {
|
| + TextureRef* ref = texture_manager()->GetTexture(contents_texture_id);
|
| + if (!ref) {
|
| + LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleDCLayerCHROMIUM",
|
| + "unknown texture");
|
| + return error::kNoError;
|
| + }
|
| + Texture::ImageState image_state;
|
| + image = ref->texture()->GetLevelImage(ref->texture()->target(), 0,
|
| + &image_state);
|
| + if (!image) {
|
| + LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleDCLayerCHROMIUM",
|
| + "unsupported texture format");
|
| + return error::kNoError;
|
| + }
|
| }
|
| + images.push_back(image);
|
| }
|
|
|
| + memset(dc_layer_textures_, 0, sizeof dc_layer_textures_);
|
| +
|
| const GLfloat* mem = GetSharedMemoryAs<const GLfloat*>(c.shm_id, c.shm_offset,
|
| 8 * sizeof(GLfloat));
|
| if (!mem) {
|
| @@ -12139,9 +12161,10 @@ error::Error GLES2DecoderImpl::HandleScheduleDCLayerCHROMIUM(
|
|
|
| ui::DCRendererLayerParams params = ui::DCRendererLayerParams(
|
| dc_layer_shared_state_->is_clipped, dc_layer_shared_state_->clip_rect,
|
| - dc_layer_shared_state_->z_order, dc_layer_shared_state_->transform, image,
|
| - contents_rect, gfx::ToEnclosingRect(bounds_rect), c.background_color,
|
| - c.edge_aa_mask, dc_layer_shared_state_->opacity, filter);
|
| + dc_layer_shared_state_->z_order, dc_layer_shared_state_->transform,
|
| + images, contents_rect, gfx::ToEnclosingRect(bounds_rect),
|
| + c.background_color, c.edge_aa_mask, dc_layer_shared_state_->opacity,
|
| + filter);
|
| if (!surface_->ScheduleDCLayer(params)) {
|
| LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleDCLayerCHROMIUM",
|
| "failed to schedule DCLayer");
|
|
|