Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1594)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2067503003: Add a new command buffer function glScheduleCALayerInUseQueryCHROMIUM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fix. Created 4 years, 6 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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 10430 matching lines...) Expand 10 before | Expand all | Expand 10 after
10441 if (!surface_->ScheduleCALayer( 10441 if (!surface_->ScheduleCALayer(
10442 image, contents_rect, c.opacity, c.background_color, c.edge_aa_mask, 10442 image, contents_rect, c.opacity, c.background_color, c.edge_aa_mask,
10443 bounds_rect, c.is_clipped ? true : false, clip_rect, transform, 10443 bounds_rect, c.is_clipped ? true : false, clip_rect, transform,
10444 c.sorting_context_id, filter)) { 10444 c.sorting_context_id, filter)) {
10445 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM", 10445 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM",
10446 "failed to schedule CALayer"); 10446 "failed to schedule CALayer");
10447 } 10447 }
10448 return error::kNoError; 10448 return error::kNoError;
10449 } 10449 }
10450 10450
10451 error::Error GLES2DecoderImpl::HandleScheduleCALayerInUseQueryCHROMIUMImmediate(
10452 uint32_t immediate_data_size,
10453 const void* cmd_data) {
10454 const gles2::cmds::ScheduleCALayerInUseQueryCHROMIUMImmediate& c =
10455 *static_cast<
10456 const gles2::cmds::ScheduleCALayerInUseQueryCHROMIUMImmediate*>(
10457 cmd_data);
10458
10459 GLuint n = static_cast<GLuint>(c.n);
10460 uint32_t data_size;
10461 if (!GLES2Util::ComputeDataSize(n, sizeof(GLuint), 1, &data_size)) {
10462 return error::kOutOfBounds;
10463 }
10464 if (data_size > immediate_data_size) {
10465 return error::kOutOfBounds;
10466 }
10467 const GLuint* textures =
10468 GetImmediateDataAs<const GLuint*>(c, data_size, immediate_data_size);
piman 2016/06/14 00:58:56 On the client side, you transmits the textures int
erikchen 2016/06/14 01:47:51 This code is no longer necessary, because I now us
10469
10470 std::vector<gl::GLSurface::CALayerInUseQuery> queries;
piman 2016/06/14 00:58:55 nit: queries.reserve(n); to avoid reallocations
erikchen 2016/06/14 01:47:51 Done.
10471 for (unsigned i = 0; i < n; ++i) {
10472 gl::GLImage* image = nullptr;
10473 GLuint texture_id = textures[i];
10474 if (texture_id) {
10475 TextureRef* ref = texture_manager()->GetTexture(texture_id);
10476 if (!ref) {
10477 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE,
10478 "glScheduleCALayerInUseQueryCHROMIUM",
10479 "unknown texture");
10480 return error::kNoError;
10481 }
10482 Texture::ImageState image_state;
10483 image = ref->texture()->GetLevelImage(ref->texture()->target(), 0,
10484 &image_state);
10485 }
10486 gl::GLSurface::CALayerInUseQuery query;
10487 query.image = image;
10488 query.texture = texture_id;
10489 queries.push_back(query);
10490 }
10491
10492 surface_->ScheduleCALayerInUseQuery(queries);
piman 2016/06/14 00:58:55 nit: std::move(queries)
erikchen 2016/06/14 01:47:51 Done.
10493 return error::kNoError;
10494 }
10495
10451 error::Error GLES2DecoderImpl::GetAttribLocationHelper( 10496 error::Error GLES2DecoderImpl::GetAttribLocationHelper(
10452 GLuint client_id, 10497 GLuint client_id,
10453 uint32_t location_shm_id, 10498 uint32_t location_shm_id,
10454 uint32_t location_shm_offset, 10499 uint32_t location_shm_offset,
10455 const std::string& name_str) { 10500 const std::string& name_str) {
10456 if (!StringIsValidForGLES(name_str)) { 10501 if (!StringIsValidForGLES(name_str)) {
10457 LOCAL_SET_GL_ERROR( 10502 LOCAL_SET_GL_ERROR(
10458 GL_INVALID_VALUE, "glGetAttribLocation", "Invalid character"); 10503 GL_INVALID_VALUE, "glGetAttribLocation", "Invalid character");
10459 return error::kNoError; 10504 return error::kNoError;
10460 } 10505 }
(...skipping 6423 matching lines...) Expand 10 before | Expand all | Expand 10 after
16884 } 16929 }
16885 16930
16886 // Include the auto-generated part of this file. We split this because it means 16931 // Include the auto-generated part of this file. We split this because it means
16887 // we can easily edit the non-auto generated parts right here in this file 16932 // we can easily edit the non-auto generated parts right here in this file
16888 // instead of having to edit some template or the code generator. 16933 // instead of having to edit some template or the code generator.
16889 #include "base/macros.h" 16934 #include "base/macros.h"
16890 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16935 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16891 16936
16892 } // namespace gles2 16937 } // namespace gles2
16893 } // namespace gpu 16938 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698