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

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: Fix compile 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
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 9356 matching lines...) Expand 10 before | Expand all | Expand 10 after
9430 image, 9431 image,
9431 gfx::Rect(c.bounds_x, c.bounds_y, c.bounds_width, c.bounds_height), 9432 gfx::Rect(c.bounds_x, c.bounds_y, c.bounds_width, c.bounds_height),
9432 gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height))) { 9433 gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height))) {
9433 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 9434 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
9434 "glScheduleOverlayPlaneCHROMIUM", 9435 "glScheduleOverlayPlaneCHROMIUM",
9435 "failed to schedule overlay"); 9436 "failed to schedule overlay");
9436 } 9437 }
9437 return error::kNoError; 9438 return error::kNoError;
9438 } 9439 }
9439 9440
9441 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM(
9442 uint32 immediate_data_size,
9443 const void* cmd_data) {
9444 const gles2::cmds::ScheduleCALayerCHROMIUM& c =
9445 *static_cast<const gles2::cmds::ScheduleCALayerCHROMIUM*>(cmd_data);
9446 gl::GLImage* image = nullptr;
9447 if (c.contents_texture_id) {
9448 TextureRef* ref = texture_manager()->GetTexture(c.contents_texture_id);
9449 if (!ref) {
9450 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM",
9451 "unknown texture");
9452 return error::kNoError;
9453 }
9454 Texture::ImageState image_state;
9455 image = ref->texture()->GetLevelImage(ref->texture()->target(), 0,
9456 &image_state);
9457 if (!image || image_state != Texture::BOUND) {
9458 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM",
9459 "unsupported texture format");
9460 return error::kNoError;
9461 }
9462 }
9463
9464 const GLfloat* mem = GetSharedMemoryAs<const GLfloat*>(c.shm_id, c.shm_offset,
9465 22 * sizeof(GLfloat));
9466 if (!mem) {
9467 return error::kOutOfBounds;
9468 }
9469 gfx::RectF contents_rect(mem[0], mem[1], mem[2], mem[3]);
9470 gfx::SizeF bounds_size(mem[4], mem[5]);
9471 gfx::Transform transform(mem[6], mem[10], mem[14], mem[18], mem[7], mem[11],
bajones 2015/11/09 19:42:22 Nit: I had to stare at this for a bit to understan
ccameron 2015/11/09 20:04:07 git cl format strikes again! Moved it back to 4x4
9472 mem[15], mem[19], mem[8], mem[12], mem[16], mem[20],
9473 mem[9], mem[13], mem[17], mem[21]);
9474 if (!surface_->ScheduleCALayer(image, contents_rect, c.opacity,
9475 c.background_color, bounds_size, transform)) {
9476 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM",
9477 "failed to schedule CALayer");
9478 }
9479 return error::kNoError;
9480 }
9481
9440 error::Error GLES2DecoderImpl::GetAttribLocationHelper( 9482 error::Error GLES2DecoderImpl::GetAttribLocationHelper(
9441 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, 9483 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset,
9442 const std::string& name_str) { 9484 const std::string& name_str) {
9443 if (!StringIsValidForGLES(name_str.c_str())) { 9485 if (!StringIsValidForGLES(name_str.c_str())) {
9444 LOCAL_SET_GL_ERROR( 9486 LOCAL_SET_GL_ERROR(
9445 GL_INVALID_VALUE, "glGetAttribLocation", "Invalid character"); 9487 GL_INVALID_VALUE, "glGetAttribLocation", "Invalid character");
9446 return error::kNoError; 9488 return error::kNoError;
9447 } 9489 }
9448 Program* program = GetProgramInfoNotShader( 9490 Program* program = GetProgramInfoNotShader(
9449 client_id, "glGetAttribLocation"); 9491 client_id, "glGetAttribLocation");
(...skipping 6150 matching lines...) Expand 10 before | Expand all | Expand 10 after
15600 return error::kNoError; 15642 return error::kNoError;
15601 } 15643 }
15602 15644
15603 // Include the auto-generated part of this file. We split this because it means 15645 // Include the auto-generated part of this file. We split this because it means
15604 // we can easily edit the non-auto generated parts right here in this file 15646 // we can easily edit the non-auto generated parts right here in this file
15605 // instead of having to edit some template or the code generator. 15647 // instead of having to edit some template or the code generator.
15606 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15648 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15607 15649
15608 } // namespace gles2 15650 } // namespace gles2
15609 } // namespace gpu 15651 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698