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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 void DoTraceEndCHROMIUM(void); | 1043 void DoTraceEndCHROMIUM(void); |
1044 | 1044 |
1045 void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs); | 1045 void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs); |
1046 | 1046 |
1047 void DoLoseContextCHROMIUM(GLenum current, GLenum other); | 1047 void DoLoseContextCHROMIUM(GLenum current, GLenum other); |
1048 | 1048 |
1049 void DoFlushDriverCachesCHROMIUM(void); | 1049 void DoFlushDriverCachesCHROMIUM(void); |
1050 | 1050 |
1051 void DoMatrixLoadfCHROMIUM(GLenum matrix_mode, const GLfloat* matrix); | 1051 void DoMatrixLoadfCHROMIUM(GLenum matrix_mode, const GLfloat* matrix); |
1052 void DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode); | 1052 void DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode); |
| 1053 void DoScheduleCALayerInUseQueryCHROMIUM(GLsizei count, |
| 1054 const GLuint* textures); |
1053 | 1055 |
1054 // Creates a Program for the given program. | 1056 // Creates a Program for the given program. |
1055 Program* CreateProgram(GLuint client_id, GLuint service_id) { | 1057 Program* CreateProgram(GLuint client_id, GLuint service_id) { |
1056 return program_manager()->CreateProgram(client_id, service_id); | 1058 return program_manager()->CreateProgram(client_id, service_id); |
1057 } | 1059 } |
1058 | 1060 |
1059 // Gets the program info for the given program. Returns NULL if none exists. | 1061 // Gets the program info for the given program. Returns NULL if none exists. |
1060 Program* GetProgram(GLuint client_id) { | 1062 Program* GetProgram(GLuint client_id) { |
1061 return program_manager()->GetProgram(client_id); | 1063 return program_manager()->GetProgram(client_id); |
1062 } | 1064 } |
(...skipping 9378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10441 if (!surface_->ScheduleCALayer( | 10443 if (!surface_->ScheduleCALayer( |
10442 image, contents_rect, c.opacity, c.background_color, c.edge_aa_mask, | 10444 image, contents_rect, c.opacity, c.background_color, c.edge_aa_mask, |
10443 bounds_rect, c.is_clipped ? true : false, clip_rect, transform, | 10445 bounds_rect, c.is_clipped ? true : false, clip_rect, transform, |
10444 c.sorting_context_id, filter)) { | 10446 c.sorting_context_id, filter)) { |
10445 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM", | 10447 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM", |
10446 "failed to schedule CALayer"); | 10448 "failed to schedule CALayer"); |
10447 } | 10449 } |
10448 return error::kNoError; | 10450 return error::kNoError; |
10449 } | 10451 } |
10450 | 10452 |
| 10453 void GLES2DecoderImpl::DoScheduleCALayerInUseQueryCHROMIUM( |
| 10454 GLsizei count, |
| 10455 const GLuint* textures) { |
| 10456 std::vector<gl::GLSurface::CALayerInUseQuery> queries; |
| 10457 queries.reserve(count); |
| 10458 for (GLsizei i = 0; i < count; ++i) { |
| 10459 gl::GLImage* image = nullptr; |
| 10460 GLuint texture_id = textures[i]; |
| 10461 if (texture_id) { |
| 10462 TextureRef* ref = texture_manager()->GetTexture(texture_id); |
| 10463 if (!ref) { |
| 10464 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, |
| 10465 "glScheduleCALayerInUseQueryCHROMIUM", |
| 10466 "unknown texture"); |
| 10467 return; |
| 10468 } |
| 10469 Texture::ImageState image_state; |
| 10470 image = ref->texture()->GetLevelImage(ref->texture()->target(), 0, |
| 10471 &image_state); |
| 10472 } |
| 10473 gl::GLSurface::CALayerInUseQuery query; |
| 10474 query.image = image; |
| 10475 query.texture = texture_id; |
| 10476 queries.push_back(query); |
| 10477 } |
| 10478 |
| 10479 surface_->ScheduleCALayerInUseQuery(std::move(queries)); |
| 10480 } |
| 10481 |
10451 error::Error GLES2DecoderImpl::GetAttribLocationHelper( | 10482 error::Error GLES2DecoderImpl::GetAttribLocationHelper( |
10452 GLuint client_id, | 10483 GLuint client_id, |
10453 uint32_t location_shm_id, | 10484 uint32_t location_shm_id, |
10454 uint32_t location_shm_offset, | 10485 uint32_t location_shm_offset, |
10455 const std::string& name_str) { | 10486 const std::string& name_str) { |
10456 if (!StringIsValidForGLES(name_str)) { | 10487 if (!StringIsValidForGLES(name_str)) { |
10457 LOCAL_SET_GL_ERROR( | 10488 LOCAL_SET_GL_ERROR( |
10458 GL_INVALID_VALUE, "glGetAttribLocation", "Invalid character"); | 10489 GL_INVALID_VALUE, "glGetAttribLocation", "Invalid character"); |
10459 return error::kNoError; | 10490 return error::kNoError; |
10460 } | 10491 } |
(...skipping 6423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16884 } | 16915 } |
16885 | 16916 |
16886 // Include the auto-generated part of this file. We split this because it means | 16917 // 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 | 16918 // 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. | 16919 // instead of having to edit some template or the code generator. |
16889 #include "base/macros.h" | 16920 #include "base/macros.h" |
16890 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16921 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
16891 | 16922 |
16892 } // namespace gles2 | 16923 } // namespace gles2 |
16893 } // namespace gpu | 16924 } // namespace gpu |
OLD | NEW |