Commit f4486fdf by Nicolas Capens

Rename the desktop OpenGL namespace to gl.

Bug 18962347 Change-Id: I0bb263b749d3af3362b2fdc02d81ab856e0f46b4 Reviewed-on: https://swiftshader-review.googlesource.com/1770Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 5597eef8
......@@ -19,7 +19,7 @@
#include "VertexDataManager.h"
#include "IndexDataManager.h"
namespace es2
namespace gl
{
Buffer::Buffer(GLuint id) : RefCountObject(id)
......
......@@ -25,7 +25,7 @@
#include <cstddef>
#include <vector>
namespace es2
namespace gl
{
class Buffer : public gl::RefCountObject
{
......
......@@ -9,7 +9,7 @@
// or implied, including but not limited to any patent rights, are granted to you.
//
// Context.cpp: Implements the es2::Context class, managing all GL state and performing
// Context.cpp: Implements the gl::Context class, managing all GL state and performing
// rendering operations. It is the GLES2 specific implementation of EGLContext.
#include "Context.h"
......@@ -37,12 +37,12 @@
#undef near
#undef far
namespace es2
namespace gl
{
Context::Context(const egl::Config *config, const Context *shareContext) : mConfig(config)
{
sw::Context *context = new sw::Context();
device = new es2::Device(context);
device = new gl::Device(context);
mFenceHandleAllocator.setBaseHandle(0);
......@@ -3002,7 +3002,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
void Context::bindTexImage(egl::Surface *surface)
{
es2::Texture2D *textureObject = getTexture2D();
gl::Texture2D *textureObject = getTexture2D();
if(textureObject)
{
......@@ -3033,14 +3033,14 @@ EGLenum Context::validateSharedImage(EGLenum target, GLuint name, GLuint texture
return EGL_BAD_PARAMETER;
}
if(textureLevel >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
if(textureLevel >= gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
return EGL_BAD_MATCH;
}
if(textureTarget != GL_NONE)
{
es2::Texture *texture = getTexture(name);
gl::Texture *texture = getTexture(name);
if(!texture || texture->getTarget() != textureTarget)
{
......@@ -3064,7 +3064,7 @@ EGLenum Context::validateSharedImage(EGLenum target, GLuint name, GLuint texture
}
else if(target == EGL_GL_RENDERBUFFER_KHR)
{
es2::Renderbuffer *renderbuffer = getRenderbuffer(name);
gl::Renderbuffer *renderbuffer = getRenderbuffer(name);
if(!renderbuffer)
{
......@@ -3098,13 +3098,13 @@ egl::Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textu
if(textureTarget != GL_NONE)
{
es2::Texture *texture = getTexture(name);
gl::Texture *texture = getTexture(name);
return texture->createSharedImage(textureTarget, textureLevel);
}
else if(target == EGL_GL_RENDERBUFFER_KHR)
{
es2::Renderbuffer *renderbuffer = getRenderbuffer(name);
gl::Renderbuffer *renderbuffer = getRenderbuffer(name);
return renderbuffer->createSharedImage();
}
......@@ -3123,8 +3123,8 @@ Device *Context::getDevice()
// Exported functions for use by EGL
extern "C"
{
es2::Context *glCreateContext(const egl::Config *config, const es2::Context *shareContext)
gl::Context *glCreateContext(const egl::Config *config, const gl::Context *shareContext)
{
return new es2::Context(config, shareContext);
return new gl::Context(config, shareContext);
}
}
......@@ -38,7 +38,7 @@ class Surface;
class Config;
}
namespace es2
namespace gl
{
struct TranslatedAttribute;
struct TranslatedIndexData;
......
......@@ -27,7 +27,7 @@
bool localShaderConstants = false;
namespace es2
namespace gl
{
using namespace sw;
......
......@@ -19,7 +19,7 @@ namespace egl
class Image;
}
namespace es2
namespace gl
{
class Texture;
class Image;
......
......@@ -16,7 +16,7 @@
#include "main.h"
#include "Common/Thread.hpp"
namespace es2
namespace gl
{
Fence::Fence()
......
......@@ -17,7 +17,7 @@
#define GL_APICALL
#include <GLES2/gl2.h>
namespace es2
namespace gl
{
class Fence
......
......@@ -19,7 +19,7 @@
#include "Texture.h"
#include "utilities.h"
namespace es2
namespace gl
{
Framebuffer::Framebuffer()
......@@ -245,7 +245,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
if(mColorbufferType == GL_RENDERBUFFER)
{
if(!es2::IsColorRenderable(colorbuffer->getFormat()))
if(!gl::IsColorRenderable(colorbuffer->getFormat()))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......@@ -262,7 +262,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
return GL_FRAMEBUFFER_UNSUPPORTED;
}
if(es2::IsDepthTexture(format) || es2::IsStencilTexture(format))
if(gl::IsDepthTexture(format) || gl::IsStencilTexture(format))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......@@ -297,14 +297,14 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
if(mDepthbufferType == GL_RENDERBUFFER)
{
if(!es2::IsDepthRenderable(depthbuffer->getFormat()))
if(!gl::IsDepthRenderable(depthbuffer->getFormat()))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
else if(IsTextureTarget(mDepthbufferType))
{
if(!es2::IsDepthTexture(depthbuffer->getFormat()))
if(!gl::IsDepthTexture(depthbuffer->getFormat()))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......@@ -347,7 +347,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
if(mStencilbufferType == GL_RENDERBUFFER)
{
if(!es2::IsStencilRenderable(stencilbuffer->getFormat()))
if(!gl::IsStencilRenderable(stencilbuffer->getFormat()))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......@@ -356,7 +356,7 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
{
GLenum internalformat = stencilbuffer->getFormat();
if(!es2::IsStencilTexture(internalformat))
if(!gl::IsStencilTexture(internalformat))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......
......@@ -21,7 +21,7 @@
#define GL_APICALL
#include <GLES2/gl2.h>
namespace es2
namespace gl
{
class Renderbuffer;
class Colorbuffer;
......
......@@ -16,7 +16,7 @@
#include "main.h"
namespace es2
namespace gl
{
HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1)
......
......@@ -20,7 +20,7 @@
#include <vector>
namespace es2
namespace gl
{
class HandleAllocator
......
......@@ -18,7 +18,7 @@
#include <GLES2/gl2ext.h>
namespace es2
namespace gl
{
static sw::Resource *getParentResource(Texture *texture)
{
......
......@@ -18,7 +18,7 @@
#define GL_APICALL
#include <GLES2/gl2.h>
namespace es2
namespace gl
{
class Texture;
......
......@@ -25,7 +25,7 @@ namespace
enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
}
namespace es2
namespace gl
{
IndexDataManager::IndexDataManager()
......
......@@ -20,7 +20,7 @@
#define GL_APICALL
#include <GLES2/gl2.h>
namespace es2
namespace gl
{
struct TranslatedIndexData
......
......@@ -24,7 +24,7 @@
#include <string>
#include <stdlib.h>
namespace es2
namespace gl
{
unsigned int Program::currentSerial = 1;
......
......@@ -24,7 +24,7 @@
#include <vector>
#include <set>
namespace es2
namespace gl
{
class Device;
class ResourceManager;
......@@ -163,7 +163,7 @@ namespace es2
static unsigned int issueSerial();
private:
es2::Device *device;
gl::Device *device;
FragmentShader *fragmentShader;
VertexShader *vertexShader;
......
......@@ -9,14 +9,14 @@
// or implied, including but not limited to any patent rights, are granted to you.
//
// Query.cpp: Implements the es2::Query class
// Query.cpp: Implements the gl::Query class
#include "Query.h"
#include "main.h"
#include "Common/Thread.hpp"
namespace es2
namespace gl
{
Query::Query(GLuint id, GLenum type) : RefCountObject(id)
......
......@@ -9,7 +9,7 @@
// or implied, including but not limited to any patent rights, are granted to you.
//
// Query.h: Defines the es2::Query class
// Query.h: Defines the gl::Query class
#ifndef LIBGL_QUERY_H_
#define LIBGL_QUERY_H_
......@@ -20,7 +20,7 @@
#define GL_APICALL
#include <GLES2/gl2.h>
namespace es2
namespace gl
{
class Query : public gl::RefCountObject
......
......@@ -19,7 +19,7 @@
#include "Texture.h"
#include "utilities.h"
namespace es2
namespace gl
{
RenderbufferInterface::RenderbufferInterface()
{
......
......@@ -23,7 +23,7 @@
#define GL_APICALL
#include <GLES2/gl2.h>
namespace es2
namespace gl
{
class Texture2D;
class TextureCubeMap;
......
......@@ -20,7 +20,7 @@
#include "Shader.h"
#include "Texture.h"
namespace es2
namespace gl
{
ResourceManager::ResourceManager()
{
......
......@@ -22,7 +22,7 @@
#include <map>
namespace es2
namespace gl
{
class Buffer;
class Shader;
......
......@@ -22,7 +22,7 @@
#include <string>
namespace es2
namespace gl
{
bool Shader::compilerInitialized = false;
......
......@@ -32,7 +32,7 @@ namespace glsl
class OutputASM;
}
namespace es2
namespace gl
{
class Shader : public glsl::Shader
......
......@@ -25,7 +25,7 @@
#include <algorithm>
namespace es2
namespace gl
{
Texture::Texture(GLuint id) : egl::Texture(id)
......@@ -1166,7 +1166,7 @@ extern "C"
{
if(config)
{
return new es2::Image(0, width, height, config->mAlphaSize ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE);
return new gl::Image(0, width, height, config->mAlphaSize ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE);
}
return 0;
......@@ -1205,7 +1205,7 @@ extern "C"
UNREACHABLE();
}
es2::Image *surface = new es2::Image(0, width, height, format, multiSampleDepth, lockable, true);
gl::Image *surface = new gl::Image(0, width, height, format, multiSampleDepth, lockable, true);
if(!surface)
{
......
......@@ -33,7 +33,7 @@ class Surface;
class Config;
}
namespace es2
namespace gl
{
class Framebuffer;
......
......@@ -24,7 +24,7 @@ namespace
enum {INITIAL_STREAM_BUFFER_SIZE = 1024 * 1024};
}
namespace es2
namespace gl
{
VertexDataManager::VertexDataManager(Context *context) : mContext(context)
......
......@@ -21,7 +21,7 @@
#define GL_APICALL
#include <GLES2/gl2.h>
namespace es2
namespace gl
{
struct TranslatedAttribute
......
......@@ -103,15 +103,15 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
}
#endif
namespace es2
namespace gl
{
es2::Context *getContext()
gl::Context *getContext()
{
egl::Context *context = egl::getCurrentContext();
if(context && context->getClientVersion() == 2)
{
return static_cast<es2::Context*>(context);
return static_cast<gl::Context*>(context);
}
return 0;
......@@ -143,7 +143,7 @@ GLint getClientVersion()
// Records an error code
void error(GLenum errorCode)
{
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......
......@@ -23,7 +23,7 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
namespace es2
namespace gl
{
Context *getContext();
egl::Display *getDisplay();
......
......@@ -18,7 +18,7 @@
#include <math.h>
namespace es2
namespace gl
{
inline bool isPow2(int x)
{
......
......@@ -20,7 +20,7 @@
#include <limits>
#include <stdio.h>
namespace es2
namespace gl
{
int UniformComponentCount(GLenum type)
{
......@@ -463,7 +463,7 @@ namespace es2sw
return sw::STENCIL_ALWAYS;
}
sw::Color<float> ConvertColor(es2::Color color)
sw::Color<float> ConvertColor(gl::Color color)
{
return sw::Color<float>(color.red, color.green, color.blue, color.alpha);
}
......@@ -615,36 +615,36 @@ namespace es2sw
}
}
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, es2::PrimitiveType &swPrimitiveType, int &primitiveCount)
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, gl::PrimitiveType &swPrimitiveType, int &primitiveCount)
{
switch(primitiveType)
{
case GL_POINTS:
swPrimitiveType = es2::DRAW_POINTLIST;
swPrimitiveType = gl::DRAW_POINTLIST;
primitiveCount = elementCount;
break;
case GL_LINES:
swPrimitiveType = es2::DRAW_LINELIST;
swPrimitiveType = gl::DRAW_LINELIST;
primitiveCount = elementCount / 2;
break;
case GL_LINE_LOOP:
swPrimitiveType = es2::DRAW_LINELOOP;
swPrimitiveType = gl::DRAW_LINELOOP;
primitiveCount = elementCount;
break;
case GL_LINE_STRIP:
swPrimitiveType = es2::DRAW_LINESTRIP;
swPrimitiveType = gl::DRAW_LINESTRIP;
primitiveCount = elementCount - 1;
break;
case GL_TRIANGLES:
swPrimitiveType = es2::DRAW_TRIANGLELIST;
swPrimitiveType = gl::DRAW_TRIANGLELIST;
primitiveCount = elementCount / 3;
break;
case GL_TRIANGLE_STRIP:
swPrimitiveType = es2::DRAW_TRIANGLESTRIP;
swPrimitiveType = gl::DRAW_TRIANGLESTRIP;
primitiveCount = elementCount - 2;
break;
case GL_TRIANGLE_FAN:
swPrimitiveType = es2::DRAW_TRIANGLEFAN;
swPrimitiveType = gl::DRAW_TRIANGLEFAN;
primitiveCount = elementCount - 2;
break;
default:
......
......@@ -24,7 +24,7 @@
#include <string>
namespace es2
namespace gl
{
struct Color;
......@@ -57,7 +57,7 @@ namespace es2sw
{
sw::DepthCompareMode ConvertDepthComparison(GLenum comparison);
sw::StencilCompareMode ConvertStencilComparison(GLenum comparison);
sw::Color<float> ConvertColor(es2::Color color);
sw::Color<float> ConvertColor(gl::Color color);
sw::BlendFactor ConvertBlendFunc(GLenum blend);
sw::BlendOperation ConvertBlendOp(GLenum blendOp);
sw::StencilOperation ConvertStencilOp(GLenum stencilOp);
......@@ -66,7 +66,7 @@ namespace es2sw
unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha);
sw::FilterType ConvertMagFilter(GLenum magFilter);
void ConvertMinFilter(GLenum texFilter, sw::FilterType *minFilter, sw::MipmapType *mipFilter, float maxAnisotropy);
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, es2::PrimitiveType &swPrimitiveType, int &primitiveCount);
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, gl::PrimitiveType &swPrimitiveType, int &primitiveCount);
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