1 #ifndef GLES_MACROS_H 2 #define GLES_MACROS_H 3 4 #define GET_CTX() \ 5 if(!s_eglIface) return; \ 6 GLEScontext *ctx = s_eglIface->getGLESContext(); \ 7 8 #define GET_CTX_CM() \ 9 if(!s_eglIface) return; \ 10 GLEScmContext *ctx = static_cast<GLEScmContext *>(s_eglIface->getGLESContext()); \ 11 if(!ctx) return; 12 13 #define GET_CTX_V2() \ 14 if(!s_eglIface) return; \ 15 GLESv2Context *ctx = static_cast<GLESv2Context *>(s_eglIface->getGLESContext()); \ 16 if(!ctx) return; 17 18 #define GET_CTX_RET(failure_ret) \ 19 if(!s_eglIface) return failure_ret; \ 20 GLEScontext *ctx = s_eglIface->getGLESContext(); \ 21 if(!ctx) return failure_ret; 22 23 #define GET_CTX_CM_RET(failure_ret) \ 24 if(!s_eglIface) return failure_ret; \ 25 GLEScmContext *ctx = static_cast<GLEScmContext *>(s_eglIface->getGLESContext()); \ 26 if(!ctx) return failure_ret; 27 28 #define GET_CTX_V2_RET(failure_ret) \ 29 if(!s_eglIface) return failure_ret; \ 30 GLESv2Context *ctx = static_cast<GLESv2Context *>(s_eglIface->getGLESContext()); \ 31 if(!ctx) return failure_ret; 32 33 34 #define SET_ERROR_IF(condition,err) if((condition)) { \ 35 fprintf(stderr, "%s:%s:%d error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \ 36 ctx->setGLerror(err); \ 37 return; \ 38 } 39 40 41 #define RET_AND_SET_ERROR_IF(condition,err,ret) if((condition)) { \ 42 fprintf(stderr, "%s:%s:%d error 0x%x\n", __FILE__, __FUNCTION__, __LINE__, err); \ 43 ctx->setGLerror(err); \ 44 return ret; \ 45 } 46 47 #endif 48