Stub out glGetError() calls from the release build of the OpenGL plug-in (found by ector, code by LordMark). Gives a speed-up in the OpenGL plug-in.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6039 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
skidau 2010-08-03 10:48:49 +00:00
parent ffef6affff
commit c76ba17ff4
5 changed files with 12 additions and 20 deletions

View File

@ -975,11 +975,11 @@ unsigned int
void check_for_GL_errors( const char *calling_location ) void check_for_GL_errors( const char *calling_location )
{ {
/* check for errors */ /* check for errors */
GLenum err_code = glGetError(); GLenum err_code = GL_REPORT_ERROR();
while( GL_NO_ERROR != err_code ) while( GL_NO_ERROR != err_code )
{ {
printf( "OpenGL Error @ %s: %i", calling_location, err_code ); printf( "OpenGL Error @ %s: %i", calling_location, err_code );
err_code = glGetError(); err_code = GL_REPORT_ERROR();
} }
} }
#else #else

View File

@ -116,19 +116,15 @@ void OpenGL_ReportARBProgramError();
GLuint OpenGL_ReportGLError(const char *function, const char *file, int line); GLuint OpenGL_ReportGLError(const char *function, const char *file, int line);
bool OpenGL_ReportFBOError(const char *function, const char *file, int line); bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
#if 1 #if defined(_DEBUG) || defined(DEBUGFAST)
#define GL_REPORT_ERROR() OpenGL_ReportGLError (__FUNCTION__, __FILE__, __LINE__) #define GL_REPORT_ERROR() OpenGL_ReportGLError (__FUNCTION__, __FILE__, __LINE__)
#define GL_REPORT_PROGRAM_ERROR() OpenGL_ReportARBProgramError() #define GL_REPORT_PROGRAM_ERROR() OpenGL_ReportARBProgramError()
#define GL_REPORT_FBO_ERROR() OpenGL_ReportFBOError (__FUNCTION__, __FILE__, __LINE__) #define GL_REPORT_FBO_ERROR() OpenGL_ReportFBOError (__FUNCTION__, __FILE__, __LINE__)
#define GL_REPORT_ERRORD() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
#else #else
#define GL_REPORT_ERROR() GL_NO_ERROR #define GL_REPORT_ERROR() GL_NO_ERROR
#define GL_REPORT_PROGRAM_ERROR() #define GL_REPORT_PROGRAM_ERROR()
#define GL_REPORT_FBO_ERROR() #define GL_REPORT_FBO_ERROR()
#endif
#if defined(_DEBUG) || defined(DEBUGFAST)
#define GL_REPORT_ERRORD() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
#else
#define GL_REPORT_ERRORD() #define GL_REPORT_ERRORD()
#endif #endif

View File

@ -198,7 +198,7 @@ void SetDefaultRectTexParams()
// Set some standard texture filter modes. // Set some standard texture filter modes.
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
if (glGetError() != GL_NO_ERROR) { if (GL_REPORT_ERROR() != GL_NO_ERROR) {
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP);
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
@ -479,7 +479,7 @@ bool Renderer::Init()
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
UpdateActiveConfig(); UpdateActiveConfig();
return glGetError() == GL_NO_ERROR && bSuccess; return GL_REPORT_ERROR() == GL_NO_ERROR && bSuccess;
} }
void Renderer::Shutdown(void) void Renderer::Shutdown(void)
@ -1058,7 +1058,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
u8 *data = (u8 *) malloc(3 * w * h); u8 *data = (u8 *) malloc(3 * w * h);
glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(back_rc.left, back_rc.bottom, w, h, GL_BGR, GL_UNSIGNED_BYTE, data); glReadPixels(back_rc.left, back_rc.bottom, w, h, GL_BGR, GL_UNSIGNED_BYTE, data);
if (glGetError() == GL_NO_ERROR && w > 0 && h > 0) if (GL_REPORT_ERROR() == GL_NO_ERROR && w > 0 && h > 0)
{ {
if (!s_bLastFrameDumped) if (!s_bLastFrameDumped)
{ {
@ -1102,7 +1102,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
u8 *data = (u8 *) malloc(3 * w * h); u8 *data = (u8 *) malloc(3 * w * h);
glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(back_rc.left, back_rc.bottom, w, h, GL_BGR, GL_UNSIGNED_BYTE, data); glReadPixels(back_rc.left, back_rc.bottom, w, h, GL_BGR, GL_UNSIGNED_BYTE, data);
if (glGetError() == GL_NO_ERROR) { if (GL_REPORT_ERROR() == GL_NO_ERROR) {
if (!s_bLastFrameDumped) { if (!s_bLastFrameDumped) {
sprintf(movie_file_name, "%sframedump.raw", File::GetUserPath(D_DUMPFRAMES_IDX)); sprintf(movie_file_name, "%sframedump.raw", File::GetUserPath(D_DUMPFRAMES_IDX));
f_pFrameDump = fopen(movie_file_name, "wb"); f_pFrameDump = fopen(movie_file_name, "wb");
@ -1522,7 +1522,7 @@ bool Renderer::SaveRenderTarget(const char *filename, TargetRectangle back_rc)
glReadPixels(back_rc.left, back_rc.bottom, W, H, GL_RGB, GL_UNSIGNED_BYTE, data); glReadPixels(back_rc.left, back_rc.bottom, W, H, GL_RGB, GL_UNSIGNED_BYTE, data);
// Show failure message // Show failure message
if (glGetError() != GL_NO_ERROR) if (GL_REPORT_ERROR() != GL_NO_ERROR)
{ {
OSD::AddMessage("Error capturing or saving screenshot.", 2000); OSD::AddMessage("Error capturing or saving screenshot.", 2000);
return false; return false;

View File

@ -792,7 +792,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
if (glGetError() != GL_NO_ERROR) { if (GL_REPORT_ERROR() != GL_NO_ERROR) {
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP);
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();

View File

@ -110,19 +110,15 @@ void OpenGL_ReportARBProgramError();
GLuint OpenGL_ReportGLError(const char *function, const char *file, int line); GLuint OpenGL_ReportGLError(const char *function, const char *file, int line);
bool OpenGL_ReportFBOError(const char *function, const char *file, int line); bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
#if 1 #if defined(_DEBUG) || defined(DEBUGFAST)
#define GL_REPORT_ERROR() OpenGL_ReportGLError (__FUNCTION__, __FILE__, __LINE__) #define GL_REPORT_ERROR() OpenGL_ReportGLError (__FUNCTION__, __FILE__, __LINE__)
#define GL_REPORT_PROGRAM_ERROR() OpenGL_ReportARBProgramError() #define GL_REPORT_PROGRAM_ERROR() OpenGL_ReportARBProgramError()
#define GL_REPORT_FBO_ERROR() OpenGL_ReportFBOError (__FUNCTION__, __FILE__, __LINE__) #define GL_REPORT_FBO_ERROR() OpenGL_ReportFBOError (__FUNCTION__, __FILE__, __LINE__)
#define GL_REPORT_ERRORD() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
#else #else
#define GL_REPORT_ERROR() GL_NO_ERROR #define GL_REPORT_ERROR() GL_NO_ERROR
#define GL_REPORT_PROGRAM_ERROR() #define GL_REPORT_PROGRAM_ERROR()
#define GL_REPORT_FBO_ERROR() #define GL_REPORT_FBO_ERROR()
#endif
#if defined(_DEBUG) || defined(DEBUGFAST)
#define GL_REPORT_ERRORD() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
#else
#define GL_REPORT_ERRORD() #define GL_REPORT_ERRORD()
#endif #endif