Add mini unit testing framework to Dolphin itself - use it to find bugs and verify the portable powerpc fp number classifier. also random cleanup.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3432 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-06-13 22:08:01 +00:00
parent df7b29da32
commit 31f7020b2d
18 changed files with 1159 additions and 620 deletions

View File

@ -144,7 +144,7 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
#if defined(_DEBUG) || defined(DEBUGFAST)
#define GL_REPORT_ERRORD() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
#else
#define GL_REPORT_ERRORD() GL_NO_ERROR
#define GL_REPORT_ERRORD()
#endif
#endif // GLTEST ??

View File

@ -81,8 +81,13 @@ void DrawMessages()
}
}
GL_REPORT_ERRORD();
if (enabled)
glEnable(GL_BLEND);
GL_REPORT_ERRORD();
}
} // namespace

View File

@ -1122,6 +1122,7 @@ void Renderer::SwapBuffers()
fpscount = 0;
}
// ---------------------------------------------------------------------
GL_REPORT_ERRORD();
for (int i = 0; i < 8; i++) {
glActiveTexture(GL_TEXTURE0 + i);
@ -1132,8 +1133,12 @@ void Renderer::SwapBuffers()
DrawDebugText();
GL_REPORT_ERRORD();
OSD::DrawMessages();
GL_REPORT_ERRORD();
#if defined(DVPROFILE)
if (g_bWriteProfile) {
//g_bWriteProfile = 0;
@ -1148,6 +1153,9 @@ void Renderer::SwapBuffers()
#endif
// Copy the rendered frame to the real window
OpenGL_SwapBuffers();
GL_REPORT_ERRORD();
// Clear framebuffer
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
@ -1359,6 +1367,7 @@ void Renderer::RenderText(const char* pstr, int left, int top, u32 color)
left * 2.0f / (float)nBackbufferWidth - 1,
1 - top * 2.0f / (float)nBackbufferHeight,
0, nBackbufferWidth, nBackbufferHeight);
GL_REPORT_ERRORD();
}

View File

@ -16,20 +16,7 @@
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#ifdef _WIN32
#include <windows.h>
#endif
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include "GLUtil.h"
#include <string.h>
@ -154,13 +141,28 @@ RasterFont::~RasterFont()
void RasterFont::printString(const char *s, double x, double y, double z)
{
int length = strlen(s);
if (!length)
return;
// Sanitize string to avoid GL errors.
char *s2 = new char[length + 1];
strcpy(s2, s);
for (int i = 0; i < length; i++) {
if (s2[i] < 32 || s2[i] > 126)
s2[i] = '!';
}
// go to the right spot
glRasterPos3d(x, y, z);
GL_REPORT_ERRORD();
glPushAttrib (GL_LIST_BIT);
glListBase(fontOffset);
glCallLists((GLsizei)strlen(s), GL_UNSIGNED_BYTE, (GLubyte *) s);
glPopAttrib ();
glCallLists((GLsizei)strlen(s2), GL_UNSIGNED_BYTE, (GLubyte *) s2);
GL_REPORT_ERRORD();
glPopAttrib();
GL_REPORT_ERRORD();
}
void RasterFont::printCenteredString(const char *s, double y, int screen_width, double z)