* commit 'ef4edab5c53249ea8fc672964f01c30957da357a': opengl translator: extending ConversionArrays class
This commit is contained in:
@@ -84,25 +84,21 @@ void GLEScmContext::setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLEScmContext::setupArrayPointerHelper(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLenum array_id,GLESpointer* p){
|
void GLEScmContext::setupArrayPointerHelper(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLenum array_id,GLESpointer* p){
|
||||||
unsigned int size = p->getSize();
|
unsigned int size = p->getSize();
|
||||||
bool usingVBO = p->isVBO();
|
|
||||||
GLenum dataType = p->getType();
|
GLenum dataType = p->getType();
|
||||||
|
|
||||||
if(needConvert(fArrs,first,count,type,indices,direct,p,array_id)){
|
if(needConvert(cArrs,first,count,type,indices,direct,p,array_id)){
|
||||||
//conversion has occured
|
//conversion has occured
|
||||||
unsigned int convertedStride = (usingVBO && dataType != GL_BYTE) ? p->getStride() : 0;
|
ArrayData currentArr = cArrs.getCurrentArray();
|
||||||
const void* data = (usingVBO && dataType!= GL_BYTE) ? p->getBufferData() : fArrs.getCurrentData();
|
setupArr(currentArr.data,array_id,currentArr.type,size,currentArr.stride,cArrs.getCurrentIndex());
|
||||||
dataType = (dataType == GL_FIXED) ? GL_FLOAT:GL_SHORT;
|
++cArrs;
|
||||||
setupArr(data,array_id,dataType,size,convertedStride,fArrs.getCurrentIndex());
|
|
||||||
++fArrs;
|
|
||||||
} else {
|
} else {
|
||||||
const void* data = usingVBO ? p->getBufferData() : p->getArrayData();
|
setupArr(p->getData(),array_id,dataType,size,p->getStride());
|
||||||
setupArr(data,array_id,dataType,size,p->getStride());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLEScmContext::setupArraysPointers(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct) {
|
void GLEScmContext::setupArraysPointers(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct) {
|
||||||
ArraysMap::iterator it;
|
ArraysMap::iterator it;
|
||||||
m_pointsIndex = -1;
|
m_pointsIndex = -1;
|
||||||
|
|
||||||
@@ -113,7 +109,7 @@ void GLEScmContext::setupArraysPointers(GLESConversionArrays& fArrs,GLint first,
|
|||||||
GLESpointer* p = (*it).second;
|
GLESpointer* p = (*it).second;
|
||||||
if(!isArrEnabled(array_id)) continue;
|
if(!isArrEnabled(array_id)) continue;
|
||||||
if(array_id == GL_TEXTURE_COORD_ARRAY) continue; //handling textures later
|
if(array_id == GL_TEXTURE_COORD_ARRAY) continue; //handling textures later
|
||||||
setupArrayPointerHelper(fArrs,first,count,type,indices,direct,array_id,p);
|
setupArrayPointerHelper(cArrs,first,count,type,indices,direct,array_id,p);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int activeTexture = m_clientActiveTexture + GL_TEXTURE0;
|
unsigned int activeTexture = m_clientActiveTexture + GL_TEXTURE0;
|
||||||
@@ -132,7 +128,7 @@ void GLEScmContext::setupArraysPointers(GLESConversionArrays& fArrs,GLint first,
|
|||||||
GLenum array_id = GL_TEXTURE_COORD_ARRAY;
|
GLenum array_id = GL_TEXTURE_COORD_ARRAY;
|
||||||
GLESpointer* p = m_map[array_id];
|
GLESpointer* p = m_map[array_id];
|
||||||
if(!isArrEnabled(array_id)) continue;
|
if(!isArrEnabled(array_id)) continue;
|
||||||
setupArrayPointerHelper(fArrs,first,count,type,indices,direct,array_id,p);
|
setupArrayPointerHelper(cArrs,first,count,type,indices,direct,array_id,p);
|
||||||
}
|
}
|
||||||
|
|
||||||
setClientActiveTexture(activeTexture);
|
setClientActiveTexture(activeTexture);
|
||||||
@@ -164,19 +160,22 @@ void GLEScmContext::drawPoints(PointSizeIndices* points) {
|
|||||||
if(indices) delete [] indices;
|
if(indices) delete [] indices;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLEScmContext::drawPointsData(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices_in,bool isElemsDraw) {
|
void GLEScmContext::drawPointsData(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices_in,bool isElemsDraw) {
|
||||||
const GLfloat *pointsArr = NULL;
|
const char *pointsArr = NULL;
|
||||||
int stride = 0; //steps in GLfloats
|
int stride = 0;
|
||||||
bool usingVBO = isBindedBuffer(GL_ARRAY_BUFFER);
|
GLESpointer* p = m_map[GL_POINT_SIZE_ARRAY_OES];
|
||||||
|
|
||||||
//choosing the right points sizes array source
|
//choosing the right points sizes array source
|
||||||
if(m_pointsIndex >= 0 && !usingVBO) { //point size array was converted
|
if(m_pointsIndex >= 0) { //point size array was converted
|
||||||
pointsArr= (const GLfloat*)fArrs[m_pointsIndex];
|
pointsArr = (const char*)(cArrs[m_pointsIndex].data);
|
||||||
stride = 1;
|
stride = cArrs[m_pointsIndex].stride;
|
||||||
} else {
|
} else {
|
||||||
GLESpointer* p = m_map[GL_POINT_SIZE_ARRAY_OES];
|
pointsArr = static_cast<const char*>(p->getData());
|
||||||
pointsArr = static_cast<const GLfloat*>(usingVBO ? p->getBufferData():p->getArrayData());
|
stride = p->getStride();
|
||||||
stride = p->getStride()?p->getStride()/sizeof(GLfloat):1;
|
}
|
||||||
|
|
||||||
|
if(stride == 0){
|
||||||
|
stride = sizeof(GLfloat);
|
||||||
}
|
}
|
||||||
|
|
||||||
//filling arrays before sorting them
|
//filling arrays before sorting them
|
||||||
@@ -186,11 +185,13 @@ void GLEScmContext::drawPointsData(GLESConversionArrays& fArrs,GLint first,GLsi
|
|||||||
GLushort index = (type == GL_UNSIGNED_SHORT?
|
GLushort index = (type == GL_UNSIGNED_SHORT?
|
||||||
static_cast<const GLushort*>(indices_in)[i]:
|
static_cast<const GLushort*>(indices_in)[i]:
|
||||||
static_cast<const GLubyte*>(indices_in)[i]);
|
static_cast<const GLubyte*>(indices_in)[i]);
|
||||||
points[pointsArr[index*stride]].push_back(index);
|
GLfloat pSize = *((GLfloat*)(pointsArr+(index*stride)));
|
||||||
|
points[pSize].push_back(index);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(int i=0; i< count; i++) {
|
for(int i=0; i< count; i++) {
|
||||||
points[pointsArr[first+i*stride]].push_back(i+first);
|
GLfloat pSize = *((GLfloat*)(pointsArr+(first+i*stride)));
|
||||||
|
points[pSize].push_back(i+first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawPoints(&points);
|
drawPoints(&points);
|
||||||
@@ -204,7 +205,7 @@ void GLEScmContext::drawPointsElems(GLESConversionArrays& arrs,GLsizei count,GLe
|
|||||||
drawPointsData(arrs,0,count,type,indices_in,true);
|
drawPointsData(arrs,0,count,type,indices_in,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLEScmContext::needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id) {
|
bool GLEScmContext::needConvert(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id) {
|
||||||
|
|
||||||
bool usingVBO = p->isVBO();
|
bool usingVBO = p->isVBO();
|
||||||
GLenum arrType = p->getType();
|
GLenum arrType = p->getType();
|
||||||
@@ -225,15 +226,15 @@ bool GLEScmContext::needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei
|
|||||||
|
|
||||||
if(!usingVBO || byteVBO) {
|
if(!usingVBO || byteVBO) {
|
||||||
if (direct) {
|
if (direct) {
|
||||||
convertDirect(fArrs,first,count,array_id,p);
|
convertDirect(cArrs,first,count,array_id,p);
|
||||||
} else {
|
} else {
|
||||||
convertIndirect(fArrs,count,type,indices,array_id,p);
|
convertIndirect(cArrs,count,type,indices,array_id,p);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (direct) {
|
if (direct) {
|
||||||
convertDirectVBO(first,count,array_id,p) ;
|
convertDirectVBO(cArrs,first,count,array_id,p) ;
|
||||||
} else {
|
} else {
|
||||||
convertIndirectVBO(count,type,indices,array_id,p);
|
convertIndirectVBO(cArrs,count,type,indices,array_id,p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void GLESv2Context::init() {
|
|||||||
|
|
||||||
GLESv2Context::GLESv2Context():GLEScontext(){};
|
GLESv2Context::GLESv2Context():GLEScontext(){};
|
||||||
|
|
||||||
void GLESv2Context::setupArraysPointers(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct) {
|
void GLESv2Context::setupArraysPointers(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct) {
|
||||||
ArraysMap::iterator it;
|
ArraysMap::iterator it;
|
||||||
|
|
||||||
//going over all clients arrays Pointers
|
//going over all clients arrays Pointers
|
||||||
@@ -42,17 +42,14 @@ void GLESv2Context::setupArraysPointers(GLESConversionArrays& fArrs,GLint first,
|
|||||||
if(!isArrEnabled(array_id)) continue;
|
if(!isArrEnabled(array_id)) continue;
|
||||||
|
|
||||||
unsigned int size = p->getSize();
|
unsigned int size = p->getSize();
|
||||||
bool usingVBO = p->isVBO();
|
|
||||||
|
|
||||||
if(needConvert(fArrs,first,count,type,indices,direct,p,array_id)){
|
if(needConvert(cArrs,first,count,type,indices,direct,p,array_id)){
|
||||||
//conversion has occured
|
//conversion has occured
|
||||||
unsigned int convertedStride = usingVBO ? p->getStride() : 0;
|
ArrayData currentArr = cArrs.getCurrentArray();
|
||||||
const void* data = usingVBO ? p->getBufferData() : fArrs.getCurrentData();
|
setupArr(currentArr.data,array_id,currentArr.type,size,currentArr.stride);
|
||||||
setupArr(data,array_id,GL_FLOAT,size,convertedStride);
|
++cArrs;
|
||||||
++fArrs;
|
|
||||||
} else {
|
} else {
|
||||||
const void* data = usingVBO ? p->getBufferData() : p->getArrayData();
|
setupArr(p->getData(),array_id,p->getType(),size,p->getStride());
|
||||||
setupArr(data,array_id,p->getType(),size,p->getStride());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,7 +60,7 @@ void GLESv2Context::setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,
|
|||||||
s_glDispatch.glVertexAttribPointer(arrayType,size,dataType,GL_FALSE,stride,arr);
|
s_glDispatch.glVertexAttribPointer(arrayType,size,dataType,GL_FALSE,stride,arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLESv2Context::needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id) {
|
bool GLESv2Context::needConvert(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id) {
|
||||||
|
|
||||||
bool usingVBO = p->isVBO();
|
bool usingVBO = p->isVBO();
|
||||||
GLenum arrType = p->getType();
|
GLenum arrType = p->getType();
|
||||||
@@ -75,15 +72,15 @@ bool GLESv2Context::needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei
|
|||||||
|
|
||||||
if(!usingVBO) {
|
if(!usingVBO) {
|
||||||
if (direct) {
|
if (direct) {
|
||||||
convertDirect(fArrs,first,count,array_id,p);
|
convertDirect(cArrs,first,count,array_id,p);
|
||||||
} else {
|
} else {
|
||||||
convertIndirect(fArrs,count,type,indices,array_id,p);
|
convertIndirect(cArrs,count,type,indices,array_id,p);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (direct) {
|
if (direct) {
|
||||||
convertDirectVBO(first,count,array_id,p) ;
|
convertDirectVBO(cArrs,first,count,array_id,p) ;
|
||||||
} else {
|
} else {
|
||||||
convertIndirectVBO(count,type,indices,array_id,p);
|
convertIndirectVBO(cArrs,count,type,indices,array_id,p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -11,37 +11,52 @@ static void convertByteDirectLoop(const char* dataIn,unsigned int strideIn,void*
|
|||||||
static void convertByteIndirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,GLsizei count,GLenum indices_type,const GLvoid* indices,unsigned int strideOut,int attribSize);
|
static void convertByteIndirectLoop(const char* dataIn,unsigned int strideIn,void* dataOut,GLsizei count,GLenum indices_type,const GLvoid* indices,unsigned int strideOut,int attribSize);
|
||||||
|
|
||||||
GLESConversionArrays::~GLESConversionArrays() {
|
GLESConversionArrays::~GLESConversionArrays() {
|
||||||
for(std::map<GLenum,std::pair<GLenum,void*> >::iterator it = m_arrays.begin(); it != m_arrays.end();it++) {
|
for(std::map<GLenum,ArrayData>::iterator it = m_arrays.begin(); it != m_arrays.end();it++) {
|
||||||
if((*it).second.first == GL_FLOAT){
|
if((*it).second.allocated){
|
||||||
GLfloat* p = (GLfloat *)((*it).second.second);
|
if((*it).second.type == GL_FLOAT){
|
||||||
if(p) delete[] p;
|
GLfloat* p = (GLfloat *)((*it).second.data);
|
||||||
} else if((*it).second.first == GL_SHORT){
|
if(p) delete[] p;
|
||||||
GLshort* p = (GLshort *)((*it).second.second);
|
} else if((*it).second.type == GL_SHORT){
|
||||||
if(p) delete[] p;
|
GLshort* p = (GLshort *)((*it).second.data);
|
||||||
|
if(p) delete[] p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLESConversionArrays::alloc(unsigned int size,GLenum type){
|
void GLESConversionArrays::allocArr(unsigned int size,GLenum type){
|
||||||
if(type == GL_FIXED){
|
if(type == GL_FIXED){
|
||||||
m_arrays[m_current].second = new GLfloat[size];
|
m_arrays[m_current].data = new GLfloat[size];
|
||||||
m_arrays[m_current].first = GL_FLOAT;
|
m_arrays[m_current].type = GL_FLOAT;
|
||||||
} else if(type == GL_BYTE){
|
} else if(type == GL_BYTE){
|
||||||
m_arrays[m_current].second = new GLshort[size];
|
m_arrays[m_current].data = new GLshort[size];
|
||||||
m_arrays[m_current].first = GL_SHORT;
|
m_arrays[m_current].type = GL_SHORT;
|
||||||
}
|
}
|
||||||
|
m_arrays[m_current].stride = 0;
|
||||||
|
m_arrays[m_current].allocated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLESConversionArrays::setArr(void* data,unsigned int stride,GLenum type){
|
||||||
|
m_arrays[m_current].type = type;
|
||||||
|
m_arrays[m_current].data = data;
|
||||||
|
m_arrays[m_current].stride = stride;
|
||||||
|
m_arrays[m_current].allocated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* GLESConversionArrays::getCurrentData(){
|
void* GLESConversionArrays::getCurrentData(){
|
||||||
return m_arrays[m_current].second;
|
return m_arrays[m_current].data;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayData& GLESConversionArrays::getCurrentArray(){
|
||||||
|
return m_arrays[m_current];
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int GLESConversionArrays::getCurrentIndex(){
|
unsigned int GLESConversionArrays::getCurrentIndex(){
|
||||||
return m_current;
|
return m_current;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* GLESConversionArrays::operator[](int i){
|
ArrayData& GLESConversionArrays::operator[](int i){
|
||||||
return m_arrays[i].second;
|
return m_arrays[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLESConversionArrays::operator++(){
|
void GLESConversionArrays::operator++(){
|
||||||
@@ -108,7 +123,7 @@ void GLEScontext::init() {
|
|||||||
m_tex2DBind[i].texture = 0;
|
m_tex2DBind[i].texture = 0;
|
||||||
for (int j=0;j<NUM_TEXTURE_TARGETS;++j)
|
for (int j=0;j<NUM_TEXTURE_TARGETS;++j)
|
||||||
m_tex2DBind[i].enabled[j] = GL_FALSE;
|
m_tex2DBind[i].enabled[j] = GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,24 +277,24 @@ int bytesRangesToIndices(RangeList& ranges,GLESpointer* p,GLushort* indices) {
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLEScontext::convertDirect(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum array_id,GLESpointer* p) {
|
void GLEScontext::convertDirect(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum array_id,GLESpointer* p) {
|
||||||
|
|
||||||
GLenum type = p->getType();
|
GLenum type = p->getType();
|
||||||
int attribSize = p->getSize();
|
int attribSize = p->getSize();
|
||||||
unsigned int size = attribSize*count + first;
|
unsigned int size = attribSize*count + first;
|
||||||
unsigned int bytes = type == GL_FIXED ? sizeof(GLfixed):sizeof(GLbyte);
|
unsigned int bytes = type == GL_FIXED ? sizeof(GLfixed):sizeof(GLbyte);
|
||||||
fArrs.alloc(size,type);
|
cArrs.allocArr(size,type);
|
||||||
int stride = p->getStride()?p->getStride():bytes*attribSize;
|
int stride = p->getStride()?p->getStride():bytes*attribSize;
|
||||||
const char* data = (const char*)p->getArrayData() + (first*stride);
|
const char* data = (const char*)p->getArrayData() + (first*stride);
|
||||||
|
|
||||||
if(type == GL_FIXED) {
|
if(type == GL_FIXED) {
|
||||||
convertFixedDirectLoop(data,stride,fArrs.getCurrentData(),size*sizeof(GLfloat),attribSize*sizeof(GLfloat),attribSize);
|
convertFixedDirectLoop(data,stride,cArrs.getCurrentData(),size*sizeof(GLfloat),attribSize*sizeof(GLfloat),attribSize);
|
||||||
} else if(type == GL_BYTE) {
|
} else if(type == GL_BYTE) {
|
||||||
convertByteDirectLoop(data,stride,fArrs.getCurrentData(),size*sizeof(GLshort),attribSize*sizeof(GLshort),attribSize);
|
convertByteDirectLoop(data,stride,cArrs.getCurrentData(),size*sizeof(GLshort),attribSize*sizeof(GLshort),attribSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLEScontext::convertDirectVBO(GLint first,GLsizei count,GLenum array_id,GLESpointer* p) {
|
void GLEScontext::convertDirectVBO(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum array_id,GLESpointer* p) {
|
||||||
|
|
||||||
RangeList ranges;
|
RangeList ranges;
|
||||||
RangeList conversions;
|
RangeList conversions;
|
||||||
@@ -301,6 +316,7 @@ void GLEScontext::convertDirectVBO(GLint first,GLsizei count,GLenum array_id,GLE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(indices) delete[] indices;
|
if(indices) delete[] indices;
|
||||||
|
cArrs.setArr(data,p->getStride(),GL_FLOAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int findMaxIndex(GLsizei count,GLenum type,const GLvoid* indices) {
|
static int findMaxIndex(GLsizei count,GLenum type,const GLvoid* indices) {
|
||||||
@@ -320,25 +336,25 @@ static int findMaxIndex(GLsizei count,GLenum type,const GLvoid* indices) {
|
|||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLEScontext::convertIndirect(GLESConversionArrays& fArrs,GLsizei count,GLenum indices_type,const GLvoid* indices,GLenum array_id,GLESpointer* p) {
|
void GLEScontext::convertIndirect(GLESConversionArrays& cArrs,GLsizei count,GLenum indices_type,const GLvoid* indices,GLenum array_id,GLESpointer* p) {
|
||||||
GLenum type = p->getType();
|
GLenum type = p->getType();
|
||||||
int maxElements = findMaxIndex(count,type,indices) + 1;
|
int maxElements = findMaxIndex(count,type,indices) + 1;
|
||||||
|
|
||||||
int attribSize = p->getSize();
|
int attribSize = p->getSize();
|
||||||
int size = attribSize * maxElements;
|
int size = attribSize * maxElements;
|
||||||
unsigned int bytes = type == GL_FIXED ? sizeof(GLfixed):sizeof(GLbyte);
|
unsigned int bytes = type == GL_FIXED ? sizeof(GLfixed):sizeof(GLbyte);
|
||||||
fArrs.alloc(size,type);
|
cArrs.allocArr(size,type);
|
||||||
int stride = p->getStride()?p->getStride():bytes*attribSize;
|
int stride = p->getStride()?p->getStride():bytes*attribSize;
|
||||||
|
|
||||||
const char* data = (const char*)p->getArrayData();
|
const char* data = (const char*)p->getArrayData();
|
||||||
if(type == GL_FIXED) {
|
if(type == GL_FIXED) {
|
||||||
convertFixedIndirectLoop(data,stride,fArrs.getCurrentData(),count,indices_type,indices,attribSize*sizeof(GLfloat),attribSize);
|
convertFixedIndirectLoop(data,stride,cArrs.getCurrentData(),count,indices_type,indices,attribSize*sizeof(GLfloat),attribSize);
|
||||||
} else if(type == GL_BYTE){
|
} else if(type == GL_BYTE){
|
||||||
convertByteIndirectLoop(data,stride,fArrs.getCurrentData(),count,indices_type,indices,attribSize*sizeof(GLshort),attribSize);
|
convertByteIndirectLoop(data,stride,cArrs.getCurrentData(),count,indices_type,indices,attribSize*sizeof(GLshort),attribSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLEScontext::convertIndirectVBO(GLsizei count,GLenum indices_type,const GLvoid* indices,GLenum array_id,GLESpointer* p) {
|
void GLEScontext::convertIndirectVBO(GLESConversionArrays& cArrs,GLsizei count,GLenum indices_type,const GLvoid* indices,GLenum array_id,GLESpointer* p) {
|
||||||
RangeList ranges;
|
RangeList ranges;
|
||||||
RangeList conversions;
|
RangeList conversions;
|
||||||
GLushort* conversionIndices = NULL;
|
GLushort* conversionIndices = NULL;
|
||||||
@@ -356,6 +372,7 @@ void GLEScontext::convertIndirectVBO(GLsizei count,GLenum indices_type,const GLv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(conversionIndices) delete[] conversionIndices;
|
if(conversionIndices) delete[] conversionIndices;
|
||||||
|
cArrs.setArr(data,p->getStride(),GL_FLOAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -449,7 +466,7 @@ void GLEScontext::releaseGlobalLock() {
|
|||||||
|
|
||||||
void GLEScontext::initCapsLocked(const GLubyte * extensionString)
|
void GLEScontext::initCapsLocked(const GLubyte * extensionString)
|
||||||
{
|
{
|
||||||
const char* cstring = (const char*)extensionString;
|
const char* cstring = (const char*)extensionString;
|
||||||
|
|
||||||
s_glDispatch.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS,&s_glSupport.maxVertexAttribs);
|
s_glDispatch.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS,&s_glSupport.maxVertexAttribs);
|
||||||
s_glDispatch.glGetIntegerv(GL_MAX_CLIP_PLANES,&s_glSupport.maxClipPlane);
|
s_glDispatch.glGetIntegerv(GL_MAX_CLIP_PLANES,&s_glSupport.maxClipPlane);
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ GLvoid* GLESpointer::getBufferData() const {
|
|||||||
return m_buffer ? static_cast<unsigned char*>(m_buffer->getData()) + m_buffOffset : NULL;
|
return m_buffer ? static_cast<unsigned char*>(m_buffer->getData()) + m_buffOffset : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const GLvoid* GLESpointer::getData() const{
|
||||||
|
return m_isVBO ? getBufferData():getArrayData();
|
||||||
|
}
|
||||||
|
|
||||||
void GLESpointer::redirectPointerData(){
|
void GLESpointer::redirectPointerData(){
|
||||||
m_data = getBufferData();
|
m_data = getBufferData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "objectNameManager.h"
|
#include "objectNameManager.h"
|
||||||
#include <utils/threads.h>
|
#include <utils/threads.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
typedef std::map<GLenum,GLESpointer*> ArraysMap;
|
typedef std::map<GLenum,GLESpointer*> ArraysMap;
|
||||||
|
|
||||||
@@ -62,19 +61,33 @@ struct GLSupport {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ArrayData{
|
||||||
|
ArrayData():data(NULL),
|
||||||
|
type(0),
|
||||||
|
stride(0),
|
||||||
|
allocated(false){};
|
||||||
|
|
||||||
|
void* data;
|
||||||
|
GLenum type;
|
||||||
|
unsigned int stride;
|
||||||
|
bool allocated;
|
||||||
|
};
|
||||||
|
|
||||||
class GLESConversionArrays
|
class GLESConversionArrays
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLESConversionArrays():m_current(0){};
|
GLESConversionArrays():m_current(0){};
|
||||||
void alloc(unsigned int size,GLenum type);
|
void setArr(void* data,unsigned int stride,GLenum type);
|
||||||
void* operator[](int i);
|
void allocArr(unsigned int size,GLenum type);
|
||||||
|
ArrayData& operator[](int i);
|
||||||
void* getCurrentData();
|
void* getCurrentData();
|
||||||
|
ArrayData& getCurrentArray();
|
||||||
unsigned int getCurrentIndex();
|
unsigned int getCurrentIndex();
|
||||||
void operator++();
|
void operator++();
|
||||||
|
|
||||||
~GLESConversionArrays();
|
~GLESConversionArrays();
|
||||||
private:
|
private:
|
||||||
std::map<GLenum,std::pair<GLenum,void*> > m_arrays;
|
std::map<GLenum,ArrayData> m_arrays;
|
||||||
unsigned int m_current;
|
unsigned int m_current;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -125,9 +138,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual bool needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id) = 0;
|
virtual bool needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id) = 0;
|
||||||
void convertDirect(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum array_id,GLESpointer* p);
|
void convertDirect(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum array_id,GLESpointer* p);
|
||||||
void convertDirectVBO(GLint first,GLsizei count,GLenum array_id,GLESpointer* p);
|
void convertDirectVBO(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum array_id,GLESpointer* p);
|
||||||
void convertIndirect(GLESConversionArrays& fArrs,GLsizei count,GLenum type,const GLvoid* indices,GLenum array_id,GLESpointer* p);
|
void convertIndirect(GLESConversionArrays& fArrs,GLsizei count,GLenum type,const GLvoid* indices,GLenum array_id,GLESpointer* p);
|
||||||
void convertIndirectVBO(GLsizei count,GLenum indices_type,const GLvoid* indices,GLenum array_id,GLESpointer* p);
|
void convertIndirectVBO(GLESConversionArrays& fArrs,GLsizei count,GLenum indices_type,const GLvoid* indices,GLenum array_id,GLESpointer* p);
|
||||||
void initCapsLocked(const GLubyte * extensionString);
|
void initCapsLocked(const GLubyte * extensionString);
|
||||||
virtual void initExtensionString() =0;
|
virtual void initExtensionString() =0;
|
||||||
static android::Mutex s_lock;
|
static android::Mutex s_lock;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public:
|
|||||||
GLsizei getStride() const;
|
GLsizei getStride() const;
|
||||||
const GLvoid* getArrayData() const;
|
const GLvoid* getArrayData() const;
|
||||||
GLvoid* getBufferData() const;
|
GLvoid* getBufferData() const;
|
||||||
|
const GLvoid* getData() const;
|
||||||
unsigned int getBufferOffset() const;
|
unsigned int getBufferOffset() const;
|
||||||
void redirectPointerData();
|
void redirectPointerData();
|
||||||
void getBufferConversions(const RangeList& rl,RangeList& rlOut);
|
void getBufferConversions(const RangeList& rl,RangeList& rlOut);
|
||||||
|
|||||||
Reference in New Issue
Block a user