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

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

Issue 1409193007: gpu: Add CHROMIUM_schedule_ca_layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 5 years, 1 month 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
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_ids_autogen.h ('k') | mojo/gpu/mojo_gles2_impl_autogen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "gpu/command_buffer/service/shader_translator.h" 54 #include "gpu/command_buffer/service/shader_translator.h"
55 #include "gpu/command_buffer/service/texture_manager.h" 55 #include "gpu/command_buffer/service/texture_manager.h"
56 #include "gpu/command_buffer/service/valuebuffer_manager.h" 56 #include "gpu/command_buffer/service/valuebuffer_manager.h"
57 #include "gpu/command_buffer/service/vertex_array_manager.h" 57 #include "gpu/command_buffer/service/vertex_array_manager.h"
58 #include "gpu/command_buffer/service/vertex_attrib_manager.h" 58 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
59 #include "third_party/smhasher/src/City.h" 59 #include "third_party/smhasher/src/City.h"
60 #include "ui/gfx/geometry/point.h" 60 #include "ui/gfx/geometry/point.h"
61 #include "ui/gfx/geometry/rect.h" 61 #include "ui/gfx/geometry/rect.h"
62 #include "ui/gfx/geometry/size.h" 62 #include "ui/gfx/geometry/size.h"
63 #include "ui/gfx/overlay_transform.h" 63 #include "ui/gfx/overlay_transform.h"
64 #include "ui/gfx/transform.h"
64 #include "ui/gl/gl_bindings.h" 65 #include "ui/gl/gl_bindings.h"
65 #include "ui/gl/gl_context.h" 66 #include "ui/gl/gl_context.h"
66 #include "ui/gl/gl_fence.h" 67 #include "ui/gl/gl_fence.h"
67 #include "ui/gl/gl_image.h" 68 #include "ui/gl/gl_image.h"
68 #include "ui/gl/gl_implementation.h" 69 #include "ui/gl/gl_implementation.h"
69 #include "ui/gl/gl_surface.h" 70 #include "ui/gl/gl_surface.h"
70 #include "ui/gl/gl_version_info.h" 71 #include "ui/gl/gl_version_info.h"
71 #include "ui/gl/gpu_timing.h" 72 #include "ui/gl/gpu_timing.h"
72 73
73 #if defined(OS_MACOSX) 74 #if defined(OS_MACOSX)
(...skipping 9329 matching lines...) Expand 10 before | Expand all | Expand 10 after
9403 image, 9404 image,
9404 gfx::Rect(c.bounds_x, c.bounds_y, c.bounds_width, c.bounds_height), 9405 gfx::Rect(c.bounds_x, c.bounds_y, c.bounds_width, c.bounds_height),
9405 gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height))) { 9406 gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height))) {
9406 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 9407 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
9407 "glScheduleOverlayPlaneCHROMIUM", 9408 "glScheduleOverlayPlaneCHROMIUM",
9408 "failed to schedule overlay"); 9409 "failed to schedule overlay");
9409 } 9410 }
9410 return error::kNoError; 9411 return error::kNoError;
9411 } 9412 }
9412 9413
9414 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM(
9415 uint32 immediate_data_size,
9416 const void* cmd_data) {
9417 const gles2::cmds::ScheduleCALayerCHROMIUM& c =
9418 *static_cast<const gles2::cmds::ScheduleCALayerCHROMIUM*>(cmd_data);
9419 gl::GLImage* image = nullptr;
9420 if (c.contents_texture_id) {
9421 TextureRef* ref = texture_manager()->GetTexture(c.contents_texture_id);
9422 if (!ref) {
9423 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM",
9424 "unknown texture");
9425 return error::kNoError;
9426 }
9427 Texture::ImageState image_state;
9428 image = ref->texture()->GetLevelImage(ref->texture()->target(), 0,
9429 &image_state);
9430 if (!image || image_state != Texture::BOUND) {
9431 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM",
9432 "unsupported texture format");
9433 return error::kNoError;
9434 }
9435 }
9436
9437 const GLfloat* mem = GetSharedMemoryAs<const GLfloat*>(c.shm_id, c.shm_offset,
9438 22 * sizeof(GLfloat));
9439 if (!mem) {
9440 return error::kOutOfBounds;
9441 }
9442 gfx::RectF contents_rect(mem[0], mem[1], mem[2], mem[3]);
9443 gfx::SizeF bounds_size(mem[4], mem[5]);
9444 gfx::Transform transform(mem[6], mem[10], mem[14], mem[18],
9445 mem[7], mem[11], mem[15], mem[19],
9446 mem[8], mem[12], mem[16], mem[20],
9447 mem[9], mem[13], mem[17], mem[21]);
9448 if (!surface_->ScheduleCALayer(image, contents_rect, c.opacity,
9449 c.background_color, bounds_size, transform)) {
9450 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM",
9451 "failed to schedule CALayer");
9452 }
9453 return error::kNoError;
9454 }
9455
9413 error::Error GLES2DecoderImpl::GetAttribLocationHelper( 9456 error::Error GLES2DecoderImpl::GetAttribLocationHelper(
9414 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, 9457 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset,
9415 const std::string& name_str) { 9458 const std::string& name_str) {
9416 if (!StringIsValidForGLES(name_str.c_str())) { 9459 if (!StringIsValidForGLES(name_str.c_str())) {
9417 LOCAL_SET_GL_ERROR( 9460 LOCAL_SET_GL_ERROR(
9418 GL_INVALID_VALUE, "glGetAttribLocation", "Invalid character"); 9461 GL_INVALID_VALUE, "glGetAttribLocation", "Invalid character");
9419 return error::kNoError; 9462 return error::kNoError;
9420 } 9463 }
9421 Program* program = GetProgramInfoNotShader( 9464 Program* program = GetProgramInfoNotShader(
9422 client_id, "glGetAttribLocation"); 9465 client_id, "glGetAttribLocation");
(...skipping 6020 matching lines...) Expand 10 before | Expand all | Expand 10 after
15443 return error::kNoError; 15486 return error::kNoError;
15444 } 15487 }
15445 15488
15446 // Include the auto-generated part of this file. We split this because it means 15489 // Include the auto-generated part of this file. We split this because it means
15447 // we can easily edit the non-auto generated parts right here in this file 15490 // we can easily edit the non-auto generated parts right here in this file
15448 // instead of having to edit some template or the code generator. 15491 // instead of having to edit some template or the code generator.
15449 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15492 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15450 15493
15451 } // namespace gles2 15494 } // namespace gles2
15452 } // namespace gpu 15495 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_ids_autogen.h ('k') | mojo/gpu/mojo_gles2_impl_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698