Commit: 91056337a8e6a608c71aa1d8e73954882d21d308 Author: Dalai Felinto Date: Mon Apr 10 08:30:09 2017 +0200 Branches: blender2.8 https://developer.blender.org/rB91056337a8e6a608c71aa1d8e73954882d21d308
Add stubs to build WITH_GL_PROFILE_CORE This is an auto-generated list, crossing gl-deprecated.h, glew.h and the Blender code. It allows Blender to build with core profile. WITH_OPENGL_LEGACY=ON: nothing changes WITH_OPENGL_LEGACY=OFF and WITH_GL_PROFILE_CORE=OFF: It stubs deprecated legacy calls. WITH_OPENGL_LEGACY=OFF and WITH_GL_PROFILE_CORE=ON: It stubs deprecated legacy calls thus allowing Blender to build with core profile only. Technically you only want to use WITH_OPENGL_LEGACY=OFF when WITH_GL_PROFILE_CORE=ON. But it doesn't hurt to have it working for both scenarios. Reviewed by: merwin Differential Revision: https://developer.blender.org/D2610 =================================================================== M intern/glew-mx/glew-mx.h M source/blender/gpu/GPU_legacy_stubs.h =================================================================== diff --git a/intern/glew-mx/glew-mx.h b/intern/glew-mx/glew-mx.h index ed17ea4a0e6..813e95958b5 100644 --- a/intern/glew-mx/glew-mx.h +++ b/intern/glew-mx/glew-mx.h @@ -85,7 +85,7 @@ extern MXContext *_mx_context; /* If compiling only for OpenGL 3.2 Core Profile then we should make sure * no legacy API entries or symbolic constants are used. */ -#if defined(WITH_GL_PROFILE_CORE) && !defined(WITH_GL_PROFILE_COMPAT) && !defined(WITH_GL_PROFILE_ES20) +#if (!defined(WITH_LEGACY_OPENGL)) || defined(WITH_GL_PROFILE_CORE) && !defined(WITH_GL_PROFILE_COMPAT) && !defined(WITH_GL_PROFILE_ES20) # include "intern/gl-deprecated.h" #endif diff --git a/source/blender/gpu/GPU_legacy_stubs.h b/source/blender/gpu/GPU_legacy_stubs.h index c115b3eb617..33ac431566f 100644 --- a/source/blender/gpu/GPU_legacy_stubs.h +++ b/source/blender/gpu/GPU_legacy_stubs.h @@ -44,11 +44,18 @@ #include "BLI_utildefines.h" -#define _GL_VOID static inline void -#define _GL_VOID_RET {} +#define _GL_PREFIX static inline -#define _GL_INT static inline GLint +#define _GL_BOOL _GL_PREFIX GLboolean +#define _GL_BOOL_RET { return false; } +#define _GL_ENUM _GL_PREFIX GLenum +#define _GL_ENUM_RET { return 0; } +#define _GL_INT _GL_PREFIX GLint #define _GL_INT_RET { return 0; } +#define _GL_UINT _GL_PREFIX GLuint +#define _GL_UINT_RET { return 0; } +#define _GL_VOID _GL_PREFIX void +#define _GL_VOID_RET {} static bool disable_enable_check(GLenum cap) { @@ -64,180 +71,359 @@ static bool disable_enable_check(GLenum cap) ); } -static bool tex_env_check(GLenum target, GLenum pname) -{ - return (ELEM(target, GL_TEXTURE_ENV) || - (target == GL_TEXTURE_FILTER_CONTROL && pname == GL_TEXTURE_LOD_BIAS)); -} - -#define glAlphaFunc oldAlphaFunc -_GL_VOID oldAlphaFunc (GLenum func, GLclampf ref) _GL_VOID_RET - -#define glBegin oldBegin -_GL_VOID oldBegin (GLenum mode) _GL_VOID_RET - -#define glBitmap oldBitmap -_GL_VOID oldBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) _GL_VOID_RET - -#define glClipPlane oldClipPlane -_GL_VOID oldClipPlane (GLenum plane, const GLdouble *equation) _GL_VOID_RET - -#define glColor3f oldColor3f -_GL_VOID oldColor3f (GLfloat red, GLfloat green, GLfloat blue) _GL_VOID_RET - -#define glColor3fv oldColor3fv -_GL_VOID oldColor3fv (const GLfloat *v) _GL_VOID_RET - -#define glColor3ub oldColor3ub -_GL_VOID oldColor3ub (GLubyte red, GLubyte green, GLubyte blue) _GL_VOID_RET - -#define glColor3ubv oldColor3ubv -_GL_VOID oldColor3ubv (const GLubyte *v) _GL_VOID_RET - -#define glColor4f oldColor4f -_GL_VOID oldColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) _GL_VOID_RET - -#define glColor4ub oldColor4ub -_GL_VOID oldColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) _GL_VOID_RET - -#define glColor4ubv oldColor4ubv -_GL_VOID oldColor4ubv (const GLubyte *v) _GL_VOID_RET - -#define glColorPointer oldColorPointer -_GL_VOID oldColorPointer (GLint size, GLenum type, GLsizei stride, const void *pointer) _GL_VOID_RET - -_GL_VOID oldDisable (GLenum cap) +_GL_VOID USE_CAREFULLY_glDisable (GLenum cap) { if (!disable_enable_check(cap)) { glDisable(cap); } } -#define glDisable oldDisable - -#define glDisableClientState oldDisableClientState -_GL_VOID oldDisableClientState (GLenum array) _GL_VOID_RET +#define glDisable USE_CAREFULLY_glDisable -_GL_VOID oldEnable (GLenum cap) +_GL_VOID USE_CAREFULLY_glEnable (GLenum cap) { if (!disable_enable_check(cap)) { glEnable(cap); } } -#define glEnable oldEnable - -#define glEnableClientState oldEnableClientState -_GL_VOID oldEnableClientState (GLenum array) _GL_VOID_RET - -#define glEnd oldEnd -_GL_VOID oldEnd (void) _GL_VOID_RET - -#define glInitNames oldInitNames -_GL_VOID oldInitNames (void) _GL_VOID_RET - -#define glLightf oldLightf -_GL_VOID oldLightf (GLenum light, GLenum pname, GLfloat param) _GL_VOID_RET - -#define glLightfv oldLightfv -_GL_VOID oldLightfv (GLenum light, GLenum pname, const GLfloat *params) _GL_VOID_RET - -#define glLineStipple oldLineStipple -_GL_VOID oldLineStipple (GLint factor, GLushort pattern) _GL_VOID_RET - -#define glLoadName oldLoadName -_GL_VOID oldLoadName (GLuint name) _GL_VOID_RET - -#define glMaterialfv oldMaterialfv -_GL_VOID oldMaterialfv (GLenum face, GLenum pname, const GLfloat *params) _GL_VOID_RET - -#define glMateriali oldMateriali -_GL_VOID oldMateriali (GLenum face, GLenum pname, GLint param) _GL_VOID_RET - -#define glNormal3fv oldNormal3fv -_GL_VOID oldNormal3fv (const GLfloat *v) _GL_VOID_RET - -#define glNormal3sv oldNormal3sv -_GL_VOID oldNormal3sv (const GLshort *v) _GL_VOID_RET - -#define glNormalPointer oldNormalPointer -_GL_VOID oldNormalPointer (GLenum type, GLsizei stride, const void *pointer) _GL_VOID_RET - -#define glPopName oldPopName -_GL_VOID oldPopName (void) _GL_VOID_RET - -#define glPushName oldPushName -_GL_VOID oldPushName (GLuint name) _GL_VOID_RET +#define glEnable USE_CAREFULLY_glEnable -#define glRasterPos2f oldRasterPos2f -_GL_VOID oldRasterPos2f (GLfloat x, GLfloat y) _GL_VOID_RET - -#define glRenderMode oldRenderMode -_GL_INT oldRenderMode (GLenum mode) _GL_INT_RET - -#define glSelectBuffer oldSelectBuffer -_GL_VOID oldSelectBuffer (GLsizei size, GLuint *buffer) _GL_VOID_RET - -#define glShadeModel oldShadeModel -_GL_VOID oldShadeModel (GLenum mode) _GL_VOID_RET - -#define glTexCoord2fv oldTexCoord2fv -_GL_VOID oldTexCoord2fv (const GLfloat *v) _GL_VOID_RET - -_GL_VOID oldTexEnvf(GLenum target, GLenum pname, GLint param) -{ - if (!tex_env_check(target, pname)) { - glTexEnvf(target, pname, param); - } -} -#define glTexEnvf oldTexEnvf - -_GL_VOID oldTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) -{ - if (!tex_env_check(target, pname)) { - glTexEnvfv(target, pname, params); - } -} -#define glTexEnvfv oldTexEnvfv - -_GL_VOID oldTexEnvi(GLenum target, GLenum pname, GLint param) -{ - if (!tex_env_check(target, pname)) { - glTexEnvi(target, pname, param); - } -} -#define glTexEnvi oldTexEnvi - -_GL_VOID oldTexGeni(GLenum coord, GLenum pname, GLint param) -{ - if (pname != GL_TEXTURE_GEN_MODE) { - glTexGeni(coord, pname, param); - } -} -#define glTexGeni oldTexGeni - -#define glVertex2f oldVertex2f -_GL_VOID oldVertex2f (GLfloat x, GLfloat y) _GL_VOID_RET - -#define glVertex3f oldVertex3f -_GL_VOID oldVertex3f (GLfloat x, GLfloat y, GLfloat z) _GL_VOID_RET +/** + * Hand written cases + */ -#define glTexCoord3fv oldTexCoord3fv -_GL_VOID oldTexCoord3fv (const GLfloat *v) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glClientActiveTexture (GLenum texture) _GL_VOID_RET -#define glTexCoordPointer oldTexCoordPointer -_GL_VOID oldTexCoordPointer (GLint size, GLenum type, GLsizei stride, const void *pointer) _GL_VOID_RET -#define glVertexPointer oldVertexPointer -_GL_VOID oldVertexPointer (GLint size, GLenum type, GLsizei stride, const void *pointer) _GL_VOID_RET +/** + * List automatically generated from `gl-deprecated.h` and `glew.h` + */ -#define glVertex3fv oldVertex3fv -_GL_VOID oldVertex3fv (const GLfloat *v) _GL_VOID_RET +/** + * ENUM values + */ +#define DO_NOT_USE_GL_POINT_SIZE_RANGE 0 +#define DO_NOT_USE_GL_POINT_SIZE_GRANULARITY 0 +#define DO_NOT_USE_GL_CURRENT_FOG_COORDINATE 0 +#define DO_NOT_USE_GL_FOG_COORDINATE 0 +#define DO_NOT_USE_GL_FOG_COORDINATE_ARRAY 0 +#define DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0 +#define DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_POINTER 0 +#define DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_STRIDE 0 +#define DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_TYPE 0 +#define DO_NOT_USE_GL_FOG_COORDINATE_SOURCE 0 +#define DO_NOT_USE_GL_SOURCE0_ALPHA 0 +#define DO_NOT_USE_GL_SOURCE0_RGB 0 +#define DO_NOT_USE_GL_SOURCE1_ALPHA 0 +#define DO_NOT_USE_GL_SOURCE1_RGB 0 +#define DO_NOT_USE_GL_SOURCE2_ALPHA 0 +#define DO_NOT_USE_GL_SOURCE2_RGB 0 +#define USE_GL_CLIP_DISTANCE0 0 +#define USE_GL_CLIP_DISTANCE1 0 +#define USE_GL_CLIP_DISTANCE2 0 +#define USE_GL_CLIP_DISTANCE3 0 +#define USE_GL_CLIP_DISTANCE4 0 +#define USE_GL_CLIP_DISTANCE5 0 +#define USE_GL_COMPARE_REF_TO_TEXTURE 0 +#define USE_GL_MAX_CLIP_DISTANCES 0 +#define USE__MAX_VARYING_COMPONENTS 0 +#define USE_GL_PROGRAM_POINT_SIZE 0 +#define DO_NOT_USE_GL_CURRENT_PROGRAM 0 + +/** + * Functions + */ +_GL_VOID DO_NOT_USE_glAccum (GLenum op, GLfloat value) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glAlphaFunc (GLenum func, GLclampf ref) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glBegin (GLenum mode) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glCallList (GLuint list) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glCallLists (GLsizei n, GLenum type, const void *lists) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glClearIndex (GLfloat c) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glClipPlane (GLenum plane, const GLdouble *equation) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3b (GLbyte red, GLbyte green, GLbyte blue) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3bv (const GLbyte *v) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3d (GLdouble red, GLdouble green, GLdouble blue) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3dv (const GLdouble *v) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3f (GLfloat red, GLfloat green, GLfloat blue) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3fv (const GLfloat *v) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3i (GLint red, GLint green, GLint blue) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3iv (const GLint *v) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3s (GLshort red, GLshort green, GLshort blue) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3sv (const GLshort *v) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3ub (GLubyte red, GLubyte green, GLubyte blue) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3ubv (const GLubyte *v) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3ui (GLuint red, GLuint green, GLuint blue) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3uiv (const GLuint *v) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3us (GLushort red, GLushort green, GLushort blue) _GL_VOID_RET +_GL_VOID DO_NOT_USE_glColor3usv (const GLushort *v) _GL_VOID_RET +_GL_VOID DO_NOT_USE @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
