OSDN Git Service

Move stream->flush to non-generated code
authorYahan Zhou <yahan@google.com>
Mon, 6 Jun 2016 19:30:39 +0000 (12:30 -0700)
committerYahan Zhou <yahan@google.com>
Mon, 6 Jun 2016 19:31:09 +0000 (12:31 -0700)
Move flush command out of auto-generated code.

Change-Id: I3f3c8ca49344ea4c5357d7d6953364ce1015ea99

system/GLESv1_enc/GLEncoder.cpp
system/GLESv2_enc/GL2Encoder.cpp
system/GLESv2_enc/gl2_enc.cpp

index 17f8931..66b72d7 100644 (file)
@@ -536,6 +536,7 @@ void GLEncoder::s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei cou
 
     ctx->sendVertexData(first, count);
     ctx->m_glDrawArrays_enc(ctx, mode, /*first*/ 0, count);
+    ctx->m_stream->flush();
 }
 
 void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices)
@@ -574,6 +575,7 @@ void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum
             ctx->sendVertexData(0, count);
             ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, ctx->m_state->currentIndexVbo());
             ctx->glDrawElementsOffset(ctx, mode, count, type, (uintptr_t)indices);
+            ctx->m_stream->flush();
             adjustIndices = false;
         } else {
             BufferData * buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo());
@@ -623,6 +625,7 @@ void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum
             ctx->sendVertexData(minIndex, maxIndex - minIndex + 1);
             ctx->glDrawElementsData(ctx, mode, count, type, adjustedIndices,
                                       count * glSizeof(type));
+            ctx->m_stream->flush();
             // XXX - OPTIMIZATION (see the other else branch) should be implemented
             if(!has_indirect_arrays) {
                 //ALOGD("unoptimized drawelements !!!\n");
index 7e5cceb..0f6d119 100755 (executable)
@@ -617,6 +617,7 @@ void GL2Encoder::s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei co
 
     ctx->sendVertexAttributes(first, count);
     ctx->m_glDrawArrays_enc(ctx, mode, 0, count);
+    ctx->m_stream->flush();
 }
 
 
@@ -685,6 +686,7 @@ void GL2Encoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum
             ctx->sendVertexAttributes(0, maxIndex + 1);
             ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, ctx->m_state->currentIndexVbo());
             ctx->glDrawElementsOffset(ctx, mode, count, type, offset);
+            ctx->m_stream->flush();
             adjustIndices = false;
         } else {
             BufferData * buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo());
@@ -723,6 +725,7 @@ void GL2Encoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum
             ctx->sendVertexAttributes(minIndex, maxIndex - minIndex + 1);
             ctx->glDrawElementsData(ctx, mode, count, type, adjustedIndices,
                                     count * glSizeof(type));
+            ctx->m_stream->flush();
             // XXX - OPTIMIZATION (see the other else branch) should be implemented
             if(!has_indirect_arrays) {
                 //ALOGD("unoptimized drawelements !!!\n");
index 70915e0..615dcc1 100644 (file)
@@ -1188,7 +1188,6 @@ void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count)
 
        if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
        if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
-       stream->flush();
 
 }
 
@@ -4836,7 +4835,7 @@ void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum ty
 
        if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
        if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
-       stream->flush();
+
 }
 
 void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
@@ -4867,7 +4866,7 @@ void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type
 
        if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
        if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
-       stream->flush();
+
 }
 
 void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats)