Pyrogenesis  trunk
Namespaces | Macros | Functions
Device.cpp File Reference
#include "precompiled.h"
#include "Device.h"
#include "lib/external_libraries/libsdl.h"
#include "lib/hash.h"
#include "lib/ogl.h"
#include "ps/CLogger.h"
#include "ps/ConfigDB.h"
#include "ps/Profile.h"
#include "renderer/backend/gl/DeviceCommandContext.h"
#include "renderer/backend/gl/PipelineState.h"
#include "renderer/backend/gl/Texture.h"
#include "scriptinterface/JSON.h"
#include "scriptinterface/Object.h"
#include "scriptinterface/ScriptInterface.h"
#include "scriptinterface/ScriptRequest.h"
#include <algorithm>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
Include dependency graph for Device.cpp:

Namespaces

 Renderer
 
 Renderer::Backend
 
 Renderer::Backend::GL
 
 Renderer::Backend::GL::anonymous_namespace{Device.cpp}
 

Macros

#define SHORTEN(what, charsToKeep)
 
#define INTEGER(id)
 
#define INTEGER2(id)
 
#define FLOAT(id)
 
#define FLOAT2(id)
 
#define STRING(id)
 
#define QUERY(target, pname)
 
#define VERTEXPROGRAM(id)
 
#define FRAGMENTPROGRAM(id)
 
#define BOOL(id)   INTEGER(id)
 

Functions

std::string Renderer::Backend::GL::anonymous_namespace{Device.cpp}::GetNameImpl ()
 
std::string Renderer::Backend::GL::anonymous_namespace{Device.cpp}::GetVersionImpl ()
 
std::string Renderer::Backend::GL::anonymous_namespace{Device.cpp}::GetDriverInformationImpl ()
 
std::vector< std::string > Renderer::Backend::GL::anonymous_namespace{Device.cpp}::GetExtensionsImpl ()
 
void GLAD_API_PTR Renderer::Backend::GL::anonymous_namespace{Device.cpp}::OnDebugMessage (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *user_param)
 
std::unique_ptr< IDevice > Renderer::Backend::GL::CreateDevice (SDL_Window *window, const bool arb)
 

Macro Definition Documentation

◆ BOOL

#define BOOL (   id)    INTEGER(id)

◆ FLOAT

#define FLOAT (   id)
Value:
do { \
GLfloat f = std::numeric_limits<GLfloat>::quiet_NaN(); \
glGetFloatv(GL_##id, &f); \
if (ogl_SquelchError(GL_INVALID_ENUM)) \
Script::SetProperty(rq, settings, "GL_" #id, errstr); \
Script::SetProperty(rq, settings, "GL_" #id, f); \
} while (false)
bool ogl_SquelchError(GLenum err_to_ignore)
ignore and reset the specified OpenGL error.
Definition: ogl.cpp:391
bool SetProperty(const ScriptRequest &rq, JS::HandleValue obj, PropType name, JS::HandleValue value, bool constant=false, bool enumerable=true)
Set the named property on the given object.
Definition: Object.h:98

◆ FLOAT2

#define FLOAT2 (   id)
Value:
do { \
GLfloat f[2] = { std::numeric_limits<GLfloat>::quiet_NaN(), std::numeric_limits<GLfloat>::quiet_NaN() }; \
glGetFloatv(GL_##id, f); \
if (ogl_SquelchError(GL_INVALID_ENUM)) { \
Script::SetProperty(rq, settings, "GL_" #id "[0]", errstr); \
Script::SetProperty(rq, settings, "GL_" #id "[1]", errstr); \
} else { \
Script::SetProperty(rq, settings, "GL_" #id "[0]", f[0]); \
Script::SetProperty(rq, settings, "GL_" #id "[1]", f[1]); \
} \
} while (false)
bool ogl_SquelchError(GLenum err_to_ignore)
ignore and reset the specified OpenGL error.
Definition: ogl.cpp:391
bool SetProperty(const ScriptRequest &rq, JS::HandleValue obj, PropType name, JS::HandleValue value, bool constant=false, bool enumerable=true)
Set the named property on the given object.
Definition: Object.h:98

◆ FRAGMENTPROGRAM

#define FRAGMENTPROGRAM (   id)
Value:
do { \
GLint i = -1; \
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_##id, &i); \
if (ogl_SquelchError(GL_INVALID_ENUM)) \
Script::SetProperty(rq, settings, "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, errstr); \
Script::SetProperty(rq, settings, "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, i); \
} while (false)
bool ogl_SquelchError(GLenum err_to_ignore)
ignore and reset the specified OpenGL error.
Definition: ogl.cpp:391
bool SetProperty(const ScriptRequest &rq, JS::HandleValue obj, PropType name, JS::HandleValue value, bool constant=false, bool enumerable=true)
Set the named property on the given object.
Definition: Object.h:98

◆ INTEGER

#define INTEGER (   id)
Value:
do { \
GLint i = -1; \
glGetIntegerv(GL_##id, &i); \
if (ogl_SquelchError(GL_INVALID_ENUM)) \
Script::SetProperty(rq, settings, "GL_" #id, errstr); \
Script::SetProperty(rq, settings, "GL_" #id, i); \
} while (false)
bool ogl_SquelchError(GLenum err_to_ignore)
ignore and reset the specified OpenGL error.
Definition: ogl.cpp:391
bool SetProperty(const ScriptRequest &rq, JS::HandleValue obj, PropType name, JS::HandleValue value, bool constant=false, bool enumerable=true)
Set the named property on the given object.
Definition: Object.h:98

◆ INTEGER2

#define INTEGER2 (   id)
Value:
do { \
GLint i[2] = { -1, -1 }; \
glGetIntegerv(GL_##id, i); \
if (ogl_SquelchError(GL_INVALID_ENUM)) { \
Script::SetProperty(rq, settings, "GL_" #id "[0]", errstr); \
Script::SetProperty(rq, settings, "GL_" #id "[1]", errstr); \
} else { \
Script::SetProperty(rq, settings, "GL_" #id "[0]", i[0]); \
Script::SetProperty(rq, settings, "GL_" #id "[1]", i[1]); \
} \
} while (false)
bool ogl_SquelchError(GLenum err_to_ignore)
ignore and reset the specified OpenGL error.
Definition: ogl.cpp:391
bool SetProperty(const ScriptRequest &rq, JS::HandleValue obj, PropType name, JS::HandleValue value, bool constant=false, bool enumerable=true)
Set the named property on the given object.
Definition: Object.h:98

◆ QUERY

#define QUERY (   target,
  pname 
)
Value:
do { \
GLint i = -1; \
glGetQueryivARB(GL_##target, GL_##pname, &i); \
if (ogl_SquelchError(GL_INVALID_ENUM)) \
Script::SetProperty(rq, settings, "GL_" #target ".GL_" #pname, errstr); \
Script::SetProperty(rq, settings, "GL_" #target ".GL_" #pname, i); \
} while (false)
bool ogl_SquelchError(GLenum err_to_ignore)
ignore and reset the specified OpenGL error.
Definition: ogl.cpp:391
bool SetProperty(const ScriptRequest &rq, JS::HandleValue obj, PropType name, JS::HandleValue value, bool constant=false, bool enumerable=true)
Set the named property on the given object.
Definition: Object.h:98

◆ SHORTEN

#define SHORTEN (   what,
  charsToKeep 
)
Value:
if (!strncmp(cardName, what, std::size(what) - 1)) \
memmove(cardName + charsToKeep, cardName + std::size(what) - 1, (strlen(cardName) - (std::size(what) - 1) + 1) * sizeof(char));

◆ STRING

#define STRING (   id)
Value:
do { \
const char* c = (const char*)glGetString(GL_##id); \
if (!c) c = ""; \
if (ogl_SquelchError(GL_INVALID_ENUM)) c = errstr; \
Script::SetProperty(rq, settings, "GL_" #id, std::string(c)); \
} while (false)
bool ogl_SquelchError(GLenum err_to_ignore)
ignore and reset the specified OpenGL error.
Definition: ogl.cpp:391
bool SetProperty(const ScriptRequest &rq, JS::HandleValue obj, PropType name, JS::HandleValue value, bool constant=false, bool enumerable=true)
Set the named property on the given object.
Definition: Object.h:98

◆ VERTEXPROGRAM

#define VERTEXPROGRAM (   id)
Value:
do { \
GLint i = -1; \
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_##id, &i); \
if (ogl_SquelchError(GL_INVALID_ENUM)) \
Script::SetProperty(rq, settings, "GL_VERTEX_PROGRAM_ARB.GL_" #id, errstr); \
Script::SetProperty(rq, settings, "GL_VERTEX_PROGRAM_ARB.GL_" #id, i); \
} while (false)
bool ogl_SquelchError(GLenum err_to_ignore)
ignore and reset the specified OpenGL error.
Definition: ogl.cpp:391
bool SetProperty(const ScriptRequest &rq, JS::HandleValue obj, PropType name, JS::HandleValue value, bool constant=false, bool enumerable=true)
Set the named property on the given object.
Definition: Object.h:98