Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index 80ca20992977ab86eee0557860ea32b402cba336..d00237fd73c87877dbaf77de90c946a23163ae5c 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -960,6 +960,9 @@ class GLES2DecoderImpl : public GLES2Decoder, |
void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs); |
+ void DoMatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* matrix); |
+ void DoMatrixLoadIdentityCHROMIUM(GLenum matrixMode); |
+ |
// Creates a Program for the given program. |
Program* CreateProgram( |
GLuint client_id, GLuint service_id) { |
@@ -10401,6 +10404,36 @@ void GLES2DecoderImpl::DoDrawBuffersEXT( |
} |
} |
+void GLES2DecoderImpl::DoMatrixLoadfCHROMIUM(GLenum matrixMode, |
+ const GLfloat* matrix) { |
+ DCHECK(matrixMode == GL_PROJECTION_CHROMIUM |
+ || 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.
|
+ |
+ GLfloat* target_matrix = matrixMode == GL_PROJECTION_CHROMIUM ? |
+ state_.projection_matrix : state_.modelview_matrix; |
+ 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
|
+ memcpy(target_matrix, matrix, sizeof(GLfloat) * 16); |
+ glMatrixLoadfEXT(matrixMode, target_matrix); |
+ } |
+} |
+ |
+void GLES2DecoderImpl::DoMatrixLoadIdentityCHROMIUM(GLenum matrixMode) { |
+ DCHECK(matrixMode == GL_PROJECTION_CHROMIUM |
+ || 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..
|
+ 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.
|
+ 1.0f, 0.0f, 0.0f, 0.0f, |
+ 0.0f, 1.0f, 0.0f, 0.0f, |
+ 0.0f, 0.0f, 1.0f, 0.0f, |
+ 0.0f, 0.0f, 0.0f, 1.0f |
+ }; |
+ GLfloat* target_matrix = matrixMode == GL_PROJECTION_CHROMIUM ? |
+ state_.projection_matrix : state_.modelview_matrix; |
+ if (memcmp(target_matrix, identity_matrix, sizeof(identity_matrix))) { |
+ memcpy(target_matrix, identity_matrix, sizeof(identity_matrix)); |
+ glMatrixLoadIdentityEXT(matrixMode); |
+ } |
+} |
+ |
bool GLES2DecoderImpl::ValidateAsyncTransfer( |
const char* function_name, |
TextureRef* texture_ref, |