ManaPlus
Macros | Functions | Variables
graphicsmanager.cpp File Reference

(986a3bf)

#include "graphicsmanager.h"
#include "settings.h"
#include "render/mobileopengl2graphics.h"
#include "render/mobileopenglgraphics.h"
#include "render/modernopenglgraphics.h"
#include "render/normalopenglgraphics.h"
#include "render/safeopenglgraphics.h"
#include "render/opengl/mgl.h"
#include "render/opengl/mglcheck.h"
#include "render/opengl/mglemu.h"
#include "render/sdlgraphics.h"
#include "resources/openglimagehelper.h"
#include "resources/openglscreenshothelper.h"
#include "resources/mobileopenglscreenshothelper.h"
#include "resources/safeopenglimagehelper.h"
#include "render/opengl/mglfunctions.h"
#include "resources/sdlimagehelper.h"
#include "resources/sdlscreenshothelper.h"
#include "utils/delete2.h"
#include "utils/sdlhelper.h"
#include "test/testmain.h"
#include <SDL_syswm.h>
#include "debug.h"

Go to the source code of this file.

Macros

#define useCompression(name)
 
#define RENDER_SOFTWARE_INIT
 
#define RENDER_SDL2_DEFAULT_INIT
 
#define RENDER_NORMAL_OPENGL_INIT
 
#define RENDER_MODERN_OPENGL_INIT
 
#define RENDER_SAFE_OPENGL_INIT
 
#define RENDER_GLES2_OPENGL_INIT
 
#define RENDER_GLES_OPENGL_INIT
 

Functions

static void debugCallback (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *text, GLvoid *userParam)
 

Variables

GraphicsManager graphicsManager
 
RenderType openGLMode = RENDER_SOFTWARE
 
ScreenshotHelperscreenshortHelper = 0
 
const int densitySize = 6
 
const std::string densityNames []
 

Macro Definition Documentation

◆ RENDER_GLES2_OPENGL_INIT

#define RENDER_GLES2_OPENGL_INIT
Value:
surfaceImageHelper = new SurfaceImageHelper; \
mainGraphics = new MobileOpenGL2Graphics; \
screenshortHelper = new MobileOpenGLScreenshotHelper; \
mUseTextureSampler = false;
ImageHelper * imageHelper
Definition: imagehelper.cpp:44
#define SurfaceImageHelper
Definition: sdlshared.h:62

Definition at line 321 of file graphicsmanager.cpp.

◆ RENDER_GLES_OPENGL_INIT

#define RENDER_GLES_OPENGL_INIT
Value:
surfaceImageHelper = new SurfaceImageHelper; \
mainGraphics = new MobileOpenGLGraphics; \
screenshortHelper = new OpenGLScreenshotHelper; \
mUseTextureSampler = false;

Definition at line 332 of file graphicsmanager.cpp.

◆ RENDER_MODERN_OPENGL_INIT

#define RENDER_MODERN_OPENGL_INIT
Value:
surfaceImageHelper = new SurfaceImageHelper; \
mainGraphics = new ModernOpenGLGraphics; \
screenshortHelper = new OpenGLScreenshotHelper; \
mUseTextureSampler = true;

Definition at line 299 of file graphicsmanager.cpp.

◆ RENDER_NORMAL_OPENGL_INIT

#define RENDER_NORMAL_OPENGL_INIT
Value:
surfaceImageHelper = new SurfaceImageHelper; \
mainGraphics = new NormalOpenGLGraphics; \
screenshortHelper = new OpenGLScreenshotHelper; \
mUseTextureSampler = true;

Definition at line 293 of file graphicsmanager.cpp.

◆ RENDER_SAFE_OPENGL_INIT

#define RENDER_SAFE_OPENGL_INIT
Value:
surfaceImageHelper = new SurfaceImageHelper; \
mainGraphics = new SafeOpenGLGraphics; \
screenshortHelper = new OpenGLScreenshotHelper; \
mUseTextureSampler = false;

Definition at line 314 of file graphicsmanager.cpp.

◆ RENDER_SDL2_DEFAULT_INIT

#define RENDER_SDL2_DEFAULT_INIT

Definition at line 286 of file graphicsmanager.cpp.

◆ RENDER_SOFTWARE_INIT

#define RENDER_SOFTWARE_INIT
Value:
surfaceImageHelper = imageHelper; \
mainGraphics = new SDLGraphics; \
screenshortHelper = new SdlScreenshotHelper;

Definition at line 281 of file graphicsmanager.cpp.

◆ useCompression

#define useCompression (   name)
Value:
{ \
logger->log("using " #name " texture compression"); \
}
static void setInternalTextureType(const int n)

Definition at line 108 of file graphicsmanager.cpp.

Function Documentation

◆ debugCallback()

static void debugCallback ( GLenum  source,
GLenum  type,
GLuint  id,
GLenum  severity,
GLsizei  length,
const GLchar *  text,
GLvoid *  userParam 
)
static

Definition at line 1555 of file graphicsmanager.cpp.

1562 {
1563  std::string message("OPENGL:");
1564  switch (source)
1565  {
1566  case GL_DEBUG_SOURCE_API:
1567  message.append(" API");
1568  break;
1570  message.append(" WM");
1571  break;
1573  message.append(" SHADERS");
1574  break;
1576  message.append(" THIRD_PARTY");
1577  break;
1579  message.append(" APP");
1580  break;
1581  case GL_DEBUG_SOURCE_OTHER:
1582  message.append(" OTHER");
1583  break;
1584  default:
1585  message.append(" ?").append(toString(source));
1586  break;
1587  }
1588  switch (type)
1589  {
1590  case GL_DEBUG_TYPE_ERROR:
1591  message.append(" ERROR");
1592  break;
1594  message.append(" DEPRECATED");
1595  break;
1597  message.append(" UNDEFINED");
1598  break;
1600  message.append(" PORTABILITY");
1601  break;
1603  message.append(" PERFORMANCE");
1604  break;
1605  case GL_DEBUG_TYPE_OTHER:
1606  message.append(" OTHER");
1607  break;
1608  case GL_DEBUG_TYPE_MARKER:
1609  message.append(" MARKER");
1610  break;
1612  message.append(" PUSH GROUP");
1613  break;
1615  message.append(" POP GROUP");
1616  break;
1617  default:
1618  message.append(" ?").append(toString(type));
1619  break;
1620  }
1621  message.append(" ").append(toString(id));
1622  switch (severity)
1623  {
1625  message.append(" N");
1626  break;
1628  message.append(" H");
1629  break;
1631  message.append(" M");
1632  break;
1633  case GL_DEBUG_SEVERITY_LOW:
1634  message.append(" L");
1635  break;
1636  default:
1637  message.append(" ?").append(toString(type));
1638  break;
1639  }
1640  char *const buf = new char[CAST_SIZE(length + 1)];
1641  memcpy(buf, text, length);
1642  buf[length] = 0;
1643  message.append(" ").append(buf);
1644  delete [] buf;
1645  logger->log(message);
1646 }
#define CAST_SIZE
Definition: cast.h:34
void log(const char *const log_text,...)
Definition: logger.cpp:269
Logger * logger
Definition: logger.cpp:89
#define GL_DEBUG_TYPE_MARKER
Definition: mgldefines.h:60
#define GL_DEBUG_SEVERITY_LOW
Definition: mgldefines.h:64
#define GL_DEBUG_SOURCE_THIRD_PARTY
Definition: mgldefines.h:51
#define GL_DEBUG_TYPE_PORTABILITY
Definition: mgldefines.h:57
#define GL_DEBUG_TYPE_OTHER
Definition: mgldefines.h:59
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR
Definition: mgldefines.h:55
#define GL_DEBUG_TYPE_PUSH_GROUP
Definition: mgldefines.h:68
#define GL_DEBUG_SOURCE_APPLICATION
Definition: mgldefines.h:52
#define GL_DEBUG_SOURCE_OTHER
Definition: mgldefines.h:53
#define GL_DEBUG_SEVERITY_MEDIUM
Definition: mgldefines.h:63
#define GL_DEBUG_SOURCE_SHADER_COMPILER
Definition: mgldefines.h:50
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR
Definition: mgldefines.h:56
#define GL_DEBUG_SEVERITY_NOTIFICATION
Definition: mgldefines.h:61
#define GL_DEBUG_TYPE_POP_GROUP
Definition: mgldefines.h:71
#define GL_DEBUG_SOURCE_WINDOW_SYSTEM
Definition: mgldefines.h:49
#define GL_DEBUG_SOURCE_API
Definition: mgldefines.h:48
#define GL_DEBUG_TYPE_ERROR
Definition: mgldefines.h:54
#define GL_DEBUG_SEVERITY_HIGH
Definition: mgldefines.h:62
#define GL_DEBUG_TYPE_PERFORMANCE
Definition: mgldefines.h:58
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774

References CAST_SIZE, GL_DEBUG_SEVERITY_HIGH, GL_DEBUG_SEVERITY_LOW, GL_DEBUG_SEVERITY_MEDIUM, GL_DEBUG_SEVERITY_NOTIFICATION, GL_DEBUG_SOURCE_API, GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_SOURCE_OTHER, GL_DEBUG_SOURCE_SHADER_COMPILER, GL_DEBUG_SOURCE_THIRD_PARTY, GL_DEBUG_SOURCE_WINDOW_SYSTEM, GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, GL_DEBUG_TYPE_ERROR, GL_DEBUG_TYPE_MARKER, GL_DEBUG_TYPE_OTHER, GL_DEBUG_TYPE_PERFORMANCE, GL_DEBUG_TYPE_POP_GROUP, GL_DEBUG_TYPE_PORTABILITY, GL_DEBUG_TYPE_PUSH_GROUP, GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, Logger::log(), logger, and Catch::toString().

Referenced by GraphicsManager::updateDebugLog().

Variable Documentation

◆ densityNames

const std::string densityNames[]
Initial value:
=
{
"low",
"medium",
"tv",
"high",
"xhigh",
"xxhigh"
}

Definition at line 123 of file graphicsmanager.cpp.

Referenced by GraphicsManager::getDensityString().

◆ densitySize

const int densitySize = 6

◆ graphicsManager

GraphicsManager graphicsManager

Definition at line 115 of file graphicsmanager.cpp.

Referenced by Setup_Video::action(), OpenGLImageHelper::copySurfaceToImage(), NormalOpenGLGraphics::drawLineArrayf(), NormalOpenGLGraphics::drawLineArrayi(), MobileOpenGL2Graphics::drawLineArrays(), MobileOpenGLGraphics::drawLineArrays(), ModernOpenGLGraphics::drawLineArrays(), drawQuad(), MobileOpenGL2Graphics::drawQuad(), ModernOpenGLGraphics::drawQuad(), NormalOpenGLGraphics::drawQuadArrayfi(), NormalOpenGLGraphics::drawQuadArrayfiCached(), NormalOpenGLGraphics::drawQuadArrayii(), NormalOpenGLGraphics::drawQuadArrayiiCached(), drawRescaledQuad(), MobileOpenGL2Graphics::drawRescaledQuad(), ModernOpenGLGraphics::drawRescaledQuad(), MobileOpenGL2Graphics::drawTriangleArray(), ModernOpenGLGraphics::drawTriangleArray(), MobileOpenGLGraphics::drawTriangleArrayfs(), MobileOpenGLGraphics::drawTriangleArrayfsCached(), emuglTextureSubImage2DEXT(), Client::gameInit(), Graphics::getMemoryUsage(), MobileOpenGLScreenshotHelper::getScreenshot(), OpenGLScreenshotHelper::getScreenshot(), OpenGLImageHelper::glLoad(), SafeOpenGLImageHelper::glLoad(), Client::initGraphics(), MapReader::loadEmptyAtlas(), MobileOpenGL2Graphics::postInit(), ModernOpenGLGraphics::postInit(), MobileOpenGLScreenshotHelper::prepare(), OpenGLScreenshotHelper::prepare(), MapReader::readTileset(), Theme::selectSkin(), setConfigDefaults2(), Graphics::setOpenGLMode(), MobileOpenGL2Graphics::testDraw(), ModernOpenGLGraphics::testDraw(), NormalOpenGLGraphics::testDraw(), TestLauncher::testTextures(), TestLauncher::testVideoDetection(), and Graphics::updateMemoryInfo().

◆ openGLMode

◆ screenshortHelper

ScreenshotHelper* screenshortHelper = 0