summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/graphicsmanager.cpp2
-rw-r--r--src/render/mobileopengl2graphics.cpp33
-rw-r--r--src/render/mobileopenglgraphics.cpp24
-rw-r--r--src/render/modernopenglgraphics.cpp33
-rw-r--r--src/render/normalopenglgraphics.cpp45
-rw-r--r--src/render/opengl/mglemu.cpp3
-rw-r--r--src/resources/openglimagehelper.cpp23
7 files changed, 162 insertions, 1 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 2cc41bb15..962faf860 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -1490,7 +1490,7 @@ std::string GraphicsManager::errorToString(const GLenum error)
default:
break;
}
- return errmsg;
+ return "OpenGL error: " + errmsg;
}
return "";
}
diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp
index a9bb2dbeb..7ec1d601f 100644
--- a/src/render/mobileopengl2graphics.cpp
+++ b/src/render/mobileopengl2graphics.cpp
@@ -289,6 +289,9 @@ void MobileOpenGL2Graphics::drawQuad(const int srcX,
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void MobileOpenGL2Graphics::drawRescaledQuad(const int srcX, const int srcY,
@@ -320,6 +323,9 @@ void MobileOpenGL2Graphics::drawRescaledQuad(const int srcX, const int srcY,
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void MobileOpenGL2Graphics::drawImage(const Image *restrict const image,
@@ -378,6 +384,9 @@ void MobileOpenGL2Graphics::testDraw() restrict2
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
// glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void MobileOpenGL2Graphics::drawImageCached(const Image *restrict const image
@@ -603,6 +612,9 @@ inline void MobileOpenGL2Graphics::drawVertexes(const
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, *ivp / 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
}
@@ -927,6 +939,9 @@ void MobileOpenGL2Graphics::drawPoint(int x, int y) restrict2
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_POINTS, 0, 1);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void MobileOpenGL2Graphics::drawLine(int x1, int y1,
@@ -946,6 +961,9 @@ void MobileOpenGL2Graphics::drawLine(int x1, int y1,
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINES, 0, 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void MobileOpenGL2Graphics::drawRectangle(const Rect &restrict rect) restrict2
@@ -971,6 +989,9 @@ void MobileOpenGL2Graphics::drawRectangle(const Rect &restrict rect) restrict2
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINE_LOOP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void MobileOpenGL2Graphics::fillRectangle(const Rect &restrict rect) restrict2
@@ -996,6 +1017,9 @@ void MobileOpenGL2Graphics::fillRectangle(const Rect &restrict rect) restrict2
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void MobileOpenGL2Graphics::setTexturingAndBlending(const bool enable)
@@ -1293,6 +1317,9 @@ void MobileOpenGL2Graphics::drawTriangleArray(const int size) restrict2
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, size / 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void MobileOpenGL2Graphics::drawTriangleArray(const GLfloat *restrict const
@@ -1305,6 +1332,9 @@ void MobileOpenGL2Graphics::drawTriangleArray(const GLfloat *restrict const
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, size / 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void MobileOpenGL2Graphics::drawLineArrays(const int size) restrict2
@@ -1315,6 +1345,9 @@ void MobileOpenGL2Graphics::drawLineArrays(const int size) restrict2
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINES, 0, size / 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
#ifdef DEBUG_BIND_TEXTURE
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index c5faad5c9..2194405a5 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -207,6 +207,9 @@ static inline void drawQuad(const Image *restrict const image,
MobileOpenGLGraphics::mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
}
@@ -260,6 +263,9 @@ static inline void drawRescaledQuad(const Image *restrict const image,
MobileOpenGLGraphics::mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
}
@@ -1120,6 +1126,9 @@ void MobileOpenGLGraphics::drawRectangle(const Rect &restrict rect,
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
else
{
@@ -1137,6 +1146,9 @@ void MobileOpenGLGraphics::drawRectangle(const Rect &restrict rect,
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINE_LOOP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
BLOCK_END("Graphics::drawRectangle")
}
@@ -1214,6 +1226,9 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfs(const int size) restrict2
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
inline void MobileOpenGLGraphics::drawTriangleArrayfsCached(const int size)
@@ -1227,6 +1242,9 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfsCached(const int size)
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
inline void MobileOpenGLGraphics::drawTriangleArrayfs(const GLshort *restrict
@@ -1243,6 +1261,9 @@ inline void MobileOpenGLGraphics::drawTriangleArrayfs(const GLshort *restrict
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
inline void MobileOpenGLGraphics::drawLineArrays(const int size) restrict2
@@ -1254,6 +1275,9 @@ inline void MobileOpenGLGraphics::drawLineArrays(const int size) restrict2
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINES, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void MobileOpenGLGraphics::dumpSettings()
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp
index c4f886314..7bec1f26c 100644
--- a/src/render/modernopenglgraphics.cpp
+++ b/src/render/modernopenglgraphics.cpp
@@ -287,6 +287,9 @@ void ModernOpenGLGraphics::drawQuad(const int srcX,
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void ModernOpenGLGraphics::drawRescaledQuad(const int srcX, const int srcY,
@@ -315,6 +318,9 @@ void ModernOpenGLGraphics::drawRescaledQuad(const int srcX, const int srcY,
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void ModernOpenGLGraphics::drawImage(const Image *restrict const image,
@@ -373,6 +379,9 @@ void ModernOpenGLGraphics::testDraw() restrict2
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
// glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void ModernOpenGLGraphics::drawImageCached(const Image *restrict const image
@@ -594,6 +603,9 @@ inline void ModernOpenGLGraphics::drawVertexes(const
#endif // DEBUG_DRAW_CALLS
// logger->log("draw from array: %u", *ivbo);
mglDrawArrays(GL_TRIANGLES, 0, *ivp / 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
}
@@ -914,6 +926,9 @@ void ModernOpenGLGraphics::drawPoint(int x, int y) restrict2
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_POINTS, 0, 1);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void ModernOpenGLGraphics::drawLine(int x1, int y1,
@@ -934,6 +949,9 @@ void ModernOpenGLGraphics::drawLine(int x1, int y1,
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINES, 0, 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void ModernOpenGLGraphics::drawRectangle(const Rect &restrict rect) restrict2
@@ -960,6 +978,9 @@ void ModernOpenGLGraphics::drawRectangle(const Rect &restrict rect) restrict2
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINE_LOOP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void ModernOpenGLGraphics::fillRectangle(const Rect &restrict rect) restrict2
@@ -986,6 +1007,9 @@ void ModernOpenGLGraphics::fillRectangle(const Rect &restrict rect) restrict2
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void ModernOpenGLGraphics::setTexturingAndBlending(const bool enable) restrict2
@@ -1304,6 +1328,9 @@ void ModernOpenGLGraphics::drawTriangleArray(const int size) restrict2
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, size / 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void ModernOpenGLGraphics::drawTriangleArray(const GLint *restrict const array,
@@ -1316,6 +1343,9 @@ void ModernOpenGLGraphics::drawTriangleArray(const GLint *restrict const array,
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_TRIANGLES, 0, size / 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void ModernOpenGLGraphics::drawLineArrays(const int size)
@@ -1327,6 +1357,9 @@ void ModernOpenGLGraphics::drawLineArrays(const int size)
mDrawCalls ++;
#endif // DEBUG_DRAW_CALLS
mglDrawArrays(GL_LINES, 0, size / 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
#ifdef DEBUG_BIND_TEXTURE
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index 27432f044..c6b3f33ec 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -253,6 +253,9 @@ static inline void drawQuad(const Image *restrict const image,
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
else
{
@@ -277,6 +280,9 @@ static inline void drawQuad(const Image *restrict const image,
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
}
@@ -327,6 +333,9 @@ static inline void drawRescaledQuad(const Image *restrict const image,
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
else
{
@@ -351,6 +360,9 @@ static inline void drawRescaledQuad(const Image *restrict const image,
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
}
@@ -412,6 +424,9 @@ void NormalOpenGLGraphics::testDraw() restrict2
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
else
{
@@ -437,6 +452,9 @@ void NormalOpenGLGraphics::testDraw() restrict2
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
}
@@ -1470,6 +1488,9 @@ void NormalOpenGLGraphics::drawRectangle(const Rect &restrict rect,
#endif // DEBUG_DRAW_CALLS
glDrawArrays(filled ? GL_QUADS : GL_LINE_LOOP, 0, 4);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
BLOCK_END("Graphics::drawRectangle")
}
@@ -1545,6 +1566,9 @@ inline void NormalOpenGLGraphics::drawQuadArrayfi(const int size) restrict2
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
inline void NormalOpenGLGraphics::drawQuadArrayfiCached(const int size)
@@ -1556,6 +1580,9 @@ inline void NormalOpenGLGraphics::drawQuadArrayfiCached(const int size)
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
inline void NormalOpenGLGraphics::drawQuadArrayfi(const GLint *restrict const
@@ -1572,6 +1599,9 @@ inline void NormalOpenGLGraphics::drawQuadArrayfi(const GLint *restrict const
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
inline void NormalOpenGLGraphics::drawQuadArrayii(const int size) restrict2
@@ -1582,6 +1612,9 @@ inline void NormalOpenGLGraphics::drawQuadArrayii(const int size) restrict2
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
inline void NormalOpenGLGraphics::drawQuadArrayiiCached(const int size)
@@ -1593,6 +1626,9 @@ inline void NormalOpenGLGraphics::drawQuadArrayiiCached(const int size)
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
inline void NormalOpenGLGraphics::drawQuadArrayii(const GLint *restrict const
@@ -1609,6 +1645,9 @@ inline void NormalOpenGLGraphics::drawQuadArrayii(const GLint *restrict const
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_QUADS, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
inline void NormalOpenGLGraphics::drawLineArrayi(const int size) restrict2
@@ -1620,6 +1659,9 @@ inline void NormalOpenGLGraphics::drawLineArrayi(const int size) restrict2
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_LINES, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
inline void NormalOpenGLGraphics::drawLineArrayf(const int size) restrict2
@@ -1631,6 +1673,9 @@ inline void NormalOpenGLGraphics::drawLineArrayf(const int size) restrict2
#endif // DEBUG_DRAW_CALLS
glDrawArrays(GL_LINES, 0, size / 2);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void NormalOpenGLGraphics::dumpSettings()
diff --git a/src/render/opengl/mglemu.cpp b/src/render/opengl/mglemu.cpp
index d0a4d0916..eb5949f0b 100644
--- a/src/render/opengl/mglemu.cpp
+++ b/src/render/opengl/mglemu.cpp
@@ -38,6 +38,9 @@ void APIENTRY emuglTextureSubImage2DEXT(GLuint texture, GLenum target,
xoffset, yoffset,
width, height,
format, type, pixels);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
void APIENTRY emuglActiveTexture(GLenum texture A_UNUSED)
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index 9af9c6643..391c3b9b5 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -339,6 +339,9 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage,
mUseOpenGL != RENDER_GLES2_OPENGL)
{
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
if (!mUseTextureSampler)
@@ -346,12 +349,26 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage,
if (mBlur)
{
mglTexParameteri(mTextureType, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
+
mglTexParameteri(mTextureType, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
else
{
mglTexParameteri(mTextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
+
mglTexParameteri(mTextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
}
}
#if !defined(ANDROID) && !defined(__native_client__)
@@ -361,6 +378,9 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage,
mglTexImage2D(mTextureType, 0, mInternalTextureType,
tmpImage->w, tmpImage->h,
0, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->pixels);
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
#ifdef DEBUG_OPENGL
/*
@@ -499,6 +519,9 @@ void OpenGLImageHelper::copySurfaceToImage(const Image *const image,
surface->w, surface->h,
GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels);
}
+#ifdef OPENGLERRORS
+ graphicsManager.logError();
+#endif // OPENGLERRORS
if (surface != oldSurface)
MSDL_FreeSurface(surface);