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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 void DoReleaseTexImage2DCHROMIUM( | 980 void DoReleaseTexImage2DCHROMIUM( |
981 GLenum target, | 981 GLenum target, |
982 GLint image_id); | 982 GLint image_id); |
983 | 983 |
984 void DoTraceEndCHROMIUM(void); | 984 void DoTraceEndCHROMIUM(void); |
985 | 985 |
986 void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs); | 986 void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs); |
987 | 987 |
988 void DoLoseContextCHROMIUM(GLenum current, GLenum other); | 988 void DoLoseContextCHROMIUM(GLenum current, GLenum other); |
989 | 989 |
| 990 void DoMatrixLoadfCHROMIUM(GLenum matrix_mode, const GLfloat* matrix); |
| 991 void DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode); |
| 992 |
990 // Creates a Program for the given program. | 993 // Creates a Program for the given program. |
991 Program* CreateProgram( | 994 Program* CreateProgram( |
992 GLuint client_id, GLuint service_id) { | 995 GLuint client_id, GLuint service_id) { |
993 return program_manager()->CreateProgram(client_id, service_id); | 996 return program_manager()->CreateProgram(client_id, service_id); |
994 } | 997 } |
995 | 998 |
996 // Gets the program info for the given program. Returns NULL if none exists. | 999 // Gets the program info for the given program. Returns NULL if none exists. |
997 Program* GetProgram(GLuint client_id) { | 1000 Program* GetProgram(GLuint client_id) { |
998 return program_manager()->GetProgram(client_id); | 1001 return program_manager()->GetProgram(client_id); |
999 } | 1002 } |
(...skipping 9653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10653 group_->set_draw_buffer(bufs[0]); | 10656 group_->set_draw_buffer(bufs[0]); |
10654 } | 10657 } |
10655 } | 10658 } |
10656 | 10659 |
10657 void GLES2DecoderImpl::DoLoseContextCHROMIUM(GLenum current, GLenum other) { | 10660 void GLES2DecoderImpl::DoLoseContextCHROMIUM(GLenum current, GLenum other) { |
10658 group_->LoseContexts(other); | 10661 group_->LoseContexts(other); |
10659 reset_status_ = current; | 10662 reset_status_ = current; |
10660 current_decoder_error_ = error::kLostContext; | 10663 current_decoder_error_ = error::kLostContext; |
10661 } | 10664 } |
10662 | 10665 |
| 10666 void GLES2DecoderImpl::DoMatrixLoadfCHROMIUM(GLenum matrix_mode, |
| 10667 const GLfloat* matrix) { |
| 10668 DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM || |
| 10669 matrix_mode == GL_PATH_MODELVIEW_CHROMIUM); |
| 10670 if (!features().chromium_path_rendering) { |
| 10671 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
| 10672 "glMatrixLoadfCHROMIUM", |
| 10673 "function not available"); |
| 10674 return; |
| 10675 } |
| 10676 |
| 10677 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM |
| 10678 ? state_.projection_matrix |
| 10679 : state_.modelview_matrix; |
| 10680 memcpy(target_matrix, matrix, sizeof(GLfloat) * 16); |
| 10681 // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV |
| 10682 // since the values of the _NV and _CHROMIUM tokens match. |
| 10683 glMatrixLoadfEXT(matrix_mode, matrix); |
| 10684 } |
| 10685 |
| 10686 void GLES2DecoderImpl::DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode) { |
| 10687 DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM || |
| 10688 matrix_mode == GL_PATH_MODELVIEW_CHROMIUM); |
| 10689 |
| 10690 if (!features().chromium_path_rendering) { |
| 10691 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
| 10692 "glMatrixLoadIdentityCHROMIUM", |
| 10693 "function not available"); |
| 10694 return; |
| 10695 } |
| 10696 |
| 10697 static GLfloat kIdentityMatrix[16] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, |
| 10698 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, |
| 10699 0.0f, 0.0f, 0.0f, 1.0f}; |
| 10700 |
| 10701 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM |
| 10702 ? state_.projection_matrix |
| 10703 : state_.modelview_matrix; |
| 10704 memcpy(target_matrix, kIdentityMatrix, sizeof(kIdentityMatrix)); |
| 10705 // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV |
| 10706 // since the values of the _NV and _CHROMIUM tokens match. |
| 10707 glMatrixLoadIdentityEXT(matrix_mode); |
| 10708 } |
| 10709 |
10663 bool GLES2DecoderImpl::ValidateAsyncTransfer( | 10710 bool GLES2DecoderImpl::ValidateAsyncTransfer( |
10664 const char* function_name, | 10711 const char* function_name, |
10665 TextureRef* texture_ref, | 10712 TextureRef* texture_ref, |
10666 GLenum target, | 10713 GLenum target, |
10667 GLint level, | 10714 GLint level, |
10668 const void * data) { | 10715 const void * data) { |
10669 // We only support async uploads to 2D textures for now. | 10716 // We only support async uploads to 2D textures for now. |
10670 if (GL_TEXTURE_2D != target) { | 10717 if (GL_TEXTURE_2D != target) { |
10671 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target"); | 10718 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target"); |
10672 return false; | 10719 return false; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10969 } | 11016 } |
10970 } | 11017 } |
10971 | 11018 |
10972 // Include the auto-generated part of this file. We split this because it means | 11019 // Include the auto-generated part of this file. We split this because it means |
10973 // we can easily edit the non-auto generated parts right here in this file | 11020 // we can easily edit the non-auto generated parts right here in this file |
10974 // instead of having to edit some template or the code generator. | 11021 // instead of having to edit some template or the code generator. |
10975 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11022 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10976 | 11023 |
10977 } // namespace gles2 | 11024 } // namespace gles2 |
10978 } // namespace gpu | 11025 } // namespace gpu |
OLD | NEW |