Commit 108f3e10 by Chris Forbes

Fix GL resource access thread safety

Add resource manager lock, and ContextPtr to automatically take it Affects: Everything, dEQP-EGL.functional.sharing.gles2.multithread.* Bug: b/112184433 Change-Id: Ifdc5b18c738f92bbab08217f672a8ed6093e1672 Reviewed-on: https://swiftshader-review.googlesource.com/20388Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com>
parent 787e3d5b
......@@ -699,6 +699,7 @@ public:
Device *getDevice();
const GLubyte *getExtensions(GLuint index, GLuint *numExt = nullptr) const;
sw::MutexLock *getResourceLock() { return mResourceManager->getLock(); }
private:
~Context() override;
......@@ -769,6 +770,26 @@ private:
Device *device;
ResourceManager *mResourceManager;
};
// ptr to a context, which also holds the context's resource manager's lock.
class ContextPtr {
public:
explicit ContextPtr(Context *context) : ptr(context)
{
if (ptr) ptr->getResourceLock()->lock();
}
~ContextPtr() {
if (ptr) ptr->getResourceLock()->unlock();
}
Context *operator ->() { return ptr; }
operator bool() const { return ptr != nullptr; }
private:
Context *ptr;
};
}
#endif // INCLUDE_CONTEXT_H_
......@@ -65,7 +65,7 @@ Framebuffer::~Framebuffer()
Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint level) const
{
Context *context = getContext();
Context *context = getContextLocked();
Renderbuffer *buffer = nullptr;
if(type == GL_NONE)
......
......@@ -19,6 +19,7 @@
#define LIBGLESV2_RESOURCEMANAGER_H_
#include "common/NameSpace.hpp"
#include "Common/MutexLock.hpp"
#include <GLES2/gl2.h>
......@@ -86,9 +87,11 @@ public:
void checkSamplerAllocation(GLuint sampler);
bool isSampler(GLuint sampler);
sw::MutexLock *getLock() { return &mMutex; }
private:
std::size_t mRefCount;
sw::MutexLock mMutex;
gl::NameSpace<Buffer> mBufferNameSpace;
gl::NameSpace<Program> mProgramNameSpace;
......
......@@ -54,7 +54,7 @@ void ActiveTexture(GLenum texture)
{
TRACE("(GLenum texture = 0x%X)", texture);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -71,7 +71,7 @@ void AttachShader(GLuint program, GLuint shader)
{
TRACE("(GLuint program = %d, GLuint shader = %d)", program, shader);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -127,7 +127,7 @@ void BeginQueryEXT(GLenum target, GLuint name)
return error(GL_INVALID_OPERATION);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -144,7 +144,7 @@ void BindAttribLocation(GLuint program, GLuint index, const GLchar* name)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -175,7 +175,7 @@ void BindBuffer(GLenum target, GLuint buffer)
{
TRACE("(GLenum target = 0x%X, GLuint buffer = %d)", target, buffer);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -220,7 +220,7 @@ void BindFramebuffer(GLenum target, GLuint framebuffer)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -245,7 +245,7 @@ void BindRenderbuffer(GLenum target, GLuint renderbuffer)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -261,7 +261,7 @@ void BindTexture(GLenum target, GLuint texture)
{
TRACE("(GLenum target = 0x%X, GLuint texture = %d)", target, texture);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -303,7 +303,7 @@ void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
TRACE("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
red, green, blue, alpha);
es2::Context* context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -344,7 +344,7 @@ void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -452,7 +452,7 @@ void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dst
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -489,7 +489,7 @@ void BufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -522,7 +522,7 @@ void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -562,7 +562,7 @@ GLenum CheckFramebufferStatus(GLenum target)
return error(GL_INVALID_ENUM, 0);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -596,7 +596,7 @@ void Clear(GLbitfield mask)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -609,7 +609,7 @@ void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
TRACE("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
red, green, blue, alpha);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -621,7 +621,7 @@ void ClearDepthf(GLclampf depth)
{
TRACE("(GLclampf depth = %f)", depth);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -633,7 +633,7 @@ void ClearStencil(GLint s)
{
TRACE("(GLint s = %d)", s);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -646,7 +646,7 @@ void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
TRACE("(GLboolean red = %d, GLboolean green = %d, GLboolean blue = %d, GLboolean alpha = %d)",
red, green, blue, alpha);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -658,7 +658,7 @@ void CompileShader(GLuint shader)
{
TRACE("(GLuint shader = %d)", shader);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -702,7 +702,7 @@ void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLs
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -807,7 +807,7 @@ void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yo
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -867,7 +867,7 @@ void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1026,7 +1026,7 @@ void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1070,7 +1070,7 @@ GLuint CreateProgram(void)
{
TRACE("()");
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1084,7 +1084,7 @@ GLuint CreateShader(GLenum type)
{
TRACE("(GLenum type = 0x%X)", type);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1111,7 +1111,7 @@ void CullFace(GLenum mode)
case GL_BACK:
case GL_FRONT_AND_BACK:
{
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1133,7 +1133,7 @@ void DeleteBuffers(GLsizei n, const GLuint* buffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1153,7 +1153,7 @@ void DeleteFencesNV(GLsizei n, const GLuint* fences)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1173,7 +1173,7 @@ void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1196,7 +1196,7 @@ void DeleteProgram(GLuint program)
return;
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1225,7 +1225,7 @@ void DeleteQueriesEXT(GLsizei n, const GLuint *ids)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1245,7 +1245,7 @@ void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1265,7 +1265,7 @@ void DeleteShader(GLuint shader)
return;
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1294,7 +1294,7 @@ void DeleteTextures(GLsizei n, const GLuint* textures)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1327,7 +1327,7 @@ void DepthFunc(GLenum func)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1339,7 +1339,7 @@ void DepthMask(GLboolean flag)
{
TRACE("(GLboolean flag = %d)", flag);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1351,7 +1351,7 @@ void DepthRangef(GLclampf zNear, GLclampf zFar)
{
TRACE("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1363,7 +1363,7 @@ void DetachShader(GLuint program, GLuint shader)
{
TRACE("(GLuint program = %d, GLuint shader = %d)", program, shader);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1409,7 +1409,7 @@ void Disable(GLenum cap)
{
TRACE("(GLenum cap = 0x%X)", cap);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1441,7 +1441,7 @@ void DisableVertexAttribArray(GLuint index)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1472,7 +1472,7 @@ void DrawArrays(GLenum mode, GLint first, GLsizei count)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1510,7 +1510,7 @@ void DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1558,7 +1558,7 @@ void DrawArraysInstancedEXT(GLenum mode, GLint first, GLsizei count, GLsizei ins
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1606,7 +1606,7 @@ void DrawElementsInstancedEXT(GLenum mode, GLsizei count, GLenum type, const voi
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1624,7 +1624,7 @@ void VertexAttribDivisorEXT(GLuint index, GLuint divisor)
{
TRACE("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1661,7 +1661,7 @@ void DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei i
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1714,7 +1714,7 @@ void DrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const v
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1737,7 +1737,7 @@ void VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
{
TRACE("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1754,7 +1754,7 @@ void Enable(GLenum cap)
{
TRACE("(GLenum cap = 0x%X)", cap);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1786,7 +1786,7 @@ void EnableVertexAttribArray(GLuint index)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1807,7 +1807,7 @@ void EndQueryEXT(GLenum target)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1819,7 +1819,7 @@ void FinishFenceNV(GLuint fence)
{
TRACE("(GLuint fence = %d)", fence);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1838,7 +1838,7 @@ void Finish(void)
{
TRACE("()");
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1850,7 +1850,7 @@ void Flush(void)
{
TRACE("()");
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1869,7 +1869,7 @@ void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuff
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1936,7 +1936,7 @@ void FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GL
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2044,7 +2044,7 @@ void FrontFace(GLenum mode)
case GL_CW:
case GL_CCW:
{
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2066,7 +2066,7 @@ void GenBuffers(GLsizei n, GLuint* buffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2081,7 +2081,7 @@ void GenerateMipmap(GLenum target)
{
TRACE("(GLenum target = 0x%X)", target);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2134,7 +2134,7 @@ void GenFencesNV(GLsizei n, GLuint* fences)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2154,7 +2154,7 @@ void GenFramebuffers(GLsizei n, GLuint* framebuffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2174,7 +2174,7 @@ void GenQueriesEXT(GLsizei n, GLuint* ids)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2194,7 +2194,7 @@ void GenRenderbuffers(GLsizei n, GLuint* renderbuffers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2214,7 +2214,7 @@ void GenTextures(GLsizei n, GLuint* textures)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2236,7 +2236,7 @@ void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *len
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2274,7 +2274,7 @@ void GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* le
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2311,7 +2311,7 @@ void GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2337,7 +2337,7 @@ int GetAttribLocation(GLuint program, const GLchar* name)
{
TRACE("(GLuint program = %d, const GLchar* name = %s)", program, name);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2370,7 +2370,7 @@ void GetBooleanv(GLenum pname, GLboolean* params)
{
TRACE("(GLenum pname = 0x%X, GLboolean* params = %p)", pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2426,7 +2426,7 @@ void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
{
TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = %p)", target, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2472,7 +2472,7 @@ GLenum GetError(void)
{
TRACE("()");
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2486,7 +2486,7 @@ void GetFenceivNV(GLuint fence, GLenum pname, GLint *params)
{
TRACE("(GLuint fence = %d, GLenum pname = 0x%X, GLint *params = %p)", fence, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2505,7 +2505,7 @@ void GetFloatv(GLenum pname, GLfloat* params)
{
TRACE("(GLenum pname = 0x%X, GLfloat* params = %p)", pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2559,7 +2559,7 @@ void GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenu
TRACE("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint* params = %p)",
target, attachment, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2798,7 +2798,7 @@ void GetIntegerv(GLenum pname, GLint* params)
{
TRACE("(GLenum pname = 0x%X, GLint* params = %p)", pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(!context)
{
......@@ -2876,7 +2876,7 @@ void GetProgramiv(GLuint program, GLenum pname, GLint* params)
{
TRACE("(GLuint program = %d, GLenum pname = 0x%X, GLint* params = %p)", program, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2960,7 +2960,7 @@ void GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar*
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2994,7 +2994,7 @@ void GetQueryivEXT(GLenum target, GLenum pname, GLint *params)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3015,7 +3015,7 @@ void GetQueryObjectuivEXT(GLuint name, GLenum pname, GLuint *params)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3049,7 +3049,7 @@ void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
{
TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = %p)", target, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3092,7 +3092,7 @@ void GetShaderiv(GLuint shader, GLenum pname, GLint* params)
{
TRACE("(GLuint shader = %d, GLenum pname = %d, GLint* params = %p)", shader, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3143,7 +3143,7 @@ void GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* i
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3212,7 +3212,7 @@ void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* so
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3250,7 +3250,7 @@ const GLubyte* GetString(GLenum name)
return (GLubyte*)"OpenGL ES GLSL ES 3.00 SwiftShader " VERSION_STRING;
case GL_EXTENSIONS:
{
es2::Context *context = es2::getContext();
auto context = es2::getContext();
return context ? context->getExtensions(GL_INVALID_INDEX) : (GLubyte*)nullptr;
}
default:
......@@ -3262,7 +3262,7 @@ void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
{
TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat* params = %p)", target, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3349,7 +3349,7 @@ void GetTexParameteriv(GLenum target, GLenum pname, GLint* params)
{
TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = %p)", target, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3442,7 +3442,7 @@ void GetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat*
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3476,7 +3476,7 @@ void GetUniformfv(GLuint program, GLint location, GLfloat* params)
{
TRACE("(GLuint program = %d, GLint location = %d, GLfloat* params = %p)", program, location, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3516,7 +3516,7 @@ void GetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* pa
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3550,7 +3550,7 @@ void GetUniformiv(GLuint program, GLint location, GLint* params)
{
TRACE("(GLuint program = %d, GLint location = %d, GLint* params = %p)", program, location, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3584,7 +3584,7 @@ int GetUniformLocation(GLuint program, const GLchar* name)
{
TRACE("(GLuint program = %d, const GLchar* name = %s)", program, name);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(strstr(name, "gl_") == name)
{
......@@ -3622,7 +3622,7 @@ void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
{
TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLfloat* params = %p)", index, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3675,7 +3675,7 @@ void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
{
TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLint* params = %p)", index, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3729,7 +3729,7 @@ void GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
{
TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLvoid** pointer = %p)", index, pname, pointer);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3761,7 +3761,7 @@ void Hint(GLenum target, GLenum mode)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3786,7 +3786,7 @@ GLboolean IsBuffer(GLuint buffer)
{
TRACE("(GLuint buffer = %d)", buffer);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context && buffer)
{
......@@ -3805,7 +3805,7 @@ GLboolean IsEnabled(GLenum cap)
{
TRACE("(GLenum cap = 0x%X)", cap);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3834,7 +3834,7 @@ GLboolean IsFenceNV(GLuint fence)
{
TRACE("(GLuint fence = %d)", fence);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3855,7 +3855,7 @@ GLboolean IsFramebuffer(GLuint framebuffer)
{
TRACE("(GLuint framebuffer = %d)", framebuffer);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context && framebuffer)
{
......@@ -3874,7 +3874,7 @@ GLboolean IsProgram(GLuint program)
{
TRACE("(GLuint program = %d)", program);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context && program)
{
......@@ -3898,7 +3898,7 @@ GLboolean IsQueryEXT(GLuint name)
return GL_FALSE;
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3917,7 +3917,7 @@ GLboolean IsRenderbuffer(GLuint renderbuffer)
{
TRACE("(GLuint renderbuffer = %d)", renderbuffer);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context && renderbuffer)
{
......@@ -3936,7 +3936,7 @@ GLboolean IsShader(GLuint shader)
{
TRACE("(GLuint shader = %d)", shader);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context && shader)
{
......@@ -3955,7 +3955,7 @@ GLboolean IsTexture(GLuint texture)
{
TRACE("(GLuint texture = %d)", texture);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context && texture)
{
......@@ -3979,7 +3979,7 @@ void LineWidth(GLfloat width)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3991,7 +3991,7 @@ void LinkProgram(GLuint program)
{
TRACE("(GLuint program = %d)", program);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4026,7 +4026,7 @@ void PixelStorei(GLenum pname, GLint param)
{
TRACE("(GLenum pname = 0x%X, GLint param = %d)", pname, param);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4112,7 +4112,7 @@ void PolygonOffset(GLfloat factor, GLfloat units)
{
TRACE("(GLfloat factor = %f, GLfloat units = %f)", factor, units);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4132,7 +4132,7 @@ void ReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4151,7 +4151,7 @@ void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4192,7 +4192,7 @@ void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum inter
return error(GL_INVALID_OPERATION);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4236,7 +4236,7 @@ void SampleCoverage(GLclampf value, GLboolean invert)
{
TRACE("(GLclampf value = %f, GLboolean invert = %d)", value, invert);
es2::Context* context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4253,7 +4253,7 @@ void SetFenceNV(GLuint fence, GLenum condition)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4277,7 +4277,7 @@ void Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
return error(GL_INVALID_VALUE);
}
es2::Context* context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4305,7 +4305,7 @@ void ShaderSource(GLuint shader, GLsizei count, const GLchar *const *string, con
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4361,7 +4361,7 @@ void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4396,7 +4396,7 @@ void StencilMaskSeparate(GLenum face, GLuint mask)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4477,7 +4477,7 @@ void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4497,7 +4497,7 @@ GLboolean TestFenceNV(GLuint fence)
{
TRACE("(GLuint fence = %d)", fence);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4526,7 +4526,7 @@ void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4621,7 +4621,7 @@ void TexParameterf(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();
auto context = es2::getContext();
if(context)
{
......@@ -4752,7 +4752,7 @@ void TexParameteri(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();
auto context = es2::getContext();
if(context)
{
......@@ -4911,7 +4911,7 @@ void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLs
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -4969,7 +4969,7 @@ void Uniform1fv(GLint location, GLsizei count, const GLfloat* v)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5006,7 +5006,7 @@ void Uniform1iv(GLint location, GLsizei count, const GLint* v)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5045,7 +5045,7 @@ void Uniform2fv(GLint location, GLsizei count, const GLfloat* v)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5084,7 +5084,7 @@ void Uniform2iv(GLint location, GLsizei count, const GLint* v)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5123,7 +5123,7 @@ void Uniform3fv(GLint location, GLsizei count, const GLfloat* v)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5162,7 +5162,7 @@ void Uniform3iv(GLint location, GLsizei count, const GLint* v)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5201,7 +5201,7 @@ void Uniform4fv(GLint location, GLsizei count, const GLfloat* v)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5240,7 +5240,7 @@ void Uniform4iv(GLint location, GLsizei count, const GLint* v)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5273,7 +5273,7 @@ void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5306,7 +5306,7 @@ void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5339,7 +5339,7 @@ void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5366,7 +5366,7 @@ void UseProgram(GLuint program)
{
TRACE("(GLuint program = %d)", program);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5403,7 +5403,7 @@ void ValidateProgram(GLuint program)
{
TRACE("(GLuint program = %d)", program);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5434,7 +5434,7 @@ void VertexAttrib1f(GLuint index, GLfloat x)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5452,7 +5452,7 @@ void VertexAttrib1fv(GLuint index, const GLfloat* values)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5470,7 +5470,7 @@ void VertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5488,7 +5488,7 @@ void VertexAttrib2fv(GLuint index, const GLfloat* values)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5506,7 +5506,7 @@ void VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5524,7 +5524,7 @@ void VertexAttrib3fv(GLuint index, const GLfloat* values)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5542,7 +5542,7 @@ void VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5560,7 +5560,7 @@ void VertexAttrib4fv(GLuint index, const GLfloat* values)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5613,7 +5613,7 @@ void VertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normal
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5638,7 +5638,7 @@ void Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5666,7 +5666,7 @@ static void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5748,7 +5748,7 @@ void TexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei wi
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5795,7 +5795,7 @@ void TexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5836,7 +5836,7 @@ void CopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffs
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5901,7 +5901,7 @@ void CompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5958,7 +5958,7 @@ void CompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -5989,7 +5989,7 @@ void FramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget,
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -6081,7 +6081,7 @@ void EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -6194,7 +6194,7 @@ void DrawBuffersEXT(GLsizei n, const GLenum *bufs)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......
......@@ -214,7 +214,7 @@ GL_APICALL void GL_APIENTRY glReadBuffer(GLenum src)
{
TRACE("(GLenum src = 0x%X)", src);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -318,7 +318,7 @@ GL_APICALL void GL_APIENTRY glDrawRangeElements(GLenum mode, GLuint start, GLuin
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -364,7 +364,7 @@ GL_APICALL void GL_APIENTRY glTexImage3D(GLenum target, GLint level, GLint inter
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -418,7 +418,7 @@ GL_APICALL void GL_APIENTRY glTexSubImage3D(GLenum target, GLint level, GLint xo
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -465,7 +465,7 @@ GL_APICALL void GL_APIENTRY glCopyTexSubImage3D(GLenum target, GLint level, GLin
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -539,7 +539,7 @@ GL_APICALL void GL_APIENTRY glCompressedTexImage3D(GLenum target, GLint level, G
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -626,7 +626,7 @@ GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D(GLenum target, GLint level
break;
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -666,7 +666,7 @@ GL_APICALL void GL_APIENTRY glGenQueries(GLsizei n, GLuint *ids)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -686,7 +686,7 @@ GL_APICALL void GL_APIENTRY glDeleteQueries(GLsizei n, const GLuint *ids)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -706,7 +706,7 @@ GL_APICALL GLboolean GL_APIENTRY glIsQuery(GLuint id)
return GL_FALSE;
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -735,7 +735,7 @@ GL_APICALL void GL_APIENTRY glBeginQuery(GLenum target, GLuint id)
return error(GL_INVALID_OPERATION);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -752,7 +752,7 @@ GL_APICALL void GL_APIENTRY glEndQuery(GLenum target)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -770,7 +770,7 @@ GL_APICALL void GL_APIENTRY glGetQueryiv(GLenum target, GLenum pname, GLint *par
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -792,7 +792,7 @@ GL_APICALL void GL_APIENTRY glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -826,7 +826,7 @@ GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer(GLenum target)
{
TRACE("(GLenum target = 0x%X)", target);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -864,7 +864,7 @@ GL_APICALL void GL_APIENTRY glGetBufferPointerv(GLenum target, GLenum pname, voi
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -893,7 +893,7 @@ GL_APICALL void GL_APIENTRY glDrawBuffers(GLsizei n, const GLenum *bufs)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -985,7 +985,7 @@ GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv(GLint location, GLsizei count,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1017,7 +1017,7 @@ GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv(GLint location, GLsizei count,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1049,7 +1049,7 @@ GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv(GLint location, GLsizei count,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1081,7 +1081,7 @@ GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv(GLint location, GLsizei count,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1113,7 +1113,7 @@ GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv(GLint location, GLsizei count,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1145,7 +1145,7 @@ GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv(GLint location, GLsizei count,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1194,7 +1194,7 @@ GL_APICALL void GL_APIENTRY glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint sr
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1222,7 +1222,7 @@ GL_APICALL void GL_APIENTRY glFramebufferTextureLayer(GLenum target, GLenum atta
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1370,7 +1370,7 @@ GL_APICALL void *GL_APIENTRY glMapBufferRange(GLenum target, GLintptr offset, GL
return error(GL_INVALID_OPERATION, nullptr);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1424,7 +1424,7 @@ GL_APICALL void GL_APIENTRY glFlushMappedBufferRange(GLenum target, GLintptr off
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1466,7 +1466,7 @@ GL_APICALL void GL_APIENTRY glBindVertexArray(GLuint array)
{
TRACE("(GLuint array = %d)", array);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1493,7 +1493,7 @@ GL_APICALL void GL_APIENTRY glDeleteVertexArrays(GLsizei n, const GLuint *arrays
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1518,7 +1518,7 @@ GL_APICALL void GL_APIENTRY glGenVertexArrays(GLsizei n, GLuint *arrays)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1543,7 +1543,7 @@ GL_APICALL GLboolean GL_APIENTRY glIsVertexArray(GLuint array)
return GL_FALSE;
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1568,7 +1568,7 @@ GL_APICALL void GL_APIENTRY glGetIntegeri_v(GLenum target, GLuint index, GLint *
TRACE("(GLenum target = 0x%X, GLuint index = %d, GLint* data = %p)",
target, index, data);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1637,7 +1637,7 @@ GL_APICALL void GL_APIENTRY glBeginTransformFeedback(GLenum primitiveMode)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1662,7 +1662,7 @@ GL_APICALL void GL_APIENTRY glEndTransformFeedback(void)
{
TRACE("()");
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1693,7 +1693,7 @@ GL_APICALL void GL_APIENTRY glBindBufferRange(GLenum target, GLuint index, GLuin
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1734,7 +1734,7 @@ GL_APICALL void GL_APIENTRY glBindBufferBase(GLenum target, GLuint index, GLuint
TRACE("(GLenum target = 0x%X, GLuint index = %d, GLuint buffer = %d)",
target, index, buffer);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1780,7 +1780,7 @@ GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings(GLuint program, GLsizei
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1805,7 +1805,7 @@ GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying(GLuint program, GLuint
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1853,7 +1853,7 @@ GL_APICALL void GL_APIENTRY glVertexAttribIPointer(GLuint index, GLint size, GLe
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1874,7 +1874,7 @@ GL_APICALL void GL_APIENTRY glGetVertexAttribIiv(GLuint index, GLenum pname, GLi
TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLint *params = %p)",
index, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1930,7 +1930,7 @@ GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv(GLuint index, GLenum pname, GL
TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLuint *params = %p)",
index, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -1991,7 +1991,7 @@ GL_APICALL void GL_APIENTRY glVertexAttribI4i(GLuint index, GLint x, GLint y, GL
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2010,7 +2010,7 @@ GL_APICALL void GL_APIENTRY glVertexAttribI4ui(GLuint index, GLuint x, GLuint y,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2028,7 +2028,7 @@ GL_APICALL void GL_APIENTRY glVertexAttribI4iv(GLuint index, const GLint *v)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2045,7 +2045,7 @@ GL_APICALL void GL_APIENTRY glVertexAttribI4uiv(GLuint index, const GLuint *v)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2058,7 +2058,7 @@ GL_APICALL void GL_APIENTRY glGetUniformuiv(GLuint program, GLint location, GLui
TRACE("(GLuint program = %d, GLint location = %d, GLuint *params = %p)",
program, location, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2092,7 +2092,7 @@ GL_APICALL GLint GL_APIENTRY glGetFragDataLocation(GLuint program, const GLchar
{
TRACE("(GLuint program = %d, const GLchar *name = %p)", program, name);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2157,7 +2157,7 @@ GL_APICALL void GL_APIENTRY glUniform1uiv(GLint location, GLsizei count, const G
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2190,7 +2190,7 @@ GL_APICALL void GL_APIENTRY glUniform2uiv(GLint location, GLsizei count, const G
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2223,7 +2223,7 @@ GL_APICALL void GL_APIENTRY glUniform3uiv(GLint location, GLsizei count, const G
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2256,7 +2256,7 @@ GL_APICALL void GL_APIENTRY glUniform4uiv(GLint location, GLsizei count, const G
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2284,7 +2284,7 @@ GL_APICALL void GL_APIENTRY glClearBufferiv(GLenum buffer, GLint drawbuffer, con
TRACE("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint *value = %p)",
buffer, drawbuffer, value);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2321,7 +2321,7 @@ GL_APICALL void GL_APIENTRY glClearBufferuiv(GLenum buffer, GLint drawbuffer, co
TRACE("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint *value = %p)",
buffer, drawbuffer, value);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2348,7 +2348,7 @@ GL_APICALL void GL_APIENTRY glClearBufferfv(GLenum buffer, GLint drawbuffer, con
TRACE("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat *value = %p)",
buffer, drawbuffer, value);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2385,7 +2385,7 @@ GL_APICALL void GL_APIENTRY glClearBufferfi(GLenum buffer, GLint drawbuffer, GLf
TRACE("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth = %f, GLint stencil = %d)",
buffer, drawbuffer, depth, stencil);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2412,7 +2412,7 @@ GL_APICALL const GLubyte *GL_APIENTRY glGetStringi(GLenum name, GLuint index)
{
TRACE("(GLenum name = 0x%X, GLuint index = %d)", name, index);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
GLuint numExtensions;
......@@ -2445,7 +2445,7 @@ GL_APICALL void GL_APIENTRY glCopyBufferSubData(GLenum readTarget, GLenum writeT
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2488,7 +2488,7 @@ GL_APICALL void GL_APIENTRY glGetUniformIndices(GLuint program, GLsizei uniformC
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2548,7 +2548,7 @@ GL_APICALL void GL_APIENTRY glGetActiveUniformsiv(GLuint program, GLsizei unifor
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2589,7 +2589,7 @@ GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex(GLuint program, const GLcha
TRACE("(GLuint program = %d, const GLchar *uniformBlockName = %p)",
program, uniformBlockName);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2618,7 +2618,7 @@ GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv(GLuint program, GLuint uni
TRACE("(GLuint program = %d, GLuint uniformBlockIndex = %d, GLenum pname = 0x%X, GLint *params = %p)",
program, uniformBlockIndex, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2663,7 +2663,7 @@ GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName(GLuint program, GLuint u
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2693,7 +2693,7 @@ GL_APICALL void GL_APIENTRY glUniformBlockBinding(GLuint program, GLuint uniform
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2737,7 +2737,7 @@ GL_APICALL void GL_APIENTRY glDrawArraysInstanced(GLenum mode, GLint first, GLsi
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2785,7 +2785,7 @@ GL_APICALL void GL_APIENTRY glDrawElementsInstanced(GLenum mode, GLsizei count,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2816,7 +2816,7 @@ GL_APICALL GLsync GL_APIENTRY glFenceSync(GLenum condition, GLbitfield flags)
return error(GL_INVALID_VALUE, nullptr);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2830,7 +2830,7 @@ GL_APICALL GLboolean GL_APIENTRY glIsSync(GLsync sync)
{
TRACE("(GLsync sync = %p)", sync);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2854,7 +2854,7 @@ GL_APICALL void GL_APIENTRY glDeleteSync(GLsync sync)
return;
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2876,7 +2876,7 @@ GL_APICALL GLenum GL_APIENTRY glClientWaitSync(GLsync sync, GLbitfield flags, GL
return error(GL_INVALID_VALUE, GL_FALSE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2909,7 +2909,7 @@ GL_APICALL void GL_APIENTRY glWaitSync(GLsync sync, GLbitfield flags, GLuint64 t
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2930,7 +2930,7 @@ GL_APICALL void GL_APIENTRY glGetInteger64v(GLenum pname, GLint64 *data)
{
TRACE("(GLenum pname = 0x%X, GLint64 *data = %p)", pname, data);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -2993,7 +2993,7 @@ GL_APICALL void GL_APIENTRY glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSi
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3011,7 +3011,7 @@ GL_APICALL void GL_APIENTRY glGetInteger64i_v(GLenum target, GLuint index, GLint
{
TRACE("(GLenum target = 0x%X, GLuint index = %d, GLint64 *data = %p)", target, index, data);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3070,7 +3070,7 @@ GL_APICALL void GL_APIENTRY glGetBufferParameteri64v(GLenum target, GLenum pname
{
TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64 *params = %p)", target, pname, params);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3122,7 +3122,7 @@ GL_APICALL void GL_APIENTRY glGenSamplers(GLsizei count, GLuint *samplers)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3142,7 +3142,7 @@ GL_APICALL void GL_APIENTRY glDeleteSamplers(GLsizei count, const GLuint *sample
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3162,7 +3162,7 @@ GL_APICALL GLboolean GL_APIENTRY glIsSampler(GLuint sampler)
return GL_FALSE;
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3184,7 +3184,7 @@ GL_APICALL void GL_APIENTRY glBindSampler(GLuint unit, GLuint sampler)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3220,7 +3220,7 @@ GL_APICALL void GL_APIENTRY glSamplerParameteriv(GLuint sampler, GLenum pname, c
return;
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3251,7 +3251,7 @@ GL_APICALL void GL_APIENTRY glSamplerParameterfv(GLuint sampler, GLenum pname, c
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3277,7 +3277,7 @@ GL_APICALL void GL_APIENTRY glGetSamplerParameteriv(GLuint sampler, GLenum pname
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3300,7 +3300,7 @@ GL_APICALL void GL_APIENTRY glGetSamplerParameterfv(GLuint sampler, GLenum pname
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3317,7 +3317,7 @@ GL_APICALL void GL_APIENTRY glVertexAttribDivisor(GLuint index, GLuint divisor)
{
TRACE("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3339,7 +3339,7 @@ GL_APICALL void GL_APIENTRY glBindTransformFeedback(GLenum target, GLuint id)
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3368,7 +3368,7 @@ GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks(GLsizei n, const GLuint *
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3398,7 +3398,7 @@ GL_APICALL void GL_APIENTRY glGenTransformFeedbacks(GLsizei n, GLuint *ids)
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3418,7 +3418,7 @@ GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback(GLuint id)
return GL_FALSE;
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3437,7 +3437,7 @@ GL_APICALL void GL_APIENTRY glPauseTransformFeedback(void)
{
TRACE("()");
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3458,7 +3458,7 @@ GL_APICALL void GL_APIENTRY glResumeTransformFeedback(void)
{
TRACE("()");
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3485,7 +3485,7 @@ GL_APICALL void GL_APIENTRY glGetProgramBinary(GLuint program, GLsizei bufSize,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3511,7 +3511,7 @@ GL_APICALL void GL_APIENTRY glProgramBinary(GLuint program, GLenum binaryFormat,
return error(GL_INVALID_VALUE);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3532,7 +3532,7 @@ GL_APICALL void GL_APIENTRY glProgramParameteri(GLuint program, GLenum pname, GL
TRACE("(GLuint program = %d, GLenum pname = 0x%X, GLint value = %d)",
program, pname, value);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3571,7 +3571,7 @@ GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer(GLenum target, GLsizei nu
TRACE("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = %p, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
target, numAttachments, attachments, x, y, width, height);
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3655,7 +3655,7 @@ GL_APICALL void GL_APIENTRY glTexStorage2D(GLenum target, GLsizei levels, GLenum
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......@@ -3737,7 +3737,7 @@ GL_APICALL void GL_APIENTRY glTexStorage3D(GLenum target, GLsizei levels, GLenum
return error(GL_INVALID_ENUM);
}
es2::Context *context = es2::getContext();
auto context = es2::getContext();
if(context)
{
......
......@@ -75,7 +75,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
namespace es2
{
es2::Context *getContext()
Context *getContextLocked()
{
egl::Context *context = libEGL->clientGetCurrentContext();
......@@ -88,17 +88,23 @@ es2::Context *getContext()
return nullptr;
}
ContextPtr getContext()
{
return ContextPtr{getContextLocked()};
}
Device *getDevice()
{
Context *context = getContext();
Context *context = getContextLocked();
return context ? context->getDevice() : nullptr;
}
// Records an error code
// Assumed to already hold the context lock for the current context
void error(GLenum errorCode)
{
es2::Context *context = es2::getContext();
es2::Context *context = es2::getContextLocked();
if(context)
{
......
......@@ -30,7 +30,8 @@
namespace es2
{
Context *getContext();
Context *getContextLocked();
ContextPtr getContext();
Device *getDevice();
void error(GLenum errorCode);
......
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