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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
953 GLenum target, | 953 GLenum target, |
954 GLint image_id); | 954 GLint image_id); |
955 void DoReleaseTexImage2DCHROMIUM( | 955 void DoReleaseTexImage2DCHROMIUM( |
956 GLenum target, | 956 GLenum target, |
957 GLint image_id); | 957 GLint image_id); |
958 | 958 |
959 void DoTraceEndCHROMIUM(void); | 959 void DoTraceEndCHROMIUM(void); |
960 | 960 |
961 void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs); | 961 void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs); |
962 | 962 |
963 void DoMatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* matrix); | |
964 void DoMatrixLoadIdentityCHROMIUM(GLenum matrixMode); | |
965 | |
963 // Creates a Program for the given program. | 966 // Creates a Program for the given program. |
964 Program* CreateProgram( | 967 Program* CreateProgram( |
965 GLuint client_id, GLuint service_id) { | 968 GLuint client_id, GLuint service_id) { |
966 return program_manager()->CreateProgram(client_id, service_id); | 969 return program_manager()->CreateProgram(client_id, service_id); |
967 } | 970 } |
968 | 971 |
969 // Gets the program info for the given program. Returns NULL if none exists. | 972 // Gets the program info for the given program. Returns NULL if none exists. |
970 Program* GetProgram(GLuint client_id) { | 973 Program* GetProgram(GLuint client_id) { |
971 return program_manager()->GetProgram(client_id); | 974 return program_manager()->GetProgram(client_id); |
972 } | 975 } |
(...skipping 9421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10394 GLenum mapped_buf = bufs[0]; | 10397 GLenum mapped_buf = bufs[0]; |
10395 if (GetBackbufferServiceId() != 0 && // emulated backbuffer | 10398 if (GetBackbufferServiceId() != 0 && // emulated backbuffer |
10396 bufs[0] == GL_BACK) { | 10399 bufs[0] == GL_BACK) { |
10397 mapped_buf = GL_COLOR_ATTACHMENT0; | 10400 mapped_buf = GL_COLOR_ATTACHMENT0; |
10398 } | 10401 } |
10399 glDrawBuffersARB(count, &mapped_buf); | 10402 glDrawBuffersARB(count, &mapped_buf); |
10400 group_->set_draw_buffer(bufs[0]); | 10403 group_->set_draw_buffer(bufs[0]); |
10401 } | 10404 } |
10402 } | 10405 } |
10403 | 10406 |
10407 void GLES2DecoderImpl::DoMatrixLoadfCHROMIUM(GLenum matrixMode, | |
10408 const GLfloat* matrix) { | |
10409 DCHECK(matrixMode == GL_PROJECTION_CHROMIUM | |
10410 || matrixMode == GL_MODELVIEW_CHROMIUM); | |
vmiura
2014/04/15 18:02:43
Instead of DCHECK, set GL error & return.
LOCAL_S
piman
2014/04/15 22:30:22
The check should already be done by the autogen'd
Kimmo Kinnunen
2014/04/23 12:26:55
Done.
Kimmo Kinnunen
2014/04/23 12:26:55
DCHECK is for consistency with other code (which d
vmiura
2014/04/23 18:00:06
Sorry, my error.
| |
10411 | |
10412 GLfloat* target_matrix = matrixMode == GL_PROJECTION_CHROMIUM ? | |
10413 state_.projection_matrix : state_.modelview_matrix; | |
10414 if (memcmp(target_matrix, matrix, sizeof(GLfloat) * 16)) { | |
piman
2014/04/15 22:30:22
Is it worth doing this comparison? We're walking 6
Kimmo Kinnunen
2014/04/23 12:26:55
It avoids function call and a memcpy. The memcpy w
vmiura
2014/04/23 18:00:06
GL calls are heavy (multiple calls, pthread_get_lo
piman
2014/04/24 19:30:07
Right, you're really comparing:
(no test): 1 memc
| |
10415 memcpy(target_matrix, matrix, sizeof(GLfloat) * 16); | |
10416 glMatrixLoadfEXT(matrixMode, target_matrix); | |
10417 } | |
10418 } | |
10419 | |
10420 void GLES2DecoderImpl::DoMatrixLoadIdentityCHROMIUM(GLenum matrixMode) { | |
10421 DCHECK(matrixMode == GL_PROJECTION_CHROMIUM | |
10422 || matrixMode == GL_MODELVIEW_CHROMIUM); | |
vmiura
2014/04/15 18:02:43
Same, LOCAL_SET_GL_ERROR instead of DCHECK.
Kimmo Kinnunen
2014/04/23 12:26:55
DCHECK is just a doc for the reader..
| |
10423 static GLfloat identity_matrix[16] = { | |
piman
2014/04/15 22:30:22
nit: const, and use kIdentityMatrix naming convent
Kimmo Kinnunen
2014/04/23 12:26:55
Done.
| |
10424 1.0f, 0.0f, 0.0f, 0.0f, | |
10425 0.0f, 1.0f, 0.0f, 0.0f, | |
10426 0.0f, 0.0f, 1.0f, 0.0f, | |
10427 0.0f, 0.0f, 0.0f, 1.0f | |
10428 }; | |
10429 GLfloat* target_matrix = matrixMode == GL_PROJECTION_CHROMIUM ? | |
10430 state_.projection_matrix : state_.modelview_matrix; | |
10431 if (memcmp(target_matrix, identity_matrix, sizeof(identity_matrix))) { | |
10432 memcpy(target_matrix, identity_matrix, sizeof(identity_matrix)); | |
10433 glMatrixLoadIdentityEXT(matrixMode); | |
10434 } | |
10435 } | |
10436 | |
10404 bool GLES2DecoderImpl::ValidateAsyncTransfer( | 10437 bool GLES2DecoderImpl::ValidateAsyncTransfer( |
10405 const char* function_name, | 10438 const char* function_name, |
10406 TextureRef* texture_ref, | 10439 TextureRef* texture_ref, |
10407 GLenum target, | 10440 GLenum target, |
10408 GLint level, | 10441 GLint level, |
10409 const void * data) { | 10442 const void * data) { |
10410 // We only support async uploads to 2D textures for now. | 10443 // We only support async uploads to 2D textures for now. |
10411 if (GL_TEXTURE_2D != target) { | 10444 if (GL_TEXTURE_2D != target) { |
10412 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target"); | 10445 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target"); |
10413 return false; | 10446 return false; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10712 } | 10745 } |
10713 } | 10746 } |
10714 | 10747 |
10715 // Include the auto-generated part of this file. We split this because it means | 10748 // Include the auto-generated part of this file. We split this because it means |
10716 // we can easily edit the non-auto generated parts right here in this file | 10749 // we can easily edit the non-auto generated parts right here in this file |
10717 // instead of having to edit some template or the code generator. | 10750 // instead of having to edit some template or the code generator. |
10718 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10751 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10719 | 10752 |
10720 } // namespace gles2 | 10753 } // namespace gles2 |
10721 } // namespace gpu | 10754 } // namespace gpu |
OLD | NEW |