Removing a 'using namespace' from a header and tweaking error checking code

This commit is contained in:
Brad Davis 2015-06-18 00:54:35 -07:00
parent db56e15410
commit dfea571e62
5 changed files with 20 additions and 9 deletions

View file

@ -12,6 +12,8 @@
#include "GLBackendShared.h"
#include <glm/gtc/type_ptr.hpp>
using namespace gpu;
GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
{
(&::gpu::GLBackend::do_draw),
@ -141,6 +143,14 @@ bool GLBackend::checkGLError(const char* name) {
}
}
bool GLBackend::checkGLErrorDebug(const char* name) {
#ifdef DEBUG
checkGLError(name);
#else
Q_UNUSED(name);
return false;
#endif
}
void GLBackend::syncCache() {
syncTransformStateCache();

View file

@ -47,6 +47,9 @@ public:
static bool checkGLError(const char* name = nullptr);
// Only checks in debug builds
static bool checkGLErrorDebug(const char* name = nullptr);
static bool makeProgram(Shader& shader, const Shader::BindingSet& bindings = Shader::BindingSet());

View file

@ -11,6 +11,7 @@
#include "GPULogging.h"
#include "GLBackendShared.h"
using namespace gpu;
GLBackend::GLFramebuffer::GLFramebuffer() {}

View file

@ -17,9 +17,7 @@
#include "Batch.h"
using namespace gpu;
static const GLenum _primitiveToGLmode[NUM_PRIMITIVES] = {
static const GLenum _primitiveToGLmode[gpu::NUM_PRIMITIVES] = {
GL_POINTS,
GL_LINES,
GL_LINE_STRIP,
@ -30,7 +28,7 @@ static const GLenum _primitiveToGLmode[NUM_PRIMITIVES] = {
GL_QUAD_STRIP,
};
static const GLenum _elementTypeToGLType[NUM_TYPES]= {
static const GLenum _elementTypeToGLType[gpu::NUM_TYPES] = {
GL_FLOAT,
GL_INT,
GL_UNSIGNED_INT,
@ -49,10 +47,8 @@ static const GLenum _elementTypeToGLType[NUM_TYPES]= {
GL_UNSIGNED_BYTE
};
#if _DEBUG
#define CHECK_GL_ERROR() ::gpu::GLBackend::checkGLError(__FUNCTION__)
#else
#define CHECK_GL_ERROR() false
#endif
// Stupid preprocessor trick to turn the line macro into a string
#define CHECK_GL_ERROR_HELPER(x) #x
#define CHECK_GL_ERROR() gpu::GLBackend::checkGLErrorDebug(__FUNCTION__ ":" CHECK_GL_ERROR_HELPER(__LINE__))
#endif

View file

@ -11,6 +11,7 @@
#include "GPULogging.h"
#include "GLBackendShared.h"
using namespace gpu;
GLBackend::GLTexture::GLTexture() :
_storageStamp(0),