Merge "Add gles 1 extension implementation to translator"
This commit is contained in:
@@ -19,21 +19,15 @@
|
||||
#include <GLcommon/GLutils.h>
|
||||
#include <string.h>
|
||||
#include <GLES/gl.h>
|
||||
|
||||
GLcmSupport GLEScmContext::s_glSupport;
|
||||
#include <GLES/glext.h>
|
||||
|
||||
void GLEScmContext::init() {
|
||||
android::Mutex::Autolock mutex(s_lock);
|
||||
if(!m_initialized) {
|
||||
int maxTexUnits;
|
||||
s_glDispatch.dispatchFuncs(GLES_1_1);
|
||||
s_glDispatch.glGetIntegerv(GL_MAX_CLIP_PLANES,&s_glSupport.maxClipPlane);
|
||||
s_glDispatch.glGetIntegerv(GL_MAX_LIGHTS,&s_glSupport.maxLights);
|
||||
s_glDispatch.glGetIntegerv(GL_MAX_TEXTURE_SIZE,&s_glSupport.maxTexSize);
|
||||
s_glDispatch.glGetIntegerv(GL_MAX_TEXTURE_UNITS,&maxTexUnits);
|
||||
s_glSupport.maxTexUnits = maxTexUnits < MAX_TEX_UNITS ? maxTexUnits:MAX_TEX_UNITS;
|
||||
initCapsLocked(s_glDispatch.glGetString(GL_EXTENSIONS));
|
||||
initExtensionString();
|
||||
}
|
||||
|
||||
m_texCoords = new GLESpointer[s_glSupport.maxTexUnits];
|
||||
m_map[GL_TEXTURE_COORD_ARRAY] = &m_texCoords[m_activeTexture];
|
||||
m_initialized = true;
|
||||
@@ -182,3 +176,29 @@ void GLEScmContext::drawPointsElems(GLESFloatArrays& arrs,GLsizei count,GLenum t
|
||||
drawPointsData(arrs,0,count,type,indices_in,true);
|
||||
}
|
||||
|
||||
void GLEScmContext::initExtensionString() {
|
||||
*s_glExtensions = "GL_OES_blend_func_separate GL_OES_blend_equation_separate GL_OES_blend_subtract "
|
||||
"GL_OES_byte_coordinates GL_OES_compressed_paletted_texture GL_OES_point_size_array "
|
||||
"GL_OES_point_sprite GL_OES_single_precision GL_OES_stencil_wrap GL_OES_texture_env_crossbar "
|
||||
"GL_OES_texture_mirored_repeat GL_OES_EGL_image GL_OES_element_index_uint GL_OES_draw_texture "
|
||||
"GL_OES_texture_cube_map ";
|
||||
if (s_glSupport.GL_OES_READ_FORMAT)
|
||||
*s_glExtensions+="GL_OES_read_format ";
|
||||
if (s_glSupport.GL_EXT_FRAMEBUFFER_OBJECT) {
|
||||
*s_glExtensions+="GL_OES_framebuffer_object GL_OES_depth24 GL_OES_depth32 GL_OES_fbo_render_mipmap "
|
||||
"GL_OES_rgb8_rgba8 GL_OES_stencil1 GL_OES_stencil4 GL_OES_stencil8 ";
|
||||
}
|
||||
if (s_glSupport.GL_NV_PACKED_DEPTH_STENCIL)
|
||||
*s_glExtensions+="GL_OES_packed_depth_stencil ";
|
||||
if (s_glSupport.GL_EXT_TEXTURE_FORMAT_BGRA8888)
|
||||
*s_glExtensions+="GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888 ";
|
||||
if (s_glSupport.GL_ARB_MATRIX_PALETTE && s_glSupport.GL_ARB_VERTEX_BLEND) {
|
||||
*s_glExtensions+="GL_OES_matrix_palette ";
|
||||
GLint max_palette_matrices=0;
|
||||
GLint max_vertex_units=0;
|
||||
dispatcher().glGetIntegerv(GL_MAX_PALETTE_MATRICES_OES,&max_palette_matrices);
|
||||
dispatcher().glGetIntegerv(GL_MAX_VERTEX_UNITS_OES,&max_vertex_units);
|
||||
if (max_palette_matrices>=32 && max_vertex_units>=4)
|
||||
*s_glExtensions+="GL_OES_extended_matrix_palette ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,19 +22,12 @@
|
||||
#include <GLcommon/GLEScontext.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <utils/threads.h>
|
||||
|
||||
|
||||
typedef std::map<GLfloat,std::vector<int> > PointSizeIndices;
|
||||
|
||||
struct GLcmSupport {
|
||||
GLcmSupport():maxLights(0),maxClipPlane(0),maxTexUnits(0),maxTexSize(0){};
|
||||
int maxLights;
|
||||
int maxClipPlane;
|
||||
int maxTexUnits;
|
||||
int maxTexSize;
|
||||
};
|
||||
|
||||
class GLEScmContext: public GLEScontext
|
||||
{
|
||||
public:
|
||||
@@ -48,20 +41,11 @@ public:
|
||||
|
||||
~GLEScmContext();
|
||||
|
||||
static int getMaxLights(){return s_glSupport.maxLights;}
|
||||
static int getMaxClipPlanes(){return s_glSupport.maxClipPlane;}
|
||||
static int getMaxTexUnits(){return s_glSupport.maxTexUnits;}
|
||||
static int getMaxTexSize(){return s_glSupport.maxTexSize;}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
void sendArr(GLvoid* arr,GLenum arrayType,GLint size,GLsizei stride,int pointsIndex = -1);
|
||||
void drawPoints(PointSizeIndices* points);
|
||||
void drawPointsData(GLESFloatArrays& arrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices_in,bool isElemsDraw);
|
||||
|
||||
|
||||
static GLcmSupport s_glSupport;
|
||||
void initExtensionString();
|
||||
|
||||
GLESpointer* m_texCoords;
|
||||
int m_pointsIndex;
|
||||
|
||||
@@ -24,13 +24,16 @@
|
||||
#include "TextureUtils.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <GLcommon/gldefs.h>
|
||||
#include <GLcommon/GLDispatch.h>
|
||||
#include <GLcommon/GLfixed_ops.h>
|
||||
#include <GLcommon/TranslatorIfaces.h>
|
||||
#include <GLcommon/ThreadInfo.h>
|
||||
#include <GLES/gl.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GLES/glext.h>
|
||||
#include <cmath>
|
||||
#include <map>
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -44,14 +47,9 @@ static __translatorMustCastToProperFunctionPointerType getProcAddress(const char
|
||||
}
|
||||
|
||||
/************************************** GLES EXTENSIONS *********************************************************/
|
||||
#define GLES_EXTENTIONS 1
|
||||
//extensions decleration
|
||||
void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
|
||||
|
||||
//extentions descriptor
|
||||
static ExtentionDescriptor s_glesExtentions[] = {
|
||||
{"glEGLImageTargetTexture2DOES",(__translatorMustCastToProperFunctionPointerType)glEGLImageTargetTexture2DOES}
|
||||
};
|
||||
typedef std::map<std::string, __translatorMustCastToProperFunctionPointerType> ProcTableMap;
|
||||
ProcTableMap *s_glesExtensions = NULL;
|
||||
/****************************************************************************************************************/
|
||||
|
||||
static EGLiface* s_eglIface = NULL;
|
||||
@@ -86,16 +84,71 @@ static void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp) {
|
||||
ctx->setShareGroup(grp);
|
||||
}
|
||||
}
|
||||
|
||||
static __translatorMustCastToProperFunctionPointerType getProcAddress(const char* procName) {
|
||||
for(int i=0;i<GLES_EXTENTIONS;i++){
|
||||
if(strcmp(procName,s_glesExtentions[i].name) == 0){
|
||||
return s_glesExtentions[i].address;
|
||||
GET_CTX_RET(NULL)
|
||||
ctx->getGlobalLock();
|
||||
static bool proc_table_initialized = false;
|
||||
if (!proc_table_initialized) {
|
||||
proc_table_initialized = true;
|
||||
if (!s_glesExtensions)
|
||||
s_glesExtensions = new ProcTableMap();
|
||||
else
|
||||
s_glesExtensions->clear();
|
||||
(*s_glesExtensions)["glEGLImageTargetTexture2DOES"] = (__translatorMustCastToProperFunctionPointerType)glEGLImageTargetTexture2DOES;
|
||||
(*s_glesExtensions)["glBlendEquationSeparateOES"] = (__translatorMustCastToProperFunctionPointerType)glBlendEquationSeparateOES;
|
||||
(*s_glesExtensions)["glBlendFuncSeparateOES"] = (__translatorMustCastToProperFunctionPointerType)glBlendFuncSeparateOES;
|
||||
(*s_glesExtensions)["glBlendEquationOES"] = (__translatorMustCastToProperFunctionPointerType)glBlendEquationOES;
|
||||
|
||||
if (ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND) {
|
||||
(*s_glesExtensions)["glCurrentPaletteMatrixOES"] = (__translatorMustCastToProperFunctionPointerType)glCurrentPaletteMatrixOES;
|
||||
(*s_glesExtensions)["glLoadPaletteFromModelViewMatrixOES"] = (__translatorMustCastToProperFunctionPointerType)glLoadPaletteFromModelViewMatrixOES;
|
||||
(*s_glesExtensions)["glMatrixIndexPointerOES"] = (__translatorMustCastToProperFunctionPointerType)glMatrixIndexPointerOES;
|
||||
(*s_glesExtensions)["glWeightPointerOES"] = (__translatorMustCastToProperFunctionPointerType)glWeightPointerOES;
|
||||
}
|
||||
(*s_glesExtensions)["glDepthRangefOES"] = (__translatorMustCastToProperFunctionPointerType)glDepthRangef;
|
||||
(*s_glesExtensions)["glFrustumfOES"] = (__translatorMustCastToProperFunctionPointerType)glFrustumf;
|
||||
(*s_glesExtensions)["glOrthofOES"] = (__translatorMustCastToProperFunctionPointerType)glOrthof;
|
||||
(*s_glesExtensions)["glClipPlanefOES"] = (__translatorMustCastToProperFunctionPointerType)glClipPlanef;
|
||||
(*s_glesExtensions)["glGetClipPlanefOES"] = (__translatorMustCastToProperFunctionPointerType)glGetClipPlanef;
|
||||
(*s_glesExtensions)["glClearDepthfOES"] = (__translatorMustCastToProperFunctionPointerType)glClearDepthf;
|
||||
(*s_glesExtensions)["glPointSizePointerOES"] = (__translatorMustCastToProperFunctionPointerType)glPointSizePointerOES;
|
||||
(*s_glesExtensions)["glTexGenfOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenfOES;
|
||||
(*s_glesExtensions)["glTexGenfvOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenfvOES;
|
||||
(*s_glesExtensions)["glTexGeniOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGeniOES;
|
||||
(*s_glesExtensions)["glTexGenivOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenivOES;
|
||||
(*s_glesExtensions)["glTexGenxOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenxOES;
|
||||
(*s_glesExtensions)["glTexGenxvOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenxvOES;
|
||||
(*s_glesExtensions)["glGetTexGenfvOES"] = (__translatorMustCastToProperFunctionPointerType)glGetTexGenfvOES;
|
||||
(*s_glesExtensions)["glGetTexGenivOES"] = (__translatorMustCastToProperFunctionPointerType)glGetTexGenivOES;
|
||||
(*s_glesExtensions)["glGetTexGenxvOES"] = (__translatorMustCastToProperFunctionPointerType)glGetTexGenxvOES;
|
||||
if (ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT) {
|
||||
(*s_glesExtensions)["glIsRenderbufferOES"] = (__translatorMustCastToProperFunctionPointerType)glIsRenderbufferOES;
|
||||
(*s_glesExtensions)["glBindRenderbufferOES"] = (__translatorMustCastToProperFunctionPointerType)glBindRenderbufferOES;
|
||||
(*s_glesExtensions)["glDeleteRenderbuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glDeleteRenderbuffersOES;
|
||||
(*s_glesExtensions)["glGenRenderbuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glGenRenderbuffersOES;
|
||||
(*s_glesExtensions)["glRenderbufferStorageOES"] = (__translatorMustCastToProperFunctionPointerType)glRenderbufferStorageOES;
|
||||
(*s_glesExtensions)["glGetRenderbufferParameterivOES"] = (__translatorMustCastToProperFunctionPointerType)glGetRenderbufferParameterivOES;
|
||||
(*s_glesExtensions)["glIsFramebufferOES"] = (__translatorMustCastToProperFunctionPointerType)glIsFramebufferOES;
|
||||
(*s_glesExtensions)["glBindFramebufferOES"] = (__translatorMustCastToProperFunctionPointerType)glBindFramebufferOES;
|
||||
(*s_glesExtensions)["glDeleteFramebuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glDeleteFramebuffersOES;
|
||||
(*s_glesExtensions)["glGenFramebuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glGenFramebuffersOES;
|
||||
(*s_glesExtensions)["glCheckFramebufferStatusOES"] = (__translatorMustCastToProperFunctionPointerType)glCheckFramebufferStatusOES;
|
||||
(*s_glesExtensions)["glFramebufferTexture2DOES"] = (__translatorMustCastToProperFunctionPointerType)glFramebufferTexture2DOES;
|
||||
(*s_glesExtensions)["glFramebufferRenderbufferOES"] = (__translatorMustCastToProperFunctionPointerType)glFramebufferRenderbufferOES;
|
||||
(*s_glesExtensions)["glGetFramebufferAttachmentParameterivOES"] = (__translatorMustCastToProperFunctionPointerType)glGetFramebufferAttachmentParameterivOES;
|
||||
(*s_glesExtensions)["glGenerateMipmapOES"] = (__translatorMustCastToProperFunctionPointerType)glGenerateMipmapOES;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
__translatorMustCastToProperFunctionPointerType ret=NULL;
|
||||
ProcTableMap::iterator val = s_glesExtensions->find(procName);
|
||||
if (val!=s_glesExtensions->end())
|
||||
ret = val->second;
|
||||
ctx->releaseGlobalLock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
GL_API GLESiface* __translator_getIfaces(EGLiface* eglIface){
|
||||
|
||||
GLESiface* __translator_getIfaces(EGLiface* eglIface){
|
||||
s_eglIface = eglIface;
|
||||
return & s_glesIface;
|
||||
}
|
||||
@@ -116,8 +169,14 @@ GL_API GLboolean GL_APIENTRY glIsEnabled( GLenum cap) {
|
||||
GET_CTX_CM_RET(GL_FALSE)
|
||||
RET_AND_SET_ERROR_IF(!GLEScmValidate::capability(cap,ctx->getMaxLights(),ctx->getMaxClipPlanes()),GL_INVALID_ENUM,GL_FALSE);
|
||||
|
||||
if(cap == GL_POINT_SIZE_ARRAY_OES) return ctx->isArrEnabled(cap);
|
||||
return ctx->dispatcher().glIsEnabled(cap);
|
||||
if (cap == GL_POINT_SIZE_ARRAY_OES)
|
||||
return ctx->isArrEnabled(cap);
|
||||
else if (cap==GL_TEXTURE_GEN_STR_OES)
|
||||
return (ctx->dispatcher().glIsEnabled(GL_TEXTURE_GEN_S) &&
|
||||
ctx->dispatcher().glIsEnabled(GL_TEXTURE_GEN_T) &&
|
||||
ctx->dispatcher().glIsEnabled(GL_TEXTURE_GEN_R));
|
||||
else
|
||||
return ctx->dispatcher().glIsEnabled(cap);
|
||||
}
|
||||
|
||||
GL_API GLboolean GL_APIENTRY glIsTexture( GLuint texture) {
|
||||
@@ -145,8 +204,7 @@ GL_API const GLubyte * GL_APIENTRY glGetString( GLenum name) {
|
||||
static GLubyte VENDOR[] = "Google";
|
||||
static GLubyte RENDERER[] = "OpenGL ES-CM 1.1";
|
||||
static GLubyte VERSION[] = "OpenGL ES-CM 1.1";
|
||||
static GLubyte EXTENSIONS[] = "GL_OES_compressed_paletted_texture "
|
||||
"GL_OES_point_size_array";
|
||||
|
||||
switch(name) {
|
||||
case GL_VENDOR:
|
||||
return VENDOR;
|
||||
@@ -155,7 +213,7 @@ GL_API const GLubyte * GL_APIENTRY glGetString( GLenum name) {
|
||||
case GL_VERSION:
|
||||
return VERSION;
|
||||
case GL_EXTENSIONS:
|
||||
return EXTENSIONS;
|
||||
return (const GLubyte*)ctx->getExtensionString();
|
||||
default:
|
||||
RET_AND_SET_ERROR_IF(true,GL_INVALID_ENUM,NULL);
|
||||
}
|
||||
@@ -321,7 +379,7 @@ GL_API void GL_APIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride
|
||||
|
||||
GL_API void GL_APIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) {
|
||||
GET_CTX_CM()
|
||||
SET_ERROR_IF(!(GLEScmValidate::texCompImgFrmt(internalformat) && GLEScmValidate::textureTarget(target)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!(GLEScmValidate::texCompImgFrmt(internalformat) && GLEScmValidate::textureTargetEx(target)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(level > log2(ctx->getMaxTexSize())|| border !=0 || level > 0 || !GLEScmValidate::texImgDim(width,height,ctx->getMaxTexSize()+2),GL_INVALID_VALUE)
|
||||
|
||||
int nMipmaps = -level + 1;
|
||||
@@ -341,7 +399,7 @@ GL_API void GL_APIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLe
|
||||
|
||||
GL_API void GL_APIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) {
|
||||
GET_CTX_CM()
|
||||
SET_ERROR_IF(!(GLEScmValidate::texCompImgFrmt(format) && GLEScmValidate::textureTarget(target)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!(GLEScmValidate::texCompImgFrmt(format) && GLEScmValidate::textureTargetEx(target)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(level < 0 || level > log2(ctx->getMaxTexSize()),GL_INVALID_VALUE)
|
||||
|
||||
GLenum uncompressedFrmt;
|
||||
@@ -352,14 +410,14 @@ GL_API void GL_APIENTRY glCompressedTexSubImage2D( GLenum target, GLint level,
|
||||
|
||||
GL_API void GL_APIENTRY glCopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!(GLEScmValidate::pixelFrmt(internalformat) && GLEScmValidate::textureTarget(target)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!(GLEScmValidate::pixelFrmt(ctx,internalformat) && GLEScmValidate::textureTargetEx(target)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(border != 0,GL_INVALID_VALUE);
|
||||
ctx->dispatcher().glCopyTexImage2D(target,level,internalformat,x,y,width,height,border);
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!GLEScmValidate::textureTarget(target),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!GLEScmValidate::textureTargetEx(target),GL_INVALID_ENUM);
|
||||
ctx->dispatcher().glCopyTexSubImage2D(target,level,xoffset,yoffset,x,y,width,height);
|
||||
}
|
||||
|
||||
@@ -413,7 +471,13 @@ GL_API void GL_APIENTRY glDepthRangex( GLclampx zNear, GLclampx zFar) {
|
||||
|
||||
GL_API void GL_APIENTRY glDisable( GLenum cap) {
|
||||
GET_CTX()
|
||||
ctx->dispatcher().glDisable(cap);
|
||||
if (cap==GL_TEXTURE_GEN_STR_OES) {
|
||||
ctx->dispatcher().glDisable(GL_TEXTURE_GEN_S);
|
||||
ctx->dispatcher().glDisable(GL_TEXTURE_GEN_T);
|
||||
ctx->dispatcher().glDisable(GL_TEXTURE_GEN_R);
|
||||
}
|
||||
else
|
||||
ctx->dispatcher().glDisable(cap);
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glDisableClientState( GLenum array) {
|
||||
@@ -466,7 +530,13 @@ GL_API void GL_APIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type
|
||||
|
||||
GL_API void GL_APIENTRY glEnable( GLenum cap) {
|
||||
GET_CTX()
|
||||
ctx->dispatcher().glEnable(cap);
|
||||
if (cap==GL_TEXTURE_GEN_STR_OES) {
|
||||
ctx->dispatcher().glEnable(GL_TEXTURE_GEN_S);
|
||||
ctx->dispatcher().glEnable(GL_TEXTURE_GEN_T);
|
||||
ctx->dispatcher().glEnable(GL_TEXTURE_GEN_R);
|
||||
}
|
||||
else
|
||||
ctx->dispatcher().glEnable(cap);
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glEnableClientState( GLenum array) {
|
||||
@@ -564,6 +634,18 @@ GL_API void GL_APIENTRY glGetBooleanv( GLenum pname, GLboolean *params) {
|
||||
*params = (i != 0) ? GL_TRUE : GL_FALSE;
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_GEN_STR_OES:
|
||||
{
|
||||
GLboolean state_s = GL_FALSE;
|
||||
GLboolean state_t = GL_FALSE;
|
||||
GLboolean state_r = GL_FALSE;
|
||||
ctx->dispatcher().glGetBooleanv(GL_TEXTURE_GEN_S,&state_s);
|
||||
ctx->dispatcher().glGetBooleanv(GL_TEXTURE_GEN_T,&state_t);
|
||||
ctx->dispatcher().glGetBooleanv(GL_TEXTURE_GEN_R,&state_r);
|
||||
*params = state_s && state_t && state_r ? GL_TRUE: GL_FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ctx->dispatcher().glGetBooleanv(pname,params);
|
||||
}
|
||||
@@ -607,6 +689,10 @@ GL_API void GL_APIENTRY glGetClipPlanex( GLenum pname, GLfixed eqn[4]) {
|
||||
|
||||
GL_API void GL_APIENTRY glGetFixedv( GLenum pname, GLfixed *params) {
|
||||
GET_CTX()
|
||||
|
||||
size_t nParams = glParamSize(pname);
|
||||
GLfloat fParams[16];
|
||||
|
||||
switch(pname)
|
||||
{
|
||||
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
||||
@@ -614,12 +700,19 @@ GL_API void GL_APIENTRY glGetFixedv( GLenum pname, GLfixed *params) {
|
||||
GLint i;
|
||||
glGetIntegerv(pname, &i);
|
||||
*params = I2X(i);
|
||||
nParams = 0;
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_GEN_STR_OES:
|
||||
ctx->dispatcher().glGetFloatv(GL_TEXTURE_GEN_S,&fParams[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
size_t nParams = glParamSize(pname);
|
||||
GLfloat fParams[16];
|
||||
ctx->dispatcher().glGetFloatv(pname,fParams);
|
||||
}
|
||||
|
||||
if (nParams)
|
||||
{
|
||||
for(size_t i =0 ; i < nParams;i++) {
|
||||
params[i] = F2X(fParams[i]);
|
||||
}
|
||||
@@ -637,6 +730,10 @@ GL_API void GL_APIENTRY glGetFloatv( GLenum pname, GLfloat *params) {
|
||||
*params = (GLfloat)i;
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_GEN_STR_OES:
|
||||
ctx->dispatcher().glGetFloatv(GL_TEXTURE_GEN_S,¶ms[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
ctx->dispatcher().glGetFloatv(pname,params);
|
||||
}
|
||||
@@ -654,6 +751,10 @@ GL_API void GL_APIENTRY glGetIntegerv( GLenum pname, GLint *params) {
|
||||
*params = GL_RGBA;
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_GEN_STR_OES:
|
||||
ctx->dispatcher().glGetIntegerv(GL_TEXTURE_GEN_S,¶ms[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
ctx->dispatcher().glGetIntegerv(pname,params);
|
||||
}
|
||||
@@ -1035,7 +1136,7 @@ GL_API void GL_APIENTRY glPushMatrix(void) {
|
||||
|
||||
GL_API void GL_APIENTRY glReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!(GLEScmValidate::pixelFrmt(format) && GLEScmValidate::pixelType(type)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!(GLEScmValidate::pixelFrmt(ctx,format) && GLEScmValidate::pixelType(ctx,type)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!(GLEScmValidate::pixelOp(format,type)),GL_INVALID_OPERATION);
|
||||
|
||||
ctx->dispatcher().glReadPixels(x,y,width,height,format,type,pixels);
|
||||
@@ -1093,6 +1194,7 @@ GL_API void GL_APIENTRY glStencilMask( GLuint mask) {
|
||||
|
||||
GL_API void GL_APIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!(GLEScmValidate::stencilOp(fail) && GLEScmValidate::stencilOp(zfail) && GLEScmValidate::stencilOp(zpass)),GL_INVALID_ENUM);
|
||||
ctx->dispatcher().glStencilOp(fail,zfail,zpass);
|
||||
}
|
||||
|
||||
@@ -1167,12 +1269,11 @@ static TextureData* getTextureData(){
|
||||
GL_API void GL_APIENTRY glTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) {
|
||||
GET_CTX()
|
||||
|
||||
SET_ERROR_IF(!(GLEScmValidate::textureTarget(target) &&
|
||||
GLEScmValidate::pixelFrmt(internalformat) &&
|
||||
GLEScmValidate::pixelFrmt(format)&&
|
||||
GLEScmValidate::pixelType(type)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!(GLEScmValidate::textureTargetEx(target) &&
|
||||
GLEScmValidate::pixelFrmt(ctx,internalformat) &&
|
||||
GLEScmValidate::pixelFrmt(ctx,format) &&
|
||||
GLEScmValidate::pixelType(ctx,type)),GL_INVALID_ENUM);
|
||||
|
||||
//SET_ERROR_IF(level < 0 || border !=0 || level > log2(ctx->getMaxTexSize()) || !GLEScmValidate::texImgDim(width,height,ctx->getMaxTexSize()),GL_INVALID_VALUE);
|
||||
SET_ERROR_IF(!(GLEScmValidate::pixelOp(format,type) && internalformat == ((GLint)format)),GL_INVALID_OPERATION);
|
||||
|
||||
if (thrd->shareGroup.Ptr()){
|
||||
@@ -1227,9 +1328,9 @@ GL_API void GL_APIENTRY glTexParameterxv( GLenum target, GLenum pname, const GL
|
||||
|
||||
GL_API void GL_APIENTRY glTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!(GLEScmValidate::textureTarget(target) &&
|
||||
GLEScmValidate::pixelFrmt(format)&&
|
||||
GLEScmValidate::pixelType(type)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!(GLEScmValidate::textureTargetEx(target) &&
|
||||
GLEScmValidate::pixelFrmt(ctx,format)&&
|
||||
GLEScmValidate::pixelType(ctx,type)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!GLEScmValidate::pixelOp(format,type),GL_INVALID_OPERATION);
|
||||
|
||||
ctx->dispatcher().glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels);
|
||||
@@ -1258,10 +1359,10 @@ GL_API void GL_APIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei he
|
||||
ctx->dispatcher().glViewport(x,y,width,height);
|
||||
}
|
||||
|
||||
void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
|
||||
GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
|
||||
{
|
||||
GET_CTX();
|
||||
SET_ERROR_IF(!GLEScmValidate::textureTarget(target),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!GLEScmValidate::textureTargetLimited(target),GL_INVALID_ENUM);
|
||||
EglImage *img = s_eglIface->eglAttachEGLImage((unsigned int)image);
|
||||
if (img) {
|
||||
// Create the texture object in the underlying EGL implementation,
|
||||
@@ -1283,3 +1384,321 @@ void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* GL_OES_blend_subtract*/
|
||||
GL_API void GL_APIENTRY glBlendEquationOES(GLenum mode) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!(GLEScmValidate::blendEquationMode(mode)), GL_INVALID_ENUM);
|
||||
ctx->dispatcher().glBlendEquation(mode);
|
||||
}
|
||||
|
||||
/* GL_OES_blend_equation_separate */
|
||||
GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!(GLEScmValidate::blendEquationMode(modeRGB) && GLEScmValidate::blendEquationMode(modeAlpha)), GL_INVALID_ENUM);
|
||||
ctx->dispatcher().glBlendEquationSeparate(modeRGB,modeAlpha);
|
||||
}
|
||||
|
||||
/* GL_OES_blend_func_separate */
|
||||
GL_API void GL_APIENTRY glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!GLEScmValidate::blendSrc(srcRGB) || !GLEScmValidate::blendDst(dstRGB) ||
|
||||
!GLEScmValidate::blendSrc(srcAlpha) || ! GLEScmValidate::blendDst(dstAlpha) ,GL_INVALID_ENUM);
|
||||
ctx->dispatcher().glBlendFuncSeparate(srcRGB,dstRGB,srcAlpha,dstAlpha);
|
||||
}
|
||||
|
||||
/* GL_OES_framebuffer_object */
|
||||
GL_API GLboolean GL_APIENTRY glIsRenderbufferOES(GLuint renderbuffer) {
|
||||
GET_CTX_RET(GL_FALSE)
|
||||
RET_AND_SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION,GL_FALSE);
|
||||
if(renderbuffer && thrd->shareGroup.Ptr()){
|
||||
return thrd->shareGroup->isObject(RENDERBUFFER,renderbuffer) ? GL_TRUE :GL_FALSE;
|
||||
}
|
||||
return ctx->dispatcher().glIsRenderbufferEXT(renderbuffer);
|
||||
}
|
||||
|
||||
GL_API void GLAPIENTRY glBindRenderbufferOES(GLenum target, GLuint renderbuffer) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
SET_ERROR_IF(!GLEScmValidate::renderbufferTarget(target),GL_INVALID_ENUM);
|
||||
|
||||
//if buffer wasn't generated before,generate one
|
||||
if(thrd->shareGroup.Ptr() && !thrd->shareGroup->isObject(RENDERBUFFER,renderbuffer)){
|
||||
thrd->shareGroup->genName(RENDERBUFFER,renderbuffer);
|
||||
}
|
||||
|
||||
int globalBufferName = thrd->shareGroup->getGlobalName(RENDERBUFFER,renderbuffer);
|
||||
ctx->dispatcher().glBindRenderbufferEXT(target,globalBufferName);
|
||||
}
|
||||
|
||||
GL_API void GLAPIENTRY glDeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
for (int i=0;i<n;++i) {
|
||||
GLuint globalBufferName = thrd->shareGroup->getGlobalName(RENDERBUFFER,renderbuffers[i]);
|
||||
ctx->dispatcher().glDeleteRenderbuffersEXT(1,&globalBufferName);
|
||||
}
|
||||
}
|
||||
|
||||
GL_API void GLAPIENTRY glGenRenderbuffersOES(GLsizei n, GLuint *renderbuffers) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
SET_ERROR_IF(n<0,GL_INVALID_VALUE);
|
||||
if(thrd->shareGroup.Ptr()) {
|
||||
for(int i=0; i<n ;i++) {
|
||||
renderbuffers[i] = thrd->shareGroup->genName(RENDERBUFFER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL_API void GLAPIENTRY glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height){
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
SET_ERROR_IF(!GLEScmValidate::renderbufferTarget(target) || !GLEScmValidate::renderbufferInternalFrmt(ctx,internalformat) ,GL_INVALID_ENUM);
|
||||
if (internalformat==GL_RGB565_OES) //RGB565 not supported by GL
|
||||
internalformat = GL_RGB8_OES;
|
||||
ctx->dispatcher().glRenderbufferStorageEXT(target,internalformat,width,height);
|
||||
}
|
||||
|
||||
GL_API void GLAPIENTRY glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
SET_ERROR_IF(!GLEScmValidate::renderbufferTarget(target) || !GLEScmValidate::renderbufferParams(pname) ,GL_INVALID_ENUM);
|
||||
ctx->dispatcher().glGetRenderbufferParameterivEXT(target,pname,params);
|
||||
}
|
||||
|
||||
GL_API GLboolean GLAPIENTRY glIsFramebufferOES(GLuint framebuffer) {
|
||||
GET_CTX_RET(GL_FALSE)
|
||||
RET_AND_SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION,GL_FALSE);
|
||||
if (framebuffer && thrd->shareGroup.Ptr()) {
|
||||
return thrd->shareGroup->isObject(FRAMEBUFFER,framebuffer) ? GL_TRUE : GL_FALSE;
|
||||
}
|
||||
return ctx->dispatcher().glIsFramebufferEXT(framebuffer);
|
||||
}
|
||||
|
||||
GL_API void GLAPIENTRY glBindFramebufferOES(GLenum target, GLuint framebuffer) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) ,GL_INVALID_ENUM);
|
||||
if (thrd->shareGroup.Ptr() && !thrd->shareGroup->isObject(FRAMEBUFFER,framebuffer)) {
|
||||
thrd->shareGroup->genName(FRAMEBUFFER,framebuffer);
|
||||
}
|
||||
int globalBufferName = thrd->shareGroup->getGlobalName(FRAMEBUFFER,framebuffer);
|
||||
ctx->dispatcher().glBindFramebufferEXT(target,globalBufferName);
|
||||
}
|
||||
|
||||
GL_API void GLAPIENTRY glDeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
for (int i=0;i<n;++i) {
|
||||
GLuint globalBufferName = thrd->shareGroup->getGlobalName(FRAMEBUFFER,framebuffers[i]);
|
||||
ctx->dispatcher().glDeleteFramebuffersEXT(1,&globalBufferName);
|
||||
}
|
||||
}
|
||||
|
||||
GL_API void GLAPIENTRY glGenFramebuffersOES(GLsizei n, GLuint *framebuffers) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
SET_ERROR_IF(n<0,GL_INVALID_VALUE);
|
||||
if (thrd->shareGroup.Ptr()) {
|
||||
for (int i=0;i<n;i++) {
|
||||
framebuffers[i] = thrd->shareGroup->genName(FRAMEBUFFER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL_API GLenum GLAPIENTRY glCheckFramebufferStatusOES(GLenum target) {
|
||||
GET_CTX_RET(0)
|
||||
RET_AND_SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION,0);
|
||||
RET_AND_SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) ,GL_INVALID_ENUM,0);
|
||||
return ctx->dispatcher().glCheckFramebufferStatusEXT(target);
|
||||
}
|
||||
|
||||
GL_API void GLAPIENTRY glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) || !GLEScmValidate::framebufferAttachment(attachment) ||
|
||||
!GLEScmValidate::textureTargetEx(textarget),GL_INVALID_ENUM);
|
||||
if (thrd->shareGroup.Ptr() && !thrd->shareGroup->isObject(TEXTURE,texture)) {
|
||||
thrd->shareGroup->genName(TEXTURE,texture);
|
||||
}
|
||||
GLuint globalTexName = thrd->shareGroup->getGlobalName(TEXTURE,texture);
|
||||
ctx->dispatcher().glFramebufferTexture2DEXT(target,attachment,textarget,globalTexName,level);
|
||||
}
|
||||
|
||||
GL_API void GLAPIENTRY glFramebufferRenderbufferOES(GLenum target, GLenum attachment,GLenum renderbuffertarget, GLuint renderbuffer) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) || !GLEScmValidate::framebufferAttachment(attachment) ||
|
||||
!GLEScmValidate::renderbufferTarget(renderbuffertarget), GL_INVALID_ENUM);
|
||||
if (thrd->shareGroup.Ptr() && !thrd->shareGroup->isObject(RENDERBUFFER,renderbuffer)) {
|
||||
thrd->shareGroup->genName(RENDERBUFFER,renderbuffer);
|
||||
}
|
||||
GLuint globalBufferName = thrd->shareGroup->getGlobalName(RENDERBUFFER,renderbuffer);
|
||||
ctx->dispatcher().glFramebufferRenderbufferEXT(target,attachment,renderbuffertarget,globalBufferName);
|
||||
}
|
||||
|
||||
GL_API void GLAPIENTRY glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint *params) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) || !GLEScmValidate::framebufferAttachment(attachment) ||
|
||||
!GLEScmValidate::framebufferAttachmentParams(pname), GL_INVALID_ENUM);
|
||||
ctx->dispatcher().glGetFramebufferAttachmentParameterivEXT(target,attachment,pname,params);
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glGenerateMipmapOES(GLenum target) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION);
|
||||
SET_ERROR_IF(!GLEScmValidate::textureTargetLimited(target),GL_INVALID_ENUM);
|
||||
ctx->dispatcher().glGenerateMipmapEXT(target);
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glCurrentPaletteMatrixOES(GLuint index) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION);
|
||||
ctx->dispatcher().glCurrentPaletteMatrixARB(index);
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES() {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION);
|
||||
GLint matrix[16];
|
||||
ctx->dispatcher().glGetIntegerv(GL_MODELVIEW_MATRIX,matrix);
|
||||
ctx->dispatcher().glMatrixIndexuivARB(1,(GLuint*)matrix);
|
||||
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION);
|
||||
ctx->dispatcher().glMatrixIndexPointerARB(size,type,stride,pointer);
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION);
|
||||
ctx->dispatcher().glWeightPointerARB(size,type,stride,pointer);
|
||||
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
|
||||
if (coord == GL_TEXTURE_GEN_STR_OES) {
|
||||
ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_S,pname,param);
|
||||
ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_T,pname,param);
|
||||
ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_R,pname,param);
|
||||
}
|
||||
else
|
||||
ctx->dispatcher().glTexGenf(coord,pname,param);
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
|
||||
if (coord == GL_TEXTURE_GEN_STR_OES) {
|
||||
ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_S,pname,params);
|
||||
ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_T,pname,params);
|
||||
ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_R,pname,params);
|
||||
}
|
||||
else
|
||||
ctx->dispatcher().glTexGenfv(coord,pname,params);
|
||||
}
|
||||
GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
|
||||
if (coord == GL_TEXTURE_GEN_STR_OES) {
|
||||
ctx->dispatcher().glTexGeni(GL_TEXTURE_GEN_S,pname,param);
|
||||
ctx->dispatcher().glTexGeni(GL_TEXTURE_GEN_T,pname,param);
|
||||
ctx->dispatcher().glTexGeni(GL_TEXTURE_GEN_R,pname,param);
|
||||
}
|
||||
else
|
||||
ctx->dispatcher().glTexGeni(coord,pname,param);
|
||||
}
|
||||
GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
|
||||
if (coord == GL_TEXTURE_GEN_STR_OES) {
|
||||
ctx->dispatcher().glTexGeniv(GL_TEXTURE_GEN_S,pname,params);
|
||||
ctx->dispatcher().glTexGeniv(GL_TEXTURE_GEN_T,pname,params);
|
||||
ctx->dispatcher().glTexGeniv(GL_TEXTURE_GEN_R,pname,params);
|
||||
}
|
||||
else
|
||||
ctx->dispatcher().glTexGeniv(coord,pname,params);
|
||||
}
|
||||
GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
|
||||
if (coord == GL_TEXTURE_GEN_STR_OES) {
|
||||
ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_S,pname,X2F(param));
|
||||
ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_T,pname,X2F(param));
|
||||
ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_R,pname,X2F(param));
|
||||
}
|
||||
else
|
||||
ctx->dispatcher().glTexGenf(coord,pname,X2F(param));
|
||||
}
|
||||
GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params) {
|
||||
GLfloat tmpParams[1];
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM);
|
||||
tmpParams[0] = X2F(params[0]);
|
||||
if (coord == GL_TEXTURE_GEN_STR_OES) {
|
||||
ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_S,pname,tmpParams);
|
||||
ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_T,pname,tmpParams);
|
||||
ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_R,pname,tmpParams);
|
||||
}
|
||||
else
|
||||
ctx->dispatcher().glTexGenfv(coord,pname,tmpParams);
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params) {
|
||||
GET_CTX()
|
||||
if (coord == GL_TEXTURE_GEN_STR_OES)
|
||||
{
|
||||
GLfloat state_s = GL_FALSE;
|
||||
GLfloat state_t = GL_FALSE;
|
||||
GLfloat state_r = GL_FALSE;
|
||||
ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_S,pname,&state_s);
|
||||
ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_T,pname,&state_t);
|
||||
ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_R,pname,&state_r);
|
||||
*params = state_s && state_t && state_r ? GL_TRUE: GL_FALSE;
|
||||
}
|
||||
else
|
||||
ctx->dispatcher().glGetTexGenfv(coord,pname,params);
|
||||
|
||||
}
|
||||
GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params) {
|
||||
GET_CTX()
|
||||
if (coord == GL_TEXTURE_GEN_STR_OES)
|
||||
{
|
||||
GLint state_s = GL_FALSE;
|
||||
GLint state_t = GL_FALSE;
|
||||
GLint state_r = GL_FALSE;
|
||||
ctx->dispatcher().glGetTexGeniv(GL_TEXTURE_GEN_S,pname,&state_s);
|
||||
ctx->dispatcher().glGetTexGeniv(GL_TEXTURE_GEN_T,pname,&state_t);
|
||||
ctx->dispatcher().glGetTexGeniv(GL_TEXTURE_GEN_R,pname,&state_r);
|
||||
*params = state_s && state_t && state_r ? GL_TRUE: GL_FALSE;
|
||||
}
|
||||
else
|
||||
ctx->dispatcher().glGetTexGeniv(coord,pname,params);
|
||||
}
|
||||
|
||||
GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params) {
|
||||
GET_CTX()
|
||||
GLfloat tmpParams[1];
|
||||
|
||||
if (coord == GL_TEXTURE_GEN_STR_OES)
|
||||
{
|
||||
GLfloat state_s = GL_FALSE;
|
||||
GLfloat state_t = GL_FALSE;
|
||||
GLfloat state_r = GL_FALSE;
|
||||
ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_S,pname,&state_s);
|
||||
ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_T,pname,&state_t);
|
||||
ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_R,pname,&state_r);
|
||||
tmpParams[0] = state_s && state_t && state_r ? GL_TRUE: GL_FALSE;
|
||||
}
|
||||
else
|
||||
ctx->dispatcher().glGetTexGenfv(coord,pname,tmpParams);
|
||||
|
||||
params[0] = F2X(tmpParams[1]);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
*/
|
||||
#include "GLEScmValidate.h"
|
||||
#include <GLcommon/GLutils.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <GLcommon/GLEScontext.h>
|
||||
#include "GLEScmValidate.h"
|
||||
|
||||
|
||||
bool GLEScmValidate::lightEnum(GLenum e,unsigned int maxLights) {
|
||||
@@ -25,11 +29,6 @@ bool GLEScmValidate::clipPlaneEnum(GLenum e,unsigned int maxClipPlanes) {
|
||||
return e >=GL_CLIP_PLANE0 && e <= (GL_CLIP_PLANE0+maxClipPlanes);
|
||||
}
|
||||
|
||||
bool GLEScmValidate::textureTarget(GLenum target) {
|
||||
return target == GL_TEXTURE_2D;
|
||||
}
|
||||
|
||||
|
||||
bool GLEScmValidate::alphaFunc(GLenum f) {
|
||||
switch(f) {
|
||||
case GL_NEVER:
|
||||
@@ -45,6 +44,22 @@ bool GLEScmValidate::alphaFunc(GLenum f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLEScmValidate::blendSrc(GLenum s) {
|
||||
switch(s) {
|
||||
case GL_ZERO:
|
||||
case GL_ONE:
|
||||
case GL_DST_COLOR:
|
||||
case GL_ONE_MINUS_DST_COLOR:
|
||||
case GL_SRC_ALPHA:
|
||||
case GL_ONE_MINUS_SRC_ALPHA:
|
||||
case GL_DST_ALPHA:
|
||||
case GL_ONE_MINUS_DST_ALPHA:
|
||||
case GL_SRC_ALPHA_SATURATE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLEScmValidate::vertexPointerParams(GLint size,GLsizei stride) {
|
||||
return ((size >=2) && (size <= 4)) && (stride >=0) ;
|
||||
}
|
||||
@@ -69,7 +84,6 @@ bool GLEScmValidate::supportedArrays(GLenum arr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool GLEScmValidate::hintTargetMode(GLenum target,GLenum mode) {
|
||||
switch(target) {
|
||||
case GL_FOG_HINT:
|
||||
@@ -166,7 +180,6 @@ bool GLEScmValidate::capability(GLenum cap,int maxLights,int maxClipPlanes) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool GLEScmValidate::texCompImgFrmt(GLenum format) {
|
||||
switch(format) {
|
||||
case GL_PALETTE4_RGB8_OES:
|
||||
@@ -193,23 +206,6 @@ bool GLEScmValidate::texImgDim(GLsizei width,GLsizei height,int maxTexSize) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool GLEScmValidate::blendSrc(GLenum s) {
|
||||
switch(s) {
|
||||
case GL_ZERO:
|
||||
case GL_ONE:
|
||||
case GL_DST_COLOR:
|
||||
case GL_ONE_MINUS_DST_COLOR:
|
||||
case GL_SRC_ALPHA:
|
||||
case GL_ONE_MINUS_SRC_ALPHA:
|
||||
case GL_DST_ALPHA:
|
||||
case GL_ONE_MINUS_DST_ALPHA:
|
||||
case GL_SRC_ALPHA_SATURATE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLEScmValidate::blendDst(GLenum d) {
|
||||
switch(d) {
|
||||
case GL_ZERO:
|
||||
@@ -224,3 +220,45 @@ bool GLEScmValidate::blendDst(GLenum d) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLEScmValidate::renderbufferInternalFrmt(GLEScontext* ctx, GLenum internalformat)
|
||||
{
|
||||
switch (internalformat) {
|
||||
case GL_DEPTH_COMPONENT16_OES:
|
||||
case GL_RGBA4_OES:
|
||||
case GL_RGB5_A1_OES:
|
||||
case GL_RGB565_OES:
|
||||
case GL_STENCIL_INDEX1_OES:
|
||||
case GL_STENCIL_INDEX4_OES:
|
||||
case GL_STENCIL_INDEX8_OES:
|
||||
case GL_RGB8_OES:
|
||||
case GL_RGBA8_OES:
|
||||
case GL_DEPTH_COMPONENT24_OES:
|
||||
case GL_DEPTH_COMPONENT32_OES:
|
||||
return true;
|
||||
}
|
||||
if (ctx->getCaps()->GL_NV_PACKED_DEPTH_STENCIL && internalformat==GL_DEPTH24_STENCIL8_OES)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLEScmValidate::stencilOp(GLenum param) {
|
||||
switch (param) {
|
||||
case GL_KEEP:
|
||||
case GL_ZERO:
|
||||
case GL_REPLACE:
|
||||
case GL_INCR:
|
||||
case GL_DECR:
|
||||
case GL_INVERT:
|
||||
case GL_INCR_WRAP_OES:
|
||||
case GL_DECR_WRAP_OES:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLEScmValidate::texGen(GLenum coord, GLenum pname) {
|
||||
return (coord == GL_TEXTURE_GEN_STR_OES && pname == GL_TEXTURE_GEN_MODE_OES);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,10 +32,14 @@ static bool hintTargetMode(GLenum target,GLenum mode);
|
||||
static bool capability(GLenum cap,int maxLights,int maxClipPlanes);
|
||||
static bool texParams(GLenum target,GLenum pname);
|
||||
static bool texCoordPointerParams(GLint size,GLsizei stride);
|
||||
static bool textureTarget(GLenum target);
|
||||
|
||||
static bool texEnv(GLenum target,GLenum pname);
|
||||
static bool texCompImgFrmt(GLenum format);
|
||||
static bool texImgDim(GLsizei width,GLsizei height,int maxTexSize);
|
||||
|
||||
static bool renderbufferInternalFrmt(GLEScontext * ctx, GLenum internalformat);
|
||||
static bool stencilOp(GLenum param);
|
||||
static bool texGen(GLenum coord,GLenum pname);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,22 +15,17 @@
|
||||
*/
|
||||
|
||||
#include "GLESv2Context.h"
|
||||
GLv2Support GLESv2Context::s_glSupport;
|
||||
|
||||
void GLESv2Context::init() {
|
||||
android::Mutex::Autolock mutex(s_lock);
|
||||
if(!m_initialized) {
|
||||
int maxTexUnits;
|
||||
s_glDispatch.dispatchFuncs(GLES_2_0);
|
||||
s_glDispatch.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS,&s_glSupport.maxVertexAttribs);
|
||||
s_glDispatch.glGetIntegerv(GL_MAX_TEXTURE_UNITS,&maxTexUnits);
|
||||
s_glSupport.maxTexUnits = maxTexUnits < MAX_TEX_UNITS ? maxTexUnits:MAX_TEX_UNITS;
|
||||
initCapsLocked(s_glDispatch.glGetString(GL_EXTENSIONS));
|
||||
|
||||
for(int i=0; i < s_glSupport.maxVertexAttribs;i++){
|
||||
m_map[i] = new GLESpointer();
|
||||
}
|
||||
}
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,23 +23,14 @@
|
||||
#include <utils/threads.h>
|
||||
|
||||
|
||||
struct GLv2Support {
|
||||
GLv2Support():maxTexUnits(0),maxVertexAttribs(0){};
|
||||
int maxTexUnits;
|
||||
int maxVertexAttribs;
|
||||
};
|
||||
|
||||
class GLESv2Context : public GLEScontext{
|
||||
public:
|
||||
void init();
|
||||
GLESv2Context();
|
||||
void convertArrs(GLESFloatArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct);
|
||||
static unsigned int getMaxTexUnits(){return s_glSupport.maxTexUnits;};
|
||||
private:
|
||||
void sendArr(GLvoid* arr,GLenum arrayType,GLint size,GLsizei stride,int pointsIndex = -1);
|
||||
|
||||
static GLv2Support s_glSupport;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -262,7 +262,7 @@ GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint leve
|
||||
|
||||
GL_APICALL void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border){
|
||||
GET_CTX();
|
||||
SET_ERROR_IF(!(GLESv2Validate::pixelFrmt(internalformat) && GLESv2Validate::textureTargetEx(target)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!(GLESv2Validate::pixelFrmt(ctx,internalformat) && GLESv2Validate::textureTargetEx(target)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(border != 0,GL_INVALID_VALUE);
|
||||
ctx->dispatcher().glCopyTexImage2D(target,level,internalformat,x,y,width,height,border);
|
||||
}
|
||||
@@ -501,7 +501,7 @@ GL_APICALL void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers){
|
||||
|
||||
GL_APICALL void GL_APIENTRY glGenerateMipmap(GLenum target){
|
||||
GET_CTX();
|
||||
SET_ERROR_IF(!GLESv2Validate::textureTarget(target),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!GLESv2Validate::textureTargetEx(target),GL_INVALID_ENUM);
|
||||
ctx->dispatcher().glGenerateMipmap(target);
|
||||
}
|
||||
|
||||
@@ -904,7 +904,7 @@ GL_APICALL void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units){
|
||||
|
||||
GL_APICALL void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels){
|
||||
GET_CTX();
|
||||
SET_ERROR_IF(!(GLESv2Validate::readPixelFrmt(format) && GLESv2Validate::pixelType(type)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!(GLESv2Validate::readPixelFrmt(format) && GLESv2Validate::pixelType(ctx,type)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!(GLESv2Validate::pixelOp(format,type)),GL_INVALID_OPERATION);
|
||||
ctx->dispatcher().glReadPixels(x,y,width,height,format,type,pixels);
|
||||
}
|
||||
@@ -994,9 +994,9 @@ static TextureData* getTextureData(){
|
||||
GL_APICALL void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels){
|
||||
GET_CTX();
|
||||
SET_ERROR_IF(!(GLESv2Validate::textureTargetEx(target) &&
|
||||
GLESv2Validate::pixelFrmt(internalformat) &&
|
||||
GLESv2Validate::pixelFrmt(format)&&
|
||||
GLESv2Validate::pixelType(type)),GL_INVALID_ENUM);
|
||||
GLESv2Validate::pixelFrmt(ctx,internalformat) &&
|
||||
GLESv2Validate::pixelFrmt(ctx,format)&&
|
||||
GLESv2Validate::pixelType(ctx,type)),GL_INVALID_ENUM);
|
||||
|
||||
SET_ERROR_IF(!(GLESv2Validate::pixelOp(format,type) && internalformat == ((GLint)format)),GL_INVALID_OPERATION);
|
||||
SET_ERROR_IF(border != 0,GL_INVALID_VALUE);
|
||||
@@ -1039,8 +1039,8 @@ GL_APICALL void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels){
|
||||
GET_CTX();
|
||||
SET_ERROR_IF(!(GLESv2Validate::textureTargetEx(target) &&
|
||||
GLESv2Validate::pixelFrmt(format)&&
|
||||
GLESv2Validate::pixelType(type)),GL_INVALID_ENUM);
|
||||
GLESv2Validate::pixelFrmt(ctx,format)&&
|
||||
GLESv2Validate::pixelType(ctx,type)),GL_INVALID_ENUM);
|
||||
SET_ERROR_IF(!GLESv2Validate::pixelOp(format,type),GL_INVALID_OPERATION);
|
||||
|
||||
ctx->dispatcher().glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels);
|
||||
|
||||
@@ -65,10 +65,6 @@ bool GLESv2Validate::blendDst(GLenum d) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLESv2Validate::textureTarget(GLenum target){
|
||||
return target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP;
|
||||
}
|
||||
|
||||
bool GLESv2Validate::textureParams(GLenum param){
|
||||
switch(param) {
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
@@ -123,62 +119,3 @@ bool GLESv2Validate::readPixelFrmt(GLenum format){
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLESv2Validate::textureTargetEx(GLenum target){
|
||||
switch(target){
|
||||
case GL_TEXTURE_2D:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLESv2Validate::framebufferTarget(GLenum target){
|
||||
return target == GL_FRAMEBUFFER;
|
||||
}
|
||||
|
||||
bool GLESv2Validate::framebufferAttachment(GLenum attachment){
|
||||
switch(attachment){
|
||||
case GL_COLOR_ATTACHMENT0:
|
||||
case GL_DEPTH_ATTACHMENT:
|
||||
case GL_STENCIL_ATTACHMENT:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLESv2Validate::framebufferAttachmentParams(GLenum pname){
|
||||
switch(pname){
|
||||
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
|
||||
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
|
||||
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
|
||||
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLESv2Validate::renderbufferTarget(GLenum target){
|
||||
return target == GL_RENDERBUFFER;
|
||||
}
|
||||
|
||||
bool GLESv2Validate::renderbufferParams(GLenum pname){
|
||||
switch(pname){
|
||||
case GL_RENDERBUFFER_WIDTH:
|
||||
case GL_RENDERBUFFER_HEIGHT:
|
||||
case GL_RENDERBUFFER_INTERNAL_FORMAT:
|
||||
case GL_RENDERBUFFER_RED_SIZE:
|
||||
case GL_RENDERBUFFER_GREEN_SIZE:
|
||||
case GL_RENDERBUFFER_BLUE_SIZE:
|
||||
case GL_RENDERBUFFER_ALPHA_SIZE:
|
||||
case GL_RENDERBUFFER_DEPTH_SIZE:
|
||||
case GL_RENDERBUFFER_STENCIL_SIZE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,18 +24,11 @@ struct GLESv2Validate:public GLESvalidate{
|
||||
static bool blendEquationMode(GLenum mode);
|
||||
static bool blendSrc(GLenum s);
|
||||
static bool blendDst(GLenum d);
|
||||
static bool textureTarget(GLenum target);
|
||||
static bool textureTargetEx(GLenum target);
|
||||
static bool textureParams(GLenum param);
|
||||
static bool hintTargetMode(GLenum target,GLenum mode);
|
||||
static bool capability(GLenum cap);
|
||||
static bool pixelStoreParam(GLenum param);
|
||||
static bool readPixelFrmt(GLenum format);
|
||||
static bool framebufferTarget(GLenum target);
|
||||
static bool framebufferAttachment(GLenum attachment);
|
||||
static bool framebufferAttachmentParams(GLenum pname);
|
||||
static bool renderbufferTarget(GLenum target);
|
||||
static bool renderbufferParams(GLenum pname);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -54,6 +54,14 @@ static GL_FUNC_PTR getGLFuncAddress(const char *funcName) {
|
||||
} \
|
||||
}
|
||||
|
||||
#define LOAD_GLEXT_FUNC(name) { void * funcAddrs = NULL; \
|
||||
if(name == NULL){ \
|
||||
funcAddrs = (void *)getGLFuncAddress(#name); \
|
||||
if(funcAddrs) \
|
||||
*(void**)(&name) = funcAddrs; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* initializing static GLDispatch members*/
|
||||
|
||||
android::Mutex GLDispatch::s_lock;
|
||||
@@ -61,6 +69,9 @@ void (GLAPIENTRY *GLDispatch::glActiveTexture)(GLenum) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glBindBuffer)(GLenum,GLuint) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glBindTexture)(GLenum, GLuint) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glBlendFunc)(GLenum,GLenum) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glBlendEquation)(GLenum) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glBlendEquationSeparate)(GLenum,GLenum) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glBlendFuncSeparate)(GLenum,GLenum,GLenum,GLenum) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glBufferData)(GLenum,GLsizeiptr,const GLvoid *,GLenum) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glBufferSubData)(GLenum,GLintptr,GLsizeiptr,const GLvoid *) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glClear)(GLbitfield) = NULL;
|
||||
@@ -179,11 +190,37 @@ void (GLAPIENTRY *GLDispatch::glTexEnviv)(GLenum, GLenum, const GLint *) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glTranslatef)(GLfloat,GLfloat, GLfloat) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glVertexPointer)(GLint,GLenum,GLsizei, const GLvoid *) = NULL;
|
||||
|
||||
/* GLES 1.1 EXTENSIONS*/
|
||||
GLboolean (GLAPIENTRY *GLDispatch::glIsRenderbufferEXT) (GLuint renderbuffer) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glBindRenderbufferEXT) (GLenum target, GLuint renderbuffer) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glDeleteRenderbuffersEXT) (GLsizei n, const GLuint *renderbuffers) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glGenRenderbuffersEXT) (GLsizei n, GLuint *renderbuffers) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glRenderbufferStorageEXT) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glGetRenderbufferParameterivEXT) (GLenum target, GLenum pname, GLint *params) = NULL;
|
||||
GLboolean (GLAPIENTRY *GLDispatch::glIsFramebufferEXT) (GLuint framebuffer) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glBindFramebufferEXT) (GLenum target, GLuint framebuffer) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glDeleteFramebuffersEXT) (GLsizei n, const GLuint *framebuffers) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glGenFramebuffersEXT) (GLsizei n, GLuint *framebuffers) = NULL;
|
||||
GLenum (GLAPIENTRY *GLDispatch::glCheckFramebufferStatusEXT) (GLenum target) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glFramebufferTexture1DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glFramebufferTexture2DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glFramebufferTexture3DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glFramebufferRenderbufferEXT) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glGetFramebufferAttachmentParameterivEXT) (GLenum target, GLenum attachment, GLenum pname, GLint *params) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glGenerateMipmapEXT) (GLenum target) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glCurrentPaletteMatrixARB) (GLint index) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glMatrixIndexuivARB) (GLint size, GLuint * indices) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glMatrixIndexPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glWeightPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glTexGenf) (GLenum coord, GLenum pname, GLfloat param ) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glTexGeni) (GLenum coord, GLenum pname, GLint param ) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glTexGenfv) (GLenum coord, GLenum pname, const GLfloat *params ) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glTexGeniv) (GLenum coord, GLenum pname, const GLint *params ) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glGetTexGenfv) (GLenum coord, GLenum pname, GLfloat *params ) = NULL;
|
||||
void (GLAPIENTRY *GLDispatch::glGetTexGeniv) (GLenum coord, GLenum pname, GLint *params ) = NULL;
|
||||
|
||||
/* GLES 2.0*/
|
||||
void (GL_APIENTRY *GLDispatch::glBlendColor)(GLclampf,GLclampf,GLclampf,GLclampf) = NULL;
|
||||
void (GL_APIENTRY *GLDispatch::glBlendEquation)(GLenum) = NULL;
|
||||
void (GL_APIENTRY *GLDispatch::glBlendEquationSeparate)(GLenum,GLenum) = NULL;
|
||||
void (GL_APIENTRY *GLDispatch::glBlendFuncSeparate)(GLenum,GLenum,GLenum,GLenum) = NULL;
|
||||
void (GL_APIENTRY *GLDispatch::glStencilFuncSeparate)(GLenum,GLenum,GLint,GLuint) = NULL;
|
||||
void (GL_APIENTRY *GLDispatch::glStencilMaskSeparate)(GLenum,GLuint) = NULL;
|
||||
void (GL_APIENTRY *GLDispatch::glGenerateMipmap)(GLenum) = NULL;
|
||||
@@ -273,6 +310,9 @@ void GLDispatch::dispatchFuncs(GLESVersion version){
|
||||
LOAD_GL_FUNC(glBindBuffer);
|
||||
LOAD_GL_FUNC(glBindTexture);
|
||||
LOAD_GL_FUNC(glBlendFunc);
|
||||
LOAD_GL_FUNC(glBlendEquation);
|
||||
LOAD_GL_FUNC(glBlendEquationSeparate);
|
||||
LOAD_GL_FUNC(glBlendFuncSeparate);
|
||||
LOAD_GL_FUNC(glBufferData);
|
||||
LOAD_GL_FUNC(glBufferSubData);
|
||||
LOAD_GL_FUNC(glClear);
|
||||
@@ -391,14 +431,40 @@ void GLDispatch::dispatchFuncs(GLESVersion version){
|
||||
LOAD_GL_FUNC(glTexEnviv);
|
||||
LOAD_GL_FUNC(glTranslatef);
|
||||
LOAD_GL_FUNC(glVertexPointer);
|
||||
|
||||
LOAD_GLEXT_FUNC(glIsRenderbufferEXT);
|
||||
LOAD_GLEXT_FUNC(glBindRenderbufferEXT);
|
||||
LOAD_GLEXT_FUNC(glDeleteRenderbuffersEXT);
|
||||
LOAD_GLEXT_FUNC(glGenRenderbuffersEXT);
|
||||
LOAD_GLEXT_FUNC(glRenderbufferStorageEXT);
|
||||
LOAD_GLEXT_FUNC(glGetRenderbufferParameterivEXT);
|
||||
LOAD_GLEXT_FUNC(glIsFramebufferEXT);
|
||||
LOAD_GLEXT_FUNC(glBindFramebufferEXT);
|
||||
LOAD_GLEXT_FUNC(glDeleteFramebuffersEXT);
|
||||
LOAD_GLEXT_FUNC(glGenFramebuffersEXT);
|
||||
LOAD_GLEXT_FUNC(glCheckFramebufferStatusEXT);
|
||||
LOAD_GLEXT_FUNC(glFramebufferTexture1DEXT);
|
||||
LOAD_GLEXT_FUNC(glFramebufferTexture2DEXT);
|
||||
LOAD_GLEXT_FUNC(glFramebufferTexture3DEXT);
|
||||
LOAD_GLEXT_FUNC(glFramebufferRenderbufferEXT);
|
||||
LOAD_GLEXT_FUNC(glGetFramebufferAttachmentParameterivEXT);
|
||||
LOAD_GLEXT_FUNC(glGenerateMipmapEXT);
|
||||
LOAD_GLEXT_FUNC(glCurrentPaletteMatrixARB);
|
||||
LOAD_GLEXT_FUNC(glMatrixIndexuivARB);
|
||||
LOAD_GLEXT_FUNC(glMatrixIndexPointerARB);
|
||||
LOAD_GLEXT_FUNC(glWeightPointerARB);
|
||||
LOAD_GLEXT_FUNC(glTexGenf);
|
||||
LOAD_GLEXT_FUNC(glTexGeni);
|
||||
LOAD_GLEXT_FUNC(glTexGenfv);
|
||||
LOAD_GLEXT_FUNC(glTexGeniv);
|
||||
LOAD_GLEXT_FUNC(glGetTexGenfv);
|
||||
LOAD_GLEXT_FUNC(glGetTexGeniv);
|
||||
|
||||
} else if (version == GLES_2_0){
|
||||
|
||||
/* Loading OpenGL functions which are needed ONLY for implementing GLES 2.0*/
|
||||
|
||||
LOAD_GL_FUNC(glBlendColor);
|
||||
LOAD_GL_FUNC(glBlendEquation);
|
||||
LOAD_GL_FUNC(glBlendEquationSeparate);
|
||||
LOAD_GL_FUNC(glBlendFuncSeparate);
|
||||
LOAD_GL_FUNC(glBlendFuncSeparate);
|
||||
LOAD_GL_FUNC(glStencilFuncSeparate);
|
||||
LOAD_GL_FUNC(glGenerateMipmap);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <GLcommon/GLEScontext.h>
|
||||
#include <GLcommon/GLfixed_ops.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
//decleration
|
||||
static int findMaxIndex(GLsizei count,GLenum type,const GLvoid* indices);
|
||||
@@ -17,14 +19,17 @@ GLESFloatArrays::~GLESFloatArrays() {
|
||||
|
||||
GLDispatch GLEScontext::s_glDispatch;
|
||||
android::Mutex GLEScontext::s_lock;
|
||||
std::string* GLEScontext::s_glExtensions= NULL;
|
||||
GLSupport GLEScontext::s_glSupport;
|
||||
|
||||
GLEScontext::GLEScontext():
|
||||
m_initialized(false) ,
|
||||
m_activeTexture(0) ,
|
||||
m_glError(GL_NO_ERROR) ,
|
||||
m_arrayBuffer(0) ,
|
||||
m_elementBuffer(0){};
|
||||
|
||||
m_elementBuffer(0) {
|
||||
|
||||
};
|
||||
|
||||
GLenum GLEScontext::getGLerror() {
|
||||
return m_glError;
|
||||
@@ -337,3 +342,58 @@ bool GLEScontext::setBufferSubData(GLenum target,GLintptr offset,GLsizeiptr size
|
||||
GLESbuffer* vbo = static_cast<GLESbuffer*>(m_shareGroup->getObjectData(VERTEXBUFFER,bufferName).Ptr());
|
||||
return vbo->setSubBuffer(offset,size,data);
|
||||
}
|
||||
|
||||
const char * GLEScontext::getExtensionString() {
|
||||
const char * ret;
|
||||
s_lock.lock();
|
||||
if (s_glExtensions)
|
||||
ret = s_glExtensions->c_str();
|
||||
else
|
||||
ret="";
|
||||
s_lock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void GLEScontext::getGlobalLock() {
|
||||
s_lock.lock();
|
||||
}
|
||||
|
||||
void GLEScontext::releaseGlobalLock() {
|
||||
s_lock.unlock();
|
||||
}
|
||||
|
||||
|
||||
void GLEScontext::initCapsLocked(const GLubyte * extensionString)
|
||||
{
|
||||
int maxTexUnits;
|
||||
const char* cstring = (const char*)extensionString;
|
||||
|
||||
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_LIGHTS,&s_glSupport.maxLights);
|
||||
s_glDispatch.glGetIntegerv(GL_MAX_TEXTURE_SIZE,&s_glSupport.maxTexSize);
|
||||
s_glDispatch.glGetIntegerv(GL_MAX_TEXTURE_UNITS,&maxTexUnits);
|
||||
s_glSupport.maxTexUnits = maxTexUnits < MAX_TEX_UNITS ? maxTexUnits:MAX_TEX_UNITS;
|
||||
|
||||
if (strstr(cstring,"GL_EXT_bgra ")!=NULL)
|
||||
s_glSupport.GL_EXT_TEXTURE_FORMAT_BGRA8888 = true;
|
||||
|
||||
if (strstr(cstring,"GL_EXT_framebuffer_object ")!=NULL)
|
||||
s_glSupport.GL_EXT_FRAMEBUFFER_OBJECT = true;
|
||||
|
||||
if (strstr(cstring,"GL_ARB_vertex_blend ")!=NULL)
|
||||
s_glSupport.GL_ARB_VERTEX_BLEND = true;
|
||||
|
||||
if (strstr(cstring,"GL_ARB_matrix_palette ")!=NULL)
|
||||
s_glSupport.GL_ARB_MATRIX_PALETTE = true;
|
||||
|
||||
if (strstr(cstring,"GL_NV_packed_depth_stencil ")!=NULL)
|
||||
s_glSupport.GL_NV_PACKED_DEPTH_STENCIL = true;
|
||||
|
||||
if (strstr(cstring,"GL_OES_read_format ")!=NULL)
|
||||
s_glSupport.GL_OES_READ_FORMAT = true;
|
||||
|
||||
//init extension string
|
||||
s_glExtensions = new std::string("");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
#include<GLcommon/GLESvalidate.h>
|
||||
#include<GLES/gl.h>
|
||||
#include<GLES/glext.h>
|
||||
|
||||
|
||||
bool GLESvalidate::textureEnum(GLenum e,unsigned int maxTex) {
|
||||
return e >= GL_TEXTURE0 && e <= (GL_TEXTURE0 + maxTex);
|
||||
}
|
||||
|
||||
bool GLESvalidate::pixelType(GLenum type) {
|
||||
bool GLESvalidate::pixelType(GLEScontext * ctx, GLenum type) {
|
||||
if (ctx && ctx->getCaps()->GL_NV_PACKED_DEPTH_STENCIL) {
|
||||
if (type == GL_UNSIGNED_INT_24_8_OES)
|
||||
return true;
|
||||
}
|
||||
switch(type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
case GL_UNSIGNED_SHORT_5_6_5:
|
||||
@@ -27,7 +33,11 @@ bool GLESvalidate::pixelOp(GLenum format,GLenum type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GLESvalidate::pixelFrmt(GLenum format) {
|
||||
bool GLESvalidate::pixelFrmt(GLEScontext* ctx ,GLenum format) {
|
||||
if (ctx && ctx->getCaps()->GL_EXT_TEXTURE_FORMAT_BGRA8888 && format == GL_BGRA_EXT)
|
||||
return true;
|
||||
if (ctx && ctx->getCaps()->GL_NV_PACKED_DEPTH_STENCIL && format == GL_DEPTH_STENCIL_OES)
|
||||
return true;
|
||||
switch(format) {
|
||||
case GL_ALPHA:
|
||||
case GL_RGB:
|
||||
@@ -62,5 +72,81 @@ bool GLESvalidate::drawMode(GLenum mode) {
|
||||
}
|
||||
|
||||
bool GLESvalidate::drawType(GLenum mode) {
|
||||
return mode == GL_UNSIGNED_BYTE || mode == GL_UNSIGNED_SHORT;
|
||||
return mode == GL_UNSIGNED_BYTE ||
|
||||
mode == GL_UNSIGNED_SHORT ||
|
||||
mode == GL_UNSIGNED_INT;
|
||||
}
|
||||
|
||||
bool GLESvalidate::textureTarget(GLenum target) {
|
||||
return target==GL_TEXTURE_2D || target==GL_TEXTURE_CUBE_MAP;
|
||||
}
|
||||
|
||||
bool GLESvalidate::textureTargetLimited(GLenum target) {
|
||||
return target==GL_TEXTURE_2D;
|
||||
}
|
||||
|
||||
bool GLESvalidate::textureTargetEx(GLenum target) {
|
||||
switch(target) {
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES:
|
||||
case GL_TEXTURE_2D:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLESvalidate::blendEquationMode(GLenum mode){
|
||||
return mode == GL_FUNC_ADD ||
|
||||
mode == GL_FUNC_SUBTRACT ||
|
||||
mode == GL_FUNC_REVERSE_SUBTRACT;
|
||||
}
|
||||
|
||||
bool GLESvalidate::framebufferTarget(GLenum target){
|
||||
return target == GL_FRAMEBUFFER;
|
||||
}
|
||||
|
||||
bool GLESvalidate::framebufferAttachment(GLenum attachment){
|
||||
switch(attachment){
|
||||
case GL_COLOR_ATTACHMENT0:
|
||||
case GL_DEPTH_ATTACHMENT:
|
||||
case GL_STENCIL_ATTACHMENT:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLESvalidate::framebufferAttachmentParams(GLenum pname){
|
||||
switch(pname){
|
||||
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
|
||||
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
|
||||
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
|
||||
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLESvalidate::renderbufferTarget(GLenum target){
|
||||
return target == GL_RENDERBUFFER;
|
||||
}
|
||||
|
||||
bool GLESvalidate::renderbufferParams(GLenum pname){
|
||||
switch(pname){
|
||||
case GL_RENDERBUFFER_WIDTH:
|
||||
case GL_RENDERBUFFER_HEIGHT:
|
||||
case GL_RENDERBUFFER_INTERNAL_FORMAT:
|
||||
case GL_RENDERBUFFER_RED_SIZE:
|
||||
case GL_RENDERBUFFER_GREEN_SIZE:
|
||||
case GL_RENDERBUFFER_BLUE_SIZE:
|
||||
case GL_RENDERBUFFER_ALPHA_SIZE:
|
||||
case GL_RENDERBUFFER_DEPTH_SIZE:
|
||||
case GL_RENDERBUFFER_STENCIL_SIZE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,16 +19,12 @@
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES2/gl2.h>
|
||||
#include <utils/threads.h>
|
||||
#include "gldefs.h"
|
||||
#include "GLutils.h"
|
||||
|
||||
#define GLAPIENTRY GL_APIENTRY
|
||||
|
||||
typedef double GLclampd; /* double precision float in [0,1] */
|
||||
typedef double GLdouble; /* double precision float */
|
||||
|
||||
typedef void(*FUNCPTR)();
|
||||
|
||||
|
||||
class GLDispatch
|
||||
{
|
||||
public:
|
||||
@@ -41,6 +37,9 @@ public:
|
||||
static void (GLAPIENTRY *glBindBuffer) (GLenum target, GLuint buffer);
|
||||
static void (GLAPIENTRY *glBindTexture) (GLenum target, GLuint texture);
|
||||
static void (GLAPIENTRY *glBlendFunc) (GLenum sfactor, GLenum dfactor);
|
||||
static void (GLAPIENTRY *glBlendEquation)( GLenum mode );
|
||||
static void (GLAPIENTRY *glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);
|
||||
static void (GLAPIENTRY *glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
static void (GLAPIENTRY *glBufferData) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
|
||||
static void (GLAPIENTRY *glBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
|
||||
static void (GLAPIENTRY *glClear) (GLbitfield mask);
|
||||
@@ -92,6 +91,7 @@ public:
|
||||
static void (GLAPIENTRY *glTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
static void (GLAPIENTRY *glViewport) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
|
||||
/* OpenGL functions which are needed ONLY for implementing GLES 1.1*/
|
||||
static void (GLAPIENTRY *glAlphaFunc) (GLenum func, GLclampf ref);
|
||||
static void (GLAPIENTRY *glBegin)( GLenum mode );
|
||||
@@ -159,11 +159,37 @@ public:
|
||||
static void (GLAPIENTRY *glTranslatef) (GLfloat x, GLfloat y, GLfloat z);
|
||||
static void (GLAPIENTRY *glVertexPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
|
||||
/* OpenGL functions which are needed ONLY for implementing GLES 1.1 EXTENSIONS*/
|
||||
static GLboolean (GLAPIENTRY *glIsRenderbufferEXT) (GLuint renderbuffer);
|
||||
static void (GLAPIENTRY *glBindRenderbufferEXT) (GLenum target, GLuint renderbuffer);
|
||||
static void (GLAPIENTRY *glDeleteRenderbuffersEXT) (GLsizei n, const GLuint *renderbuffers);
|
||||
static void (GLAPIENTRY *glGenRenderbuffersEXT) (GLsizei n, GLuint *renderbuffers);
|
||||
static void (GLAPIENTRY *glRenderbufferStorageEXT) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
static void (GLAPIENTRY *glGetRenderbufferParameterivEXT) (GLenum target, GLenum pname, GLint *params);
|
||||
static GLboolean (GLAPIENTRY *glIsFramebufferEXT) (GLuint framebuffer);
|
||||
static void (GLAPIENTRY *glBindFramebufferEXT) (GLenum target, GLuint framebuffer);
|
||||
static void (GLAPIENTRY *glDeleteFramebuffersEXT) (GLsizei n, const GLuint *framebuffers);
|
||||
static void (GLAPIENTRY *glGenFramebuffersEXT) (GLsizei n, GLuint *framebuffers);
|
||||
static GLenum (GLAPIENTRY *glCheckFramebufferStatusEXT) (GLenum target);
|
||||
static void (GLAPIENTRY *glFramebufferTexture1DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
static void (GLAPIENTRY *glFramebufferTexture2DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
static void (GLAPIENTRY *glFramebufferTexture3DEXT) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
||||
static void (GLAPIENTRY *glFramebufferRenderbufferEXT) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
static void (GLAPIENTRY *glGetFramebufferAttachmentParameterivEXT) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
static void (GLAPIENTRY *glGenerateMipmapEXT) (GLenum target);
|
||||
static void (GLAPIENTRY *glCurrentPaletteMatrixARB) (GLint index);
|
||||
static void (GLAPIENTRY *glMatrixIndexuivARB) (GLint size, GLuint * indices);
|
||||
static void (GLAPIENTRY *glMatrixIndexPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
|
||||
static void (GLAPIENTRY *glWeightPointerARB) (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
|
||||
static void (GLAPIENTRY *glTexGenf) (GLenum coord, GLenum pname, GLfloat param );
|
||||
static void (GLAPIENTRY *glTexGeni) (GLenum coord, GLenum pname, GLint param );
|
||||
static void (GLAPIENTRY *glTexGenfv) (GLenum coord, GLenum pname, const GLfloat *params );
|
||||
static void (GLAPIENTRY *glTexGeniv) (GLenum coord, GLenum pname, const GLint *params );
|
||||
static void (GLAPIENTRY *glGetTexGenfv) (GLenum coord, GLenum pname, GLfloat *params );
|
||||
static void (GLAPIENTRY *glGetTexGeniv) (GLenum coord, GLenum pname, GLint *params );
|
||||
|
||||
/* Loading OpenGL functions which are needed ONLY for implementing GLES 2.0*/
|
||||
static void (GL_APIENTRY *glBlendColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
static void (GL_APIENTRY *glBlendEquation)( GLenum mode );
|
||||
static void (GL_APIENTRY *glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);
|
||||
static void (GL_APIENTRY *glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
|
||||
static void (GL_APIENTRY *glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
static void (GL_APIENTRY *glStencilMaskSeparate)(GLenum face, GLuint mask);
|
||||
static void (GL_APIENTRY *glGenerateMipmap)(GLenum target);
|
||||
|
||||
@@ -5,11 +5,30 @@
|
||||
#include "GLESpointer.h"
|
||||
#include "objectNameManager.h"
|
||||
#include <utils/threads.h>
|
||||
#include <string>
|
||||
|
||||
#define MAX_TEX_UNITS 8
|
||||
|
||||
typedef std::map<GLenum,GLESpointer*> ArraysMap;
|
||||
|
||||
struct GLSupport {
|
||||
GLSupport():maxLights(0),maxVertexAttribs(0),maxClipPlane(0),maxTexUnits(0),maxTexSize(0) , \
|
||||
GL_EXT_TEXTURE_FORMAT_BGRA8888(false), GL_EXT_FRAMEBUFFER_OBJECT(false), \
|
||||
GL_ARB_VERTEX_BLEND(false), GL_ARB_MATRIX_PALETTE(false), \
|
||||
GL_NV_PACKED_DEPTH_STENCIL(false) , GL_OES_READ_FORMAT(false) {} ;
|
||||
int maxLights;
|
||||
int maxVertexAttribs;
|
||||
int maxClipPlane;
|
||||
int maxTexUnits;
|
||||
int maxTexSize;
|
||||
bool GL_EXT_TEXTURE_FORMAT_BGRA8888;
|
||||
bool GL_EXT_FRAMEBUFFER_OBJECT;
|
||||
bool GL_ARB_VERTEX_BLEND;
|
||||
bool GL_ARB_MATRIX_PALETTE;
|
||||
bool GL_NV_PACKED_DEPTH_STENCIL;
|
||||
bool GL_OES_READ_FORMAT;
|
||||
};
|
||||
|
||||
struct GLESFloatArrays
|
||||
{
|
||||
GLESFloatArrays(){};
|
||||
@@ -42,19 +61,30 @@ public:
|
||||
void getBufferUsage(GLenum target,GLint* param);
|
||||
bool setBufferData(GLenum target,GLsizeiptr size,const GLvoid* data,GLenum usage);
|
||||
bool setBufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,const GLvoid* data);
|
||||
|
||||
const char * getExtensionString();
|
||||
void getGlobalLock();
|
||||
void releaseGlobalLock();
|
||||
virtual GLSupport* getCaps(){return &s_glSupport;};
|
||||
virtual ~GLEScontext();
|
||||
|
||||
static GLDispatch& dispatcher(){return s_glDispatch;};
|
||||
|
||||
static int getMaxLights(){return s_glSupport.maxLights;}
|
||||
static int getMaxClipPlanes(){return s_glSupport.maxClipPlane;}
|
||||
static int getMaxTexUnits(){return s_glSupport.maxTexUnits;}
|
||||
static int getMaxTexSize(){return s_glSupport.maxTexSize;}
|
||||
|
||||
|
||||
protected:
|
||||
void chooseConvertMethod(GLESFloatArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id,unsigned int& index);
|
||||
|
||||
void initCapsLocked(const GLubyte * extensionString);
|
||||
static android::Mutex s_lock;
|
||||
static GLDispatch s_glDispatch;
|
||||
bool m_initialized;
|
||||
unsigned int m_activeTexture;
|
||||
ArraysMap m_map;
|
||||
static std::string* s_glExtensions;
|
||||
static GLSupport s_glSupport;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -17,17 +17,26 @@
|
||||
#define GLES_VALIDATE_H
|
||||
|
||||
#include <GLES/gl.h>
|
||||
|
||||
#include "GLEScontext.h"
|
||||
struct GLESvalidate
|
||||
{
|
||||
static bool textureEnum(GLenum e,unsigned int maxTex);
|
||||
static bool pixelType(GLenum type);
|
||||
static bool pixelType(GLEScontext * ctx,GLenum type);
|
||||
static bool pixelOp(GLenum format,GLenum type);
|
||||
static bool pixelFrmt(GLenum format);
|
||||
static bool pixelFrmt(GLEScontext* ctx , GLenum format);
|
||||
static bool bufferTarget(GLenum target);
|
||||
static bool bufferParam(GLenum param);
|
||||
static bool drawMode(GLenum mode);
|
||||
static bool drawType(GLenum mode);
|
||||
static bool textureTarget(GLenum target);
|
||||
static bool textureTargetLimited(GLenum target);
|
||||
static bool textureTargetEx(GLenum target);
|
||||
static bool blendEquationMode(GLenum mode);
|
||||
static bool framebufferTarget(GLenum target);
|
||||
static bool framebufferAttachment(GLenum attachment);
|
||||
static bool framebufferAttachmentParams(GLenum pname);
|
||||
static bool renderbufferTarget(GLenum target);
|
||||
static bool renderbufferParams(GLenum pname);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
typedef double GLclampd; /* double precision float in [0,1] */
|
||||
typedef double GLdouble; /* double precision float */
|
||||
|
||||
#define GL_TEXTURE_GEN_S 0x0C60
|
||||
#define GL_TEXTURE_GEN_T 0x0C61
|
||||
#define GL_TEXTURE_GEN_R 0x0C62
|
||||
@@ -17,7 +17,8 @@ LOCAL_SRC_FILES:= \
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libGLcommon \
|
||||
libEGL_translator \
|
||||
libGLES_CM_translator
|
||||
libGLES_CM_translator \
|
||||
libGLcommon
|
||||
|
||||
LOCAL_CFLAGS += $(SDL_CFLAGS) -g -O0
|
||||
LOCAL_LDLIBS += $(SDL_LDLIBS)
|
||||
|
||||
@@ -16,7 +16,8 @@ LOCAL_SRC_FILES:= \
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libGLcommon \
|
||||
libEGL_translator \
|
||||
libGLES_V2_translator
|
||||
libGLES_V2_translator \
|
||||
libGLcommon
|
||||
|
||||
LOCAL_CFLAGS += $(SDL_CFLAGS) -g -O0
|
||||
LOCAL_LDLIBS += $(SDL_LDLIBS)
|
||||
|
||||
Reference in New Issue
Block a user