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
......
......@@ -35,7 +35,7 @@
static bool validImageSize(GLint level, GLsizei width, GLsizei height)
{
if(level < 0 || level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS || width < 0 || height < 0)
if(level < 0 || level >= gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS || width < 0 || height < 0)
{
return false;
}
......@@ -43,7 +43,7 @@ static bool validImageSize(GLint level, GLsizei width, GLsizei height)
return true;
}
static bool validateSubImageParams(bool compressed, GLsizei width, GLsizei height, GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format, es2::Texture *texture)
static bool validateSubImageParams(bool compressed, GLsizei width, GLsizei height, GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format, gl::Texture *texture)
{
if(!texture)
{
......@@ -103,10 +103,10 @@ static bool validReadFormatType(GLenum format, GLenum type)
return false;
}
break;
case es2::IMPLEMENTATION_COLOR_READ_FORMAT:
case gl::IMPLEMENTATION_COLOR_READ_FORMAT:
switch(type)
{
case es2::IMPLEMENTATION_COLOR_READ_TYPE:
case gl::IMPLEMENTATION_COLOR_READ_TYPE:
break;
default:
return false;
......@@ -126,11 +126,11 @@ void GL_APIENTRY glActiveTexture(GLenum texture)
{
TRACE("(GLenum texture = 0x%X)", texture);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + es2::MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)
if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + gl::MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)
{
return error(GL_INVALID_ENUM);
}
......@@ -143,12 +143,12 @@ void GL_APIENTRY glAttachShader(GLuint program, GLuint shader)
{
TRACE("(GLuint program = %d, GLuint shader = %d)", program, shader);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
es2::Shader *shaderObject = context->getShader(shader);
gl::Program *programObject = context->getProgram(program);
gl::Shader *shaderObject = context->getShader(shader);
if(!programObject)
{
......@@ -199,7 +199,7 @@ void GL_APIENTRY glBeginQueryEXT(GLenum target, GLuint id)
return error(GL_INVALID_OPERATION);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -211,16 +211,16 @@ void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar
{
TRACE("(GLuint program = %d, GLuint index = %d, const GLchar* name = %s)", program, index, name);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject)
{
......@@ -247,7 +247,7 @@ void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer)
{
TRACE("(GLenum target = 0x%X, GLuint buffer = %d)", target, buffer);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -274,7 +274,7 @@ void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -299,7 +299,7 @@ void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -320,11 +320,11 @@ void GL_APIENTRY glBindTexture(GLenum target, GLuint texture)
{
TRACE("(GLenum target = 0x%X, GLuint texture = %d)", target, texture);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Texture *textureObject = context->getTexture(texture);
gl::Texture *textureObject = context->getTexture(texture);
if(textureObject && textureObject->getTarget() != target && texture != 0)
{
......@@ -353,11 +353,11 @@ void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLcla
TRACE("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
red, green, blue, alpha);
es2::Context* context = es2::getContext();
gl::Context* context = gl::getContext();
if(context)
{
context->setBlendColor(es2::clamp01(red), es2::clamp01(green), es2::clamp01(blue), es2::clamp01(alpha));
context->setBlendColor(gl::clamp01(red), gl::clamp01(green), gl::clamp01(blue), gl::clamp01(alpha));
}
}
......@@ -394,7 +394,7 @@ void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -498,7 +498,7 @@ void GL_APIENTRY glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlp
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -528,11 +528,11 @@ void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Buffer *buffer;
gl::Buffer *buffer;
switch(target)
{
......@@ -573,11 +573,11 @@ void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Buffer *buffer;
gl::Buffer *buffer;
switch(target)
{
......@@ -614,11 +614,11 @@ GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target)
return error(GL_INVALID_ENUM, 0);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Framebuffer *framebuffer = NULL;
gl::Framebuffer *framebuffer = NULL;
if(target == GL_READ_FRAMEBUFFER_ANGLE)
{
framebuffer = context->getReadFramebuffer();
......@@ -643,7 +643,7 @@ void GL_APIENTRY glClear(GLbitfield mask)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -656,7 +656,7 @@ void GL_APIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLcla
TRACE("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
red, green, blue, alpha);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -668,7 +668,7 @@ void GL_APIENTRY glClearDepthf(GLclampf depth)
{
TRACE("(GLclampf depth = %f)", depth);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -680,7 +680,7 @@ void GL_APIENTRY glClearStencil(GLint s)
{
TRACE("(GLint s = %d)", s);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -693,7 +693,7 @@ void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLb
TRACE("(GLboolean red = %d, GLboolean green = %d, GLboolean blue = %d, GLboolean alpha = %d)",
red, green, blue, alpha);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -705,11 +705,11 @@ void GL_APIENTRY glCompileShader(GLuint shader)
{
TRACE("(GLuint shader = %d)", shader);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Shader *shaderObject = context->getShader(shader);
gl::Shader *shaderObject = context->getShader(shader);
if(!shaderObject)
{
......@@ -767,11 +767,11 @@ void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum inter
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
if(level > es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
if(level > gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
return error(GL_INVALID_VALUE);
}
......@@ -779,8 +779,8 @@ void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum inter
switch(target)
{
case GL_TEXTURE_2D:
if(width > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||
height > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))
if(width > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||
height > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))
{
return error(GL_INVALID_VALUE);
}
......@@ -796,8 +796,8 @@ void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum inter
return error(GL_INVALID_VALUE);
}
if(width > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||
height > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))
if(width > (gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||
height > (gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))
{
return error(GL_INVALID_VALUE);
}
......@@ -806,14 +806,14 @@ void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum inter
return error(GL_INVALID_ENUM);
}
if(imageSize != es2::ComputeCompressedSize(width, height, internalformat))
if(imageSize != gl::ComputeCompressedSize(width, height, internalformat))
{
return error(GL_INVALID_VALUE);
}
if(target == GL_TEXTURE_2D)
{
es2::Texture2D *texture = context->getTexture2D();
gl::Texture2D *texture = context->getTexture2D();
if(!texture)
{
......@@ -824,7 +824,7 @@ void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum inter
}
else
{
es2::TextureCubeMap *texture = context->getTextureCubeMap();
gl::TextureCubeMap *texture = context->getTextureCubeMap();
if(!texture)
{
......@@ -855,7 +855,7 @@ void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xof
"GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)",
target, level, xoffset, yoffset, width, height, format, imageSize, data);
if(!es2::IsTextureTarget(target))
if(!gl::IsTextureTarget(target))
{
return error(GL_INVALID_ENUM);
}
......@@ -887,16 +887,16 @@ void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xof
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
if(level > es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
if(level > gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
return error(GL_INVALID_VALUE);
}
if(imageSize != es2::ComputeCompressedSize(width, height, format))
if(imageSize != gl::ComputeCompressedSize(width, height, format))
{
return error(GL_INVALID_VALUE);
}
......@@ -909,16 +909,16 @@ void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xof
if(target == GL_TEXTURE_2D)
{
es2::Texture2D *texture = context->getTexture2D();
gl::Texture2D *texture = context->getTexture2D();
if(validateSubImageParams(true, width, height, xoffset, yoffset, target, level, format, texture))
{
texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data);
}
}
else if(es2::IsCubemapTextureTarget(target))
else if(gl::IsCubemapTextureTarget(target))
{
es2::TextureCubeMap *texture = context->getTextureCubeMap();
gl::TextureCubeMap *texture = context->getTextureCubeMap();
if(validateSubImageParams(true, width, height, xoffset, yoffset, target, level, format, texture))
{
......@@ -948,15 +948,15 @@ void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalfor
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
switch(target)
{
case GL_TEXTURE_2D:
if(width > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||
height > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))
if(width > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||
height > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))
{
return error(GL_INVALID_VALUE);
}
......@@ -972,8 +972,8 @@ void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalfor
return error(GL_INVALID_VALUE);
}
if(width > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||
height > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))
if(width > (gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||
height > (gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))
{
return error(GL_INVALID_VALUE);
}
......@@ -982,7 +982,7 @@ void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalfor
return error(GL_INVALID_ENUM);
}
es2::Framebuffer *framebuffer = context->getReadFramebuffer();
gl::Framebuffer *framebuffer = context->getReadFramebuffer();
if(framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
{
......@@ -994,7 +994,7 @@ void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalfor
return error(GL_INVALID_OPERATION);
}
es2::Renderbuffer *source = framebuffer->getColorbuffer();
gl::Renderbuffer *source = framebuffer->getColorbuffer();
GLenum colorbufferFormat = source->getFormat();
// [OpenGL ES 2.0.24] table 3.9
......@@ -1053,7 +1053,7 @@ void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalfor
if(target == GL_TEXTURE_2D)
{
es2::Texture2D *texture = context->getTexture2D();
gl::Texture2D *texture = context->getTexture2D();
if(!texture)
{
......@@ -1062,9 +1062,9 @@ void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalfor
texture->copyImage(level, internalformat, x, y, width, height, framebuffer);
}
else if(es2::IsCubemapTextureTarget(target))
else if(gl::IsCubemapTextureTarget(target))
{
es2::TextureCubeMap *texture = context->getTextureCubeMap();
gl::TextureCubeMap *texture = context->getTextureCubeMap();
if(!texture)
{
......@@ -1083,7 +1083,7 @@ void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset,
"GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
target, level, xoffset, yoffset, x, y, width, height);
if(!es2::IsTextureTarget(target))
if(!gl::IsTextureTarget(target))
{
return error(GL_INVALID_ENUM);
}
......@@ -1103,16 +1103,16 @@ void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset,
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
if(level > es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
if(level > gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
return error(GL_INVALID_VALUE);
}
es2::Framebuffer *framebuffer = context->getReadFramebuffer();
gl::Framebuffer *framebuffer = context->getReadFramebuffer();
if(framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
{
......@@ -1124,15 +1124,15 @@ void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset,
return error(GL_INVALID_OPERATION);
}
es2::Renderbuffer *source = framebuffer->getColorbuffer();
gl::Renderbuffer *source = framebuffer->getColorbuffer();
GLenum colorbufferFormat = source->getFormat();
es2::Texture *texture = NULL;
gl::Texture *texture = NULL;
if(target == GL_TEXTURE_2D)
{
texture = context->getTexture2D();
}
else if(es2::IsCubemapTextureTarget(target))
else if(gl::IsCubemapTextureTarget(target))
{
texture = context->getTextureCubeMap();
}
......@@ -1210,7 +1210,7 @@ GLuint GL_APIENTRY glCreateProgram(void)
{
TRACE("()");
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1224,7 +1224,7 @@ GLuint GL_APIENTRY glCreateShader(GLenum type)
{
TRACE("(GLenum type = 0x%X)", type);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1251,7 +1251,7 @@ void GL_APIENTRY glCullFace(GLenum mode)
case GL_BACK:
case GL_FRONT_AND_BACK:
{
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1273,7 +1273,7 @@ void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1293,7 +1293,7 @@ void GL_APIENTRY glDeleteFencesNV(GLsizei n, const GLuint* fences)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1313,7 +1313,7 @@ void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1336,7 +1336,7 @@ void GL_APIENTRY glDeleteProgram(GLuint program)
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1365,7 +1365,7 @@ void GL_APIENTRY glDeleteQueriesEXT(GLsizei n, const GLuint *ids)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1385,7 +1385,7 @@ void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1405,7 +1405,7 @@ void GL_APIENTRY glDeleteShader(GLuint shader)
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1434,7 +1434,7 @@ void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1467,7 +1467,7 @@ void GL_APIENTRY glDepthFunc(GLenum func)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1479,7 +1479,7 @@ void GL_APIENTRY glDepthMask(GLboolean flag)
{
TRACE("(GLboolean flag = %d)", flag);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1491,7 +1491,7 @@ void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar)
{
TRACE("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1503,17 +1503,17 @@ void GL_APIENTRY glDetachShader(GLuint program, GLuint shader)
{
TRACE("(GLuint program = %d, GLuint shader = %d)", program, shader);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
es2::Shader *shaderObject = context->getShader(shader);
gl::Program *programObject = context->getProgram(program);
gl::Shader *shaderObject = context->getShader(shader);
if(!programObject)
{
es2::Shader *shaderByProgramHandle;
gl::Shader *shaderByProgramHandle;
shaderByProgramHandle = context->getShader(program);
if(!shaderByProgramHandle)
{
......@@ -1527,7 +1527,7 @@ void GL_APIENTRY glDetachShader(GLuint program, GLuint shader)
if(!shaderObject)
{
es2::Program *programByShaderHandle = context->getProgram(shader);
gl::Program *programByShaderHandle = context->getProgram(shader);
if(!programByShaderHandle)
{
return error(GL_INVALID_VALUE);
......@@ -1549,7 +1549,7 @@ void GL_APIENTRY glDisable(GLenum cap)
{
TRACE("(GLenum cap = 0x%X)", cap);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1574,12 +1574,12 @@ void GL_APIENTRY glDisableVertexAttribArray(GLuint index)
{
TRACE("(GLuint index = %d)", index);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1596,7 +1596,7 @@ void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1614,7 +1614,7 @@ void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const G
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1636,7 +1636,7 @@ void GL_APIENTRY glEnable(GLenum cap)
{
TRACE("(GLenum cap = 0x%X)", cap);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1661,12 +1661,12 @@ void GL_APIENTRY glEnableVertexAttribArray(GLuint index)
{
TRACE("(GLuint index = %d)", index);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1687,7 +1687,7 @@ void GL_APIENTRY glEndQueryEXT(GLenum target)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1699,11 +1699,11 @@ void GL_APIENTRY glFinishFenceNV(GLuint fence)
{
TRACE("(GLuint fence = %d)", fence);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Fence* fenceObject = context->getFence(fence);
gl::Fence* fenceObject = context->getFence(fence);
if(fenceObject == NULL)
{
......@@ -1718,7 +1718,7 @@ void GL_APIENTRY glFinish(void)
{
TRACE("()");
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1730,7 +1730,7 @@ void GL_APIENTRY glFlush(void)
{
TRACE("()");
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1749,11 +1749,11 @@ void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLe
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Framebuffer *framebuffer = NULL;
gl::Framebuffer *framebuffer = NULL;
GLuint framebufferHandle = 0;
if(target == GL_READ_FRAMEBUFFER_ANGLE)
{
......@@ -1808,7 +1808,7 @@ void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1818,7 +1818,7 @@ void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum
}
else
{
es2::Texture *tex = context->getTexture(texture);
gl::Texture *tex = context->getTexture(texture);
if(tex == NULL)
{
......@@ -1859,7 +1859,7 @@ void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum
}
}
es2::Framebuffer *framebuffer = NULL;
gl::Framebuffer *framebuffer = NULL;
GLuint framebufferHandle = 0;
if(target == GL_READ_FRAMEBUFFER_ANGLE)
{
......@@ -1895,7 +1895,7 @@ void GL_APIENTRY glFrontFace(GLenum mode)
case GL_CW:
case GL_CCW:
{
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1917,7 +1917,7 @@ void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1932,11 +1932,11 @@ void GL_APIENTRY glGenerateMipmap(GLenum target)
{
TRACE("(GLenum target = 0x%X)", target);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Texture *texture;
gl::Texture *texture;
switch(target)
{
......@@ -1968,7 +1968,7 @@ void GL_APIENTRY glGenFencesNV(GLsizei n, GLuint* fences)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -1988,7 +1988,7 @@ void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -2008,7 +2008,7 @@ void GL_APIENTRY glGenQueriesEXT(GLsizei n, GLuint* ids)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -2028,7 +2028,7 @@ void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -2048,7 +2048,7 @@ void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -2070,11 +2070,11 @@ void GL_APIENTRY glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject)
{
......@@ -2108,11 +2108,11 @@ void GL_APIENTRY glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsiz
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject)
{
......@@ -2145,11 +2145,11 @@ void GL_APIENTRY glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei*
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject)
{
......@@ -2171,12 +2171,12 @@ int GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar* name)
{
TRACE("(GLuint program = %d, const GLchar* name = %s)", program, name);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject)
{
......@@ -2205,7 +2205,7 @@ void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params)
{
TRACE("(GLenum pname = 0x%X, GLboolean* params = 0x%0.8p)", pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -2261,11 +2261,11 @@ void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* para
{
TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Buffer *buffer;
gl::Buffer *buffer;
switch(target)
{
......@@ -2303,7 +2303,7 @@ GLenum GL_APIENTRY glGetError(void)
{
TRACE("()");
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -2317,11 +2317,11 @@ void GL_APIENTRY glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
{
TRACE("(GLuint fence = %d, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", fence, pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Fence *fenceObject = context->getFence(fence);
gl::Fence *fenceObject = context->getFence(fence);
if(fenceObject == NULL)
{
......@@ -2336,7 +2336,7 @@ void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params)
{
TRACE("(GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -2390,7 +2390,7 @@ void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum att
TRACE("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
target, attachment, pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -2399,7 +2399,7 @@ void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum att
return error(GL_INVALID_ENUM);
}
es2::Framebuffer *framebuffer = NULL;
gl::Framebuffer *framebuffer = NULL;
if(target == GL_READ_FRAMEBUFFER_ANGLE)
{
if(context->getReadFramebufferHandle() == 0)
......@@ -2444,7 +2444,7 @@ void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum att
{
attachmentObjectType = attachmentType;
}
else if(es2::IsTextureTarget(attachmentType))
else if(gl::IsTextureTarget(attachmentType))
{
attachmentObjectType = GL_TEXTURE;
}
......@@ -2478,7 +2478,7 @@ void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum att
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
if(attachmentObjectType == GL_TEXTURE)
{
if(es2::IsCubemapTextureTarget(attachmentType))
if(gl::IsCubemapTextureTarget(attachmentType))
{
*params = attachmentType;
}
......@@ -2509,7 +2509,7 @@ void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params)
{
TRACE("(GLenum pname = 0x%X, GLint* params = 0x%0.8p)", pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -2569,11 +2569,11 @@ void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params)
{
TRACE("(GLuint program = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", program, pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject)
{
......@@ -2625,11 +2625,11 @@ void GL_APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* l
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject)
{
......@@ -2652,7 +2652,7 @@ void GL_APIENTRY glGetQueryivEXT(GLenum target, GLenum pname, GLint *params)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -2673,11 +2673,11 @@ void GL_APIENTRY glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Query *queryObject = context->getQuery(id, false, GL_NONE);
gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
if(!queryObject)
{
......@@ -2707,7 +2707,7 @@ void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint
{
TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -2721,7 +2721,7 @@ void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint
return error(GL_INVALID_OPERATION);
}
es2::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getRenderbufferHandle());
gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getRenderbufferHandle());
switch(pname)
{
......@@ -2745,11 +2745,11 @@ void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
{
TRACE("(GLuint shader = %d, GLenum pname = %d, GLint* params = 0x%0.8p)", shader, pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Shader *shaderObject = context->getShader(shader);
gl::Shader *shaderObject = context->getShader(shader);
if(!shaderObject)
{
......@@ -2789,11 +2789,11 @@ void GL_APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* len
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Shader *shaderObject = context->getShader(shader);
gl::Shader *shaderObject = context->getShader(shader);
if(!shaderObject)
{
......@@ -2851,11 +2851,11 @@ void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* leng
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Shader *shaderObject = context->getShader(shader);
gl::Shader *shaderObject = context->getShader(shader);
if(!shaderObject)
{
......@@ -2870,7 +2870,7 @@ const GLubyte* GL_APIENTRY glGetString(GLenum name)
{
TRACE("(GLenum name = 0x%X)", name);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
switch(name)
{
......@@ -2926,11 +2926,11 @@ void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* param
{
TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", target, pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Texture *texture;
gl::Texture *texture;
switch(target)
{
......@@ -2977,11 +2977,11 @@ void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
{
TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Texture *texture;
gl::Texture *texture;
switch(target)
{
......@@ -3034,7 +3034,7 @@ void GL_APIENTRY glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufS
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3043,7 +3043,7 @@ void GL_APIENTRY glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufS
return error(GL_INVALID_VALUE);
}
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject || !programObject->isLinked())
{
......@@ -3061,7 +3061,7 @@ void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params)
{
TRACE("(GLuint program = %d, GLint location = %d, GLfloat* params = 0x%0.8p)", program, location, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3070,7 +3070,7 @@ void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params)
return error(GL_INVALID_VALUE);
}
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject || !programObject->isLinked())
{
......@@ -3094,7 +3094,7 @@ void GL_APIENTRY glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufS
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3103,7 +3103,7 @@ void GL_APIENTRY glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufS
return error(GL_INVALID_VALUE);
}
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject || !programObject->isLinked())
{
......@@ -3126,7 +3126,7 @@ void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params)
{
TRACE("(GLuint program = %d, GLint location = %d, GLint* params = 0x%0.8p)", program, location, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3135,7 +3135,7 @@ void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params)
return error(GL_INVALID_VALUE);
}
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject || !programObject->isLinked())
{
......@@ -3158,7 +3158,7 @@ int GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar* name)
{
TRACE("(GLuint program = %d, const GLchar* name = %s)", program, name);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(strstr(name, "gl_") == name)
{
......@@ -3167,7 +3167,7 @@ int GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar* name)
if(context)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject)
{
......@@ -3196,16 +3196,16 @@ void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params
{
TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", index, pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
const es2::VertexAttribute &attribState = context->getVertexAttribState(index);
const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
switch(pname)
{
......@@ -3242,16 +3242,16 @@ void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
{
TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", index, pname, params);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
const es2::VertexAttribute &attribState = context->getVertexAttribState(index);
const gl::VertexAttribute &attribState = context->getVertexAttribState(index);
switch(pname)
{
......@@ -3289,11 +3289,11 @@ void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid**
{
TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLvoid** pointer = 0x%0.8p)", index, pname, pointer);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
......@@ -3321,7 +3321,7 @@ void GL_APIENTRY glHint(GLenum target, GLenum mode)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
switch(target)
{
case GL_GENERATE_MIPMAP_HINT:
......@@ -3339,11 +3339,11 @@ GLboolean GL_APIENTRY glIsBuffer(GLuint buffer)
{
TRACE("(GLuint buffer = %d)", buffer);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context && buffer)
{
es2::Buffer *bufferObject = context->getBuffer(buffer);
gl::Buffer *bufferObject = context->getBuffer(buffer);
if(bufferObject)
{
......@@ -3358,7 +3358,7 @@ GLboolean GL_APIENTRY glIsEnabled(GLenum cap)
{
TRACE("(GLenum cap = 0x%X)", cap);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3385,11 +3385,11 @@ GLboolean GL_APIENTRY glIsFenceNV(GLuint fence)
{
TRACE("(GLuint fence = %d)", fence);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Fence *fenceObject = context->getFence(fence);
gl::Fence *fenceObject = context->getFence(fence);
if(fenceObject == NULL)
{
......@@ -3406,11 +3406,11 @@ GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer)
{
TRACE("(GLuint framebuffer = %d)", framebuffer);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context && framebuffer)
{
es2::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer);
gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer);
if(framebufferObject)
{
......@@ -3425,11 +3425,11 @@ GLboolean GL_APIENTRY glIsProgram(GLuint program)
{
TRACE("(GLuint program = %d)", program);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context && program)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(programObject)
{
......@@ -3449,11 +3449,11 @@ GLboolean GL_APIENTRY glIsQueryEXT(GLuint id)
return GL_FALSE;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Query *queryObject = context->getQuery(id, false, GL_NONE);
gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
if(queryObject)
{
......@@ -3468,11 +3468,11 @@ GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer)
{
TRACE("(GLuint renderbuffer = %d)", renderbuffer);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context && renderbuffer)
{
es2::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);
gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);
if(renderbufferObject)
{
......@@ -3487,11 +3487,11 @@ GLboolean GL_APIENTRY glIsShader(GLuint shader)
{
TRACE("(GLuint shader = %d)", shader);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context && shader)
{
es2::Shader *shaderObject = context->getShader(shader);
gl::Shader *shaderObject = context->getShader(shader);
if(shaderObject)
{
......@@ -3506,11 +3506,11 @@ GLboolean GL_APIENTRY glIsTexture(GLuint texture)
{
TRACE("(GLuint texture = %d)", texture);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context && texture)
{
es2::Texture *textureObject = context->getTexture(texture);
gl::Texture *textureObject = context->getTexture(texture);
if(textureObject)
{
......@@ -3530,7 +3530,7 @@ void GL_APIENTRY glLineWidth(GLfloat width)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3542,11 +3542,11 @@ void GL_APIENTRY glLinkProgram(GLuint program)
{
TRACE("(GLuint program = %d)", program);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject)
{
......@@ -3568,7 +3568,7 @@ void GL_APIENTRY glPixelStorei(GLenum pname, GLint param)
{
TRACE("(GLenum pname = 0x%X, GLint param = %d)", pname, param);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3598,7 +3598,7 @@ void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units)
{
TRACE("(GLfloat factor = %f, GLfloat units = %f)", factor, units);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3623,7 +3623,7 @@ void GL_APIENTRY glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei heigh
return error(GL_INVALID_OPERATION);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3647,7 +3647,7 @@ void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, G
return error(GL_INVALID_OPERATION);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3659,7 +3659,7 @@ void GL_APIENTRY glReleaseShaderCompiler(void)
{
TRACE("()");
es2::Shader::releaseCompiler();
gl::Shader::releaseCompiler();
}
void GL_APIENTRY glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
......@@ -3675,7 +3675,7 @@ void GL_APIENTRY glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei sa
return error(GL_INVALID_ENUM);
}
if(!es2::IsColorRenderable(internalformat) && !es2::IsDepthRenderable(internalformat) && !es2::IsStencilRenderable(internalformat))
if(!gl::IsColorRenderable(internalformat) && !gl::IsDepthRenderable(internalformat) && !gl::IsStencilRenderable(internalformat))
{
return error(GL_INVALID_ENUM);
}
......@@ -3685,13 +3685,13 @@ void GL_APIENTRY glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei sa
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
if(width > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE ||
height > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE ||
samples > es2::IMPLEMENTATION_MAX_SAMPLES)
if(width > gl::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE ||
height > gl::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE ||
samples > gl::IMPLEMENTATION_MAX_SAMPLES)
{
return error(GL_INVALID_VALUE);
}
......@@ -3705,20 +3705,20 @@ void GL_APIENTRY glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei sa
switch(internalformat)
{
case GL_DEPTH_COMPONENT16:
context->setRenderbufferStorage(new es2::Depthbuffer(width, height, samples));
context->setRenderbufferStorage(new gl::Depthbuffer(width, height, samples));
break;
case GL_RGBA4:
case GL_RGB5_A1:
case GL_RGB565:
case GL_RGB8_OES:
case GL_RGBA8_OES:
context->setRenderbufferStorage(new es2::Colorbuffer(width, height, internalformat, samples));
context->setRenderbufferStorage(new gl::Colorbuffer(width, height, internalformat, samples));
break;
case GL_STENCIL_INDEX8:
context->setRenderbufferStorage(new es2::Stencilbuffer(width, height, samples));
context->setRenderbufferStorage(new gl::Stencilbuffer(width, height, samples));
break;
case GL_DEPTH24_STENCIL8_OES:
context->setRenderbufferStorage(new es2::DepthStencilbuffer(width, height, samples));
context->setRenderbufferStorage(new gl::DepthStencilbuffer(width, height, samples));
break;
default:
return error(GL_INVALID_ENUM);
......@@ -3735,11 +3735,11 @@ void GL_APIENTRY glSampleCoverage(GLclampf value, GLboolean invert)
{
TRACE("(GLclampf value = %f, GLboolean invert = %d)", value, invert);
es2::Context* context = es2::getContext();
gl::Context* context = gl::getContext();
if(context)
{
context->setSampleCoverageParams(es2::clamp01(value), invert == GL_TRUE);
context->setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE);
}
}
......@@ -3752,11 +3752,11 @@ void GL_APIENTRY glSetFenceNV(GLuint fence, GLenum condition)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Fence *fenceObject = context->getFence(fence);
gl::Fence *fenceObject = context->getFence(fence);
if(fenceObject == NULL)
{
......@@ -3776,7 +3776,7 @@ void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
return error(GL_INVALID_VALUE);
}
es2::Context* context = es2::getContext();
gl::Context* context = gl::getContext();
if(context)
{
......@@ -3804,11 +3804,11 @@ void GL_APIENTRY glShaderSource(GLuint shader, GLsizei count, const GLchar *cons
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Shader *shaderObject = context->getShader(shader);
gl::Shader *shaderObject = context->getShader(shader);
if(!shaderObject)
{
......@@ -3860,7 +3860,7 @@ void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLui
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3895,7 +3895,7 @@ void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3976,7 +3976,7 @@ void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLe
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -3996,11 +3996,11 @@ GLboolean GL_APIENTRY glTestFenceNV(GLuint fence)
{
TRACE("(GLuint fence = %d)", fence);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Fence *fenceObject = context->getFence(fence);
gl::Fence *fenceObject = context->getFence(fence);
if(fenceObject == NULL)
{
......@@ -4121,15 +4121,15 @@ void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
switch(target)
{
case GL_TEXTURE_2D:
if(width > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||
height > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))
if(width > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||
height > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))
{
return error(GL_INVALID_VALUE);
}
......@@ -4145,8 +4145,8 @@ void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat,
return error(GL_INVALID_VALUE);
}
if(width > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||
height > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))
if(width > (gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||
height > (gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))
{
return error(GL_INVALID_VALUE);
}
......@@ -4157,7 +4157,7 @@ void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat,
if(target == GL_TEXTURE_2D)
{
es2::Texture2D *texture = context->getTexture2D();
gl::Texture2D *texture = context->getTexture2D();
if(!texture)
{
......@@ -4168,7 +4168,7 @@ void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat,
}
else
{
es2::TextureCubeMap *texture = context->getTextureCubeMap();
gl::TextureCubeMap *texture = context->getTextureCubeMap();
if(!texture)
{
......@@ -4184,11 +4184,11 @@ void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param)
{
TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", target, pname, param);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Texture *texture;
gl::Texture *texture;
switch(target)
{
......@@ -4252,11 +4252,11 @@ void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param)
{
TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Texture *texture;
gl::Texture *texture;
switch(target)
{
......@@ -4324,7 +4324,7 @@ void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLin
"const GLvoid* pixels = 0x%0.8p)",
target, level, xoffset, yoffset, width, height, format, type, pixels);
if(!es2::IsTextureTarget(target))
if(!gl::IsTextureTarget(target))
{
return error(GL_INVALID_ENUM);
}
......@@ -4339,7 +4339,7 @@ void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLin
return error(GL_INVALID_VALUE);
}
if(!es2::CheckTextureFormatType(format, type))
if(!gl::CheckTextureFormatType(format, type))
{
return error(GL_INVALID_ENUM);
}
......@@ -4349,27 +4349,27 @@ void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLin
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
if(level > es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
if(level > gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
return error(GL_INVALID_VALUE);
}
if(target == GL_TEXTURE_2D)
{
es2::Texture2D *texture = context->getTexture2D();
gl::Texture2D *texture = context->getTexture2D();
if(validateSubImageParams(false, width, height, xoffset, yoffset, target, level, format, texture))
{
texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getUnpackAlignment(), pixels);
}
}
else if(es2::IsCubemapTextureTarget(target))
else if(gl::IsCubemapTextureTarget(target))
{
es2::TextureCubeMap *texture = context->getTextureCubeMap();
gl::TextureCubeMap *texture = context->getTextureCubeMap();
if(validateSubImageParams(false, width, height, xoffset, yoffset, target, level, format, texture))
{
......@@ -4402,11 +4402,11 @@ void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *program = context->getCurrentProgram();
gl::Program *program = context->getCurrentProgram();
if(!program)
{
......@@ -4439,11 +4439,11 @@ void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v)
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *program = context->getCurrentProgram();
gl::Program *program = context->getCurrentProgram();
if(!program)
{
......@@ -4478,11 +4478,11 @@ void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *program = context->getCurrentProgram();
gl::Program *program = context->getCurrentProgram();
if(!program)
{
......@@ -4517,11 +4517,11 @@ void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v)
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *program = context->getCurrentProgram();
gl::Program *program = context->getCurrentProgram();
if(!program)
{
......@@ -4556,11 +4556,11 @@ void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *program = context->getCurrentProgram();
gl::Program *program = context->getCurrentProgram();
if(!program)
{
......@@ -4595,11 +4595,11 @@ void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v)
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *program = context->getCurrentProgram();
gl::Program *program = context->getCurrentProgram();
if(!program)
{
......@@ -4634,11 +4634,11 @@ void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *program = context->getCurrentProgram();
gl::Program *program = context->getCurrentProgram();
if(!program)
{
......@@ -4673,11 +4673,11 @@ void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v)
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *program = context->getCurrentProgram();
gl::Program *program = context->getCurrentProgram();
if(!program)
{
......@@ -4706,11 +4706,11 @@ void GL_APIENTRY glUniformMatrix2fv(GLint location, GLsizei count, GLboolean tra
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *program = context->getCurrentProgram();
gl::Program *program = context->getCurrentProgram();
if(!program)
{
......@@ -4739,11 +4739,11 @@ void GL_APIENTRY glUniformMatrix3fv(GLint location, GLsizei count, GLboolean tra
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *program = context->getCurrentProgram();
gl::Program *program = context->getCurrentProgram();
if(!program)
{
......@@ -4772,11 +4772,11 @@ void GL_APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean tra
return;
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *program = context->getCurrentProgram();
gl::Program *program = context->getCurrentProgram();
if(!program)
{
......@@ -4794,11 +4794,11 @@ void GL_APIENTRY glUseProgram(GLuint program)
{
TRACE("(GLuint program = %d)", program);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject && program != 0)
{
......@@ -4825,11 +4825,11 @@ void GL_APIENTRY glValidateProgram(GLuint program)
{
TRACE("(GLuint program = %d)", program);
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Program *programObject = context->getProgram(program);
gl::Program *programObject = context->getProgram(program);
if(!programObject)
{
......@@ -4851,12 +4851,12 @@ void GL_APIENTRY glVertexAttrib1f(GLuint index, GLfloat x)
{
TRACE("(GLuint index = %d, GLfloat x = %f)", index, x);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -4869,12 +4869,12 @@ void GL_APIENTRY glVertexAttrib1fv(GLuint index, const GLfloat* values)
{
TRACE("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -4887,12 +4887,12 @@ void GL_APIENTRY glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
{
TRACE("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f)", index, x, y);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -4905,12 +4905,12 @@ void GL_APIENTRY glVertexAttrib2fv(GLuint index, const GLfloat* values)
{
TRACE("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -4923,12 +4923,12 @@ void GL_APIENTRY glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
{
TRACE("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", index, x, y, z);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -4941,12 +4941,12 @@ void GL_APIENTRY glVertexAttrib3fv(GLuint index, const GLfloat* values)
{
TRACE("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -4959,12 +4959,12 @@ void GL_APIENTRY glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z,
{
TRACE("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)", index, x, y, z, w);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -4977,12 +4977,12 @@ void GL_APIENTRY glVertexAttrib4fv(GLuint index, const GLfloat* values)
{
TRACE("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -4996,7 +4996,7 @@ void GL_APIENTRY glVertexAttribPointer(GLuint index, GLint size, GLenum type, GL
"GLboolean normalized = %d, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)",
index, size, type, normalized, stride, ptr);
if(index >= es2::MAX_VERTEX_ATTRIBS)
if(index >= gl::MAX_VERTEX_ATTRIBS)
{
return error(GL_INVALID_VALUE);
}
......@@ -5024,7 +5024,7 @@ void GL_APIENTRY glVertexAttribPointer(GLuint index, GLint size, GLenum type, GL
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -5041,7 +5041,7 @@ void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -5076,7 +5076,7 @@ void GL_APIENTRY glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, G
return error(GL_INVALID_OPERATION);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
......@@ -5125,11 +5125,11 @@ void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image
return error(GL_INVALID_OPERATION);
}
es2::Context *context = es2::getContext();
gl::Context *context = gl::getContext();
if(context)
{
es2::Texture2D *texture = 0;
gl::Texture2D *texture = 0;
switch(target)
{
......
......@@ -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