summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-25 16:55:35 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-25 16:55:35 +0300
commit4821f538a888370eb80ec28f9bab269a4427a63c (patch)
tree8e78fcb52df8b10cdd4cd2ed3859ad29c4c4c711 /src/render
parent51b81830c032fe255254a269b85679a89aa3728d (diff)
downloadmanaplus-4821f538a888370eb80ec28f9bab269a4427a63c.tar.gz
manaplus-4821f538a888370eb80ec28f9bab269a4427a63c.tar.bz2
manaplus-4821f538a888370eb80ec28f9bab269a4427a63c.tar.xz
manaplus-4821f538a888370eb80ec28f9bab269a4427a63c.zip
Report into log OpenGL errors if enabled configure option --enable-openglerrors.
Diffstat (limited to 'src/render')
-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
5 files changed, 138 insertions, 0 deletions
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)