diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.cpp b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.cpp index 7092e10c2..1df4b5db1 100644 --- a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.cpp +++ b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.cpp @@ -136,31 +136,6 @@ void GLEScmContext::setupArraysPointers(GLESConversionArrays& cArrs,GLint first, s_glDispatch.glClientActiveTexture(activeTexture); } -void GLEScmContext::drawPoints(PointSizeIndices* points) { - - GLushort* indices = NULL; - int last_size = 0; - - //drawing each group of vertices by the points size - for(PointSizeIndices::iterator it = points->begin();it != points->end(); it++) { - int count = (*it).second.size(); - int pointSize = (*it).first; - std::vector& arr = (*it).second; - - if(count > last_size) { - if(indices) delete [] indices; - indices = new GLushort[count]; - } - int i = 0 ; - for(std::vector::iterator it2 = arr.begin();it2 != arr.end();it2++) { - indices[i++] = (*it2); - } - s_glDispatch.glPointSize(pointSize); - s_glDispatch.glDrawElements(GL_POINTS,count,GL_UNSIGNED_SHORT,indices); - } - if(indices) delete [] indices; -} - void GLEScmContext::drawPointsData(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices_in,bool isElemsDraw) { const char *pointsArr = NULL; int stride = 0; @@ -179,23 +154,52 @@ void GLEScmContext::drawPointsData(GLESConversionArrays& cArrs,GLint first,GLsi stride = sizeof(GLfloat); } - //filling arrays before sorting them - PointSizeIndices points; + if(isElemsDraw) { - for(int i=0; i< count; i++) { - GLushort index = (type == GL_UNSIGNED_SHORT? - static_cast(indices_in)[i]: - static_cast(indices_in)[i]); - GLfloat pSize = *((GLfloat*)(pointsArr+(index*stride))); - points[pSize].push_back(index); + int tSize = type == GL_UNSIGNED_SHORT ? 2 : 1; + + int i = 0; + while(i(indices_in)[i]: \ + static_cast(indices_in)[i]) + + GLfloat pSize = *((GLfloat*)(pointsArr+(INDEX*stride))); + i++; + + while(i < count && pSize == *((GLfloat*)(pointsArr+(INDEX*stride)))) + { + sCount++; + i++; + } + + s_glDispatch.glPointSize(pSize); + s_glDispatch.glDrawElements(GL_POINTS, sCount, type, (char*)indices_in+sStart*tSize); } } else { - for(int i=0; i< count; i++) { - GLfloat pSize = *((GLfloat*)(pointsArr+(first+i*stride))); - points[pSize].push_back(i+first); + int i = 0; + while(isetupArraysPointers(tmpArrs,first,count,0,NULL,true); - if(mode != GL_POINTS || !ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){ - ctx->dispatcher().glDrawArrays(mode,first,count); - } - else{ + if(mode == GL_POINTS && ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){ ctx->drawPointsArrs(tmpArrs,first,count); } + else + { + ctx->dispatcher().glDrawArrays(mode,first,count); + } } GL_API void GL_APIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *elementsIndices) { @@ -577,11 +578,11 @@ GL_API void GL_APIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type } ctx->setupArraysPointers(tmpArrs,0,count,type,indices,false); - if(mode != GL_POINTS || !ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){ - ctx->dispatcher().glDrawElements(mode,count,type,indices); + if(mode == GL_POINTS && ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){ + ctx->drawPointsElems(tmpArrs,count,type,indices); } else{ - ctx->drawPointsElems(tmpArrs,count,type,indices); + ctx->dispatcher().glDrawElements(mode,count,type,indices); } }