Commit f9b76a8b by Nicolas Capens Committed by Nicolas Capens

Rename the GLES2 namespace to gl2.

BUG=18110152 Change-Id: Ia1ec422b26b7f8d5edf856d3b625a0e9ebd5d31b Reviewed-on: https://swiftshader-review.googlesource.com/1250Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 16ea3c87
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
namespace gl namespace gl2
{ {
static void output(const char *format, va_list vararg) static void output(const char *format, va_list vararg)
{ {
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#define TRACE_OUTPUT_FILE "debug.txt" #define TRACE_OUTPUT_FILE "debug.txt"
#endif #endif
namespace gl namespace gl2
{ {
// Outputs text to the debugging log // Outputs text to the debugging log
void trace(const char *format, ...); void trace(const char *format, ...);
...@@ -31,21 +31,21 @@ namespace gl ...@@ -31,21 +31,21 @@ namespace gl
#if defined(ANGLE_DISABLE_TRACE) #if defined(ANGLE_DISABLE_TRACE)
#define TRACE(message, ...) (void(0)) #define TRACE(message, ...) (void(0))
#else #else
#define TRACE(message, ...) gl::trace("trace: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__) #define TRACE(message, ...) gl2::trace("trace: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif #endif
// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing. // A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
#if defined(ANGLE_DISABLE_TRACE) #if defined(ANGLE_DISABLE_TRACE)
#define FIXME(message, ...) (void(0)) #define FIXME(message, ...) (void(0))
#else #else
#define FIXME(message, ...) do {gl::trace("fixme: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false) #define FIXME(message, ...) do {gl2::trace("fixme: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false)
#endif #endif
// A macro to output a function call and its arguments to the debugging log, in case of error. // A macro to output a function call and its arguments to the debugging log, in case of error.
#if defined(ANGLE_DISABLE_TRACE) #if defined(ANGLE_DISABLE_TRACE)
#define ERR(message, ...) (void(0)) #define ERR(message, ...) (void(0))
#else #else
#define ERR(message, ...) do {gl::trace("err: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false) #define ERR(message, ...) do {gl2::trace("err: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false)
#endif #endif
// A macro asserting a condition and outputting failures to the debug log // A macro asserting a condition and outputting failures to the debug log
......
...@@ -99,7 +99,7 @@ namespace sh ...@@ -99,7 +99,7 @@ namespace sh
this->registerIndex = registerIndex; this->registerIndex = registerIndex;
} }
OutputASM::OutputASM(TParseContext &context, gl::Shader *shaderObject) : TIntermTraverser(true, true, true), mContext(context), shaderObject(shaderObject) OutputASM::OutputASM(TParseContext &context, gl2::Shader *shaderObject) : TIntermTraverser(true, true, true), mContext(context), shaderObject(shaderObject)
{ {
shader = 0; shader = 0;
pixelShader = 0; pixelShader = 0;
...@@ -2003,10 +2003,10 @@ namespace sh ...@@ -2003,10 +2003,10 @@ namespace sh
{ {
const TType &type = varying->getType(); const TType &type = varying->getType();
const char *name = varying->getAsSymbolNode()->getSymbol().c_str(); const char *name = varying->getAsSymbolNode()->getSymbol().c_str();
gl::VaryingList &activeVaryings = shaderObject->varyings; gl2::VaryingList &activeVaryings = shaderObject->varyings;
// Check if this varying has been declared before without having a register assigned // Check if this varying has been declared before without having a register assigned
for(gl::VaryingList::iterator v = activeVaryings.begin(); v != activeVaryings.end(); v++) for(gl2::VaryingList::iterator v = activeVaryings.begin(); v != activeVaryings.end(); v++)
{ {
if(v->name == name) if(v->name == name)
{ {
...@@ -2020,7 +2020,7 @@ namespace sh ...@@ -2020,7 +2020,7 @@ namespace sh
} }
} }
activeVaryings.push_back(gl::Varying(glVariableType(type), name, varying->getArraySize(), reg, 0)); activeVaryings.push_back(gl2::Varying(glVariableType(type), name, varying->getArraySize(), reg, 0));
} }
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <set> #include <set>
#include <map> #include <map>
namespace gl namespace gl2
{ {
class Shader; class Shader;
} }
...@@ -81,7 +81,7 @@ namespace sh ...@@ -81,7 +81,7 @@ namespace sh
class OutputASM : public TIntermTraverser class OutputASM : public TIntermTraverser
{ {
public: public:
explicit OutputASM(TParseContext &context, gl::Shader *shaderObject); explicit OutputASM(TParseContext &context, gl2::Shader *shaderObject);
~OutputASM(); ~OutputASM();
void output(); void output();
...@@ -144,7 +144,7 @@ namespace sh ...@@ -144,7 +144,7 @@ namespace sh
static int dim2(TIntermNode *m); static int dim2(TIntermNode *m);
static unsigned int loopCount(TIntermLoop *node); static unsigned int loopCount(TIntermLoop *node);
gl::Shader *const shaderObject; gl2::Shader *const shaderObject;
sw::Shader *shader; sw::Shader *shader;
sw::PixelShader *pixelShader; sw::PixelShader *pixelShader;
sw::VertexShader *vertexShader; sw::VertexShader *vertexShader;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "InitializeParseContext.h" #include "InitializeParseContext.h"
TranslatorASM::TranslatorASM(gl::Shader *shaderObject, ShShaderType type, ShShaderSpec spec) : TCompiler(type, spec), shaderObject(shaderObject) TranslatorASM::TranslatorASM(gl2::Shader *shaderObject, ShShaderType type, ShShaderSpec spec) : TCompiler(type, spec), shaderObject(shaderObject)
{ {
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "Shader/PixelShader.hpp" #include "Shader/PixelShader.hpp"
#include "Shader/VertexShader.hpp" #include "Shader/VertexShader.hpp"
namespace gl namespace gl2
{ {
class Shader; class Shader;
} }
...@@ -25,13 +25,13 @@ namespace gl ...@@ -25,13 +25,13 @@ namespace gl
class TranslatorASM : public TCompiler class TranslatorASM : public TCompiler
{ {
public: public:
TranslatorASM(gl::Shader *shaderObject, ShShaderType type, ShShaderSpec spec); TranslatorASM(gl2::Shader *shaderObject, ShShaderType type, ShShaderSpec spec);
protected: protected:
virtual bool translate(TIntermNode* root); virtual bool translate(TIntermNode* root);
private: private:
gl::Shader *const shaderObject; gl2::Shader *const shaderObject;
}; };
#endif // COMPILER_TRANSLATORASM_H_ #endif // COMPILER_TRANSLATORASM_H_
...@@ -387,7 +387,7 @@ EGLContext Display::createContext(EGLConfig configHandle, const egl::Context *sh ...@@ -387,7 +387,7 @@ EGLContext Display::createContext(EGLConfig configHandle, const egl::Context *sh
{ {
const egl::Config *config = mConfigSet.get(configHandle); const egl::Config *config = mConfigSet.get(configHandle);
egl::Context *context = gl::createContext(config, shareContext); egl::Context *context = gl2::createContext(config, shareContext);
mContextSet.insert(context); mContextSet.insert(context);
return context; return context;
......
...@@ -131,7 +131,7 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight) ...@@ -131,7 +131,7 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight)
if(mWindow) if(mWindow)
{ {
frameBuffer = gl::createFrameBuffer(mDisplay->getNativeDisplay(), mWindow, backBufferWidth, backBufferHeight); frameBuffer = gl2::createFrameBuffer(mDisplay->getNativeDisplay(), mWindow, backBufferWidth, backBufferHeight);
if(!frameBuffer) if(!frameBuffer)
{ {
...@@ -141,7 +141,7 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight) ...@@ -141,7 +141,7 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight)
} }
} }
backBuffer = gl::createBackBuffer(backBufferWidth, backBufferHeight, mConfig); backBuffer = gl2::createBackBuffer(backBufferWidth, backBufferHeight, mConfig);
if(!backBuffer) if(!backBuffer)
{ {
...@@ -152,7 +152,7 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight) ...@@ -152,7 +152,7 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight)
if(mConfig->mDepthStencilFormat != sw::FORMAT_NULL) if(mConfig->mDepthStencilFormat != sw::FORMAT_NULL)
{ {
mDepthStencil = gl::createDepthStencil(backBufferWidth, backBufferHeight, mConfig->mDepthStencilFormat, 1, false); mDepthStencil = gl2::createDepthStencil(backBufferWidth, backBufferHeight, mConfig->mDepthStencilFormat, 1, false);
if(!mDepthStencil) if(!mDepthStencil)
{ {
...@@ -304,7 +304,7 @@ bool Surface::checkForResize() ...@@ -304,7 +304,7 @@ bool Surface::checkForResize()
if(static_cast<egl::Surface*>(getCurrentDrawSurface()) == this) if(static_cast<egl::Surface*>(getCurrentDrawSurface()) == this)
{ {
gl::makeCurrent(static_cast<egl::Context*>(getCurrentContext()), static_cast<egl::Display*>(getCurrentDisplay()), this); gl2::makeCurrent(static_cast<egl::Context*>(getCurrentContext()), static_cast<egl::Display*>(getCurrentDisplay()), this);
} }
return true; return true;
......
...@@ -868,7 +868,7 @@ EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurfac ...@@ -868,7 +868,7 @@ EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurfac
egl::setCurrentReadSurface(read); egl::setCurrentReadSurface(read);
egl::setCurrentContext(ctx); egl::setCurrentContext(ctx);
gl::makeCurrent(context, display, static_cast<egl::Surface*>(draw)); gl2::makeCurrent(context, display, static_cast<egl::Surface*>(draw));
return success(EGL_TRUE); return success(EGL_TRUE);
} }
...@@ -1194,7 +1194,7 @@ __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const cha ...@@ -1194,7 +1194,7 @@ __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const cha
} }
} }
return gl::getProcAddress(procname); return gl2::getProcAddress(procname);
} }
catch(std::bad_alloc&) catch(std::bad_alloc&)
{ {
......
...@@ -89,12 +89,12 @@ CONSTRUCTOR static bool eglAttachProcess() ...@@ -89,12 +89,12 @@ CONSTRUCTOR static bool eglAttachProcess()
#endif #endif
libGLESv2 = loadLibrary(libGLESv2_lib); libGLESv2 = loadLibrary(libGLESv2_lib);
gl::createContext = (egl::Context *(*)(const egl::Config*, const egl::Context*))getProcAddress(libGLESv2, "glCreateContext"); gl2::createContext = (egl::Context *(*)(const egl::Config*, const egl::Context*))getProcAddress(libGLESv2, "glCreateContext");
gl::makeCurrent = (void (*)(egl::Context*, egl::Display*, egl::Surface*))getProcAddress(libGLESv2, "glMakeCurrent"); gl2::makeCurrent = (void (*)(egl::Context*, egl::Display*, egl::Surface*))getProcAddress(libGLESv2, "glMakeCurrent");
gl::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLESv2, "glGetProcAddress"); gl2::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLESv2, "glGetProcAddress");
gl::createBackBuffer = (egl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLESv2, "createBackBuffer"); gl2::createBackBuffer = (egl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLESv2, "createBackBuffer");
gl::createDepthStencil = (egl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLESv2, "createDepthStencil"); gl2::createDepthStencil = (egl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLESv2, "createDepthStencil");
gl::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLESv2, "createFrameBuffer"); gl2::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLESv2, "createFrameBuffer");
return libGLESv2 != 0; return libGLESv2 != 0;
} }
...@@ -258,7 +258,7 @@ void error(EGLint errorCode) ...@@ -258,7 +258,7 @@ void error(EGLint errorCode)
} }
} }
namespace gl namespace gl2
{ {
egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext) = 0; egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext) = 0;
void (*makeCurrent)(egl::Context *context, egl::Display *display, egl::Surface *surface) = 0; void (*makeCurrent)(egl::Context *context, egl::Display *display, egl::Surface *surface) = 0;
......
...@@ -83,7 +83,7 @@ namespace sw ...@@ -83,7 +83,7 @@ namespace sw
} }
// libGLESv2 dependencies // libGLESv2 dependencies
namespace gl namespace gl2
{ {
extern egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext); extern egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext);
extern void (*makeCurrent)(egl::Context *context, egl::Display *display, egl::Surface *surface); extern void (*makeCurrent)(egl::Context *context, egl::Display *display, egl::Surface *surface);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "VertexDataManager.h" #include "VertexDataManager.h"
#include "IndexDataManager.h" #include "IndexDataManager.h"
namespace gl namespace gl2
{ {
Buffer::Buffer(GLuint id) : RefCountObject(id) Buffer::Buffer(GLuint id) : RefCountObject(id)
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <cstddef> #include <cstddef>
#include <vector> #include <vector>
namespace gl namespace gl2
{ {
class Buffer : public RefCountObject class Buffer : public RefCountObject
{ {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// or implied, including but not limited to any patent rights, are granted to you. // or implied, including but not limited to any patent rights, are granted to you.
// //
// Context.cpp: Implements the gl::Context class, managing all GL state and performing // Context.cpp: Implements the gl2::Context class, managing all GL state and performing
// rendering operations. It is the GLES2 specific implementation of EGLContext. // rendering operations. It is the GLES2 specific implementation of EGLContext.
#include "Context.h" #include "Context.h"
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#undef near #undef near
#undef far #undef far
namespace gl namespace gl2
{ {
Device *Context::device = 0; Device *Context::device = 0;
...@@ -224,9 +224,9 @@ Context::~Context() ...@@ -224,9 +224,9 @@ Context::~Context()
void Context::destroy() void Context::destroy()
{ {
if(this == gl::getContext()) if(this == gl2::getContext())
{ {
gl::makeCurrent(NULL, NULL, NULL); gl2::makeCurrent(NULL, NULL, NULL);
} }
delete this; delete this;
...@@ -3022,7 +3022,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 ...@@ -3022,7 +3022,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
void Context::bindTexImage(egl::Surface *surface) void Context::bindTexImage(egl::Surface *surface)
{ {
gl::Texture2D *textureObject = getTexture2D(); gl2::Texture2D *textureObject = getTexture2D();
if(textureObject) if(textureObject)
{ {
...@@ -3053,14 +3053,14 @@ EGLenum Context::validateSharedImage(EGLenum target, GLuint name, GLuint texture ...@@ -3053,14 +3053,14 @@ EGLenum Context::validateSharedImage(EGLenum target, GLuint name, GLuint texture
return EGL_BAD_PARAMETER; return EGL_BAD_PARAMETER;
} }
if(textureLevel >= gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS) if(textureLevel >= gl2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{ {
return EGL_BAD_MATCH; return EGL_BAD_MATCH;
} }
if(textureTarget != GL_NONE) if(textureTarget != GL_NONE)
{ {
gl::Texture *texture = getTexture(name); gl2::Texture *texture = getTexture(name);
if(!texture || texture->getTarget() != textureTarget) if(!texture || texture->getTarget() != textureTarget)
{ {
...@@ -3084,7 +3084,7 @@ EGLenum Context::validateSharedImage(EGLenum target, GLuint name, GLuint texture ...@@ -3084,7 +3084,7 @@ EGLenum Context::validateSharedImage(EGLenum target, GLuint name, GLuint texture
} }
else if(target == EGL_GL_RENDERBUFFER_KHR) else if(target == EGL_GL_RENDERBUFFER_KHR)
{ {
gl::Renderbuffer *renderbuffer = getRenderbuffer(name); gl2::Renderbuffer *renderbuffer = getRenderbuffer(name);
if(!renderbuffer) if(!renderbuffer)
{ {
...@@ -3118,13 +3118,13 @@ egl::Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textu ...@@ -3118,13 +3118,13 @@ egl::Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textu
if(textureTarget != GL_NONE) if(textureTarget != GL_NONE)
{ {
gl::Texture *texture = getTexture(name); gl2::Texture *texture = getTexture(name);
return texture->createSharedImage(textureTarget, textureLevel); return texture->createSharedImage(textureTarget, textureLevel);
} }
else if(target == EGL_GL_RENDERBUFFER_KHR) else if(target == EGL_GL_RENDERBUFFER_KHR)
{ {
gl::Renderbuffer *renderbuffer = getRenderbuffer(name); gl2::Renderbuffer *renderbuffer = getRenderbuffer(name);
return renderbuffer->createSharedImage(); return renderbuffer->createSharedImage();
} }
...@@ -3138,7 +3138,7 @@ Device *Context::getDevice() ...@@ -3138,7 +3138,7 @@ Device *Context::getDevice()
if(!device) if(!device)
{ {
sw::Context *context = new sw::Context(); sw::Context *context = new sw::Context();
device = new gl::Device(context); device = new gl2::Device(context);
} }
return device; return device;
...@@ -3149,13 +3149,13 @@ Device *Context::getDevice() ...@@ -3149,13 +3149,13 @@ Device *Context::getDevice()
// Exported functions for use by EGL // Exported functions for use by EGL
extern "C" extern "C"
{ {
gl::Context *glCreateContext(const egl::Config *config, const gl::Context *shareContext) gl2::Context *glCreateContext(const egl::Config *config, const gl2::Context *shareContext)
{ {
return new gl::Context(config, shareContext); return new gl2::Context(config, shareContext);
} }
void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface) void glMakeCurrent(gl2::Context *context, egl::Display *display, egl::Surface *surface)
{ {
gl::makeCurrent(context, display, surface); gl2::makeCurrent(context, display, surface);
} }
} }
...@@ -38,7 +38,7 @@ class Surface; ...@@ -38,7 +38,7 @@ class Surface;
class Config; class Config;
} }
namespace gl namespace gl2
{ {
struct TranslatedAttribute; struct TranslatedAttribute;
struct TranslatedIndexData; struct TranslatedIndexData;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
bool localShaderConstants = false; bool localShaderConstants = false;
namespace gl namespace gl2
{ {
using namespace sw; using namespace sw;
......
...@@ -19,7 +19,7 @@ namespace egl ...@@ -19,7 +19,7 @@ namespace egl
class Image; class Image;
} }
namespace gl namespace gl2
{ {
class Texture; class Texture;
class Image; class Image;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "main.h" #include "main.h"
#include "Common/Thread.hpp" #include "Common/Thread.hpp"
namespace gl namespace gl2
{ {
Fence::Fence() Fence::Fence()
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#define GL_APICALL #define GL_APICALL
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
namespace gl namespace gl2
{ {
class Fence class Fence
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "Texture.h" #include "Texture.h"
#include "utilities.h" #include "utilities.h"
namespace gl namespace gl2
{ {
Framebuffer::Framebuffer() Framebuffer::Framebuffer()
...@@ -245,7 +245,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -245,7 +245,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
if(mColorbufferType == GL_RENDERBUFFER) if(mColorbufferType == GL_RENDERBUFFER)
{ {
if(!gl::IsColorRenderable(colorbuffer->getFormat())) if(!gl2::IsColorRenderable(colorbuffer->getFormat()))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
...@@ -262,7 +262,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -262,7 +262,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
return GL_FRAMEBUFFER_UNSUPPORTED; return GL_FRAMEBUFFER_UNSUPPORTED;
} }
if(gl::IsDepthTexture(format) || gl::IsStencilTexture(format)) if(gl2::IsDepthTexture(format) || gl2::IsStencilTexture(format))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
...@@ -297,14 +297,14 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -297,14 +297,14 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
if(mDepthbufferType == GL_RENDERBUFFER) if(mDepthbufferType == GL_RENDERBUFFER)
{ {
if(!gl::IsDepthRenderable(depthbuffer->getFormat())) if(!gl2::IsDepthRenderable(depthbuffer->getFormat()))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
} }
else if(IsTextureTarget(mDepthbufferType)) else if(IsTextureTarget(mDepthbufferType))
{ {
if(!gl::IsDepthTexture(depthbuffer->getFormat())) if(!gl2::IsDepthTexture(depthbuffer->getFormat()))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
...@@ -347,7 +347,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -347,7 +347,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
if(mStencilbufferType == GL_RENDERBUFFER) if(mStencilbufferType == GL_RENDERBUFFER)
{ {
if(!gl::IsStencilRenderable(stencilbuffer->getFormat())) if(!gl2::IsStencilRenderable(stencilbuffer->getFormat()))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
...@@ -356,7 +356,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -356,7 +356,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
{ {
GLenum internalformat = stencilbuffer->getFormat(); GLenum internalformat = stencilbuffer->getFormat();
if(!gl::IsStencilTexture(internalformat)) if(!gl2::IsStencilTexture(internalformat))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#define GL_APICALL #define GL_APICALL
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
namespace gl namespace gl2
{ {
class Renderbuffer; class Renderbuffer;
class Colorbuffer; class Colorbuffer;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "main.h" #include "main.h"
namespace gl namespace gl2
{ {
HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1) HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1)
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <vector> #include <vector>
namespace gl namespace gl2
{ {
class HandleAllocator class HandleAllocator
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <GLES2/gl2ext.h> #include <GLES2/gl2ext.h>
namespace gl namespace gl2
{ {
static sw::Resource *getParentResource(Texture *texture) static sw::Resource *getParentResource(Texture *texture)
{ {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#define GL_APICALL #define GL_APICALL
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
namespace gl namespace gl2
{ {
class Texture; class Texture;
......
...@@ -25,7 +25,7 @@ namespace ...@@ -25,7 +25,7 @@ namespace
enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) }; enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
} }
namespace gl namespace gl2
{ {
IndexDataManager::IndexDataManager() IndexDataManager::IndexDataManager()
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#define GL_APICALL #define GL_APICALL
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
namespace gl namespace gl2
{ {
struct TranslatedIndexData struct TranslatedIndexData
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <string> #include <string>
#include <stdlib.h> #include <stdlib.h>
namespace gl namespace gl2
{ {
unsigned int Program::currentSerial = 1; unsigned int Program::currentSerial = 1;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <vector> #include <vector>
#include <set> #include <set>
namespace gl namespace gl2
{ {
class Device; class Device;
class ResourceManager; class ResourceManager;
...@@ -163,7 +163,7 @@ namespace gl ...@@ -163,7 +163,7 @@ namespace gl
static unsigned int issueSerial(); static unsigned int issueSerial();
private: private:
gl::Device *device; gl2::Device *device;
FragmentShader *fragmentShader; FragmentShader *fragmentShader;
VertexShader *vertexShader; VertexShader *vertexShader;
......
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
// or implied, including but not limited to any patent rights, are granted to you. // or implied, including but not limited to any patent rights, are granted to you.
// //
// Query.cpp: Implements the gl::Query class // Query.cpp: Implements the gl2::Query class
#include "Query.h" #include "Query.h"
#include "main.h" #include "main.h"
#include "Common/Thread.hpp" #include "Common/Thread.hpp"
namespace gl namespace gl2
{ {
Query::Query(GLuint id, GLenum type) : RefCountObject(id) Query::Query(GLuint id, GLenum type) : RefCountObject(id)
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// or implied, including but not limited to any patent rights, are granted to you. // or implied, including but not limited to any patent rights, are granted to you.
// //
// Query.h: Defines the gl::Query class // Query.h: Defines the gl2::Query class
#ifndef LIBGLESV2_QUERY_H_ #ifndef LIBGLESV2_QUERY_H_
#define LIBGLESV2_QUERY_H_ #define LIBGLESV2_QUERY_H_
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#define GL_APICALL #define GL_APICALL
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
namespace gl namespace gl2
{ {
class Query : public RefCountObject class Query : public RefCountObject
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "Common/Thread.hpp" #include "Common/Thread.hpp"
namespace gl namespace gl2
{ {
RefCountObject::RefCountObject(GLuint id) RefCountObject::RefCountObject(GLuint id)
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <cstddef> #include <cstddef>
namespace gl namespace gl2
{ {
class RefCountObject class RefCountObject
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "Texture.h" #include "Texture.h"
#include "utilities.h" #include "utilities.h"
namespace gl namespace gl2
{ {
RenderbufferInterface::RenderbufferInterface() RenderbufferInterface::RenderbufferInterface()
{ {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#define GL_APICALL #define GL_APICALL
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
namespace gl namespace gl2
{ {
class Texture2D; class Texture2D;
class TextureCubeMap; class TextureCubeMap;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "Shader.h" #include "Shader.h"
#include "Texture.h" #include "Texture.h"
namespace gl namespace gl2
{ {
ResourceManager::ResourceManager() ResourceManager::ResourceManager()
{ {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <map> #include <map>
namespace gl namespace gl2
{ {
class Buffer; class Buffer;
class Shader; class Shader;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <string> #include <string>
namespace gl namespace gl2
{ {
Shader::Shader(ResourceManager *manager, GLuint handle) : mHandle(handle), mResourceManager(manager) Shader::Shader(ResourceManager *manager, GLuint handle) : mHandle(handle), mResourceManager(manager)
{ {
......
...@@ -32,7 +32,7 @@ namespace sh ...@@ -32,7 +32,7 @@ namespace sh
class OutputASM; class OutputASM;
} }
namespace gl namespace gl2
{ {
struct Varying struct Varying
{ {
...@@ -46,7 +46,7 @@ struct Varying ...@@ -46,7 +46,7 @@ struct Varying
return arraySize >= 1; return arraySize >= 1;
} }
int size() const // Unify with gl::Uniform? int size() const // Unify with gl2::Uniform?
{ {
return arraySize > 0 ? arraySize : 1; return arraySize > 0 ? arraySize : 1;
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <algorithm> #include <algorithm>
namespace gl namespace gl2
{ {
Texture::Texture(GLuint id) : RefCountObject(id) Texture::Texture(GLuint id) : RefCountObject(id)
...@@ -1156,17 +1156,17 @@ void TextureExternal::setImage(Image *sharedImage) ...@@ -1156,17 +1156,17 @@ void TextureExternal::setImage(Image *sharedImage)
// Exported functions for use by EGL // Exported functions for use by EGL
extern "C" extern "C"
{ {
gl::Image *createBackBuffer(int width, int height, const egl::Config *config) gl2::Image *createBackBuffer(int width, int height, const egl::Config *config)
{ {
if(config) if(config)
{ {
return new gl::Image(0, width, height, config->mAlphaSize ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE); return new gl2::Image(0, width, height, config->mAlphaSize ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE);
} }
return 0; return 0;
} }
gl::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard) gl2::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard)
{ {
if(width == 0 || height == 0 || height > OUTLINE_RESOLUTION) if(width == 0 || height == 0 || height > OUTLINE_RESOLUTION)
{ {
...@@ -1199,7 +1199,7 @@ extern "C" ...@@ -1199,7 +1199,7 @@ extern "C"
UNREACHABLE(); UNREACHABLE();
} }
gl::Image *surface = new gl::Image(0, width, height, format, multiSampleDepth, lockable, true); gl2::Image *surface = new gl2::Image(0, width, height, format, multiSampleDepth, lockable, true);
if(!surface) if(!surface)
{ {
......
...@@ -33,7 +33,7 @@ class Surface; ...@@ -33,7 +33,7 @@ class Surface;
class Config; class Config;
} }
namespace gl namespace gl2
{ {
class Framebuffer; class Framebuffer;
......
...@@ -24,7 +24,7 @@ namespace ...@@ -24,7 +24,7 @@ namespace
enum {INITIAL_STREAM_BUFFER_SIZE = 1024 * 1024}; enum {INITIAL_STREAM_BUFFER_SIZE = 1024 * 1024};
} }
namespace gl namespace gl2
{ {
VertexDataManager::VertexDataManager(Context *context) : mContext(context) VertexDataManager::VertexDataManager(Context *context) : mContext(context)
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#define GL_APICALL #define GL_APICALL
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
namespace gl namespace gl2
{ {
struct TranslatedAttribute struct TranslatedAttribute
......
...@@ -32,7 +32,7 @@ static void glAttachThread() ...@@ -32,7 +32,7 @@ static void glAttachThread()
{ {
TRACE("()"); TRACE("()");
gl::Current *current = new gl::Current; gl2::Current *current = new gl2::Current;
if(current) if(current)
{ {
...@@ -47,7 +47,7 @@ static void glDetachThread() ...@@ -47,7 +47,7 @@ static void glDetachThread()
{ {
TRACE("()"); TRACE("()");
gl::Current *current = (gl::Current*)sw::Thread::getLocalStorage(currentTLS); gl2::Current *current = (gl2::Current*)sw::Thread::getLocalStorage(currentTLS);
if(current) if(current)
{ {
...@@ -105,9 +105,9 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved ...@@ -105,9 +105,9 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
} }
#endif #endif
namespace gl namespace gl2
{ {
static gl::Current *getCurrent(void) static gl2::Current *getCurrent(void)
{ {
Current *current = (Current*)sw::Thread::getLocalStorage(currentTLS); Current *current = (Current*)sw::Thread::getLocalStorage(currentTLS);
...@@ -157,7 +157,7 @@ Device *getDevice() ...@@ -157,7 +157,7 @@ Device *getDevice()
// Records an error code // Records an error code
void error(GLenum errorCode) void error(GLenum errorCode)
{ {
gl::Context *context = gl::getContext(); gl2::Context *context = gl2::getContext();
if(context) if(context)
{ {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
#include <GLES2/gl2ext.h> #include <GLES2/gl2ext.h>
namespace gl namespace gl2
{ {
struct Current struct Current
{ {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <math.h> #include <math.h>
namespace gl namespace gl2
{ {
inline bool isPow2(int x) inline bool isPow2(int x)
{ {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <limits> #include <limits>
#include <stdio.h> #include <stdio.h>
namespace gl namespace gl2
{ {
int UniformComponentCount(GLenum type) int UniformComponentCount(GLenum type)
{ {
...@@ -478,7 +478,7 @@ namespace es2sw ...@@ -478,7 +478,7 @@ namespace es2sw
return sw::STENCIL_ALWAYS; return sw::STENCIL_ALWAYS;
} }
sw::Color<float> ConvertColor(gl::Color color) sw::Color<float> ConvertColor(gl2::Color color)
{ {
return sw::Color<float>(color.red, color.green, color.blue, color.alpha); return sw::Color<float>(color.red, color.green, color.blue, color.alpha);
} }
...@@ -630,36 +630,36 @@ namespace es2sw ...@@ -630,36 +630,36 @@ namespace es2sw
} }
} }
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, gl::PrimitiveType &swPrimitiveType, int &primitiveCount) bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, gl2::PrimitiveType &swPrimitiveType, int &primitiveCount)
{ {
switch(primitiveType) switch(primitiveType)
{ {
case GL_POINTS: case GL_POINTS:
swPrimitiveType = gl::DRAW_POINTLIST; swPrimitiveType = gl2::DRAW_POINTLIST;
primitiveCount = elementCount; primitiveCount = elementCount;
break; break;
case GL_LINES: case GL_LINES:
swPrimitiveType = gl::DRAW_LINELIST; swPrimitiveType = gl2::DRAW_LINELIST;
primitiveCount = elementCount / 2; primitiveCount = elementCount / 2;
break; break;
case GL_LINE_LOOP: case GL_LINE_LOOP:
swPrimitiveType = gl::DRAW_LINELOOP; swPrimitiveType = gl2::DRAW_LINELOOP;
primitiveCount = elementCount; primitiveCount = elementCount;
break; break;
case GL_LINE_STRIP: case GL_LINE_STRIP:
swPrimitiveType = gl::DRAW_LINESTRIP; swPrimitiveType = gl2::DRAW_LINESTRIP;
primitiveCount = elementCount - 1; primitiveCount = elementCount - 1;
break; break;
case GL_TRIANGLES: case GL_TRIANGLES:
swPrimitiveType = gl::DRAW_TRIANGLELIST; swPrimitiveType = gl2::DRAW_TRIANGLELIST;
primitiveCount = elementCount / 3; primitiveCount = elementCount / 3;
break; break;
case GL_TRIANGLE_STRIP: case GL_TRIANGLE_STRIP:
swPrimitiveType = gl::DRAW_TRIANGLESTRIP; swPrimitiveType = gl2::DRAW_TRIANGLESTRIP;
primitiveCount = elementCount - 2; primitiveCount = elementCount - 2;
break; break;
case GL_TRIANGLE_FAN: case GL_TRIANGLE_FAN:
swPrimitiveType = gl::DRAW_TRIANGLEFAN; swPrimitiveType = gl2::DRAW_TRIANGLEFAN;
primitiveCount = elementCount - 2; primitiveCount = elementCount - 2;
break; break;
default: default:
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <string> #include <string>
namespace gl namespace gl2
{ {
struct Color; struct Color;
...@@ -57,7 +57,7 @@ namespace es2sw ...@@ -57,7 +57,7 @@ namespace es2sw
{ {
sw::DepthCompareMode ConvertDepthComparison(GLenum comparison); sw::DepthCompareMode ConvertDepthComparison(GLenum comparison);
sw::StencilCompareMode ConvertStencilComparison(GLenum comparison); sw::StencilCompareMode ConvertStencilComparison(GLenum comparison);
sw::Color<float> ConvertColor(gl::Color color); sw::Color<float> ConvertColor(gl2::Color color);
sw::BlendFactor ConvertBlendFunc(GLenum blend); sw::BlendFactor ConvertBlendFunc(GLenum blend);
sw::BlendOperation ConvertBlendOp(GLenum blendOp); sw::BlendOperation ConvertBlendOp(GLenum blendOp);
sw::StencilOperation ConvertStencilOp(GLenum stencilOp); sw::StencilOperation ConvertStencilOp(GLenum stencilOp);
...@@ -66,7 +66,7 @@ namespace es2sw ...@@ -66,7 +66,7 @@ namespace es2sw
unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha); unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha);
sw::FilterType ConvertMagFilter(GLenum magFilter); sw::FilterType ConvertMagFilter(GLenum magFilter);
void ConvertMinFilter(GLenum texFilter, sw::FilterType *minFilter, sw::MipmapType *mipFilter, float maxAnisotropy); void ConvertMinFilter(GLenum texFilter, sw::FilterType *minFilter, sw::MipmapType *mipFilter, float maxAnisotropy);
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, gl::PrimitiveType &swPrimitiveType, int &primitiveCount); bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, gl2::PrimitiveType &swPrimitiveType, int &primitiveCount);
sw::Format ConvertRenderbufferFormat(GLenum format); sw::Format ConvertRenderbufferFormat(GLenum format);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment