From 2482f9470632fb7fae6cd4e4f5d3e4c58fde1afc Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 10 Apr 2017 08:59:05 +0200 Subject: Expand OpenGL stubs to allow for breakpoints --- source/blender/gpu/GPU_legacy_stubs.h | 49 ++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'source/blender/gpu/GPU_legacy_stubs.h') diff --git a/source/blender/gpu/GPU_legacy_stubs.h b/source/blender/gpu/GPU_legacy_stubs.h index 33ac431566f..c1da1ec7cef 100644 --- a/source/blender/gpu/GPU_legacy_stubs.h +++ b/source/blender/gpu/GPU_legacy_stubs.h @@ -40,26 +40,57 @@ #if defined(__GNUC__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wunused-parameter" +# pragma GCC diagnostic ignored "-Wunused-function" #endif #include "BLI_utildefines.h" #define _GL_PREFIX static inline +/** + * Empty function, use for breakpoint when a depreacated + * OpenGL function is called. + */ +static void gl_deprecated(void) +{ + BLI_assert(false); +} + #define _GL_BOOL _GL_PREFIX GLboolean -#define _GL_BOOL_RET { return false; } +#define _GL_BOOL_RET { \ + gl_deprecated(); \ + return false; \ +} + #define _GL_ENUM _GL_PREFIX GLenum -#define _GL_ENUM_RET { return 0; } +#define _GL_ENUM_RET { \ + gl_deprecated(); \ + return 0; \ +} + #define _GL_INT _GL_PREFIX GLint -#define _GL_INT_RET { return 0; } +#define _GL_INT_RET { \ + gl_deprecated(); \ + return 0; \ +} + + #define _GL_UINT _GL_PREFIX GLuint -#define _GL_UINT_RET { return 0; } +#define _GL_UINT_RET { \ + gl_deprecated(); \ + return 0; \ +} + #define _GL_VOID _GL_PREFIX void -#define _GL_VOID_RET {} +#define _GL_VOID_RET { \ + gl_deprecated(); \ +} static bool disable_enable_check(GLenum cap) { - return ELEM(cap, + const bool is_deprecated = \ + ELEM( + cap, GL_ALPHA_TEST, GL_LINE_STIPPLE, GL_POINT_SPRITE, @@ -69,6 +100,12 @@ static bool disable_enable_check(GLenum cap) GL_TEXTURE_GEN_T, -1 ); + + if (is_deprecated) { + gl_deprecated(); + } + + return is_deprecated; } _GL_VOID USE_CAREFULLY_glDisable (GLenum cap) -- cgit v1.2.3