| OLD | NEW |
| 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 9955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9966 "failed to schedule overlay"); | 9966 "failed to schedule overlay"); |
| 9967 } | 9967 } |
| 9968 return error::kNoError; | 9968 return error::kNoError; |
| 9969 } | 9969 } |
| 9970 | 9970 |
| 9971 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM( | 9971 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM( |
| 9972 uint32_t immediate_data_size, | 9972 uint32_t immediate_data_size, |
| 9973 const void* cmd_data) { | 9973 const void* cmd_data) { |
| 9974 const gles2::cmds::ScheduleCALayerCHROMIUM& c = | 9974 const gles2::cmds::ScheduleCALayerCHROMIUM& c = |
| 9975 *static_cast<const gles2::cmds::ScheduleCALayerCHROMIUM*>(cmd_data); | 9975 *static_cast<const gles2::cmds::ScheduleCALayerCHROMIUM*>(cmd_data); |
| 9976 GLuint filter = c.filter; |
| 9977 if (filter != GL_NEAREST && filter != GL_LINEAR) { |
| 9978 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM", |
| 9979 "invalid filter"); |
| 9980 return error::kNoError; |
| 9981 } |
| 9982 |
| 9976 gl::GLImage* image = nullptr; | 9983 gl::GLImage* image = nullptr; |
| 9977 if (c.contents_texture_id) { | 9984 GLuint contents_texture_id = c.contents_texture_id; |
| 9978 TextureRef* ref = texture_manager()->GetTexture(c.contents_texture_id); | 9985 if (contents_texture_id) { |
| 9986 TextureRef* ref = texture_manager()->GetTexture(contents_texture_id); |
| 9979 if (!ref) { | 9987 if (!ref) { |
| 9980 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM", | 9988 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM", |
| 9981 "unknown texture"); | 9989 "unknown texture"); |
| 9982 return error::kNoError; | 9990 return error::kNoError; |
| 9983 } | 9991 } |
| 9984 Texture::ImageState image_state; | 9992 Texture::ImageState image_state; |
| 9985 image = ref->texture()->GetLevelImage(ref->texture()->target(), 0, | 9993 image = ref->texture()->GetLevelImage(ref->texture()->target(), 0, |
| 9986 &image_state); | 9994 &image_state); |
| 9987 if (!image) { | 9995 if (!image) { |
| 9988 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM", | 9996 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM", |
| 9989 "unsupported texture format"); | 9997 "unsupported texture format"); |
| 9990 return error::kNoError; | 9998 return error::kNoError; |
| 9991 } | 9999 } |
| 9992 } | 10000 } |
| 9993 | 10001 |
| 9994 const GLfloat* mem = GetSharedMemoryAs<const GLfloat*>(c.shm_id, c.shm_offset, | 10002 const GLfloat* mem = GetSharedMemoryAs<const GLfloat*>(c.shm_id, c.shm_offset, |
| 9995 28 * sizeof(GLfloat)); | 10003 28 * sizeof(GLfloat)); |
| 9996 if (!mem) { | 10004 if (!mem) { |
| 9997 return error::kOutOfBounds; | 10005 return error::kOutOfBounds; |
| 9998 } | 10006 } |
| 9999 gfx::RectF contents_rect(mem[0], mem[1], mem[2], mem[3]); | 10007 gfx::RectF contents_rect(mem[0], mem[1], mem[2], mem[3]); |
| 10000 gfx::RectF bounds_rect(mem[4], mem[5], mem[6], mem[7]); | 10008 gfx::RectF bounds_rect(mem[4], mem[5], mem[6], mem[7]); |
| 10001 gfx::RectF clip_rect(mem[8], mem[9], mem[10], mem[11]); | 10009 gfx::RectF clip_rect(mem[8], mem[9], mem[10], mem[11]); |
| 10002 gfx::Transform transform(mem[12], mem[16], mem[20], mem[24], | 10010 gfx::Transform transform(mem[12], mem[16], mem[20], mem[24], |
| 10003 mem[13], mem[17], mem[21], mem[25], | 10011 mem[13], mem[17], mem[21], mem[25], |
| 10004 mem[14], mem[18], mem[22], mem[26], | 10012 mem[14], mem[18], mem[22], mem[26], |
| 10005 mem[15], mem[19], mem[23], mem[27]); | 10013 mem[15], mem[19], mem[23], mem[27]); |
| 10006 if (!surface_->ScheduleCALayer(image, contents_rect, c.opacity, | 10014 if (!surface_->ScheduleCALayer( |
| 10007 c.background_color, c.edge_aa_mask, | 10015 image, contents_rect, c.opacity, c.background_color, c.edge_aa_mask, |
| 10008 bounds_rect, c.is_clipped ? true : false, | 10016 bounds_rect, c.is_clipped ? true : false, clip_rect, transform, |
| 10009 clip_rect, transform, c.sorting_context_id)) { | 10017 c.sorting_context_id, filter)) { |
| 10010 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM", | 10018 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM", |
| 10011 "failed to schedule CALayer"); | 10019 "failed to schedule CALayer"); |
| 10012 } | 10020 } |
| 10013 return error::kNoError; | 10021 return error::kNoError; |
| 10014 } | 10022 } |
| 10015 | 10023 |
| 10016 error::Error GLES2DecoderImpl::GetAttribLocationHelper( | 10024 error::Error GLES2DecoderImpl::GetAttribLocationHelper( |
| 10017 GLuint client_id, | 10025 GLuint client_id, |
| 10018 uint32_t location_shm_id, | 10026 uint32_t location_shm_id, |
| 10019 uint32_t location_shm_offset, | 10027 uint32_t location_shm_offset, |
| (...skipping 6505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16525 } | 16533 } |
| 16526 | 16534 |
| 16527 // Include the auto-generated part of this file. We split this because it means | 16535 // Include the auto-generated part of this file. We split this because it means |
| 16528 // we can easily edit the non-auto generated parts right here in this file | 16536 // we can easily edit the non-auto generated parts right here in this file |
| 16529 // instead of having to edit some template or the code generator. | 16537 // instead of having to edit some template or the code generator. |
| 16530 #include "base/macros.h" | 16538 #include "base/macros.h" |
| 16531 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16539 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 16532 | 16540 |
| 16533 } // namespace gles2 | 16541 } // namespace gles2 |
| 16534 } // namespace gpu | 16542 } // namespace gpu |
| OLD | NEW |