Remove try-catch blocks from entry points.
BUG=angle:700
Change-Id: I036901c397053a75677923304d7e1ed697c82aa2
Reviewed-on: https://chromium-review.googlesource.com/209570
Reviewed-by: <ehsan@mozilla.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index e004769..5e2ec4a 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -40,23 +40,16 @@
{
EVENT("(GLenum texture = 0x%X)", texture);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + context->getMaximumCombinedTextureImageUnits() - 1)
{
- if (texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + context->getMaximumCombinedTextureImageUnits() - 1)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- context->getState().setActiveSampler(texture - GL_TEXTURE0);
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->getState().setActiveSampler(texture - GL_TEXTURE0);
}
}
@@ -64,48 +57,41 @@
{
EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
+ gl::Program *programObject = context->getProgram(program);
+ gl::Shader *shaderObject = context->getShader(shader);
- if (context)
+ if (!programObject)
{
- gl::Program *programObject = context->getProgram(program);
- gl::Shader *shaderObject = context->getShader(shader);
-
- if (!programObject)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- if (!shaderObject)
- {
- if (context->getProgram(shader))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- if (!programObject->attachShader(shaderObject))
+ if (context->getShader(program))
{
return gl::error(GL_INVALID_OPERATION);
}
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!shaderObject)
+ {
+ if (context->getProgram(shader))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ if (!programObject->attachShader(shaderObject))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
}
}
@@ -113,23 +99,16 @@
{
EVENT("(GLenum target = 0x%X, GLuint %d)", target, id);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateBeginQuery(context, target, id))
{
- if (!ValidateBeginQuery(context, target, id))
- {
- return;
- }
-
- context->beginQuery(target, id);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->beginQuery(target, id);
}
}
@@ -137,42 +116,35 @@
{
EVENT("(GLuint program = %d, GLuint index = %d, const GLchar* name = 0x%0.8p)", program, index, name);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
{
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- if (strncmp(name, "gl_", 3) == 0)
+ if (context->getShader(program))
{
return gl::error(GL_INVALID_OPERATION);
}
-
- programObject->bindAttributeLocation(index, name);
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (strncmp(name, "gl_", 3) == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ programObject->bindAttributeLocation(index, name);
}
}
@@ -180,51 +152,44 @@
{
EVENT("(GLenum target = 0x%X, GLuint buffer = %d)", target, buffer);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
{
- if (!gl::ValidBufferTarget(context, target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (target)
- {
- case GL_ARRAY_BUFFER:
- context->bindArrayBuffer(buffer);
- return;
- case GL_ELEMENT_ARRAY_BUFFER:
- context->bindElementArrayBuffer(buffer);
- return;
- case GL_COPY_READ_BUFFER:
- context->bindCopyReadBuffer(buffer);
- return;
- case GL_COPY_WRITE_BUFFER:
- context->bindCopyWriteBuffer(buffer);
- return;
- case GL_PIXEL_PACK_BUFFER:
- context->bindPixelPackBuffer(buffer);
- return;
- case GL_PIXEL_UNPACK_BUFFER:
- context->bindPixelUnpackBuffer(buffer);
- return;
- case GL_UNIFORM_BUFFER:
- context->bindGenericUniformBuffer(buffer);
- return;
- case GL_TRANSFORM_FEEDBACK_BUFFER:
- context->bindGenericTransformFeedbackBuffer(buffer);
- return;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (target)
+ {
+ case GL_ARRAY_BUFFER:
+ context->bindArrayBuffer(buffer);
+ return;
+ case GL_ELEMENT_ARRAY_BUFFER:
+ context->bindElementArrayBuffer(buffer);
+ return;
+ case GL_COPY_READ_BUFFER:
+ context->bindCopyReadBuffer(buffer);
+ return;
+ case GL_COPY_WRITE_BUFFER:
+ context->bindCopyWriteBuffer(buffer);
+ return;
+ case GL_PIXEL_PACK_BUFFER:
+ context->bindPixelPackBuffer(buffer);
+ return;
+ case GL_PIXEL_UNPACK_BUFFER:
+ context->bindPixelUnpackBuffer(buffer);
+ return;
+ case GL_UNIFORM_BUFFER:
+ context->bindGenericUniformBuffer(buffer);
+ return;
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ context->bindGenericTransformFeedbackBuffer(buffer);
+ return;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -232,31 +197,24 @@
{
EVENT("(GLenum target = 0x%X, GLuint framebuffer = %d)", target, framebuffer);
- ANGLE_TRY
+ if (!gl::ValidFramebufferTarget(target))
{
- if (!gl::ValidFramebufferTarget(target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (target == GL_READ_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
- {
- context->bindReadFramebuffer(framebuffer);
- }
-
- if (target == GL_DRAW_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
- {
- context->bindDrawFramebuffer(framebuffer);
- }
- }
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ if (target == GL_READ_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
+ {
+ context->bindReadFramebuffer(framebuffer);
+ }
+
+ if (target == GL_DRAW_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
+ {
+ context->bindDrawFramebuffer(framebuffer);
+ }
}
}
@@ -264,23 +222,16 @@
{
EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %d)", target, renderbuffer);
- ANGLE_TRY
+ if (target != GL_RENDERBUFFER)
{
- if (target != GL_RENDERBUFFER)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- context->bindRenderbuffer(renderbuffer);
- }
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->bindRenderbuffer(renderbuffer);
}
}
@@ -288,50 +239,43 @@
{
EVENT("(GLenum target = 0x%X, GLuint texture = %d)", target, texture);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
+ gl::Texture *textureObject = context->getTexture(texture);
- if (context)
+ if (textureObject && textureObject->getTarget() != target && texture != 0)
{
- gl::Texture *textureObject = context->getTexture(texture);
+ return gl::error(GL_INVALID_OPERATION);
+ }
- if (textureObject && textureObject->getTarget() != target && texture != 0)
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ context->bindTexture2D(texture);
+ return;
+ case GL_TEXTURE_CUBE_MAP:
+ context->bindTextureCubeMap(texture);
+ return;
+ case GL_TEXTURE_3D:
+ if (context->getClientVersion() < 3)
{
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- context->bindTexture2D(texture);
- return;
- case GL_TEXTURE_CUBE_MAP:
- context->bindTextureCubeMap(texture);
- return;
- case GL_TEXTURE_3D:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- context->bindTexture3D(texture);
- return;
- case GL_TEXTURE_2D_ARRAY:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- context->bindTexture2DArray(texture);
- return;
- default:
return gl::error(GL_INVALID_ENUM);
}
+ context->bindTexture3D(texture);
+ return;
+ case GL_TEXTURE_2D_ARRAY:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ context->bindTexture2DArray(texture);
+ return;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
}
void __stdcall glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
@@ -339,18 +283,11 @@
EVENT("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
red, green, blue, alpha);
- ANGLE_TRY
- {
- gl::Context* context = gl::getNonLostContext();
+ gl::Context* context = gl::getNonLostContext();
- if (context)
- {
- context->getState().setBlendColor(gl::clamp01(red), gl::clamp01(green), gl::clamp01(blue), gl::clamp01(alpha));
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setBlendColor(gl::clamp01(red), gl::clamp01(green), gl::clamp01(blue), gl::clamp01(alpha));
}
}
@@ -363,44 +300,37 @@
{
EVENT("(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)", modeRGB, modeAlpha);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ switch (modeRGB)
{
- gl::Context *context = gl::getNonLostContext();
+ case GL_FUNC_ADD:
+ case GL_FUNC_SUBTRACT:
+ case GL_FUNC_REVERSE_SUBTRACT:
+ case GL_MIN:
+ case GL_MAX:
+ break;
- switch (modeRGB)
- {
- case GL_FUNC_ADD:
- case GL_FUNC_SUBTRACT:
- case GL_FUNC_REVERSE_SUBTRACT:
- case GL_MIN:
- case GL_MAX:
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (modeAlpha)
- {
- case GL_FUNC_ADD:
- case GL_FUNC_SUBTRACT:
- case GL_FUNC_REVERSE_SUBTRACT:
- case GL_MIN:
- case GL_MAX:
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (context)
- {
- context->getState().setBlendEquation(modeRGB, modeAlpha);
- }
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ switch (modeAlpha)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ case GL_FUNC_ADD:
+ case GL_FUNC_SUBTRACT:
+ case GL_FUNC_REVERSE_SUBTRACT:
+ case GL_MIN:
+ case GL_MAX:
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (context)
+ {
+ context->getState().setBlendEquation(modeRGB, modeAlpha);
}
}
@@ -414,132 +344,125 @@
EVENT("(GLenum srcRGB = 0x%X, GLenum dstRGB = 0x%X, GLenum srcAlpha = 0x%X, GLenum dstAlpha = 0x%X)",
srcRGB, dstRGB, srcAlpha, dstAlpha);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ switch (srcRGB)
{
- gl::Context *context = gl::getNonLostContext();
-
- switch (srcRGB)
- {
- case GL_ZERO:
- case GL_ONE:
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_DST_COLOR:
- case GL_ONE_MINUS_DST_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- case GL_DST_ALPHA:
- case GL_ONE_MINUS_DST_ALPHA:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- case GL_SRC_ALPHA_SATURATE:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (dstRGB)
- {
- case GL_ZERO:
- case GL_ONE:
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_DST_COLOR:
- case GL_ONE_MINUS_DST_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- case GL_DST_ALPHA:
- case GL_ONE_MINUS_DST_ALPHA:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- break;
-
- case GL_SRC_ALPHA_SATURATE:
- if (!context || context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (srcAlpha)
- {
- case GL_ZERO:
- case GL_ONE:
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_DST_COLOR:
- case GL_ONE_MINUS_DST_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- case GL_DST_ALPHA:
- case GL_ONE_MINUS_DST_ALPHA:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- case GL_SRC_ALPHA_SATURATE:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (dstAlpha)
- {
- case GL_ZERO:
- case GL_ONE:
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_DST_COLOR:
- case GL_ONE_MINUS_DST_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- case GL_DST_ALPHA:
- case GL_ONE_MINUS_DST_ALPHA:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- break;
-
- case GL_SRC_ALPHA_SATURATE:
- if (!context || context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- bool constantColorUsed = (srcRGB == GL_CONSTANT_COLOR || srcRGB == GL_ONE_MINUS_CONSTANT_COLOR ||
- dstRGB == GL_CONSTANT_COLOR || dstRGB == GL_ONE_MINUS_CONSTANT_COLOR);
-
- bool constantAlphaUsed = (srcRGB == GL_CONSTANT_ALPHA || srcRGB == GL_ONE_MINUS_CONSTANT_ALPHA ||
- dstRGB == GL_CONSTANT_ALPHA || dstRGB == GL_ONE_MINUS_CONSTANT_ALPHA);
-
- if (constantColorUsed && constantAlphaUsed)
- {
- ERR("Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR invalid under WebGL");
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (context)
- {
- context->getState().setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
- }
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ case GL_SRC_ALPHA_SATURATE:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ switch (dstRGB)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ break;
+
+ case GL_SRC_ALPHA_SATURATE:
+ if (!context || context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (srcAlpha)
+ {
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ case GL_SRC_ALPHA_SATURATE:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (dstAlpha)
+ {
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ break;
+
+ case GL_SRC_ALPHA_SATURATE:
+ if (!context || context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ bool constantColorUsed = (srcRGB == GL_CONSTANT_COLOR || srcRGB == GL_ONE_MINUS_CONSTANT_COLOR ||
+ dstRGB == GL_CONSTANT_COLOR || dstRGB == GL_ONE_MINUS_CONSTANT_COLOR);
+
+ bool constantAlphaUsed = (srcRGB == GL_CONSTANT_ALPHA || srcRGB == GL_ONE_MINUS_CONSTANT_ALPHA ||
+ dstRGB == GL_CONSTANT_ALPHA || dstRGB == GL_ONE_MINUS_CONSTANT_ALPHA);
+
+ if (constantColorUsed && constantAlphaUsed)
+ {
+ ERR("Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR invalid under WebGL");
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (context)
+ {
+ context->getState().setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
}
@@ -548,58 +471,51 @@
EVENT("(GLenum target = 0x%X, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p, GLenum usage = %d)",
target, size, data, usage);
- ANGLE_TRY
+ if (size < 0)
{
- if (size < 0)
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ switch (usage)
+ {
+ case GL_STREAM_DRAW:
+ case GL_STATIC_DRAW:
+ case GL_DYNAMIC_DRAW:
+ break;
+
+ case GL_STREAM_READ:
+ case GL_STREAM_COPY:
+ case GL_STATIC_READ:
+ case GL_STATIC_COPY:
+ case GL_DYNAMIC_READ:
+ case GL_DYNAMIC_COPY:
+ if (context && context->getClientVersion() < 3)
{
- return gl::error(GL_INVALID_VALUE);
+ return gl::error(GL_INVALID_ENUM);
}
+ break;
- gl::Context *context = gl::getNonLostContext();
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
- switch (usage)
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
{
- case GL_STREAM_DRAW:
- case GL_STATIC_DRAW:
- case GL_DYNAMIC_DRAW:
- break;
-
- case GL_STREAM_READ:
- case GL_STREAM_COPY:
- case GL_STATIC_READ:
- case GL_STATIC_COPY:
- case GL_DYNAMIC_READ:
- case GL_DYNAMIC_COPY:
- if (context && context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
-
- default:
return gl::error(GL_INVALID_ENUM);
}
- if (context)
+ gl::Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (!buffer)
{
- if (!gl::ValidBufferTarget(context, target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Buffer *buffer = context->getState().getTargetBuffer(target);
-
- if (!buffer)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- buffer->bufferData(data, size, usage);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ buffer->bufferData(data, size, usage);
}
}
@@ -608,56 +524,49 @@
EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p)",
target, offset, size, data);
- ANGLE_TRY
+ if (size < 0 || offset < 0)
{
- if (size < 0 || offset < 0)
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (data == NULL)
+ {
+ return;
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (!buffer)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (buffer->isMapped())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Check for possible overflow of size + offset
+ if (!rx::IsUnsignedAdditionSafe<size_t>(size, offset))
+ {
+ return gl::error(GL_OUT_OF_MEMORY);
+ }
+
+ if (size + offset > buffer->getSize())
{
return gl::error(GL_INVALID_VALUE);
}
- if (data == NULL)
- {
- return;
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (!gl::ValidBufferTarget(context, target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Buffer *buffer = context->getState().getTargetBuffer(target);
-
- if (!buffer)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (buffer->isMapped())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // Check for possible overflow of size + offset
- if (!rx::IsUnsignedAdditionSafe<size_t>(size, offset))
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
-
- if (size + offset > buffer->getSize())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- buffer->bufferSubData(data, size, offset);
- }
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ buffer->bufferSubData(data, size, offset);
}
}
@@ -665,25 +574,18 @@
{
EVENT("(GLenum target = 0x%X)", target);
- ANGLE_TRY
+ if (!gl::ValidFramebufferTarget(target))
{
- if (!gl::ValidFramebufferTarget(target))
- {
- return gl::error(GL_INVALID_ENUM, 0);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
- ASSERT(framebuffer);
- return framebuffer->completeness();
- }
+ return gl::error(GL_INVALID_ENUM, 0);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY, 0);
+ gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+ return framebuffer->completeness();
}
return 0;
@@ -693,30 +595,23 @@
{
EVENT("(GLbitfield mask = 0x%X)", mask);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::Framebuffer *framebufferObject = context->getState().getDrawFramebuffer();
+
+ if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE)
{
- gl::Framebuffer *framebufferObject = context->getState().getDrawFramebuffer();
-
- if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE)
- {
- return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- context->clear(mask);
+ return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->clear(mask);
}
}
@@ -725,18 +620,11 @@
EVENT("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
red, green, blue, alpha);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- context->getState().setClearColor(red, green, blue, alpha);
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setClearColor(red, green, blue, alpha);
}
}
@@ -744,18 +632,11 @@
{
EVENT("(GLclampf depth = %f)", depth);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- context->getState().setClearDepth(depth);
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setClearDepth(depth);
}
}
@@ -763,18 +644,11 @@
{
EVENT("(GLint s = %d)", s);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- context->getState().setClearStencil(s);
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setClearStencil(s);
}
}
@@ -783,18 +657,11 @@
EVENT("(GLboolean red = %d, GLboolean green = %u, GLboolean blue = %u, GLboolean alpha = %u)",
red, green, blue, alpha);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- context->getState().setColorMask(red == GL_TRUE, green == GL_TRUE, blue == GL_TRUE, alpha == GL_TRUE);
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setColorMask(red == GL_TRUE, green == GL_TRUE, blue == GL_TRUE, alpha == GL_TRUE);
}
}
@@ -802,96 +669,82 @@
{
EVENT("(GLuint shader = %d)", shader);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
{
- gl::Shader *shaderObject = context->getShader(shader);
-
- if (!shaderObject)
+ if (context->getProgram(shader))
{
- if (context->getProgram(shader))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
-
- shaderObject->compile();
- }
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
-}
-
-void __stdcall glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const GLvoid* data)
-{
- EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, "
- "GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)",
- target, level, internalformat, width, height, border, imageSize, data);
-
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (context->getClientVersion() < 3 &&
- !ValidateES2TexImageParameters(context, target, level, internalformat, true, false,
- 0, 0, width, height, border, GL_NONE, GL_NONE, data))
- {
- return;
- }
-
- if (context->getClientVersion() >= 3 &&
- !ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
- 0, 0, 0, width, height, 1, border, GL_NONE, GL_NONE, data))
- {
- return;
- }
-
- if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(internalformat, GL_UNSIGNED_BYTE, width, height))
+ else
{
return gl::error(GL_INVALID_VALUE);
}
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- {
- gl::Texture2D *texture = context->getTexture2D();
- texture->setCompressedImage(level, internalformat, width, height, imageSize, data);
- }
- break;
-
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- texture->setCompressedImage(target, level, internalformat, width, height, imageSize, data);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
}
+
+ shaderObject->compile();
}
- ANGLE_CATCH_ALL
+}
+
+void __stdcall glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
+ GLint border, GLsizei imageSize, const GLvoid* data)
+{
+ EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, "
+ "GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)",
+ target, level, internalformat, width, height, border, imageSize, data);
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, internalformat, true, false,
+ 0, 0, width, height, border, GL_NONE, GL_NONE, data))
+ {
+ return;
+ }
+
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
+ 0, 0, 0, width, height, 1, border, GL_NONE, GL_NONE, data))
+ {
+ return;
+ }
+
+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(internalformat, GL_UNSIGNED_BYTE, width, height))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+ texture->setCompressedImage(level, internalformat, width, height, imageSize, data);
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setCompressedImage(target, level, internalformat, width, height, imageSize, data);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -903,60 +756,53 @@
"GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)",
target, level, xoffset, yoffset, width, height, format, imageSize, data);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true,
+ xoffset, yoffset, width, height, 0, GL_NONE, GL_NONE, data))
{
- if (context->getClientVersion() < 3 &&
- !ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true,
- xoffset, yoffset, width, height, 0, GL_NONE, GL_NONE, data))
- {
- return;
- }
-
- if (context->getClientVersion() >= 3 &&
- !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
- xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data))
- {
- return;
- }
-
- if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(format, GL_UNSIGNED_BYTE, width, height))
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- {
- gl::Texture2D *texture = context->getTexture2D();
- texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data);
- }
- break;
-
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- texture->subImageCompressed(target, level, xoffset, yoffset, width, height, format, imageSize, data);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
+ xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data))
+ {
+ return;
+ }
+
+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(format, GL_UNSIGNED_BYTE, width, height))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+ texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data);
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->subImageCompressed(target, level, xoffset, yoffset, width, height, format, imageSize, data);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -966,57 +812,50 @@
"GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)",
target, level, internalformat, x, y, width, height, border);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2CopyTexImageParameters(context, target, level, internalformat, false,
+ 0, 0, x, y, width, height, border))
{
- if (context->getClientVersion() < 3 &&
- !ValidateES2CopyTexImageParameters(context, target, level, internalformat, false,
- 0, 0, x, y, width, height, border))
- {
- return;
- }
-
- if (context->getClientVersion() >= 3 &&
- !ValidateES3CopyTexImageParameters(context, target, level, internalformat, false,
- 0, 0, 0, x, y, width, height, border))
- {
- return;
- }
-
- gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer();
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- {
- gl::Texture2D *texture = context->getTexture2D();
- texture->copyImage(level, internalformat, x, y, width, height, framebuffer);
- }
- break;
-
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3CopyTexImageParameters(context, target, level, internalformat, false,
+ 0, 0, 0, x, y, width, height, border))
+ {
+ return;
+ }
+
+ gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer();
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+ texture->copyImage(level, internalformat, x, y, width, height, framebuffer);
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -1026,58 +865,50 @@
"GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
target, level, xoffset, yoffset, x, y, width, height);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true,
+ xoffset, yoffset, x, y, width, height, 0))
{
- if (context->getClientVersion() < 3 &&
- !ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true,
- xoffset, yoffset, x, y, width, height, 0))
- {
- return;
- }
-
- if (context->getClientVersion() >= 3 &&
- !ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true,
- xoffset, yoffset, 0, x, y, width, height, 0))
- {
- return;
- }
-
- gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer();
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- {
- gl::Texture2D *texture = context->getTexture2D();
- texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer);
- }
- break;
-
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true,
+ xoffset, yoffset, 0, x, y, width, height, 0))
+ {
+ return;
+ }
+
+ gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer();
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+ texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer);
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -1085,18 +916,10 @@
{
EVENT("()");
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- return context->createProgram();
- }
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, 0);
+ return context->createProgram();
}
return 0;
@@ -1106,25 +929,18 @@
{
EVENT("(GLenum type = 0x%X)", type);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- switch (type)
- {
- case GL_FRAGMENT_SHADER:
- case GL_VERTEX_SHADER:
- return context->createShader(type);
- default:
- return gl::error(GL_INVALID_ENUM, 0);
- }
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY, 0);
+ switch (type)
+ {
+ case GL_FRAGMENT_SHADER:
+ case GL_VERTEX_SHADER:
+ return context->createShader(type);
+ default:
+ return gl::error(GL_INVALID_ENUM, 0);
+ }
}
return 0;
@@ -1134,29 +950,22 @@
{
EVENT("(GLenum mode = 0x%X)", mode);
- ANGLE_TRY
+ switch (mode)
{
- switch (mode)
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
{
- case GL_FRONT:
- case GL_BACK:
- case GL_FRONT_AND_BACK:
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- context->getState().setCullMode(mode);
- }
+ if (context)
+ {
+ context->getState().setCullMode(mode);
}
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
}
@@ -1164,26 +973,19 @@
{
EVENT("(GLsizei n = %d, const GLuint* buffers = 0x%0.8p)", n, buffers);
- ANGLE_TRY
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- for (int i = 0; i < n; i++)
- {
- context->deleteBuffer(buffers[i]);
- }
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ for (int i = 0; i < n; i++)
+ {
+ context->deleteBuffer(buffers[i]);
+ }
}
}
@@ -1191,26 +993,19 @@
{
EVENT("(GLsizei n = %d, const GLuint* fences = 0x%0.8p)", n, fences);
- ANGLE_TRY
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- for (int i = 0; i < n; i++)
- {
- context->deleteFenceNV(fences[i]);
- }
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ for (int i = 0; i < n; i++)
+ {
+ context->deleteFenceNV(fences[i]);
+ }
}
}
@@ -1218,65 +1013,51 @@
{
EVENT("(GLsizei n = %d, const GLuint* framebuffers = 0x%0.8p)", n, framebuffers);
- ANGLE_TRY
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ return gl::error(GL_INVALID_VALUE);
+ }
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
{
- for (int i = 0; i < n; i++)
+ if (framebuffers[i] != 0)
{
- if (framebuffers[i] != 0)
- {
- context->deleteFramebuffer(framebuffers[i]);
- }
+ context->deleteFramebuffer(framebuffers[i]);
}
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
}
void __stdcall glDeleteProgram(GLuint program)
{
EVENT("(GLuint program = %d)", program);
- ANGLE_TRY
+ if (program == 0)
{
- if (program == 0)
- {
- return;
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (!context->getProgram(program))
- {
- if(context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- context->deleteProgram(program);
- }
+ return;
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ if (!context->getProgram(program))
+ {
+ if(context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ context->deleteProgram(program);
}
}
@@ -1284,26 +1065,19 @@
{
EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids);
- ANGLE_TRY
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- for (int i = 0; i < n; i++)
- {
- context->deleteQuery(ids[i]);
- }
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ for (int i = 0; i < n; i++)
+ {
+ context->deleteQuery(ids[i]);
+ }
}
}
@@ -1311,26 +1085,19 @@
{
EVENT("(GLsizei n = %d, const GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers);
- ANGLE_TRY
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- for (int i = 0; i < n; i++)
- {
- context->deleteRenderbuffer(renderbuffers[i]);
- }
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ for (int i = 0; i < n; i++)
+ {
+ context->deleteRenderbuffer(renderbuffers[i]);
+ }
}
}
@@ -1338,35 +1105,28 @@
{
EVENT("(GLuint shader = %d)", shader);
- ANGLE_TRY
+ if (shader == 0)
{
- if (shader == 0)
- {
- return;
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (!context->getShader(shader))
- {
- if(context->getProgram(shader))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- context->deleteShader(shader);
- }
+ return;
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ if (!context->getShader(shader))
+ {
+ if(context->getProgram(shader))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ context->deleteShader(shader);
}
}
@@ -1374,63 +1134,49 @@
{
EVENT("(GLsizei n = %d, const GLuint* textures = 0x%0.8p)", n, textures);
- ANGLE_TRY
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ return gl::error(GL_INVALID_VALUE);
+ }
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ for (int i = 0; i < n; i++)
{
- for (int i = 0; i < n; i++)
+ if (textures[i] != 0)
{
- if (textures[i] != 0)
- {
- context->deleteTexture(textures[i]);
- }
+ context->deleteTexture(textures[i]);
}
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
}
void __stdcall glDepthFunc(GLenum func)
{
EVENT("(GLenum func = 0x%X)", func);
- ANGLE_TRY
+ switch (func)
{
- switch (func)
- {
- case GL_NEVER:
- case GL_ALWAYS:
- case GL_LESS:
- case GL_LEQUAL:
- case GL_EQUAL:
- case GL_GREATER:
- case GL_GEQUAL:
- case GL_NOTEQUAL:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- context->getState().setDepthFunc(func);
- }
+ case GL_NEVER:
+ case GL_ALWAYS:
+ case GL_LESS:
+ case GL_LEQUAL:
+ case GL_EQUAL:
+ case GL_GREATER:
+ case GL_GEQUAL:
+ case GL_NOTEQUAL:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setDepthFunc(func);
}
}
@@ -1438,18 +1184,11 @@
{
EVENT("(GLboolean flag = %u)", flag);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- context->getState().setDepthMask(flag != GL_FALSE);
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setDepthMask(flag != GL_FALSE);
}
}
@@ -1457,18 +1196,11 @@
{
EVENT("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- context->getState().setDepthRange(zNear, zFar);
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setDepthRange(zNear, zFar);
}
}
@@ -1476,52 +1208,45 @@
{
EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
- if (context)
+ gl::Program *programObject = context->getProgram(program);
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!programObject)
{
-
- gl::Program *programObject = context->getProgram(program);
- gl::Shader *shaderObject = context->getShader(shader);
-
- if (!programObject)
+ gl::Shader *shaderByProgramHandle;
+ shaderByProgramHandle = context->getShader(program);
+ if (!shaderByProgramHandle)
{
- gl::Shader *shaderByProgramHandle;
- shaderByProgramHandle = context->getShader(program);
- if (!shaderByProgramHandle)
- {
- return gl::error(GL_INVALID_VALUE);
- }
- else
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_VALUE);
}
-
- if (!shaderObject)
- {
- gl::Program *programByShaderHandle = context->getProgram(shader);
- if (!programByShaderHandle)
- {
- return gl::error(GL_INVALID_VALUE);
- }
- else
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- }
-
- if (!programObject->detachShader(shaderObject))
+ else
{
return gl::error(GL_INVALID_OPERATION);
}
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!shaderObject)
+ {
+ gl::Program *programByShaderHandle = context->getProgram(shader);
+ if (!programByShaderHandle)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+
+ if (!programObject->detachShader(shaderObject))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
}
}
@@ -1529,23 +1254,16 @@
{
EVENT("(GLenum cap = 0x%X)", cap);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidCap(context, cap))
{
- if (!ValidCap(context, cap))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- context->getState().setEnableFeature(cap, false);
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->getState().setEnableFeature(cap, false);
}
}
@@ -1553,23 +1271,16 @@
{
EVENT("(GLuint index = %d)", index);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- context->getState().setEnableVertexAttribArray(index, false);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setEnableVertexAttribArray(index, false);
}
}
@@ -1577,23 +1288,16 @@
{
EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)", mode, first, count);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateDrawArrays(context, mode, first, count))
{
- if (!ValidateDrawArrays(context, mode, first, count))
- {
- return;
- }
-
- context->drawArrays(mode, first, count, 0);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->drawArrays(mode, first, count, 0);
}
}
@@ -1601,23 +1305,16 @@
{
EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)", mode, first, count, primcount);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateDrawArraysInstanced(context, mode, first, count, primcount))
{
- if (!ValidateDrawArraysInstanced(context, mode, first, count, primcount))
- {
- return;
- }
-
- context->drawArrays(mode, first, count, primcount);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->drawArrays(mode, first, count, primcount);
}
}
@@ -1626,23 +1323,16 @@
EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p)",
mode, count, type, indices);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateDrawElements(context, mode, count, type, indices))
{
- if (!ValidateDrawElements(context, mode, count, type, indices))
- {
- return;
- }
-
- context->drawElements(mode, count, type, indices, 0);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->drawElements(mode, count, type, indices, 0);
}
}
@@ -1651,23 +1341,16 @@
EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei primcount = %d)",
mode, count, type, indices, primcount);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateDrawElementsInstanced(context, mode, count, type, indices, primcount))
{
- if (!ValidateDrawElementsInstanced(context, mode, count, type, indices, primcount))
- {
- return;
- }
-
- context->drawElements(mode, count, type, indices, primcount);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->drawElements(mode, count, type, indices, primcount);
}
}
@@ -1675,23 +1358,16 @@
{
EVENT("(GLenum cap = 0x%X)", cap);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidCap(context, cap))
{
- if (!ValidCap(context, cap))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- context->getState().setEnableFeature(cap, true);
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->getState().setEnableFeature(cap, true);
}
}
@@ -1699,23 +1375,16 @@
{
EVENT("(GLuint index = %d)", index);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- context->getState().setEnableVertexAttribArray(index, true);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setEnableVertexAttribArray(index, true);
}
}
@@ -1723,23 +1392,16 @@
{
EVENT("GLenum target = 0x%X)", target);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateEndQuery(context, target))
{
- if (!ValidateEndQuery(context, target))
- {
- return;
- }
-
- context->endQuery(target);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->endQuery(target);
}
}
@@ -1747,30 +1409,23 @@
{
EVENT("(GLuint fence = %d)", fence);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
+
+ if (fenceObject == NULL)
{
- gl::FenceNV *fenceObject = context->getFenceNV(fence);
-
- if (fenceObject == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (fenceObject->isFence() != GL_TRUE)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- fenceObject->finishFence();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (fenceObject->isFence() != GL_TRUE)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ fenceObject->finishFence();
}
}
@@ -1778,18 +1433,11 @@
{
EVENT("()");
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- context->sync(true);
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->sync(true);
}
}
@@ -1797,18 +1445,11 @@
{
EVENT("()");
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- context->sync(false);
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->sync(false);
}
}
@@ -1817,53 +1458,46 @@
EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, "
"GLuint renderbuffer = %d)", target, attachment, renderbuffertarget, renderbuffer);
- ANGLE_TRY
+ if (!gl::ValidFramebufferTarget(target) || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0))
{
- if (!gl::ValidFramebufferTarget(target) || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (!gl::ValidateFramebufferRenderbufferParameters(context, target, attachment, renderbuffertarget, renderbuffer))
- {
- return;
- }
-
- gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
- ASSERT(framebuffer);
-
- if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
- {
- unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
- framebuffer->setColorbuffer(colorAttachment, GL_RENDERBUFFER, renderbuffer, 0, 0);
- }
- else
- {
- switch (attachment)
- {
- case GL_DEPTH_ATTACHMENT:
- framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
- break;
- case GL_STENCIL_ATTACHMENT:
- framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
- break;
- case GL_DEPTH_STENCIL_ATTACHMENT:
- framebuffer->setDepthStencilBuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
- break;
- default:
- UNREACHABLE();
- break;
- }
- }
- }
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ if (!gl::ValidateFramebufferRenderbufferParameters(context, target, attachment, renderbuffertarget, renderbuffer))
+ {
+ return;
+ }
+
+ gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ {
+ unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+ framebuffer->setColorbuffer(colorAttachment, GL_RENDERBUFFER, renderbuffer, 0, 0);
+ }
+ else
+ {
+ switch (attachment)
+ {
+ case GL_DEPTH_ATTACHMENT:
+ framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
+ break;
+ case GL_STENCIL_ATTACHMENT:
+ framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
+ break;
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ framebuffer->setDepthStencilBuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
}
}
@@ -1872,71 +1506,57 @@
EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, "
"GLuint texture = %d, GLint level = %d)", target, attachment, textarget, texture, level);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (!ValidateFramebufferTexture2D(context, target, attachment, textarget, texture, level))
{
- if (!ValidateFramebufferTexture2D(context, target, attachment, textarget, texture, level))
- {
- return;
- }
+ return;
+ }
- if (texture == 0)
- {
- textarget = GL_NONE;
- }
+ if (texture == 0)
+ {
+ textarget = GL_NONE;
+ }
- gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
+ gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
- if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ {
+ const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+ framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, 0);
+ }
+ else
+ {
+ switch (attachment)
{
- const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
- framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, 0);
- }
- else
- {
- switch (attachment)
- {
- case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, 0); break;
- case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, 0); break;
- case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, 0); break;
- }
+ case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, 0); break;
+ case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, 0); break;
+ case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, 0); break;
}
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
}
void __stdcall glFrontFace(GLenum mode)
{
EVENT("(GLenum mode = 0x%X)", mode);
- ANGLE_TRY
+ switch (mode)
{
- switch (mode)
+ case GL_CW:
+ case GL_CCW:
{
- case GL_CW:
- case GL_CCW:
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- context->getState().setFrontFace(mode);
- }
+ if (context)
+ {
+ context->getState().setFrontFace(mode);
}
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
}
@@ -1944,26 +1564,19 @@
{
EVENT("(GLsizei n = %d, GLuint* buffers = 0x%0.8p)", n, buffers);
- ANGLE_TRY
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- for (int i = 0; i < n; i++)
- {
- buffers[i] = context->createBuffer();
- }
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ for (int i = 0; i < n; i++)
+ {
+ buffers[i] = context->createBuffer();
+ }
}
}
@@ -1971,74 +1584,67 @@
{
EVENT("(GLenum target = 0x%X)", target);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidTextureTarget(context, target))
{
- if (!ValidTextureTarget(context, target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Texture *texture = context->getTargetTexture(target);
-
- if (texture == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- GLenum internalFormat = texture->getBaseLevelInternalFormat();
- const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalFormat);
-
- // GenerateMipmap should not generate an INVALID_OPERATION for textures created with
- // unsized formats or that are color renderable and filterable. Since we do not track if
- // the texture was created with sized or unsized format (only sized formats are stored),
- // it is not possible to make sure the the LUMA formats can generate mipmaps (they should
- // be able to) because they aren't color renderable. Simply do a special case for LUMA
- // textures since they're the only texture format that can be created with unsized formats
- // that is not color renderable. New unsized formats are unlikely to be added, since ES2
- // was the last version to use add them.
- bool isLUMA = internalFormat == GL_LUMINANCE8_EXT ||
- internalFormat == GL_LUMINANCE8_ALPHA8_EXT ||
- internalFormat == GL_ALPHA8_EXT;
-
- if (gl::GetDepthBits(internalFormat) > 0 || gl::GetStencilBits(internalFormat) > 0 || !formatCaps.filterable ||
- (!formatCaps.renderable && !isLUMA) || gl::IsFormatCompressed(internalFormat))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // GL_EXT_sRGB does not support mipmap generation on sRGB textures
- if (context->getClientVersion() == 2 && gl::GetColorEncoding(internalFormat) == GL_SRGB)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // Non-power of 2 ES2 check
- if (!context->getExtensions().textureNPOT && (!gl::isPow2(texture->getBaseLevelWidth()) || !gl::isPow2(texture->getBaseLevelHeight())))
- {
- ASSERT(context->getClientVersion() <= 2 && (target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP));
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // Cube completeness check
- if (target == GL_TEXTURE_CUBE_MAP)
- {
- gl::TextureCubeMap *textureCube = static_cast<gl::TextureCubeMap *>(texture);
- if (!textureCube->isCubeComplete())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- }
-
- texture->generateMipmaps();
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::Texture *texture = context->getTargetTexture(target);
+
+ if (texture == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ GLenum internalFormat = texture->getBaseLevelInternalFormat();
+ const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalFormat);
+
+ // GenerateMipmap should not generate an INVALID_OPERATION for textures created with
+ // unsized formats or that are color renderable and filterable. Since we do not track if
+ // the texture was created with sized or unsized format (only sized formats are stored),
+ // it is not possible to make sure the the LUMA formats can generate mipmaps (they should
+ // be able to) because they aren't color renderable. Simply do a special case for LUMA
+ // textures since they're the only texture format that can be created with unsized formats
+ // that is not color renderable. New unsized formats are unlikely to be added, since ES2
+ // was the last version to use add them.
+ bool isLUMA = internalFormat == GL_LUMINANCE8_EXT ||
+ internalFormat == GL_LUMINANCE8_ALPHA8_EXT ||
+ internalFormat == GL_ALPHA8_EXT;
+
+ if (gl::GetDepthBits(internalFormat) > 0 || gl::GetStencilBits(internalFormat) > 0 || !formatCaps.filterable ||
+ (!formatCaps.renderable && !isLUMA) || gl::IsFormatCompressed(internalFormat))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // GL_EXT_sRGB does not support mipmap generation on sRGB textures
+ if (context->getClientVersion() == 2 && gl::GetColorEncoding(internalFormat) == GL_SRGB)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Non-power of 2 ES2 check
+ if (!context->getExtensions().textureNPOT && (!gl::isPow2(texture->getBaseLevelWidth()) || !gl::isPow2(texture->getBaseLevelHeight())))
+ {
+ ASSERT(context->getClientVersion() <= 2 && (target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP));
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Cube completeness check
+ if (target == GL_TEXTURE_CUBE_MAP)
+ {
+ gl::TextureCubeMap *textureCube = static_cast<gl::TextureCubeMap *>(texture);
+ if (!textureCube->isCubeComplete())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+
+ texture->generateMipmaps();
}
}
@@ -2046,26 +1652,19 @@
{
EVENT("(GLsizei n = %d, GLuint* fences = 0x%0.8p)", n, fences);
- ANGLE_TRY
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- for (int i = 0; i < n; i++)
- {
- fences[i] = context->createFenceNV();
- }
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ for (int i = 0; i < n; i++)
+ {
+ fences[i] = context->createFenceNV();
+ }
}
}
@@ -2073,26 +1672,19 @@
{
EVENT("(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)", n, framebuffers);
- ANGLE_TRY
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- for (int i = 0; i < n; i++)
- {
- framebuffers[i] = context->createFramebuffer();
- }
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ for (int i = 0; i < n; i++)
+ {
+ framebuffers[i] = context->createFramebuffer();
+ }
}
}
@@ -2100,26 +1692,19 @@
{
EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- for (GLsizei i = 0; i < n; i++)
- {
- ids[i] = context->createQuery();
- }
+ return gl::error(GL_INVALID_VALUE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ for (GLsizei i = 0; i < n; i++)
+ {
+ ids[i] = context->createQuery();
+ }
}
}
@@ -2127,26 +1712,19 @@
{
EVENT("(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers);
- ANGLE_TRY
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- for (int i = 0; i < n; i++)
- {
- renderbuffers[i] = context->createRenderbuffer();
- }
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ for (int i = 0; i < n; i++)
+ {
+ renderbuffers[i] = context->createRenderbuffer();
+ }
}
}
@@ -2154,26 +1732,19 @@
{
EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures);
- ANGLE_TRY
+ if (n < 0)
{
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- for (int i = 0; i < n; i++)
- {
- textures[i] = context->createTexture();
- }
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ for (int i = 0; i < n; i++)
+ {
+ textures[i] = context->createTexture();
+ }
}
}
@@ -2183,42 +1754,35 @@
"GLint *size = 0x%0.8p, GLenum *type = %0.8p, GLchar *name = %0.8p)",
program, index, bufsize, length, size, type, name);
- ANGLE_TRY
+ if (bufsize < 0)
{
- if (bufsize < 0)
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ if (index >= (GLuint)programObject->getActiveAttributeCount())
{
return gl::error(GL_INVALID_VALUE);
}
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- if (index >= (GLuint)programObject->getActiveAttributeCount())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- programObject->getActiveAttribute(index, bufsize, length, size, type, name);
- }
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ programObject->getActiveAttribute(index, bufsize, length, size, type, name);
}
}
@@ -2228,42 +1792,35 @@
"GLsizei* length = 0x%0.8p, GLint* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)",
program, index, bufsize, length, size, type, name);
- ANGLE_TRY
+ if (bufsize < 0)
{
- if (bufsize < 0)
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ if (index >= (GLuint)programObject->getActiveUniformCount())
{
return gl::error(GL_INVALID_VALUE);
}
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- if (index >= (GLuint)programObject->getActiveUniformCount())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- programObject->getActiveUniform(index, bufsize, length, size, type, name);
- }
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ programObject->getActiveUniform(index, bufsize, length, size, type, name);
}
}
@@ -2272,37 +1829,30 @@
EVENT("(GLuint program = %d, GLsizei maxcount = %d, GLsizei* count = 0x%0.8p, GLuint* shaders = 0x%0.8p)",
program, maxcount, count, shaders);
- ANGLE_TRY
+ if (maxcount < 0)
{
- if (maxcount < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- return programObject->getAttachedShaders(maxcount, count, shaders);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ return programObject->getAttachedShaders(maxcount, count, shaders);
}
}
@@ -2310,39 +1860,32 @@
{
EVENT("(GLuint program = %d, const GLchar* name = %s)", program, name);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
- if (context)
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
{
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION, -1);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE, -1);
- }
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
- if (!programObject->isLinked() || !programBinary)
+ if (context->getShader(program))
{
return gl::error(GL_INVALID_OPERATION, -1);
}
-
- return programBinary->getAttributeLocation(name);
+ else
+ {
+ return gl::error(GL_INVALID_VALUE, -1);
+ }
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, -1);
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programObject->isLinked() || !programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION, -1);
+ }
+
+ return programBinary->getAttributeLocation(name);
}
return -1;
@@ -2352,32 +1895,25 @@
{
EVENT("(GLenum pname = 0x%X, GLboolean* params = 0x%0.8p)", pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
{
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
- {
- return;
- }
-
- if (nativeType == GL_BOOL)
- {
- context->getBooleanv(pname, params);
- }
- else
- {
- CastStateValues(context, nativeType, pname, numParams, params);
- }
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (nativeType == GL_BOOL)
+ {
+ context->getBooleanv(pname, params);
+ }
+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
+ }
}
}
@@ -2385,57 +1921,50 @@
{
EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
{
- if (!gl::ValidBufferTarget(context, target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (!gl::ValidBufferParameter(context, pname))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Buffer *buffer = context->getState().getTargetBuffer(target);
-
- if (!buffer)
- {
- // A null buffer means that "0" is bound to the requested buffer target
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (pname)
- {
- case GL_BUFFER_USAGE:
- *params = static_cast<GLint>(buffer->getUsage());
- break;
- case GL_BUFFER_SIZE:
- *params = gl::clampCast<GLint>(buffer->getSize());
- break;
- case GL_BUFFER_ACCESS_FLAGS:
- *params = buffer->getAccessFlags();
- break;
- case GL_BUFFER_MAPPED:
- *params = static_cast<GLint>(buffer->isMapped());
- break;
- case GL_BUFFER_MAP_OFFSET:
- *params = gl::clampCast<GLint>(buffer->getMapOffset());
- break;
- case GL_BUFFER_MAP_LENGTH:
- *params = gl::clampCast<GLint>(buffer->getMapLength());
- break;
- default: UNREACHABLE(); break;
- }
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!gl::ValidBufferParameter(context, pname))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (!buffer)
+ {
+ // A null buffer means that "0" is bound to the requested buffer target
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (pname)
+ {
+ case GL_BUFFER_USAGE:
+ *params = static_cast<GLint>(buffer->getUsage());
+ break;
+ case GL_BUFFER_SIZE:
+ *params = gl::clampCast<GLint>(buffer->getSize());
+ break;
+ case GL_BUFFER_ACCESS_FLAGS:
+ *params = buffer->getAccessFlags();
+ break;
+ case GL_BUFFER_MAPPED:
+ *params = static_cast<GLint>(buffer->isMapped());
+ break;
+ case GL_BUFFER_MAP_OFFSET:
+ *params = gl::clampCast<GLint>(buffer->getMapOffset());
+ break;
+ case GL_BUFFER_MAP_LENGTH:
+ *params = gl::clampCast<GLint>(buffer->getMapLength());
+ break;
+ default: UNREACHABLE(); break;
+ }
}
}
@@ -2457,40 +1986,33 @@
{
EVENT("(GLuint fence = %d, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", fence, pname, params);
- ANGLE_TRY
- {
-
- gl::Context *context = gl::getNonLostContext();
- if (context)
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
+
+ if (fenceObject == NULL)
{
- gl::FenceNV *fenceObject = context->getFenceNV(fence);
-
- if (fenceObject == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (fenceObject->isFence() != GL_TRUE)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (pname)
- {
- case GL_FENCE_STATUS_NV:
- case GL_FENCE_CONDITION_NV:
- break;
-
- default: return gl::error(GL_INVALID_ENUM);
- }
-
- params[0] = fenceObject->getFencei(pname);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (fenceObject->isFence() != GL_TRUE)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (pname)
+ {
+ case GL_FENCE_STATUS_NV:
+ case GL_FENCE_CONDITION_NV:
+ break;
+
+ default: return gl::error(GL_INVALID_ENUM);
+ }
+
+ params[0] = fenceObject->getFencei(pname);
}
}
@@ -2498,32 +2020,25 @@
{
EVENT("(GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
{
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
- {
- return;
- }
-
- if (nativeType == GL_FLOAT)
- {
- context->getFloatv(pname, params);
- }
- else
- {
- CastStateValues(context, nativeType, pname, numParams, params);
- }
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (nativeType == GL_FLOAT)
+ {
+ context->getFloatv(pname, params);
+ }
+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
+ }
}
}
@@ -2532,279 +2047,272 @@
EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
target, attachment, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!gl::ValidFramebufferTarget(target))
{
- if (!gl::ValidFramebufferTarget(target))
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ int clientVersion = context->getClientVersion();
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+ if (clientVersion < 3 && !context->getExtensions().sRGB)
{
return gl::error(GL_INVALID_ENUM);
}
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
+ if (clientVersion < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
- int clientVersion = context->getClientVersion();
+ // Determine if the attachment is a valid enum
+ switch (attachment)
+ {
+ case GL_BACK:
+ case GL_FRONT:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (clientVersion < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
+
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ break;
+
+ default:
+ if (attachment < GL_COLOR_ATTACHMENT0_EXT ||
+ (attachment - GL_COLOR_ATTACHMENT0_EXT) >= context->getCaps().maxColorAttachments)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ break;
+ }
+
+ GLuint framebufferHandle = context->getState().getTargetFramebuffer(target)->id();
+ gl::Framebuffer *framebuffer = context->getFramebuffer(framebufferHandle);
+
+ if (framebufferHandle == 0)
+ {
+ if (clientVersion < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (attachment)
+ {
+ case GL_BACK:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ else
+ {
+ if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ {
+ // Valid attachment query
+ }
+ else
+ {
+ switch (attachment)
+ {
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ break;
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (framebuffer->hasValidDepthStencil())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+
+ GLenum attachmentType = GL_NONE;
+ GLuint attachmentHandle = 0;
+ GLuint attachmentLevel = 0;
+ GLuint attachmentLayer = 0;
+
+ const gl::FramebufferAttachment *attachmentObject = framebuffer->getAttachment(attachment);
+
+ if (attachmentObject)
+ {
+ attachmentType = attachmentObject->type();
+ attachmentHandle = attachmentObject->id();
+ attachmentLevel = attachmentObject->mipLevel();
+ attachmentLayer = attachmentObject->layer();
+ }
+
+ GLenum attachmentObjectType; // Type category
+ if (framebufferHandle == 0)
+ {
+ attachmentObjectType = GL_FRAMEBUFFER_DEFAULT;
+ }
+ else if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER)
+ {
+ attachmentObjectType = attachmentType;
+ }
+ else if (gl::ValidTexture2DDestinationTarget(context, attachmentType))
+ {
+ attachmentObjectType = GL_TEXTURE;
+ }
+ else
+ {
+ UNREACHABLE();
+ return;
+ }
+
+ if (attachmentObjectType == GL_NONE)
+ {
+ // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
+ // is NONE, then querying any other pname will generate INVALID_ENUM.
+
+ // ES 3.0.2 spec pg 235 states that if the attachment type is none,
+ // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an
+ // INVALID_OPERATION for all other pnames
switch (pname)
{
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ *params = attachmentObjectType;
+ break;
+
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
- if (clientVersion < 3 && !context->getExtensions().sRGB)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
- case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
- case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
- case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
- case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
- case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
- case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
if (clientVersion < 3)
{
return gl::error(GL_INVALID_ENUM);
}
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- // Determine if the attachment is a valid enum
- switch (attachment)
- {
- case GL_BACK:
- case GL_FRONT:
- case GL_DEPTH:
- case GL_STENCIL:
- case GL_DEPTH_STENCIL_ATTACHMENT:
- if (clientVersion < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
-
- case GL_DEPTH_ATTACHMENT:
- case GL_STENCIL_ATTACHMENT:
+ *params = 0;
break;
default:
- if (attachment < GL_COLOR_ATTACHMENT0_EXT ||
- (attachment - GL_COLOR_ATTACHMENT0_EXT) >= context->getCaps().maxColorAttachments)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- break;
- }
-
- GLuint framebufferHandle = context->getState().getTargetFramebuffer(target)->id();
- gl::Framebuffer *framebuffer = context->getFramebuffer(framebufferHandle);
-
- if (framebufferHandle == 0)
- {
if (clientVersion < 3)
{
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (attachment)
- {
- case GL_BACK:
- case GL_DEPTH:
- case GL_STENCIL:
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
- }
- }
- else
- {
- if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
- {
- // Valid attachment query
+ return gl::error(GL_INVALID_ENUM);
}
else
{
- switch (attachment)
- {
- case GL_DEPTH_ATTACHMENT:
- case GL_STENCIL_ATTACHMENT:
- break;
- case GL_DEPTH_STENCIL_ATTACHMENT:
- if (framebuffer->hasValidDepthStencil())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- break;
- default:
- return gl::error(GL_INVALID_OPERATION);
- }
- }
- }
-
- GLenum attachmentType = GL_NONE;
- GLuint attachmentHandle = 0;
- GLuint attachmentLevel = 0;
- GLuint attachmentLayer = 0;
-
- const gl::FramebufferAttachment *attachmentObject = framebuffer->getAttachment(attachment);
-
- if (attachmentObject)
- {
- attachmentType = attachmentObject->type();
- attachmentHandle = attachmentObject->id();
- attachmentLevel = attachmentObject->mipLevel();
- attachmentLayer = attachmentObject->layer();
- }
-
- GLenum attachmentObjectType; // Type category
- if (framebufferHandle == 0)
- {
- attachmentObjectType = GL_FRAMEBUFFER_DEFAULT;
- }
- else if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER)
- {
- attachmentObjectType = attachmentType;
- }
- else if (gl::ValidTexture2DDestinationTarget(context, attachmentType))
- {
- attachmentObjectType = GL_TEXTURE;
- }
- else
- {
- UNREACHABLE();
- return;
- }
-
- if (attachmentObjectType == GL_NONE)
- {
- // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
- // is NONE, then querying any other pname will generate INVALID_ENUM.
-
- // ES 3.0.2 spec pg 235 states that if the attachment type is none,
- // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an
- // INVALID_OPERATION for all other pnames
-
- switch (pname)
- {
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
- *params = attachmentObjectType;
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
- if (clientVersion < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = 0;
- break;
-
- default:
- if (clientVersion < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- else
- {
- gl::error(GL_INVALID_OPERATION);
- }
- }
- }
- else
- {
- ASSERT(attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE ||
- attachmentObjectType == GL_FRAMEBUFFER_DEFAULT);
- ASSERT(attachmentObject != NULL);
-
- switch (pname)
- {
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
- *params = attachmentObjectType;
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
- if (attachmentObjectType != GL_RENDERBUFFER && attachmentObjectType != GL_TEXTURE)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = attachmentHandle;
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
- if (attachmentObjectType != GL_TEXTURE)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = attachmentLevel;
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
- if (attachmentObjectType != GL_TEXTURE)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = gl::IsCubemapTextureTarget(attachmentType) ? attachmentType : 0;
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
- *params = attachmentObject->getRedSize();
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
- *params = attachmentObject->getGreenSize();
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
- *params = attachmentObject->getBlueSize();
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
- *params = attachmentObject->getAlphaSize();
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
- *params = attachmentObject->getDepthSize();
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
- *params = attachmentObject->getStencilSize();
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
- if (attachment == GL_DEPTH_STENCIL)
- {
- gl::error(GL_INVALID_OPERATION);
- }
- *params = attachmentObject->getComponentType();
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
- *params = attachmentObject->getColorEncoding();
- break;
-
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
- if (attachmentObjectType != GL_TEXTURE)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = attachmentLayer;
- break;
-
- default:
- UNREACHABLE();
- break;
+ gl::error(GL_INVALID_OPERATION);
}
}
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ else
+ {
+ ASSERT(attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE ||
+ attachmentObjectType == GL_FRAMEBUFFER_DEFAULT);
+ ASSERT(attachmentObject != NULL);
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ *params = attachmentObjectType;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ if (attachmentObjectType != GL_RENDERBUFFER && attachmentObjectType != GL_TEXTURE)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = attachmentHandle;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+ if (attachmentObjectType != GL_TEXTURE)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = attachmentLevel;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+ if (attachmentObjectType != GL_TEXTURE)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = gl::IsCubemapTextureTarget(attachmentType) ? attachmentType : 0;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+ *params = attachmentObject->getRedSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+ *params = attachmentObject->getGreenSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+ *params = attachmentObject->getBlueSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+ *params = attachmentObject->getAlphaSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+ *params = attachmentObject->getDepthSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+ *params = attachmentObject->getStencilSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+ if (attachment == GL_DEPTH_STENCIL)
+ {
+ gl::error(GL_INVALID_OPERATION);
+ }
+ *params = attachmentObject->getComponentType();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+ *params = attachmentObject->getColorEncoding();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
+ if (attachmentObjectType != GL_TEXTURE)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = attachmentLayer;
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
}
}
@@ -2812,54 +2320,40 @@
{
EVENT("()");
- ANGLE_TRY
- {
- gl::Context *context = gl::getContext();
+ gl::Context *context = gl::getContext();
- if (context)
- {
- return context->getResetStatus();
- }
-
- return GL_NO_ERROR;
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return GL_OUT_OF_MEMORY;
+ return context->getResetStatus();
}
+
+ return GL_NO_ERROR;
}
void __stdcall glGetIntegerv(GLenum pname, GLint* params)
{
EVENT("(GLenum pname = 0x%X, GLint* params = 0x%0.8p)", pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+
+ if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
{
- GLenum nativeType;
- unsigned int numParams = 0;
-
- if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
- {
- return;
- }
-
- if (nativeType == GL_INT)
- {
- context->getIntegerv(pname, params);
- }
- else
- {
- CastStateValues(context, nativeType, pname, numParams, params);
- }
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (nativeType == GL_INT)
+ {
+ context->getIntegerv(pname, params);
+ }
+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
+ }
}
}
@@ -2867,87 +2361,80 @@
{
EVENT("(GLuint program = %d, GLenum pname = %d, GLint* params = 0x%0.8p)", program, pname, params);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
+ gl::Program *programObject = context->getProgram(program);
- if (context)
+ if (!programObject)
{
- gl::Program *programObject = context->getProgram(program);
+ return gl::error(GL_INVALID_VALUE);
+ }
- if (!programObject)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (context->getClientVersion() < 3)
- {
- switch (pname)
- {
- case GL_ACTIVE_UNIFORM_BLOCKS:
- case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
- case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
- case GL_TRANSFORM_FEEDBACK_VARYINGS:
- case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
- return gl::error(GL_INVALID_ENUM);
- }
- }
-
+ if (context->getClientVersion() < 3)
+ {
switch (pname)
{
- case GL_DELETE_STATUS:
- *params = programObject->isFlaggedForDeletion();
- return;
- case GL_LINK_STATUS:
- *params = programObject->isLinked();
- return;
- case GL_VALIDATE_STATUS:
- *params = programObject->isValidated();
- return;
- case GL_INFO_LOG_LENGTH:
- *params = programObject->getInfoLogLength();
- return;
- case GL_ATTACHED_SHADERS:
- *params = programObject->getAttachedShadersCount();
- return;
- case GL_ACTIVE_ATTRIBUTES:
- *params = programObject->getActiveAttributeCount();
- return;
- case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
- *params = programObject->getActiveAttributeMaxLength();
- return;
- case GL_ACTIVE_UNIFORMS:
- *params = programObject->getActiveUniformCount();
- return;
- case GL_ACTIVE_UNIFORM_MAX_LENGTH:
- *params = programObject->getActiveUniformMaxLength();
- return;
- case GL_PROGRAM_BINARY_LENGTH_OES:
- *params = programObject->getProgramBinaryLength();
- return;
case GL_ACTIVE_UNIFORM_BLOCKS:
- *params = programObject->getActiveUniformBlockCount();
- return;
case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
- *params = programObject->getActiveUniformBlockMaxLength();
- break;
case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
- *params = programObject->getTransformFeedbackBufferMode();
- break;
case GL_TRANSFORM_FEEDBACK_VARYINGS:
- *params = programObject->getTransformFeedbackVaryingCount();
- break;
case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
- *params = programObject->getTransformFeedbackVaryingMaxLength();
- break;
- default:
return gl::error(GL_INVALID_ENUM);
}
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (pname)
+ {
+ case GL_DELETE_STATUS:
+ *params = programObject->isFlaggedForDeletion();
+ return;
+ case GL_LINK_STATUS:
+ *params = programObject->isLinked();
+ return;
+ case GL_VALIDATE_STATUS:
+ *params = programObject->isValidated();
+ return;
+ case GL_INFO_LOG_LENGTH:
+ *params = programObject->getInfoLogLength();
+ return;
+ case GL_ATTACHED_SHADERS:
+ *params = programObject->getAttachedShadersCount();
+ return;
+ case GL_ACTIVE_ATTRIBUTES:
+ *params = programObject->getActiveAttributeCount();
+ return;
+ case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
+ *params = programObject->getActiveAttributeMaxLength();
+ return;
+ case GL_ACTIVE_UNIFORMS:
+ *params = programObject->getActiveUniformCount();
+ return;
+ case GL_ACTIVE_UNIFORM_MAX_LENGTH:
+ *params = programObject->getActiveUniformMaxLength();
+ return;
+ case GL_PROGRAM_BINARY_LENGTH_OES:
+ *params = programObject->getProgramBinaryLength();
+ return;
+ case GL_ACTIVE_UNIFORM_BLOCKS:
+ *params = programObject->getActiveUniformBlockCount();
+ return;
+ case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
+ *params = programObject->getActiveUniformBlockMaxLength();
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
+ *params = programObject->getTransformFeedbackBufferMode();
+ break;
+ case GL_TRANSFORM_FEEDBACK_VARYINGS:
+ *params = programObject->getTransformFeedbackVaryingCount();
+ break;
+ case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
+ *params = programObject->getTransformFeedbackVaryingMaxLength();
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -2956,30 +2443,23 @@
EVENT("(GLuint program = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)",
program, bufsize, length, infolog);
- ANGLE_TRY
+ if (bufsize < 0)
{
- if (bufsize < 0)
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
{
return gl::error(GL_INVALID_VALUE);
}
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- programObject->getInfoLog(bufsize, length, infolog);
- }
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ programObject->getInfoLog(bufsize, length, infolog);
}
}
@@ -2987,31 +2467,24 @@
{
EVENT("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidQueryType(context, target))
{
- if (!ValidQueryType(context, target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (pname)
- {
- case GL_CURRENT_QUERY_EXT:
- params[0] = context->getState().getActiveQueryId(target);
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (pname)
+ {
+ case GL_CURRENT_QUERY_EXT:
+ params[0] = context->getState().getActiveQueryId(target);
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -3019,40 +2492,33 @@
{
EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
+
+ if (!queryObject)
{
- gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
-
- if (!queryObject)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (context->getState().getActiveQueryId(queryObject->getType()) == id)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch(pname)
- {
- case GL_QUERY_RESULT_EXT:
- params[0] = queryObject->getResult();
- break;
- case GL_QUERY_RESULT_AVAILABLE_EXT:
- params[0] = queryObject->isResultAvailable();
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (context->getState().getActiveQueryId(queryObject->getType()) == id)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch(pname)
+ {
+ case GL_QUERY_RESULT_EXT:
+ params[0] = queryObject->getResult();
+ break;
+ case GL_QUERY_RESULT_AVAILABLE_EXT:
+ params[0] = queryObject->isResultAvailable();
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -3060,50 +2526,43 @@
{
EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (target != GL_RENDERBUFFER)
{
- if (target != GL_RENDERBUFFER)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (context->getState().getRenderbufferId() == 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getState().getRenderbufferId());
-
- switch (pname)
- {
- case GL_RENDERBUFFER_WIDTH: *params = renderbuffer->getWidth(); break;
- case GL_RENDERBUFFER_HEIGHT: *params = renderbuffer->getHeight(); break;
- case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer->getInternalFormat(); break;
- case GL_RENDERBUFFER_RED_SIZE: *params = renderbuffer->getRedSize(); break;
- case GL_RENDERBUFFER_GREEN_SIZE: *params = renderbuffer->getGreenSize(); break;
- case GL_RENDERBUFFER_BLUE_SIZE: *params = renderbuffer->getBlueSize(); break;
- case GL_RENDERBUFFER_ALPHA_SIZE: *params = renderbuffer->getAlphaSize(); break;
- case GL_RENDERBUFFER_DEPTH_SIZE: *params = renderbuffer->getDepthSize(); break;
- case GL_RENDERBUFFER_STENCIL_SIZE: *params = renderbuffer->getStencilSize(); break;
- case GL_RENDERBUFFER_SAMPLES_ANGLE:
- if (!context->getExtensions().framebufferMultisample)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = renderbuffer->getSamples();
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (context->getState().getRenderbufferId() == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getState().getRenderbufferId());
+
+ switch (pname)
+ {
+ case GL_RENDERBUFFER_WIDTH: *params = renderbuffer->getWidth(); break;
+ case GL_RENDERBUFFER_HEIGHT: *params = renderbuffer->getHeight(); break;
+ case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer->getInternalFormat(); break;
+ case GL_RENDERBUFFER_RED_SIZE: *params = renderbuffer->getRedSize(); break;
+ case GL_RENDERBUFFER_GREEN_SIZE: *params = renderbuffer->getGreenSize(); break;
+ case GL_RENDERBUFFER_BLUE_SIZE: *params = renderbuffer->getBlueSize(); break;
+ case GL_RENDERBUFFER_ALPHA_SIZE: *params = renderbuffer->getAlphaSize(); break;
+ case GL_RENDERBUFFER_DEPTH_SIZE: *params = renderbuffer->getDepthSize(); break;
+ case GL_RENDERBUFFER_STENCIL_SIZE: *params = renderbuffer->getStencilSize(); break;
+ case GL_RENDERBUFFER_SAMPLES_ANGLE:
+ if (!context->getExtensions().framebufferMultisample)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = renderbuffer->getSamples();
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -3111,47 +2570,40 @@
{
EVENT("(GLuint shader = %d, GLenum pname = %d, GLint* params = 0x%0.8p)", shader, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
{
- gl::Shader *shaderObject = context->getShader(shader);
-
- if (!shaderObject)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- switch (pname)
- {
- case GL_SHADER_TYPE:
- *params = shaderObject->getType();
- return;
- case GL_DELETE_STATUS:
- *params = shaderObject->isFlaggedForDeletion();
- return;
- case GL_COMPILE_STATUS:
- *params = shaderObject->isCompiled() ? GL_TRUE : GL_FALSE;
- return;
- case GL_INFO_LOG_LENGTH:
- *params = shaderObject->getInfoLogLength();
- return;
- case GL_SHADER_SOURCE_LENGTH:
- *params = shaderObject->getSourceLength();
- return;
- case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE:
- *params = shaderObject->getTranslatedSourceLength();
- return;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (pname)
+ {
+ case GL_SHADER_TYPE:
+ *params = shaderObject->getType();
+ return;
+ case GL_DELETE_STATUS:
+ *params = shaderObject->isFlaggedForDeletion();
+ return;
+ case GL_COMPILE_STATUS:
+ *params = shaderObject->isCompiled() ? GL_TRUE : GL_FALSE;
+ return;
+ case GL_INFO_LOG_LENGTH:
+ *params = shaderObject->getInfoLogLength();
+ return;
+ case GL_SHADER_SOURCE_LENGTH:
+ *params = shaderObject->getSourceLength();
+ return;
+ case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE:
+ *params = shaderObject->getTranslatedSourceLength();
+ return;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -3160,30 +2612,23 @@
EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)",
shader, bufsize, length, infolog);
- ANGLE_TRY
+ if (bufsize < 0)
{
- if (bufsize < 0)
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
{
return gl::error(GL_INVALID_VALUE);
}
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- gl::Shader *shaderObject = context->getShader(shader);
-
- if (!shaderObject)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- shaderObject->getInfoLog(bufsize, length, infolog);
- }
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ shaderObject->getInfoLog(bufsize, length, infolog);
}
}
@@ -3192,43 +2637,36 @@
EVENT("(GLenum shadertype = 0x%X, GLenum precisiontype = 0x%X, GLint* range = 0x%0.8p, GLint* precision = 0x%0.8p)",
shadertype, precisiontype, range, precision);
- ANGLE_TRY
+ switch (shadertype)
{
- switch (shadertype)
- {
- case GL_VERTEX_SHADER:
- case GL_FRAGMENT_SHADER:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (precisiontype)
- {
- case GL_LOW_FLOAT:
- case GL_MEDIUM_FLOAT:
- case GL_HIGH_FLOAT:
- // Assume IEEE 754 precision
- range[0] = 127;
- range[1] = 127;
- *precision = 23;
- break;
- case GL_LOW_INT:
- case GL_MEDIUM_INT:
- case GL_HIGH_INT:
- // Some (most) hardware only supports single-precision floating-point numbers,
- // which can accurately represent integers up to +/-16777216
- range[0] = 24;
- range[1] = 24;
- *precision = 0;
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ case GL_VERTEX_SHADER:
+ case GL_FRAGMENT_SHADER:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ switch (precisiontype)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ case GL_LOW_FLOAT:
+ case GL_MEDIUM_FLOAT:
+ case GL_HIGH_FLOAT:
+ // Assume IEEE 754 precision
+ range[0] = 127;
+ range[1] = 127;
+ *precision = 23;
+ break;
+ case GL_LOW_INT:
+ case GL_MEDIUM_INT:
+ case GL_HIGH_INT:
+ // Some (most) hardware only supports single-precision floating-point numbers,
+ // which can accurately represent integers up to +/-16777216
+ range[0] = 24;
+ range[1] = 24;
+ *precision = 0;
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
}
@@ -3237,30 +2675,23 @@
EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)",
shader, bufsize, length, source);
- ANGLE_TRY
+ if (bufsize < 0)
{
- if (bufsize < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- gl::Shader *shaderObject = context->getShader(shader);
-
- if (!shaderObject)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- shaderObject->getSource(bufsize, length, source);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ shaderObject->getSource(bufsize, length, source);
}
}
@@ -3269,30 +2700,23 @@
EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)",
shader, bufsize, length, source);
- ANGLE_TRY
+ if (bufsize < 0)
{
- if (bufsize < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- gl::Shader *shaderObject = context->getShader(shader);
-
- if (!shaderObject)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- shaderObject->getTranslatedSource(bufsize, length, source);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ shaderObject->getTranslatedSource(bufsize, length, source);
}
}
@@ -3300,43 +2724,36 @@
{
EVENT("(GLenum name = 0x%X)", name);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- switch (name)
- {
- case GL_VENDOR:
- return (GLubyte*)"Google Inc.";
- case GL_RENDERER:
- return (GLubyte*)((context != NULL) ? context->getRendererString().c_str() : "ANGLE");
- case GL_VERSION:
- if (context->getClientVersion() == 2)
- {
- return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")";
- }
- else
- {
- return (GLubyte*)"OpenGL ES 3.0 (ANGLE " ANGLE_VERSION_STRING ")";
- }
- case GL_SHADING_LANGUAGE_VERSION:
- if (context->getClientVersion() == 2)
- {
- return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")";
- }
- else
- {
- return (GLubyte*)"OpenGL ES GLSL ES 3.00 (ANGLE " ANGLE_VERSION_STRING ")";
- }
- case GL_EXTENSIONS:
- return (GLubyte*)((context != NULL) ? context->getExtensionString().c_str() : "");
- default:
- return gl::error(GL_INVALID_ENUM, (GLubyte*)NULL);
- }
- }
- ANGLE_CATCH_ALL
+ switch (name)
{
- return gl::error(GL_OUT_OF_MEMORY, (GLubyte*)NULL);
+ case GL_VENDOR:
+ return (GLubyte*)"Google Inc.";
+ case GL_RENDERER:
+ return (GLubyte*)((context != NULL) ? context->getRendererString().c_str() : "ANGLE");
+ case GL_VERSION:
+ if (context->getClientVersion() == 2)
+ {
+ return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
+ else
+ {
+ return (GLubyte*)"OpenGL ES 3.0 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
+ case GL_SHADING_LANGUAGE_VERSION:
+ if (context->getClientVersion() == 2)
+ {
+ return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
+ else
+ {
+ return (GLubyte*)"OpenGL ES GLSL ES 3.00 (ANGLE " ANGLE_VERSION_STRING ")";
+ }
+ case GL_EXTENSIONS:
+ return (GLubyte*)((context != NULL) ? context->getExtensionString().c_str() : "");
+ default:
+ return gl::error(GL_INVALID_ENUM, (GLubyte*)NULL);
}
}
@@ -3344,125 +2761,118 @@
{
EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", target, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::Texture *texture = context->getTargetTexture(target);
+
+ if (!texture)
{
- gl::Texture *texture = context->getTargetTexture(target);
-
- if (!texture)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (pname)
- {
- case GL_TEXTURE_MAG_FILTER:
- *params = (GLfloat)texture->getSamplerState().magFilter;
- break;
- case GL_TEXTURE_MIN_FILTER:
- *params = (GLfloat)texture->getSamplerState().minFilter;
- break;
- case GL_TEXTURE_WRAP_S:
- *params = (GLfloat)texture->getSamplerState().wrapS;
- break;
- case GL_TEXTURE_WRAP_T:
- *params = (GLfloat)texture->getSamplerState().wrapT;
- break;
- case GL_TEXTURE_WRAP_R:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLfloat)texture->getSamplerState().wrapR;
- break;
- case GL_TEXTURE_IMMUTABLE_FORMAT:
- // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
- *params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE);
- break;
- case GL_TEXTURE_IMMUTABLE_LEVELS:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLfloat)texture->immutableLevelCount();
- break;
- case GL_TEXTURE_USAGE_ANGLE:
- *params = (GLfloat)texture->getUsage();
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (!context->getExtensions().textureFilterAnisotropic)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLfloat)texture->getSamplerState().maxAnisotropy;
- break;
- case GL_TEXTURE_SWIZZLE_R:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLfloat)texture->getSamplerState().swizzleRed;
- break;
- case GL_TEXTURE_SWIZZLE_G:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLfloat)texture->getSamplerState().swizzleGreen;
- break;
- case GL_TEXTURE_SWIZZLE_B:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLfloat)texture->getSamplerState().swizzleBlue;
- break;
- case GL_TEXTURE_SWIZZLE_A:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLfloat)texture->getSamplerState().swizzleAlpha;
- break;
- case GL_TEXTURE_BASE_LEVEL:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLfloat)texture->getSamplerState().baseLevel;
- break;
- case GL_TEXTURE_MAX_LEVEL:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLfloat)texture->getSamplerState().maxLevel;
- break;
- case GL_TEXTURE_MIN_LOD:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = texture->getSamplerState().minLod;
- break;
- case GL_TEXTURE_MAX_LOD:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = texture->getSamplerState().maxLod;
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (pname)
+ {
+ case GL_TEXTURE_MAG_FILTER:
+ *params = (GLfloat)texture->getSamplerState().magFilter;
+ break;
+ case GL_TEXTURE_MIN_FILTER:
+ *params = (GLfloat)texture->getSamplerState().minFilter;
+ break;
+ case GL_TEXTURE_WRAP_S:
+ *params = (GLfloat)texture->getSamplerState().wrapS;
+ break;
+ case GL_TEXTURE_WRAP_T:
+ *params = (GLfloat)texture->getSamplerState().wrapT;
+ break;
+ case GL_TEXTURE_WRAP_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSamplerState().wrapR;
+ break;
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
+ *params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE);
+ break;
+ case GL_TEXTURE_IMMUTABLE_LEVELS:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->immutableLevelCount();
+ break;
+ case GL_TEXTURE_USAGE_ANGLE:
+ *params = (GLfloat)texture->getUsage();
+ break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (!context->getExtensions().textureFilterAnisotropic)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSamplerState().maxAnisotropy;
+ break;
+ case GL_TEXTURE_SWIZZLE_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSamplerState().swizzleRed;
+ break;
+ case GL_TEXTURE_SWIZZLE_G:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSamplerState().swizzleGreen;
+ break;
+ case GL_TEXTURE_SWIZZLE_B:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSamplerState().swizzleBlue;
+ break;
+ case GL_TEXTURE_SWIZZLE_A:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSamplerState().swizzleAlpha;
+ break;
+ case GL_TEXTURE_BASE_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSamplerState().baseLevel;
+ break;
+ case GL_TEXTURE_MAX_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLfloat)texture->getSamplerState().maxLevel;
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSamplerState().minLod;
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSamplerState().maxLod;
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -3470,125 +2880,118 @@
{
EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::Texture *texture = context->getTargetTexture(target);
+
+ if (!texture)
{
- gl::Texture *texture = context->getTargetTexture(target);
-
- if (!texture)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (pname)
- {
- case GL_TEXTURE_MAG_FILTER:
- *params = texture->getSamplerState().magFilter;
- break;
- case GL_TEXTURE_MIN_FILTER:
- *params = texture->getSamplerState().minFilter;
- break;
- case GL_TEXTURE_WRAP_S:
- *params = texture->getSamplerState().wrapS;
- break;
- case GL_TEXTURE_WRAP_T:
- *params = texture->getSamplerState().wrapT;
- break;
- case GL_TEXTURE_WRAP_R:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = texture->getSamplerState().wrapR;
- break;
- case GL_TEXTURE_IMMUTABLE_FORMAT:
- // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
- *params = texture->isImmutable() ? GL_TRUE : GL_FALSE;
- break;
- case GL_TEXTURE_IMMUTABLE_LEVELS:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = texture->immutableLevelCount();
- break;
- case GL_TEXTURE_USAGE_ANGLE:
- *params = texture->getUsage();
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (!context->getExtensions().textureFilterAnisotropic)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLint)texture->getSamplerState().maxAnisotropy;
- break;
- case GL_TEXTURE_SWIZZLE_R:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = texture->getSamplerState().swizzleRed;
- break;
- case GL_TEXTURE_SWIZZLE_G:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = texture->getSamplerState().swizzleGreen;
- break;
- case GL_TEXTURE_SWIZZLE_B:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = texture->getSamplerState().swizzleBlue;
- break;
- case GL_TEXTURE_SWIZZLE_A:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = texture->getSamplerState().swizzleAlpha;
- break;
- case GL_TEXTURE_BASE_LEVEL:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = texture->getSamplerState().baseLevel;
- break;
- case GL_TEXTURE_MAX_LEVEL:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = texture->getSamplerState().maxLevel;
- break;
- case GL_TEXTURE_MIN_LOD:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLint)texture->getSamplerState().minLod;
- break;
- case GL_TEXTURE_MAX_LOD:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- *params = (GLint)texture->getSamplerState().maxLod;
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (pname)
+ {
+ case GL_TEXTURE_MAG_FILTER:
+ *params = texture->getSamplerState().magFilter;
+ break;
+ case GL_TEXTURE_MIN_FILTER:
+ *params = texture->getSamplerState().minFilter;
+ break;
+ case GL_TEXTURE_WRAP_S:
+ *params = texture->getSamplerState().wrapS;
+ break;
+ case GL_TEXTURE_WRAP_T:
+ *params = texture->getSamplerState().wrapT;
+ break;
+ case GL_TEXTURE_WRAP_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSamplerState().wrapR;
+ break;
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
+ *params = texture->isImmutable() ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_TEXTURE_IMMUTABLE_LEVELS:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->immutableLevelCount();
+ break;
+ case GL_TEXTURE_USAGE_ANGLE:
+ *params = texture->getUsage();
+ break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (!context->getExtensions().textureFilterAnisotropic)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLint)texture->getSamplerState().maxAnisotropy;
+ break;
+ case GL_TEXTURE_SWIZZLE_R:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSamplerState().swizzleRed;
+ break;
+ case GL_TEXTURE_SWIZZLE_G:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSamplerState().swizzleGreen;
+ break;
+ case GL_TEXTURE_SWIZZLE_B:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSamplerState().swizzleBlue;
+ break;
+ case GL_TEXTURE_SWIZZLE_A:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSamplerState().swizzleAlpha;
+ break;
+ case GL_TEXTURE_BASE_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSamplerState().baseLevel;
+ break;
+ case GL_TEXTURE_MAX_LEVEL:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = texture->getSamplerState().maxLevel;
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLint)texture->getSamplerState().minLod;
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+ *params = (GLint)texture->getSamplerState().maxLod;
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -3597,44 +3000,37 @@
EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = 0x%0.8p)",
program, location, bufSize, params);
- ANGLE_TRY
+ if (bufSize < 0)
{
- if (bufSize < 0)
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (program == 0)
{
return gl::error(GL_INVALID_VALUE);
}
- gl::Context *context = gl::getNonLostContext();
+ gl::Program *programObject = context->getProgram(program);
- if (context)
+ if (!programObject || !programObject->isLinked())
{
- if (program == 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject || !programObject->isLinked())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
- if (!programBinary)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!programBinary->getUniformfv(location, &bufSize, params))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->getUniformfv(location, &bufSize, params))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
}
}
@@ -3642,85 +3038,71 @@
{
EVENT("(GLuint program = %d, GLint location = %d, GLfloat* params = 0x%0.8p)", program, location, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (program == 0)
{
- if (program == 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject || !programObject->isLinked())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
- if (!programBinary)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!programBinary->getUniformfv(location, NULL, params))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject || !programObject->isLinked())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->getUniformfv(location, NULL, params))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
}
}
void __stdcall glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params)
{
- EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLint* params = 0x%0.8p)",
+ EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLint* params = 0x%0.8p)",
program, location, bufSize, params);
- ANGLE_TRY
+ if (bufSize < 0)
{
- if (bufSize < 0)
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (program == 0)
{
return gl::error(GL_INVALID_VALUE);
}
- gl::Context *context = gl::getNonLostContext();
+ gl::Program *programObject = context->getProgram(program);
- if (context)
+ if (!programObject || !programObject->isLinked())
{
- if (program == 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject || !programObject->isLinked())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
- if (!programBinary)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!programBinary->getUniformiv(location, &bufSize, params))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->getUniformiv(location, &bufSize, params))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
}
}
@@ -3728,39 +3110,32 @@
{
EVENT("(GLuint program = %d, GLint location = %d, GLint* params = 0x%0.8p)", program, location, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (program == 0)
{
- if (program == 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject || !programObject->isLinked())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
- if (!programBinary)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!programBinary->getUniformiv(location, NULL, params))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject || !programObject->isLinked())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->getUniformiv(location, NULL, params))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
}
}
@@ -3768,43 +3143,36 @@
{
EVENT("(GLuint program = %d, const GLchar* name = 0x%0.8p)", program, name);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (strstr(name, "gl_") == name)
{
- gl::Context *context = gl::getNonLostContext();
+ return -1;
+ }
- if (strstr(name, "gl_") == name)
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
{
- return -1;
- }
-
- if (context)
- {
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION, -1);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE, -1);
- }
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
- if (!programObject->isLinked() || !programBinary)
+ if (context->getShader(program))
{
return gl::error(GL_INVALID_OPERATION, -1);
}
-
- return programBinary->getUniformLocation(name);
+ else
+ {
+ return gl::error(GL_INVALID_VALUE, -1);
+ }
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, -1);
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programObject->isLinked() || !programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION, -1);
+ }
+
+ return programBinary->getUniformLocation(name);
}
return -1;
@@ -3814,41 +3182,33 @@
{
EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", index, pname, params);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ return gl::error(GL_INVALID_VALUE);
+ }
- const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index);
+ const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index);
+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
+ {
+ return;
+ }
- if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index);
+ for (int i = 0; i < 4; ++i)
{
- return;
- }
-
- if (pname == GL_CURRENT_VERTEX_ATTRIB)
- {
- const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index);
- for (int i = 0; i < 4; ++i)
- {
- params[i] = currentValueData.FloatValues[i];
- }
- }
- else
- {
- *params = gl::QuerySingleVertexAttributeParameter<GLfloat>(attribState, pname);
+ params[i] = currentValueData.FloatValues[i];
}
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ else
+ {
+ *params = gl::QuerySingleVertexAttributeParameter<GLfloat>(attribState, pname);
+ }
}
}
@@ -3856,42 +3216,35 @@
{
EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", index, pname, params);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ return gl::error(GL_INVALID_VALUE);
+ }
- const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index);
+ const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index);
- if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
- {
- return;
- }
+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
+ {
+ return;
+ }
- if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index);
+ for (int i = 0; i < 4; ++i)
{
- const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index);
- for (int i = 0; i < 4; ++i)
- {
- float currentValue = currentValueData.FloatValues[i];
- params[i] = gl::iround<GLint>(currentValue);
- }
- }
- else
- {
- *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname);
+ float currentValue = currentValueData.FloatValues[i];
+ params[i] = gl::iround<GLint>(currentValue);
}
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ else
+ {
+ *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname);
+ }
}
}
@@ -3899,28 +3252,21 @@
{
EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLvoid** pointer = 0x%0.8p)", index, pname, pointer);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- *pointer = const_cast<GLvoid*>(context->getState().getVertexAttribPointer(index));
+ return gl::error(GL_INVALID_VALUE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ *pointer = const_cast<GLvoid*>(context->getState().getVertexAttribPointer(index));
}
}
@@ -3928,34 +3274,27 @@
{
EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode);
- ANGLE_TRY
+ switch (mode)
{
- switch (mode)
- {
- case GL_FASTEST:
- case GL_NICEST:
- case GL_DONT_CARE:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Context *context = gl::getNonLostContext();
- switch (target)
- {
- case GL_GENERATE_MIPMAP_HINT:
- if (context) context->getState().setGenerateMipmapHint(mode);
- break;
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
- if (context) context->getState().setFragmentShaderDerivativeHint(mode);
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ case GL_FASTEST:
+ case GL_NICEST:
+ case GL_DONT_CARE:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+ switch (target)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ case GL_GENERATE_MIPMAP_HINT:
+ if (context) context->getState().setGenerateMipmapHint(mode);
+ break;
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
+ if (context) context->getState().setFragmentShaderDerivativeHint(mode);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
}
@@ -3963,24 +3302,17 @@
{
EVENT("(GLuint buffer = %d)", buffer);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context && buffer)
+ if (context && buffer)
+ {
+ gl::Buffer *bufferObject = context->getBuffer(buffer);
+
+ if (bufferObject)
{
- gl::Buffer *bufferObject = context->getBuffer(buffer);
-
- if (bufferObject)
- {
- return GL_TRUE;
- }
+ return GL_TRUE;
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
- }
return GL_FALSE;
}
@@ -3989,23 +3321,16 @@
{
EVENT("(GLenum cap = 0x%X)", cap);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidCap(context, cap))
{
- if (!ValidCap(context, cap))
- {
- return gl::error(GL_INVALID_ENUM, false);
- }
-
- return context->getState().getEnableFeature(cap);
+ return gl::error(GL_INVALID_ENUM, false);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, false);
+
+ return context->getState().getEnableFeature(cap);
}
return false;
@@ -4015,25 +3340,18 @@
{
EVENT("(GLuint fence = %d)", fence);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
+
+ if (fenceObject == NULL)
{
- gl::FenceNV *fenceObject = context->getFenceNV(fence);
-
- if (fenceObject == NULL)
- {
- return GL_FALSE;
- }
-
- return fenceObject->isFence();
+ return GL_FALSE;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+
+ return fenceObject->isFence();
}
return GL_FALSE;
@@ -4043,24 +3361,17 @@
{
EVENT("(GLuint framebuffer = %d)", framebuffer);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context && framebuffer)
+ if (context && framebuffer)
+ {
+ gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer);
+
+ if (framebufferObject)
{
- gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer);
-
- if (framebufferObject)
- {
- return GL_TRUE;
- }
+ return GL_TRUE;
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
- }
return GL_FALSE;
}
@@ -4069,24 +3380,17 @@
{
EVENT("(GLuint program = %d)", program);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context && program)
+ if (context && program)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (programObject)
{
- gl::Program *programObject = context->getProgram(program);
-
- if (programObject)
- {
- return GL_TRUE;
- }
+ return GL_TRUE;
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
- }
return GL_FALSE;
}
@@ -4095,18 +3399,11 @@
{
EVENT("(GLuint id = %d)", id);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+ return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
}
return GL_FALSE;
@@ -4116,24 +3413,17 @@
{
EVENT("(GLuint renderbuffer = %d)", renderbuffer);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context && renderbuffer)
+ if (context && renderbuffer)
+ {
+ gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);
+
+ if (renderbufferObject)
{
- gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);
-
- if (renderbufferObject)
- {
- return GL_TRUE;
- }
+ return GL_TRUE;
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
- }
return GL_FALSE;
}
@@ -4142,24 +3432,17 @@
{
EVENT("(GLuint shader = %d)", shader);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context && shader)
+ if (context && shader)
+ {
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (shaderObject)
{
- gl::Shader *shaderObject = context->getShader(shader);
-
- if (shaderObject)
- {
- return GL_TRUE;
- }
+ return GL_TRUE;
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
- }
return GL_FALSE;
}
@@ -4168,24 +3451,17 @@
{
EVENT("(GLuint texture = %d)", texture);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context && texture)
+ if (context && texture)
+ {
+ gl::Texture *textureObject = context->getTexture(texture);
+
+ if (textureObject)
{
- gl::Texture *textureObject = context->getTexture(texture);
-
- if (textureObject)
- {
- return GL_TRUE;
- }
+ return GL_TRUE;
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
- }
return GL_FALSE;
}
@@ -4194,23 +3470,16 @@
{
EVENT("(GLfloat width = %f)", width);
- ANGLE_TRY
+ if (width <= 0.0f)
{
- if (width <= 0.0f)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- context->getState().setLineWidth(width);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setLineWidth(width);
}
}
@@ -4218,32 +3487,25 @@
{
EVENT("(GLuint program = %d)", program);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
{
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
+ if (context->getShader(program))
{
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
-
- context->linkProgram(program);
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->linkProgram(program);
}
}
@@ -4251,78 +3513,64 @@
{
EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ switch (pname)
{
- switch (pname)
+ case GL_UNPACK_ALIGNMENT:
+ if (param != 1 && param != 2 && param != 4 && param != 8)
{
- case GL_UNPACK_ALIGNMENT:
- if (param != 1 && param != 2 && param != 4 && param != 8)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ return gl::error(GL_INVALID_VALUE);
+ }
- context->getState().setUnpackAlignment(param);
- break;
+ context->getState().setUnpackAlignment(param);
+ break;
- case GL_PACK_ALIGNMENT:
- if (param != 1 && param != 2 && param != 4 && param != 8)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ case GL_PACK_ALIGNMENT:
+ if (param != 1 && param != 2 && param != 4 && param != 8)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
- context->getState().setPackAlignment(param);
- break;
+ context->getState().setPackAlignment(param);
+ break;
- case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
- context->getState().setPackReverseRowOrder(param != 0);
- break;
+ case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
+ context->getState().setPackReverseRowOrder(param != 0);
+ break;
- case GL_UNPACK_IMAGE_HEIGHT:
- case GL_UNPACK_SKIP_IMAGES:
- case GL_UNPACK_ROW_LENGTH:
- case GL_UNPACK_SKIP_ROWS:
- case GL_UNPACK_SKIP_PIXELS:
- case GL_PACK_ROW_LENGTH:
- case GL_PACK_SKIP_ROWS:
- case GL_PACK_SKIP_PIXELS:
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- UNIMPLEMENTED();
- break;
-
- default:
+ case GL_UNPACK_IMAGE_HEIGHT:
+ case GL_UNPACK_SKIP_IMAGES:
+ case GL_UNPACK_ROW_LENGTH:
+ case GL_UNPACK_SKIP_ROWS:
+ case GL_UNPACK_SKIP_PIXELS:
+ case GL_PACK_ROW_LENGTH:
+ case GL_PACK_SKIP_ROWS:
+ case GL_PACK_SKIP_PIXELS:
+ if (context->getClientVersion() < 3)
+ {
return gl::error(GL_INVALID_ENUM);
}
+ UNIMPLEMENTED();
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
}
void __stdcall glPolygonOffset(GLfloat factor, GLfloat units)
{
EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
- {
- context->getState().setPolygonOffsetParams(factor, units);
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setPolygonOffsetParams(factor, units);
}
}
@@ -4334,29 +3582,22 @@
"GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = 0x%0.8p)",
x, y, width, height, format, type, bufSize, data);
- ANGLE_TRY
+ if (width < 0 || height < 0 || bufSize < 0)
{
- if (width < 0 || height < 0 || bufSize < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (!gl::ValidateReadPixelsParameters(context, x, y, width, height,
- format, type, &bufSize, data))
- {
- return;
- }
-
- context->readPixels(x, y, width, height, format, type, &bufSize, data);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ if (!gl::ValidateReadPixelsParameters(context, x, y, width, height,
+ format, type, &bufSize, data))
+ {
+ return;
+ }
+
+ context->readPixels(x, y, width, height, format, type, &bufSize, data);
}
}
@@ -4367,29 +3608,22 @@
"GLenum format = 0x%X, GLenum type = 0x%X, GLvoid* pixels = 0x%0.8p)",
x, y, width, height, format, type, pixels);
- ANGLE_TRY
+ if (width < 0 || height < 0)
{
- if (width < 0 || height < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (!gl::ValidateReadPixelsParameters(context, x, y, width, height,
- format, type, NULL, pixels))
- {
- return;
- }
-
- context->readPixels(x, y, width, height, format, type, NULL, pixels);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ if (!gl::ValidateReadPixelsParameters(context, x, y, width, height,
+ format, type, NULL, pixels))
+ {
+ return;
+ }
+
+ context->readPixels(x, y, width, height, format, type, NULL, pixels);
}
}
@@ -4397,14 +3631,7 @@
{
EVENT("()");
- ANGLE_TRY
- {
- gl::Shader::releaseCompiler();
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
+ gl::Shader::releaseCompiler();
}
void __stdcall glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
@@ -4412,24 +3639,17 @@
EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
target, samples, internalformat, width, height);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat,
+ width, height, true))
{
- if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat,
- width, height, true))
- {
- return;
- }
-
- context->setRenderbufferStorage(width, height, internalformat, samples);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->setRenderbufferStorage(width, height, internalformat, samples);
}
}
@@ -4442,18 +3662,11 @@
{
EVENT("(GLclampf value = %f, GLboolean invert = %u)", value, invert);
- ANGLE_TRY
- {
- gl::Context* context = gl::getNonLostContext();
+ gl::Context* context = gl::getNonLostContext();
- if (context)
- {
- context->getState().setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE);
- }
- }
- ANGLE_CATCH_ALL
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE);
}
}
@@ -4461,30 +3674,23 @@
{
EVENT("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition);
- ANGLE_TRY
+ if (condition != GL_ALL_COMPLETED_NV)
{
- if (condition != GL_ALL_COMPLETED_NV)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- gl::FenceNV *fenceObject = context->getFenceNV(fence);
-
- if (fenceObject == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- fenceObject->setFence(condition);
- }
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
+
+ if (fenceObject == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ fenceObject->setFence(condition);
}
}
@@ -4492,23 +3698,16 @@
{
EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height);
- ANGLE_TRY
+ if (width < 0 || height < 0)
{
- if (width < 0 || height < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context* context = gl::getNonLostContext();
-
- if (context)
- {
- context->getState().setScissorParams(x, y, width, height);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context* context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setScissorParams(x, y, width, height);
}
}
@@ -4518,15 +3717,8 @@
"const GLvoid* binary = 0x%0.8p, GLsizei length = %d)",
n, shaders, binaryformat, binary, length);
- ANGLE_TRY
- {
- // No binary shader formats are supported.
- return gl::error(GL_INVALID_ENUM);
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
+ // No binary shader formats are supported.
+ return gl::error(GL_INVALID_ENUM);
}
void __stdcall glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length)
@@ -4534,37 +3726,30 @@
EVENT("(GLuint shader = %d, GLsizei count = %d, const GLchar** string = 0x%0.8p, const GLint* length = 0x%0.8p)",
shader, count, string, length);
- ANGLE_TRY
+ if (count < 0)
{
- if (count < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- gl::Shader *shaderObject = context->getShader(shader);
-
- if (!shaderObject)
- {
- if (context->getProgram(shader))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- shaderObject->setSource(count, string, length);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ gl::Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
+ {
+ if (context->getProgram(shader))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ shaderObject->setSource(count, string, length);
}
}
@@ -4577,51 +3762,44 @@
{
EVENT("(GLenum face = 0x%X, GLenum func = 0x%X, GLint ref = %d, GLuint mask = %d)", face, func, ref, mask);
- ANGLE_TRY
+ switch (face)
{
- switch (face)
- {
- case GL_FRONT:
- case GL_BACK:
- case GL_FRONT_AND_BACK:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (func)
- {
- case GL_NEVER:
- case GL_ALWAYS:
- case GL_LESS:
- case GL_LEQUAL:
- case GL_EQUAL:
- case GL_GEQUAL:
- case GL_GREATER:
- case GL_NOTEQUAL:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
- {
- context->getState().setStencilParams(func, ref, mask);
- }
-
- if (face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- context->getState().setStencilBackParams(func, ref, mask);
- }
- }
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ switch (func)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ case GL_NEVER:
+ case GL_ALWAYS:
+ case GL_LESS:
+ case GL_LEQUAL:
+ case GL_EQUAL:
+ case GL_GEQUAL:
+ case GL_GREATER:
+ case GL_NOTEQUAL:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+ {
+ context->getState().setStencilParams(func, ref, mask);
+ }
+
+ if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+ {
+ context->getState().setStencilBackParams(func, ref, mask);
+ }
}
}
@@ -4634,36 +3812,29 @@
{
EVENT("(GLenum face = 0x%X, GLuint mask = %d)", face, mask);
- ANGLE_TRY
+ switch (face)
{
- switch (face)
- {
- case GL_FRONT:
- case GL_BACK:
- case GL_FRONT_AND_BACK:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
- {
- context->getState().setStencilWritemask(mask);
- }
-
- if (face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- context->getState().setStencilBackWritemask(mask);
- }
- }
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+ {
+ context->getState().setStencilWritemask(mask);
+ }
+
+ if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+ {
+ context->getState().setStencilBackWritemask(mask);
+ }
}
}
@@ -4677,81 +3848,74 @@
EVENT("(GLenum face = 0x%X, GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpas = 0x%Xs)",
face, fail, zfail, zpass);
- ANGLE_TRY
+ switch (face)
{
- switch (face)
- {
- case GL_FRONT:
- case GL_BACK:
- case GL_FRONT_AND_BACK:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (fail)
- {
- case GL_ZERO:
- case GL_KEEP:
- case GL_REPLACE:
- case GL_INCR:
- case GL_DECR:
- case GL_INVERT:
- case GL_INCR_WRAP:
- case GL_DECR_WRAP:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (zfail)
- {
- case GL_ZERO:
- case GL_KEEP:
- case GL_REPLACE:
- case GL_INCR:
- case GL_DECR:
- case GL_INVERT:
- case GL_INCR_WRAP:
- case GL_DECR_WRAP:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (zpass)
- {
- case GL_ZERO:
- case GL_KEEP:
- case GL_REPLACE:
- case GL_INCR:
- case GL_DECR:
- case GL_INVERT:
- case GL_INCR_WRAP:
- case GL_DECR_WRAP:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
- {
- context->getState().setStencilOperations(fail, zfail, zpass);
- }
-
- if (face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- context->getState().setStencilBackOperations(fail, zfail, zpass);
- }
- }
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
- ANGLE_CATCH_ALL
+
+ switch (fail)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ case GL_ZERO:
+ case GL_KEEP:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_DECR:
+ case GL_INVERT:
+ case GL_INCR_WRAP:
+ case GL_DECR_WRAP:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (zfail)
+ {
+ case GL_ZERO:
+ case GL_KEEP:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_DECR:
+ case GL_INVERT:
+ case GL_INCR_WRAP:
+ case GL_DECR_WRAP:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (zpass)
+ {
+ case GL_ZERO:
+ case GL_KEEP:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_DECR:
+ case GL_INVERT:
+ case GL_INCR_WRAP:
+ case GL_DECR_WRAP:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
+ {
+ if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+ {
+ context->getState().setStencilOperations(fail, zfail, zpass);
+ }
+
+ if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+ {
+ context->getState().setStencilBackOperations(fail, zfail, zpass);
+ }
}
}
@@ -4759,32 +3923,25 @@
{
EVENT("(GLuint fence = %d)", fence);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::FenceNV *fenceObject = context->getFenceNV(fence);
+
+ if (fenceObject == NULL)
{
- gl::FenceNV *fenceObject = context->getFenceNV(fence);
-
- if (fenceObject == NULL)
- {
- return gl::error(GL_INVALID_OPERATION, GL_TRUE);
- }
-
- if (fenceObject->isFence() != GL_TRUE)
- {
- return gl::error(GL_INVALID_OPERATION, GL_TRUE);
- }
-
- return fenceObject->testFence();
+ return gl::error(GL_INVALID_OPERATION, GL_TRUE);
}
+
+ if (fenceObject->isFence() != GL_TRUE)
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_TRUE);
+ }
+
+ return fenceObject->testFence();
}
- ANGLE_CATCH_ALL
- {
- gl::error(GL_OUT_OF_MEMORY);
- }
-
+
return GL_TRUE;
}
@@ -4795,77 +3952,70 @@
"GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
target, level, internalformat, width, height, border, format, type, pixels);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, internalformat, false, false,
+ 0, 0, width, height, border, format, type, pixels))
{
- if (context->getClientVersion() < 3 &&
- !ValidateES2TexImageParameters(context, target, level, internalformat, false, false,
- 0, 0, width, height, border, format, type, pixels))
- {
- return;
- }
-
- if (context->getClientVersion() >= 3 &&
- !ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
- 0, 0, 0, width, height, 1, border, format, type, pixels))
- {
- return;
- }
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- {
- gl::Texture2D *texture = context->getTexture2D();
- texture->setImage(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- texture->setImagePosX(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- texture->setImageNegX(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- texture->setImagePosY(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- texture->setImageNegY(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- texture->setImagePosZ(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- texture->setImageNegZ(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
- default: UNREACHABLE();
- }
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
+ 0, 0, 0, width, height, 1, border, format, type, pixels))
+ {
+ return;
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+ texture->setImage(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImagePosX(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImageNegX(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImagePosY(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImageNegY(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImagePosZ(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->setImageNegZ(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+ default: UNREACHABLE();
+ }
}
}
@@ -4873,50 +4023,43 @@
{
EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)", target, pname, param);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateTexParamParameters(context, pname, static_cast<GLint>(param)))
{
- if (!ValidateTexParamParameters(context, pname, static_cast<GLint>(param)))
- {
- return;
- }
-
- gl::Texture *texture = context->getTargetTexture(target);
-
- if (!texture)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (pname)
- {
- case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = gl::uiround<GLenum>(param); break;
- case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = gl::uiround<GLenum>(param); break;
- case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = gl::uiround<GLenum>(param); break;
- case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = gl::uiround<GLenum>(param); break;
- case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = gl::uiround<GLenum>(param); break;
- case GL_TEXTURE_USAGE_ANGLE: texture->setUsage(gl::uiround<GLenum>(param)); break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min(param, context->getExtensions().maxTextureAnisotropy); break;
- case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = gl::uiround<GLenum>(param); break;
- case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = gl::uiround<GLenum>(param); break;
- case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = gl::uiround<GLenum>(param); break;
- case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = gl::uiround<GLenum>(param); break;
- case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = gl::uiround<GLenum>(param); break;
- case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = gl::uiround<GLenum>(param); break;
- case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = gl::iround<GLint>(param); break;
- case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = gl::iround<GLint>(param); break;
- case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = param; break;
- case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = param; break;
- default: UNREACHABLE(); break;
- }
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::Texture *texture = context->getTargetTexture(target);
+
+ if (!texture)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = gl::uiround<GLenum>(param); break;
+ case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = gl::uiround<GLenum>(param); break;
+ case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = gl::uiround<GLenum>(param); break;
+ case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = gl::uiround<GLenum>(param); break;
+ case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = gl::uiround<GLenum>(param); break;
+ case GL_TEXTURE_USAGE_ANGLE: texture->setUsage(gl::uiround<GLenum>(param)); break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min(param, context->getExtensions().maxTextureAnisotropy); break;
+ case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = gl::uiround<GLenum>(param); break;
+ case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = gl::uiround<GLenum>(param); break;
+ case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = gl::uiround<GLenum>(param); break;
+ case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = gl::uiround<GLenum>(param); break;
+ case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = gl::uiround<GLenum>(param); break;
+ case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = gl::uiround<GLenum>(param); break;
+ case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = gl::iround<GLint>(param); break;
+ case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = gl::iround<GLint>(param); break;
+ case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = param; break;
+ case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = param; break;
+ default: UNREACHABLE(); break;
+ }
}
}
@@ -4929,50 +4072,43 @@
{
EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateTexParamParameters(context, pname, param))
{
- if (!ValidateTexParamParameters(context, pname, param))
- {
- return;
- }
-
- gl::Texture *texture = context->getTargetTexture(target);
-
- if (!texture)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (pname)
- {
- case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = (GLenum)param; break;
- case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = (GLenum)param; break;
- case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = (GLenum)param; break;
- case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = (GLenum)param; break;
- case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = (GLenum)param; break;
- case GL_TEXTURE_USAGE_ANGLE: texture->setUsage((GLenum)param); break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min((float)param, context->getExtensions().maxTextureAnisotropy); break;
- case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = (GLenum)param; break;
- case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = (GLenum)param; break;
- case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = (GLenum)param; break;
- case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = (GLenum)param; break;
- case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = (GLenum)param; break;
- case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = (GLenum)param; break;
- case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = param; break;
- case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = param; break;
- case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = (GLfloat)param; break;
- case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = (GLfloat)param; break;
- default: UNREACHABLE(); break;
- }
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::Texture *texture = context->getTargetTexture(target);
+
+ if (!texture)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = (GLenum)param; break;
+ case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = (GLenum)param; break;
+ case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = (GLenum)param; break;
+ case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = (GLenum)param; break;
+ case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = (GLenum)param; break;
+ case GL_TEXTURE_USAGE_ANGLE: texture->setUsage((GLenum)param); break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min((float)param, context->getExtensions().maxTextureAnisotropy); break;
+ case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = (GLenum)param; break;
+ case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = (GLenum)param; break;
+ case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = (GLenum)param; break;
+ case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = (GLenum)param; break;
+ case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = (GLenum)param; break;
+ case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = (GLenum)param; break;
+ case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = param; break;
+ case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = param; break;
+ case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = (GLfloat)param; break;
+ case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = (GLfloat)param; break;
+ default: UNREACHABLE(); break;
+ }
}
}
@@ -4986,53 +4122,46 @@
EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
target, levels, internalformat, width, height);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!context->getExtensions().textureStorage)
{
- if (!context->getExtensions().textureStorage)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (context->getClientVersion() < 3 &&
- !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height))
- {
- return;
- }
-
- if (context->getClientVersion() >= 3 &&
- !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1))
- {
- return;
- }
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- {
- gl::Texture2D *texture2d = context->getTexture2D();
- texture2d->storage(levels, internalformat, width, height);
- }
- break;
-
- case GL_TEXTURE_CUBE_MAP:
- {
- gl::TextureCubeMap *textureCube = context->getTextureCubeMap();
- textureCube->storage(levels, internalformat, width);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height))
+ {
+ return;
+ }
+
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1))
+ {
+ return;
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ gl::Texture2D *texture2d = context->getTexture2D();
+ texture2d->storage(levels, internalformat, width, height);
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP:
+ {
+ gl::TextureCubeMap *textureCube = context->getTextureCubeMap();
+ textureCube->storage(levels, internalformat, width);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -5044,61 +4173,54 @@
"const GLvoid* pixels = 0x%0.8p)",
target, level, xoffset, yoffset, width, height, format, type, pixels);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3 &&
+ !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true,
+ xoffset, yoffset, width, height, 0, format, type, pixels))
{
- if (context->getClientVersion() < 3 &&
- !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true,
- xoffset, yoffset, width, height, 0, format, type, pixels))
- {
- return;
- }
-
- if (context->getClientVersion() >= 3 &&
- !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
- xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels))
- {
- return;
- }
-
- // Zero sized uploads are valid but no-ops
- if (width == 0 || height == 0)
- {
- return;
- }
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- {
- gl::Texture2D *texture = context->getTexture2D();
- texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
-
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- {
- gl::TextureCubeMap *texture = context->getTextureCubeMap();
- texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
-
- default:
- UNREACHABLE();
- }
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (context->getClientVersion() >= 3 &&
+ !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
+ xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels))
+ {
+ return;
+ }
+
+ // Zero sized uploads are valid but no-ops
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ gl::Texture2D *texture = context->getTexture2D();
+ texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ gl::TextureCubeMap *texture = context->getTextureCubeMap();
+ texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ }
}
}
@@ -5111,24 +4233,17 @@
{
EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_FLOAT, location, count))
{
- if (!ValidateUniform(context, GL_FLOAT, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform1fv(location, count, v);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform1fv(location, count, v);
}
}
@@ -5141,24 +4256,17 @@
{
EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_INT, location, count))
{
- if (!ValidateUniform(context, GL_INT, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform1iv(location, count, v);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform1iv(location, count, v);
}
}
@@ -5173,24 +4281,17 @@
{
EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_FLOAT_VEC2, location, count))
{
- if (!ValidateUniform(context, GL_FLOAT_VEC2, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform2fv(location, count, v);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform2fv(location, count, v);
}
}
@@ -5205,24 +4306,17 @@
{
EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_INT_VEC2, location, count))
{
- if (!ValidateUniform(context, GL_INT_VEC2, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform2iv(location, count, v);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform2iv(location, count, v);
}
}
@@ -5237,24 +4331,17 @@
{
EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_FLOAT_VEC3, location, count))
{
- if (!ValidateUniform(context, GL_FLOAT_VEC3, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform3fv(location, count, v);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform3fv(location, count, v);
}
}
@@ -5269,24 +4356,17 @@
{
EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_INT_VEC3, location, count))
{
- if (!ValidateUniform(context, GL_INT_VEC3, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform3iv(location, count, v);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform3iv(location, count, v);
}
}
@@ -5301,24 +4381,17 @@
{
EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_FLOAT_VEC4, location, count))
{
- if (!ValidateUniform(context, GL_FLOAT_VEC4, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform4fv(location, count, v);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform4fv(location, count, v);
}
}
@@ -5333,24 +4406,17 @@
{
EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_INT_VEC4, location, count))
{
- if (!ValidateUniform(context, GL_INT_VEC4, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform4iv(location, count, v);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform4iv(location, count, v);
}
}
@@ -5359,24 +4425,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
location, count, transpose, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose))
{
- if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniformMatrix2fv(location, count, transpose, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniformMatrix2fv(location, count, transpose, value);
}
}
@@ -5385,24 +4444,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
location, count, transpose, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose))
{
- if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniformMatrix3fv(location, count, transpose, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniformMatrix3fv(location, count, transpose, value);
}
}
@@ -5411,24 +4463,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
location, count, transpose, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose))
{
- if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniformMatrix4fv(location, count, transpose, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniformMatrix4fv(location, count, transpose, value);
}
}
@@ -5436,37 +4481,30 @@
{
EVENT("(GLuint program = %d)", program);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
+ gl::Program *programObject = context->getProgram(program);
- if (context)
+ if (!programObject && program != 0)
{
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject && program != 0)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- if (program != 0 && !programObject->isLinked())
+ if (context->getShader(program))
{
return gl::error(GL_INVALID_OPERATION);
}
-
- context->useProgram(program);
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (program != 0 && !programObject->isLinked())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->useProgram(program);
}
}
@@ -5474,32 +4512,25 @@
{
EVENT("(GLuint program = %d)", program);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
{
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
+ if (context->getShader(program))
{
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
-
- programObject->validate();
+ else
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ programObject->validate();
}
}
@@ -5507,24 +4538,17 @@
{
EVENT("(GLuint index = %d, GLfloat x = %f)", index, x);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- GLfloat vals[4] = { x, 0, 0, 1 };
- context->getState().setVertexAttribf(index, vals);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ GLfloat vals[4] = { x, 0, 0, 1 };
+ context->getState().setVertexAttribf(index, vals);
}
}
@@ -5532,24 +4556,17 @@
{
EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- GLfloat vals[4] = { values[0], 0, 0, 1 };
- context->getState().setVertexAttribf(index, vals);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ GLfloat vals[4] = { values[0], 0, 0, 1 };
+ context->getState().setVertexAttribf(index, vals);
}
}
@@ -5557,24 +4574,17 @@
{
EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f)", index, x, y);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- GLfloat vals[4] = { x, y, 0, 1 };
- context->getState().setVertexAttribf(index, vals);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ GLfloat vals[4] = { x, y, 0, 1 };
+ context->getState().setVertexAttribf(index, vals);
}
}
@@ -5582,24 +4592,17 @@
{
EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- GLfloat vals[4] = { values[0], values[1], 0, 1 };
- context->getState().setVertexAttribf(index, vals);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ GLfloat vals[4] = { values[0], values[1], 0, 1 };
+ context->getState().setVertexAttribf(index, vals);
}
}
@@ -5607,24 +4610,17 @@
{
EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", index, x, y, z);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- GLfloat vals[4] = { x, y, z, 1 };
- context->getState().setVertexAttribf(index, vals);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ GLfloat vals[4] = { x, y, z, 1 };
+ context->getState().setVertexAttribf(index, vals);
}
}
@@ -5632,24 +4628,17 @@
{
EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- GLfloat vals[4] = { values[0], values[1], values[2], 1 };
- context->getState().setVertexAttribf(index, vals);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ GLfloat vals[4] = { values[0], values[1], values[2], 1 };
+ context->getState().setVertexAttribf(index, vals);
}
}
@@ -5657,24 +4646,17 @@
{
EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)", index, x, y, z, w);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- GLfloat vals[4] = { x, y, z, w };
- context->getState().setVertexAttribf(index, vals);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ GLfloat vals[4] = { x, y, z, w };
+ context->getState().setVertexAttribf(index, vals);
}
}
@@ -5682,23 +4664,16 @@
{
EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- context->getState().setVertexAttribf(index, values);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setVertexAttribf(index, values);
}
}
@@ -5706,23 +4681,16 @@
{
EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- context->setVertexAttribDivisor(index, divisor);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->setVertexAttribDivisor(index, divisor);
}
}
@@ -5732,74 +4700,67 @@
"GLboolean normalized = %u, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)",
index, size, type, normalized, stride, ptr);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ return gl::error(GL_INVALID_VALUE);
+ }
- if (size < 1 || size > 4)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ if (size < 1 || size > 4)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- switch (type)
+ switch (type)
+ {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_FIXED:
+ case GL_FLOAT:
+ break;
+ case GL_HALF_FLOAT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ if (context && context->getClientVersion() < 3)
{
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_FIXED:
- case GL_FLOAT:
- break;
- case GL_HALF_FLOAT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- if (context && context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_ENUM);
- }
- else
- {
- break;
- }
- default:
return gl::error(GL_INVALID_ENUM);
}
-
- if (stride < 0)
+ else
{
- return gl::error(GL_INVALID_VALUE);
+ break;
}
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
- if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4)
+ if (stride < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (context)
+ {
+ // [OpenGL ES 3.0.2] Section 2.8 page 24:
+ // An INVALID_OPERATION error is generated when a non-zero vertex array object
+ // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
+ // and the pointer argument is not NULL.
+ if (context->getState().getVertexArray()->id() != 0 && context->getState().getArrayBufferId() == 0 && ptr != NULL)
{
return gl::error(GL_INVALID_OPERATION);
}
- if (context)
- {
- // [OpenGL ES 3.0.2] Section 2.8 page 24:
- // An INVALID_OPERATION error is generated when a non-zero vertex array object
- // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
- // and the pointer argument is not NULL.
- if (context->getState().getVertexArray()->id() != 0 && context->getState().getArrayBufferId() == 0 && ptr != NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type,
- normalized == GL_TRUE, false, stride, ptr);
- }
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type,
+ normalized == GL_TRUE, false, stride, ptr);
}
}
@@ -5807,23 +4768,16 @@
{
EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height);
- ANGLE_TRY
+ if (width < 0 || height < 0)
{
- if (width < 0 || height < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- context->getState().setViewportParams(x, y, width, height);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setViewportParams(x, y, width, height);
}
}
@@ -5833,24 +4787,17 @@
{
EVENT("(GLenum mode = 0x%X)", mode);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // glReadBuffer
- UNIMPLEMENTED();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ // glReadBuffer
+ UNIMPLEMENTED();
}
}
@@ -5859,24 +4806,17 @@
EVENT("(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, "
"const GLvoid* indices = 0x%0.8p)", mode, start, end, count, type, indices);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // glDrawRangeElements
- UNIMPLEMENTED();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ // glDrawRangeElements
+ UNIMPLEMENTED();
}
}
@@ -5887,48 +4827,41 @@
"GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
target, level, internalformat, width, height, depth, border, format, type, pixels);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // validateES3TexImageFormat sets the error code if there is an error
- if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
- 0, 0, 0, width, height, depth, border, format, type, pixels))
- {
- return;
- }
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- {
- gl::Texture3D *texture = context->getTexture3D();
- texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
-
- case GL_TEXTURE_2D_ARRAY:
- {
- gl::Texture2DArray *texture = context->getTexture2DArray();
- texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ // validateES3TexImageFormat sets the error code if there is an error
+ if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
+ 0, 0, 0, width, height, depth, border, format, type, pixels))
+ {
+ return;
+ }
+
+ switch(target)
+ {
+ case GL_TEXTURE_3D:
+ {
+ gl::Texture3D *texture = context->getTexture3D();
+ texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -5939,55 +4872,48 @@
"GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)",
target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // validateES3TexImageFormat sets the error code if there is an error
- if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
- xoffset, yoffset, zoffset, width, height, depth, 0,
- format, type, pixels))
- {
- return;
- }
-
- // Zero sized uploads are valid but no-ops
- if (width == 0 || height == 0 || depth == 0)
- {
- return;
- }
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- {
- gl::Texture3D *texture = context->getTexture3D();
- texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
-
- case GL_TEXTURE_2D_ARRAY:
- {
- gl::Texture2DArray *texture = context->getTexture2DArray();
- texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ // validateES3TexImageFormat sets the error code if there is an error
+ if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
+ xoffset, yoffset, zoffset, width, height, depth, 0,
+ format, type, pixels))
+ {
+ return;
+ }
+
+ // Zero sized uploads are valid but no-ops
+ if (width == 0 || height == 0 || depth == 0)
+ {
+ return;
+ }
+
+ switch(target)
+ {
+ case GL_TEXTURE_3D:
+ {
+ gl::Texture3D *texture = context->getTexture3D();
+ texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -5997,45 +4923,38 @@
"GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
target, level, xoffset, yoffset, zoffset, x, y, width, height);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset, yoffset, zoffset,
- x, y, width, height, 0))
- {
- return;
- }
-
- gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer();
- gl::Texture *texture = NULL;
- switch (target)
- {
- case GL_TEXTURE_3D:
- texture = context->getTexture3D();
- break;
-
- case GL_TEXTURE_2D_ARRAY:
- texture = context->getTexture2DArray();
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- texture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, framebuffer);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset, yoffset, zoffset,
+ x, y, width, height, 0))
+ {
+ return;
+ }
+
+ gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer();
+ gl::Texture *texture = NULL;
+ switch (target)
+ {
+ case GL_TEXTURE_3D:
+ texture = context->getTexture3D();
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ texture = context->getTexture2DArray();
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ texture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, framebuffer);
}
}
@@ -6046,53 +4965,46 @@
"const GLvoid* data = 0x%0.8p)",
target, level, internalformat, width, height, depth, border, imageSize, data);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(internalformat, GL_UNSIGNED_BYTE, width, height))
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- // validateES3TexImageFormat sets the error code if there is an error
- if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
- 0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data))
- {
- return;
- }
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- {
- gl::Texture3D *texture = context->getTexture3D();
- texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
- }
- break;
-
- case GL_TEXTURE_2D_ARRAY:
- {
- gl::Texture2DArray *texture = context->getTexture2DArray();
- texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(internalformat, GL_UNSIGNED_BYTE, width, height))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ // validateES3TexImageFormat sets the error code if there is an error
+ if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
+ 0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data))
+ {
+ return;
+ }
+
+ switch(target)
+ {
+ case GL_TEXTURE_3D:
+ {
+ gl::Texture3D *texture = context->getTexture3D();
+ texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -6103,66 +5015,59 @@
"GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)",
target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(format, GL_UNSIGNED_BYTE, width, height))
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (!data)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- // validateES3TexImageFormat sets the error code if there is an error
- if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
- 0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data))
- {
- return;
- }
-
- // Zero sized uploads are valid but no-ops
- if (width == 0 || height == 0)
- {
- return;
- }
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- {
- gl::Texture3D *texture = context->getTexture3D();
- texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth,
- format, imageSize, data);
- }
- break;
-
- case GL_TEXTURE_2D_ARRAY:
- {
- gl::Texture2DArray *texture = context->getTexture2DArray();
- texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth,
- format, imageSize, data);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (imageSize < 0 || imageSize != (GLsizei)gl::GetBlockSize(format, GL_UNSIGNED_BYTE, width, height))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (!data)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ // validateES3TexImageFormat sets the error code if there is an error
+ if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
+ 0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data))
+ {
+ return;
+ }
+
+ // Zero sized uploads are valid but no-ops
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
+ switch(target)
+ {
+ case GL_TEXTURE_3D:
+ {
+ gl::Texture3D *texture = context->getTexture3D();
+ texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth,
+ format, imageSize, data);
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture = context->getTexture2DArray();
+ texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth,
+ format, imageSize, data);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -6170,31 +5075,24 @@
{
EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- for (GLsizei i = 0; i < n; i++)
- {
- ids[i] = context->createQuery();
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (GLsizei i = 0; i < n; i++)
+ {
+ ids[i] = context->createQuery();
+ }
}
}
@@ -6202,31 +5100,24 @@
{
EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- for (GLsizei i = 0; i < n; i++)
- {
- context->deleteQuery(ids[i]);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (GLsizei i = 0; i < n; i++)
+ {
+ context->deleteQuery(ids[i]);
+ }
}
}
@@ -6234,23 +5125,16 @@
{
EVENT("(GLuint id = %u)", id);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION, GL_FALSE);
- }
-
- return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+
+ return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
}
return GL_FALSE;
@@ -6260,27 +5144,20 @@
{
EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!ValidateBeginQuery(context, target, id))
- {
- return;
- }
- context->beginQuery(target, id);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!ValidateBeginQuery(context, target, id))
+ {
+ return;
+ }
+ context->beginQuery(target, id);
}
}
@@ -6288,28 +5165,21 @@
{
EVENT("(GLenum target = 0x%X)", target);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!ValidateEndQuery(context, target))
- {
- return;
- }
-
- context->endQuery(target);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!ValidateEndQuery(context, target))
+ {
+ return;
+ }
+
+ context->endQuery(target);
}
}
@@ -6317,36 +5187,29 @@
{
EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!ValidQueryType(context, target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (pname)
- {
- case GL_CURRENT_QUERY:
- params[0] = static_cast<GLint>(context->getState().getActiveQueryId(target));
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!ValidQueryType(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (pname)
+ {
+ case GL_CURRENT_QUERY:
+ params[0] = static_cast<GLint>(context->getState().getActiveQueryId(target));
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -6354,45 +5217,38 @@
{
EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", id, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
-
- if (!queryObject)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (context->getState().getActiveQueryId(queryObject->getType()) == id)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch(pname)
- {
- case GL_QUERY_RESULT:
- params[0] = queryObject->getResult();
- break;
- case GL_QUERY_RESULT_AVAILABLE:
- params[0] = queryObject->isResultAvailable();
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::Query *queryObject = context->getQuery(id, false, GL_NONE);
+
+ if (!queryObject)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (context->getState().getActiveQueryId(queryObject->getType()) == id)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch(pname)
+ {
+ case GL_QUERY_RESULT:
+ params[0] = queryObject->getResult();
+ break;
+ case GL_QUERY_RESULT_AVAILABLE:
+ params[0] = queryObject->isResultAvailable();
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -6400,23 +5256,16 @@
{
EVENT("(GLenum target = 0x%X)", target);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION, GL_FALSE);
- }
-
- return glUnmapBufferOES(target);
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+
+ return glUnmapBufferOES(target);
}
return GL_FALSE;
@@ -6426,45 +5275,31 @@
{
EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- glGetBufferPointervOES(target, pname, params);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ glGetBufferPointervOES(target, pname, params);
}
}
void __stdcall glDrawBuffers(GLsizei n, const GLenum* bufs)
{
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- glDrawBuffersEXT(n, bufs);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ glDrawBuffersEXT(n, bufs);
}
}
@@ -6473,24 +5308,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
location, count, transpose, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x3, location, count, transpose))
{
- if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x3, location, count, transpose))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniformMatrix2x3fv(location, count, transpose, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniformMatrix2x3fv(location, count, transpose, value);
}
}
@@ -6499,24 +5327,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
location, count, transpose, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x2, location, count, transpose))
{
- if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x2, location, count, transpose))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniformMatrix3x2fv(location, count, transpose, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniformMatrix3x2fv(location, count, transpose, value);
}
}
@@ -6525,24 +5346,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
location, count, transpose, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x4, location, count, transpose))
{
- if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x4, location, count, transpose))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniformMatrix2x4fv(location, count, transpose, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniformMatrix2x4fv(location, count, transpose, value);
}
}
@@ -6551,24 +5365,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
location, count, transpose, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x2, location, count, transpose))
{
- if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x2, location, count, transpose))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniformMatrix4x2fv(location, count, transpose, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniformMatrix4x2fv(location, count, transpose, value);
}
}
@@ -6577,24 +5384,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
location, count, transpose, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x4, location, count, transpose))
{
- if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x4, location, count, transpose))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniformMatrix3x4fv(location, count, transpose, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniformMatrix3x4fv(location, count, transpose, value);
}
}
@@ -6603,24 +5403,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)",
location, count, transpose, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x3, location, count, transpose))
{
- if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x3, location, count, transpose))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniformMatrix4x3fv(location, count, transpose, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniformMatrix4x3fv(location, count, transpose, value);
}
}
@@ -6630,30 +5423,23 @@
"GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
- dstX0, dstY0, dstX1, dstY1, mask, filter,
- false))
- {
- return;
- }
-
- context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
- mask, filter);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1, mask, filter,
+ false))
+ {
+ return;
+ }
+
+ context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
+ mask, filter);
}
}
@@ -6662,29 +5448,22 @@
EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
target, samples, internalformat, width, height);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat,
- width, height, false))
- {
- return;
- }
-
- context->setRenderbufferStorage(width, height, internalformat, samples);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat,
+ width, height, false))
+ {
+ return;
+ }
+
+ context->setRenderbufferStorage(width, height, internalformat, samples);
}
}
@@ -6693,44 +5472,37 @@
EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)",
target, attachment, texture, level, layer);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (!ValidateFramebufferTextureLayer(context, target, attachment, texture,
+ level, layer))
{
- if (!ValidateFramebufferTextureLayer(context, target, attachment, texture,
- level, layer))
- {
- return;
- }
+ return;
+ }
- gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
- ASSERT(framebuffer);
+ gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
+ ASSERT(framebuffer);
- gl::Texture *textureObject = context->getTexture(texture);
- GLenum textarget = textureObject ? textureObject->getTarget() : GL_NONE;
+ gl::Texture *textureObject = context->getTexture(texture);
+ GLenum textarget = textureObject ? textureObject->getTarget() : GL_NONE;
- if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ {
+ const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+ framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, layer);
+ }
+ else
+ {
+ switch (attachment)
{
- const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
- framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, layer);
- }
- else
- {
- switch (attachment)
- {
- case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, layer); break;
- case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, layer); break;
- case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, layer); break;
- }
+ case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, layer); break;
+ case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, layer); break;
+ case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, layer); break;
}
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
}
GLvoid* __stdcall glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
@@ -6738,23 +5510,16 @@
EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)",
target, offset, length, access);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
- }
-
- return glMapBufferRangeEXT(target, offset, length, access);
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLvoid*>(NULL));
+
+ return glMapBufferRangeEXT(target, offset, length, access);
}
return NULL;
@@ -6764,23 +5529,16 @@
{
EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- glFlushMappedBufferRangeEXT(target, offset, length);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ glFlushMappedBufferRangeEXT(target, offset, length);
}
}
@@ -6788,32 +5546,25 @@
{
EVENT("(GLuint array = %u)", array);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::VertexArray *vao = context->getVertexArray(array);
-
- if (!vao)
- {
- // The default VAO should always exist
- ASSERT(array != 0);
- return gl::error(GL_INVALID_OPERATION);
- }
-
- context->bindVertexArray(array);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::VertexArray *vao = context->getVertexArray(array);
+
+ if (!vao)
+ {
+ // The default VAO should always exist
+ ASSERT(array != 0);
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->bindVertexArray(array);
}
}
@@ -6821,66 +5572,52 @@
{
EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_OPERATION);
+ }
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
- for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
+ for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
+ {
+ if (arrays[arrayIndex] != 0)
{
- if (arrays[arrayIndex] != 0)
- {
- context->deleteVertexArray(arrays[arrayIndex]);
- }
+ context->deleteVertexArray(arrays[arrayIndex]);
}
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
}
void __stdcall glGenVertexArrays(GLsizei n, GLuint* arrays)
{
EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (n < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
- {
- arrays[arrayIndex] = context->createVertexArray();
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (n < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
+ {
+ arrays[arrayIndex] = context->createVertexArray();
+ }
}
}
@@ -6888,30 +5625,23 @@
{
EVENT("(GLuint array = %u)", array);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION, GL_FALSE);
- }
-
- if (array == 0)
- {
- return GL_FALSE;
- }
-
- gl::VertexArray *vao = context->getVertexArray(array);
-
- return (vao != NULL ? GL_TRUE : GL_FALSE);
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+
+ if (array == 0)
+ {
+ return GL_FALSE;
+ }
+
+ gl::VertexArray *vao = context->getVertexArray(array);
+
+ return (vao != NULL ? GL_TRUE : GL_FALSE);
}
return GL_FALSE;
@@ -6922,120 +5652,106 @@
EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)",
target, index, data);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_OPERATION);
+ }
- switch (target)
- {
- case GL_TRANSFORM_FEEDBACK_BUFFER_START:
- case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
- case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
- if (index >= context->getMaxTransformFeedbackBufferBindings())
- return gl::error(GL_INVALID_VALUE);
- break;
- case GL_UNIFORM_BUFFER_START:
- case GL_UNIFORM_BUFFER_SIZE:
- case GL_UNIFORM_BUFFER_BINDING:
- if (index >= context->getMaximumCombinedUniformBufferBindings())
- return gl::error(GL_INVALID_VALUE);
- break;
- default:
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ if (index >= context->getMaxTransformFeedbackBufferBindings())
+ return gl::error(GL_INVALID_VALUE);
+ break;
+ case GL_UNIFORM_BUFFER_START:
+ case GL_UNIFORM_BUFFER_SIZE:
+ case GL_UNIFORM_BUFFER_BINDING:
+ if (index >= context->getMaximumCombinedUniformBufferBindings())
+ return gl::error(GL_INVALID_VALUE);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (!(context->getIndexedIntegerv(target, index, data)))
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams))
return gl::error(GL_INVALID_ENUM);
- }
- if (!(context->getIndexedIntegerv(target, index, data)))
+ if (numParams == 0)
+ return; // it is known that pname is valid, but there are no parameters to return
+
+ if (nativeType == GL_INT_64_ANGLEX)
{
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams))
- return gl::error(GL_INVALID_ENUM);
+ GLint64 minIntValue = static_cast<GLint64>(std::numeric_limits<int>::min());
+ GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<int>::max());
+ GLint64 *int64Params = new GLint64[numParams];
- if (numParams == 0)
- return; // it is known that pname is valid, but there are no parameters to return
+ context->getIndexedInteger64v(target, index, int64Params);
- if (nativeType == GL_INT_64_ANGLEX)
+ for (unsigned int i = 0; i < numParams; ++i)
{
- GLint64 minIntValue = static_cast<GLint64>(std::numeric_limits<int>::min());
- GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<int>::max());
- GLint64 *int64Params = new GLint64[numParams];
-
- context->getIndexedInteger64v(target, index, int64Params);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue);
- data[i] = static_cast<GLint>(clampedValue);
- }
-
- delete [] int64Params;
+ GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue);
+ data[i] = static_cast<GLint>(clampedValue);
}
- else
- {
- UNREACHABLE();
- }
+
+ delete [] int64Params;
+ }
+ else
+ {
+ UNREACHABLE();
}
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
}
void __stdcall glBeginTransformFeedback(GLenum primitiveMode)
{
EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (primitiveMode)
- {
- case GL_TRIANGLES:
- case GL_LINES:
- case GL_POINTS:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
- ASSERT(transformFeedback != NULL);
-
- if (transformFeedback->isStarted())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (transformFeedback->isPaused())
- {
- transformFeedback->resume();
- }
- else
- {
- transformFeedback->start(primitiveMode);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (primitiveMode)
+ {
+ case GL_TRIANGLES:
+ case GL_LINES:
+ case GL_POINTS:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
+
+ if (transformFeedback->isStarted())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (transformFeedback->isPaused())
+ {
+ transformFeedback->resume();
+ }
+ else
+ {
+ transformFeedback->start(primitiveMode);
+ }
}
}
@@ -7043,31 +5759,24 @@
{
EVENT("(void)");
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
- ASSERT(transformFeedback != NULL);
-
- if (!transformFeedback->isStarted())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- transformFeedback->stop();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
+
+ if (!transformFeedback->isStarted())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ transformFeedback->stop();
}
}
@@ -7076,77 +5785,70 @@
EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)",
target, index, buffer, offset, size);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ if (index >= context->getMaxTransformFeedbackBufferBindings())
{
- return gl::error(GL_INVALID_OPERATION);
+ return gl::error(GL_INVALID_VALUE);
}
+ break;
- switch (target)
+ case GL_UNIFORM_BUFFER:
+ if (index >= context->getMaximumCombinedUniformBufferBindings())
{
- case GL_TRANSFORM_FEEDBACK_BUFFER:
- if (index >= context->getMaxTransformFeedbackBufferBindings())
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
-
- case GL_UNIFORM_BUFFER:
- if (index >= context->getMaximumCombinedUniformBufferBindings())
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
+ return gl::error(GL_INVALID_VALUE);
}
+ break;
- if (buffer != 0 && size <= 0)
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (buffer != 0 && size <= 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+
+ // size and offset must be a multiple of 4
+ if (buffer != 0 && ((offset % 4) != 0 || (size % 4) != 0))
{
return gl::error(GL_INVALID_VALUE);
}
- switch (target)
+ context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size);
+ context->bindGenericTransformFeedbackBuffer(buffer);
+ break;
+
+ case GL_UNIFORM_BUFFER:
+
+ // it is an error to bind an offset not a multiple of the alignment
+ if (buffer != 0 && (offset % context->getUniformBufferOffsetAlignment()) != 0)
{
- case GL_TRANSFORM_FEEDBACK_BUFFER:
-
- // size and offset must be a multiple of 4
- if (buffer != 0 && ((offset % 4) != 0 || (size % 4) != 0))
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size);
- context->bindGenericTransformFeedbackBuffer(buffer);
- break;
-
- case GL_UNIFORM_BUFFER:
-
- // it is an error to bind an offset not a multiple of the alignment
- if (buffer != 0 && (offset % context->getUniformBufferOffsetAlignment()) != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- context->bindIndexedUniformBuffer(buffer, index, offset, size);
- context->bindGenericUniformBuffer(buffer);
- break;
-
- default:
- UNREACHABLE();
+ return gl::error(GL_INVALID_VALUE);
}
+
+ context->bindIndexedUniformBuffer(buffer, index, offset, size);
+ context->bindGenericUniformBuffer(buffer);
+ break;
+
+ default:
+ UNREACHABLE();
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
}
void __stdcall glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
@@ -7154,57 +5856,50 @@
EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)",
target, index, buffer);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (target)
- {
- case GL_TRANSFORM_FEEDBACK_BUFFER:
- if (index >= context->getMaxTransformFeedbackBufferBindings())
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
-
- case GL_UNIFORM_BUFFER:
- if (index >= context->getMaximumCombinedUniformBufferBindings())
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- switch (target)
- {
- case GL_TRANSFORM_FEEDBACK_BUFFER:
- context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0);
- context->bindGenericTransformFeedbackBuffer(buffer);
- break;
-
- case GL_UNIFORM_BUFFER:
- context->bindIndexedUniformBuffer(buffer, index, 0, 0);
- context->bindGenericUniformBuffer(buffer);
- break;
-
- default:
- UNREACHABLE();
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ if (index >= context->getMaxTransformFeedbackBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+
+ case GL_UNIFORM_BUFFER:
+ if (index >= context->getMaximumCombinedUniformBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0);
+ context->bindGenericTransformFeedbackBuffer(buffer);
+ break;
+
+ case GL_UNIFORM_BUFFER:
+ context->bindIndexedUniformBuffer(buffer, index, 0, 0);
+ context->bindGenericUniformBuffer(buffer);
+ break;
+
+ default:
+ UNREACHABLE();
+ }
}
}
@@ -7213,50 +5908,43 @@
EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)",
program, count, varyings, bufferMode);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_OPERATION);
+ }
- if (count < 0)
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (bufferMode)
+ {
+ case GL_INTERLEAVED_ATTRIBS:
+ break;
+ case GL_SEPARATE_ATTRIBS:
+ if (static_cast<GLuint>(count) > context->getMaxTransformFeedbackBufferBindings())
{
return gl::error(GL_INVALID_VALUE);
}
-
- switch (bufferMode)
- {
- case GL_INTERLEAVED_ATTRIBS:
- break;
- case GL_SEPARATE_ATTRIBS:
- if (static_cast<GLuint>(count) > context->getMaxTransformFeedbackBufferBindings())
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (!gl::ValidProgram(context, program))
- {
- return;
- }
-
- gl::Program *programObject = context->getProgram(program);
- ASSERT(programObject);
-
- programObject->setTransformFeedbackVaryings(count, varyings, bufferMode);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!gl::ValidProgram(context, program))
+ {
+ return;
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+ ASSERT(programObject);
+
+ programObject->setTransformFeedbackVaryings(count, varyings, bufferMode);
}
}
@@ -7266,41 +5954,34 @@
"GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)",
program, index, bufSize, length, size, type, name);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (bufSize < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (!gl::ValidProgram(context, program))
- {
- return;
- }
-
- gl::Program *programObject = context->getProgram(program);
- ASSERT(programObject);
-
- if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount()))
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (bufSize < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (!gl::ValidProgram(context, program))
+ {
+ return;
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+ ASSERT(programObject);
+
+ if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount()))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name);
}
}
@@ -7309,71 +5990,64 @@
EVENT("(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)",
index, size, type, stride, pointer);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
+ }
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
- if (size < 1 || size > 4)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ if (size < 1 || size > 4)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
- switch (type)
- {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ switch (type)
+ {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
- if (stride < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ if (stride < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
- if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4)
+ if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (context)
+ {
+ // [OpenGL ES 3.0.2] Section 2.8 page 24:
+ // An INVALID_OPERATION error is generated when a non-zero vertex array object
+ // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
+ // and the pointer argument is not NULL.
+ if (context->getState().getVertexArray()->id() != 0 && context->getState().getArrayBufferId() == 0 && pointer != NULL)
{
return gl::error(GL_INVALID_OPERATION);
}
- if (context)
- {
- // [OpenGL ES 3.0.2] Section 2.8 page 24:
- // An INVALID_OPERATION error is generated when a non-zero vertex array object
- // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
- // and the pointer argument is not NULL.
- if (context->getState().getVertexArray()->id() != 0 && context->getState().getArrayBufferId() == 0 && pointer != NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, false, true,
- stride, pointer);
- }
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, false, true,
+ stride, pointer);
}
}
@@ -7382,46 +6056,39 @@
EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
index, pname, params);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_OPERATION);
+ }
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
- const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index);
+ const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index);
- if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
- {
- return;
- }
+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
+ {
+ return;
+ }
- if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index);
+ for (int i = 0; i < 4; ++i)
{
- const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index);
- for (int i = 0; i < 4; ++i)
- {
- params[i] = currentValueData.IntValues[i];
- }
- }
- else
- {
- *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname);
+ params[i] = currentValueData.IntValues[i];
}
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ else
+ {
+ *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname);
+ }
}
}
@@ -7430,46 +6097,39 @@
EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)",
index, pname, params);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_OPERATION);
+ }
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
- const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index);
+ const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index);
- if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
- {
- return;
- }
+ if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion()))
+ {
+ return;
+ }
- if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index);
+ for (int i = 0; i < 4; ++i)
{
- const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index);
- for (int i = 0; i < 4; ++i)
- {
- params[i] = currentValueData.UnsignedIntValues[i];
- }
- }
- else
- {
- *params = gl::QuerySingleVertexAttributeParameter<GLuint>(attribState, pname);
+ params[i] = currentValueData.UnsignedIntValues[i];
}
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ else
+ {
+ *params = gl::QuerySingleVertexAttributeParameter<GLuint>(attribState, pname);
+ }
}
}
@@ -7478,29 +6138,22 @@
EVENT("(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)",
index, x, y, z, w);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- GLint vals[4] = { x, y, z, w };
- context->getState().setVertexAttribi(index, vals);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ GLint vals[4] = { x, y, z, w };
+ context->getState().setVertexAttribi(index, vals);
}
}
@@ -7509,29 +6162,22 @@
EVENT("(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)",
index, x, y, z, w);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- GLuint vals[4] = { x, y, z, w };
- context->getState().setVertexAttribu(index, vals);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ GLuint vals[4] = { x, y, z, w };
+ context->getState().setVertexAttribu(index, vals);
}
}
@@ -7539,28 +6185,21 @@
{
EVENT("(GLuint index = %u, const GLint* v = 0x%0.8p)", index, v);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- context->getState().setVertexAttribi(index, v);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->getState().setVertexAttribi(index, v);
}
}
@@ -7568,28 +6207,21 @@
{
EVENT("(GLuint index = %u, const GLuint* v = 0x%0.8p)", index, v);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- context->getState().setVertexAttribu(index, v);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->getState().setVertexAttribu(index, v);
}
}
@@ -7598,44 +6230,37 @@
EVENT("(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)",
program, location, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (program == 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject || !programObject->isLinked())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
- if (!programBinary)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!programBinary->getUniformuiv(location, NULL, params))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (program == 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject || !programObject->isLinked())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->getUniformuiv(location, NULL, params))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
}
}
@@ -7644,41 +6269,34 @@
EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)",
program, name);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION, -1);
- }
-
- if (program == 0)
- {
- return gl::error(GL_INVALID_VALUE, -1);
- }
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject || !programObject->isLinked())
- {
- return gl::error(GL_INVALID_OPERATION, -1);
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
- if (!programBinary)
- {
- return gl::error(GL_INVALID_OPERATION, -1);
- }
-
- return programBinary->getFragDataLocation(name);
+ return gl::error(GL_INVALID_OPERATION, -1);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, 0);
+
+ if (program == 0)
+ {
+ return gl::error(GL_INVALID_VALUE, -1);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject || !programObject->isLinked())
+ {
+ return gl::error(GL_INVALID_OPERATION, -1);
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION, -1);
+ }
+
+ return programBinary->getFragDataLocation(name);
}
return 0;
@@ -7712,24 +6330,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)",
location, count, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_UNSIGNED_INT, location, count))
{
- if (!ValidateUniform(context, GL_UNSIGNED_INT, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform1uiv(location, count, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform1uiv(location, count, value);
}
}
@@ -7738,24 +6349,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)",
location, count, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC2, location, count))
{
- if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC2, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform2uiv(location, count, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform2uiv(location, count, value);
}
}
@@ -7764,24 +6368,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value)",
location, count, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC3, location, count))
{
- if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC3, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform3uiv(location, count, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform3uiv(location, count, value);
}
}
@@ -7790,24 +6387,17 @@
EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)",
location, count, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC4, location, count))
{
- if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC4, location, count))
- {
- return;
- }
-
- gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
- programBinary->setUniform4uiv(location, count, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+ programBinary->setUniform4uiv(location, count, value);
}
}
@@ -7816,41 +6406,34 @@
EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)",
buffer, drawbuffer, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateClearBuffer(context))
{
- if (!ValidateClearBuffer(context))
- {
- return;
- }
-
- switch (buffer)
- {
- case GL_COLOR:
- if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- case GL_STENCIL:
- if (drawbuffer != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- context->clearBufferiv(buffer, drawbuffer, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (buffer)
+ {
+ case GL_COLOR:
+ if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ case GL_STENCIL:
+ if (drawbuffer != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ context->clearBufferiv(buffer, drawbuffer, value);
}
}
@@ -7859,35 +6442,28 @@
EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)",
buffer, drawbuffer, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateClearBuffer(context))
{
- if (!ValidateClearBuffer(context))
- {
- return;
- }
-
- switch (buffer)
- {
- case GL_COLOR:
- if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- context->clearBufferuiv(buffer, drawbuffer, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (buffer)
+ {
+ case GL_COLOR:
+ if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ context->clearBufferuiv(buffer, drawbuffer, value);
}
}
@@ -7896,41 +6472,34 @@
EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)",
buffer, drawbuffer, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateClearBuffer(context))
{
- if (!ValidateClearBuffer(context))
- {
- return;
- }
-
- switch (buffer)
- {
- case GL_COLOR:
- if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- case GL_DEPTH:
- if (drawbuffer != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- context->clearBufferfv(buffer, drawbuffer, value);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (buffer)
+ {
+ case GL_COLOR:
+ if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ case GL_DEPTH:
+ if (drawbuffer != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ context->clearBufferfv(buffer, drawbuffer, value);
}
}
@@ -7939,35 +6508,28 @@
EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)",
buffer, drawbuffer, depth, stencil);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateClearBuffer(context))
{
- if (!ValidateClearBuffer(context))
- {
- return;
- }
-
- switch (buffer)
- {
- case GL_DEPTH_STENCIL:
- if (drawbuffer != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- context->clearBufferfi(buffer, drawbuffer, depth, stencil);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (buffer)
+ {
+ case GL_DEPTH_STENCIL:
+ if (drawbuffer != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ context->clearBufferfi(buffer, drawbuffer, depth, stencil);
}
}
@@ -7975,33 +6537,26 @@
{
EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLubyte*>(NULL));
- }
-
- if (name != GL_EXTENSIONS)
- {
- return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLubyte*>(NULL));
- }
-
- if (index >= context->getExtensionStringCount())
- {
- return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLubyte*>(NULL));
- }
-
- return reinterpret_cast<const GLubyte*>(context->getExtensionString(index).c_str());
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLubyte*>(NULL));
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLubyte*>(NULL));
+
+ if (name != GL_EXTENSIONS)
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLubyte*>(NULL));
+ }
+
+ if (index >= context->getExtensionStringCount())
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLubyte*>(NULL));
+ }
+
+ return reinterpret_cast<const GLubyte*>(context->getExtensionString(index).c_str());
}
return NULL;
@@ -8012,59 +6567,52 @@
EVENT("(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)",
readTarget, writeTarget, readOffset, writeOffset, size);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!gl::ValidBufferTarget(context, readTarget) || !gl::ValidBufferTarget(context, readTarget))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Buffer *readBuffer = context->getState().getTargetBuffer(readTarget);
- gl::Buffer *writeBuffer = context->getState().getTargetBuffer(writeTarget);
-
- if (!readBuffer || !writeBuffer)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (readBuffer->isMapped() || writeBuffer->isMapped())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (readOffset < 0 || writeOffset < 0 || size < 0 ||
- static_cast<unsigned int>(readOffset + size) > readBuffer->getSize() ||
- static_cast<unsigned int>(writeOffset + size) > writeBuffer->getSize())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (readBuffer == writeBuffer && abs(readOffset - writeOffset) < size)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- // TODO: Verify that readBuffer and writeBuffer are not currently mapped (GL_INVALID_OPERATION)
-
- // if size is zero, the copy is a successful no-op
- if (size > 0)
- {
- writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!gl::ValidBufferTarget(context, readTarget) || !gl::ValidBufferTarget(context, readTarget))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Buffer *readBuffer = context->getState().getTargetBuffer(readTarget);
+ gl::Buffer *writeBuffer = context->getState().getTargetBuffer(writeTarget);
+
+ if (!readBuffer || !writeBuffer)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (readBuffer->isMapped() || writeBuffer->isMapped())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (readOffset < 0 || writeOffset < 0 || size < 0 ||
+ static_cast<unsigned int>(readOffset + size) > readBuffer->getSize() ||
+ static_cast<unsigned int>(writeOffset + size) > writeBuffer->getSize())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (readBuffer == writeBuffer && abs(readOffset - writeOffset) < size)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ // TODO: Verify that readBuffer and writeBuffer are not currently mapped (GL_INVALID_OPERATION)
+
+ // if size is zero, the copy is a successful no-op
+ if (size > 0)
+ {
+ writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size);
+ }
}
}
@@ -8073,56 +6621,49 @@
EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)",
program, uniformCount, uniformNames, uniformIndices);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (uniformCount < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
{
return gl::error(GL_INVALID_OPERATION);
}
-
- if (uniformCount < 0)
+ else
{
return gl::error(GL_INVALID_VALUE);
}
+ }
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programObject->isLinked() || !programBinary)
+ {
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
{
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
- if (!programObject->isLinked() || !programBinary)
- {
- for (int uniformId = 0; uniformId < uniformCount; uniformId++)
- {
- uniformIndices[uniformId] = GL_INVALID_INDEX;
- }
- }
- else
- {
- for (int uniformId = 0; uniformId < uniformCount; uniformId++)
- {
- uniformIndices[uniformId] = programBinary->getUniformIndex(uniformNames[uniformId]);
- }
+ uniformIndices[uniformId] = GL_INVALID_INDEX;
}
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ else
+ {
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ uniformIndices[uniformId] = programBinary->getUniformIndex(uniformNames[uniformId]);
+ }
+ }
}
}
@@ -8131,78 +6672,71 @@
EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
program, uniformCount, uniformIndices, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (uniformCount < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
{
return gl::error(GL_INVALID_OPERATION);
}
-
- if (uniformCount < 0)
+ else
{
return gl::error(GL_INVALID_VALUE);
}
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- switch (pname)
- {
- case GL_UNIFORM_TYPE:
- case GL_UNIFORM_SIZE:
- case GL_UNIFORM_NAME_LENGTH:
- case GL_UNIFORM_BLOCK_INDEX:
- case GL_UNIFORM_OFFSET:
- case GL_UNIFORM_ARRAY_STRIDE:
- case GL_UNIFORM_MATRIX_STRIDE:
- case GL_UNIFORM_IS_ROW_MAJOR:
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-
- if (!programBinary && uniformCount > 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- for (int uniformId = 0; uniformId < uniformCount; uniformId++)
- {
- const GLuint index = uniformIndices[uniformId];
-
- if (index >= (GLuint)programBinary->getActiveUniformCount())
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- for (int uniformId = 0; uniformId < uniformCount; uniformId++)
- {
- const GLuint index = uniformIndices[uniformId];
- params[uniformId] = programBinary->getActiveUniformi(index, pname);
- }
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (pname)
+ {
+ case GL_UNIFORM_TYPE:
+ case GL_UNIFORM_SIZE:
+ case GL_UNIFORM_NAME_LENGTH:
+ case GL_UNIFORM_BLOCK_INDEX:
+ case GL_UNIFORM_OFFSET:
+ case GL_UNIFORM_ARRAY_STRIDE:
+ case GL_UNIFORM_MATRIX_STRIDE:
+ case GL_UNIFORM_IS_ROW_MAJOR:
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ if (!programBinary && uniformCount > 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ const GLuint index = uniformIndices[uniformId];
+
+ if (index >= (GLuint)programBinary->getActiveUniformCount())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+ }
+
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ const GLuint index = uniformIndices[uniformId];
+ params[uniformId] = programBinary->getActiveUniformi(index, pname);
+ }
}
}
@@ -8210,43 +6744,36 @@
{
EVENT("(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)", program, uniformBlockName);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
+ return gl::error(GL_INVALID_OPERATION, GL_INVALID_INDEX);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
{
return gl::error(GL_INVALID_OPERATION, GL_INVALID_INDEX);
}
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
+ else
{
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION, GL_INVALID_INDEX);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE, GL_INVALID_INDEX);
- }
+ return gl::error(GL_INVALID_VALUE, GL_INVALID_INDEX);
}
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
- if (!programBinary)
- {
- return GL_INVALID_INDEX;
- }
-
- return programBinary->getUniformBlockIndex(uniformBlockName);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, 0);
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+ if (!programBinary)
+ {
+ return GL_INVALID_INDEX;
+ }
+
+ return programBinary->getUniformBlockIndex(uniformBlockName);
}
return 0;
@@ -8257,60 +6784,53 @@
EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
program, uniformBlockIndex, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
{
return gl::error(GL_INVALID_OPERATION);
}
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-
- if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
+ else
{
return gl::error(GL_INVALID_VALUE);
}
-
- switch (pname)
- {
- case GL_UNIFORM_BLOCK_BINDING:
- *params = static_cast<GLint>(programObject->getUniformBlockBinding(uniformBlockIndex));
- break;
-
- case GL_UNIFORM_BLOCK_DATA_SIZE:
- case GL_UNIFORM_BLOCK_NAME_LENGTH:
- case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
- case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
- case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
- case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
- programBinary->getActiveUniformBlockiv(uniformBlockIndex, pname, params);
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (pname)
+ {
+ case GL_UNIFORM_BLOCK_BINDING:
+ *params = static_cast<GLint>(programObject->getUniformBlockBinding(uniformBlockIndex));
+ break;
+
+ case GL_UNIFORM_BLOCK_DATA_SIZE:
+ case GL_UNIFORM_BLOCK_NAME_LENGTH:
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
+ programBinary->getActiveUniformBlockiv(uniformBlockIndex, pname, params);
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -8319,44 +6839,37 @@
EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)",
program, uniformBlockIndex, bufSize, length, uniformBlockName);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
{
return gl::error(GL_INVALID_OPERATION);
}
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-
- if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
+ else
{
return gl::error(GL_INVALID_VALUE);
}
-
- programBinary->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ programBinary->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName);
}
}
@@ -8365,50 +6878,43 @@
EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)",
program, uniformBlockIndex, uniformBlockBinding);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (uniformBlockBinding >= context->getMaximumCombinedUniformBufferBindings())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ if (context->getShader(program))
{
return gl::error(GL_INVALID_OPERATION);
}
-
- if (uniformBlockBinding >= context->getMaximumCombinedUniformBufferBindings())
+ else
{
return gl::error(GL_INVALID_VALUE);
}
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- if (context->getShader(program))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- else
- {
- return gl::error(GL_INVALID_VALUE);
- }
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-
- // if never linked, there won't be any uniform blocks
- if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ // if never linked, there won't be any uniform blocks
+ if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding);
}
}
@@ -8417,24 +6923,17 @@
EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)",
mode, first, count, instanceCount);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // glDrawArraysInstanced
- UNIMPLEMENTED();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ // glDrawArraysInstanced
+ UNIMPLEMENTED();
}
}
@@ -8443,24 +6942,17 @@
EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)",
mode, count, type, indices, instanceCount);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // glDrawElementsInstanced
- UNIMPLEMENTED();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ // glDrawElementsInstanced
+ UNIMPLEMENTED();
}
}
@@ -8468,33 +6960,26 @@
{
EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLsync>(0));
- }
-
- if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE)
- {
- return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLsync>(0));
- }
-
- if (flags != 0)
- {
- return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLsync>(0));
- }
-
- return context->createFenceSync(condition);
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLsync>(0));
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLsync>(NULL));
+
+ if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE)
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLsync>(0));
+ }
+
+ if (flags != 0)
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLsync>(0));
+ }
+
+ return context->createFenceSync(condition);
}
return NULL;
@@ -8504,23 +6989,16 @@
{
EVENT("(GLsync sync = 0x%0.8p)", sync);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION, GL_FALSE);
- }
-
- return (context->getFenceSync(sync) != NULL);
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+
+ return (context->getFenceSync(sync) != NULL);
}
return GL_FALSE;
@@ -8530,28 +7008,21 @@
{
EVENT("(GLsync sync = 0x%0.8p)", sync);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (sync != static_cast<GLsync>(0) && !context->getFenceSync(sync))
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- context->deleteFenceSync(sync);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (sync != static_cast<GLsync>(0) && !context->getFenceSync(sync))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->deleteFenceSync(sync);
}
}
@@ -8560,35 +7031,28 @@
EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)",
sync, flags, timeout);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION, GL_WAIT_FAILED);
- }
-
- if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0)
- {
- return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED);
- }
-
- gl::FenceSync *fenceSync = context->getFenceSync(sync);
-
- if (!fenceSync)
- {
- return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED);
- }
-
- return fenceSync->clientWait(flags, timeout);
+ return gl::error(GL_INVALID_OPERATION, GL_WAIT_FAILED);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+
+ if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0)
+ {
+ return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED);
+ }
+
+ gl::FenceSync *fenceSync = context->getFenceSync(sync);
+
+ if (!fenceSync)
+ {
+ return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED);
+ }
+
+ return fenceSync->clientWait(flags, timeout);
}
return GL_FALSE;
@@ -8599,40 +7063,33 @@
EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)",
sync, flags, timeout);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (flags != 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (timeout != GL_TIMEOUT_IGNORED)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::FenceSync *fenceSync = context->getFenceSync(sync);
-
- if (!fenceSync)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- fenceSync->serverWait();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (flags != 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (timeout != GL_TIMEOUT_IGNORED)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::FenceSync *fenceSync = context->getFenceSync(sync);
+
+ if (!fenceSync)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ fenceSync->serverWait();
}
}
@@ -8641,37 +7098,30 @@
EVENT("(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)",
pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
- {
- return;
- }
-
- if (nativeType == GL_INT_64_ANGLEX)
- {
- context->getInteger64v(pname, params);
- }
- else
- {
- CastStateValues(context, nativeType, pname, numParams, params);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
+ {
+ return;
+ }
+
+ if (nativeType == GL_INT_64_ANGLEX)
+ {
+ context->getInteger64v(pname, params);
+ }
+ else
+ {
+ CastStateValues(context, nativeType, pname, numParams, params);
+ }
}
}
@@ -8680,44 +7130,37 @@
EVENT("(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)",
sync, pname, bufSize, length, values);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (bufSize < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::FenceSync *fenceSync = context->getFenceSync(sync);
-
- if (!fenceSync)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- switch (pname)
- {
- case GL_OBJECT_TYPE: values[0] = static_cast<GLint>(GL_SYNC_FENCE); break;
- case GL_SYNC_STATUS: values[0] = static_cast<GLint>(fenceSync->getStatus()); break;
- case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break;
- case GL_SYNC_FLAGS: values[0] = 0; break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (bufSize < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ gl::FenceSync *fenceSync = context->getFenceSync(sync);
+
+ if (!fenceSync)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (pname)
+ {
+ case GL_OBJECT_TYPE: values[0] = static_cast<GLint>(GL_SYNC_FENCE); break;
+ case GL_SYNC_STATUS: values[0] = static_cast<GLint>(fenceSync->getStatus()); break;
+ case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break;
+ case GL_SYNC_FLAGS: values[0] = 0; break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -8726,69 +7169,62 @@
EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)",
target, index, data);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
+ return gl::error(GL_INVALID_OPERATION);
+ }
- switch (target)
- {
- case GL_TRANSFORM_FEEDBACK_BUFFER_START:
- case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
- case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
- if (index >= context->getMaxTransformFeedbackBufferBindings())
- return gl::error(GL_INVALID_VALUE);
- break;
- case GL_UNIFORM_BUFFER_START:
- case GL_UNIFORM_BUFFER_SIZE:
- case GL_UNIFORM_BUFFER_BINDING:
- if (index >= context->getMaximumCombinedUniformBufferBindings())
- return gl::error(GL_INVALID_VALUE);
- break;
- default:
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ if (index >= context->getMaxTransformFeedbackBufferBindings())
+ return gl::error(GL_INVALID_VALUE);
+ break;
+ case GL_UNIFORM_BUFFER_START:
+ case GL_UNIFORM_BUFFER_SIZE:
+ case GL_UNIFORM_BUFFER_BINDING:
+ if (index >= context->getMaximumCombinedUniformBufferBindings())
+ return gl::error(GL_INVALID_VALUE);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (!(context->getIndexedInteger64v(target, index, data)))
+ {
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams))
return gl::error(GL_INVALID_ENUM);
- }
- if (!(context->getIndexedInteger64v(target, index, data)))
+ if (numParams == 0)
+ return; // it is known that pname is valid, but there are no parameters to return
+
+ if (nativeType == GL_INT)
{
- GLenum nativeType;
- unsigned int numParams = 0;
- if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams))
- return gl::error(GL_INVALID_ENUM);
+ GLint *intParams = new GLint[numParams];
- if (numParams == 0)
- return; // it is known that pname is valid, but there are no parameters to return
+ context->getIndexedIntegerv(target, index, intParams);
- if (nativeType == GL_INT)
+ for (unsigned int i = 0; i < numParams; ++i)
{
- GLint *intParams = new GLint[numParams];
-
- context->getIndexedIntegerv(target, index, intParams);
-
- for (unsigned int i = 0; i < numParams; ++i)
- {
- data[i] = static_cast<GLint64>(intParams[i]);
- }
-
- delete [] intParams;
+ data[i] = static_cast<GLint64>(intParams[i]);
}
- else
- {
- UNREACHABLE();
- }
+
+ delete [] intParams;
+ }
+ else
+ {
+ UNREACHABLE();
}
}
}
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
}
void __stdcall glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
@@ -8796,62 +7232,55 @@
EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)",
target, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!gl::ValidBufferTarget(context, target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (!gl::ValidBufferParameter(context, pname))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Buffer *buffer = context->getState().getTargetBuffer(target);
-
- if (!buffer)
- {
- // A null buffer means that "0" is bound to the requested buffer target
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (pname)
- {
- case GL_BUFFER_USAGE:
- *params = static_cast<GLint64>(buffer->getUsage());
- break;
- case GL_BUFFER_SIZE:
- *params = buffer->getSize();
- break;
- case GL_BUFFER_ACCESS_FLAGS:
- *params = static_cast<GLint64>(buffer->getAccessFlags());
- break;
- case GL_BUFFER_MAPPED:
- *params = static_cast<GLint64>(buffer->isMapped());
- break;
- case GL_BUFFER_MAP_OFFSET:
- *params = buffer->getMapOffset();
- break;
- case GL_BUFFER_MAP_LENGTH:
- *params = buffer->getMapLength();
- break;
- default: UNREACHABLE(); break;
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (!gl::ValidBufferParameter(context, pname))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (!buffer)
+ {
+ // A null buffer means that "0" is bound to the requested buffer target
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ switch (pname)
+ {
+ case GL_BUFFER_USAGE:
+ *params = static_cast<GLint64>(buffer->getUsage());
+ break;
+ case GL_BUFFER_SIZE:
+ *params = buffer->getSize();
+ break;
+ case GL_BUFFER_ACCESS_FLAGS:
+ *params = static_cast<GLint64>(buffer->getAccessFlags());
+ break;
+ case GL_BUFFER_MAPPED:
+ *params = static_cast<GLint64>(buffer->isMapped());
+ break;
+ case GL_BUFFER_MAP_OFFSET:
+ *params = buffer->getMapOffset();
+ break;
+ case GL_BUFFER_MAP_LENGTH:
+ *params = buffer->getMapLength();
+ break;
+ default: UNREACHABLE(); break;
+ }
}
}
@@ -8859,31 +7288,24 @@
{
EVENT("(GLsizei count = %d, GLuint* samplers = 0x%0.8p)", count, samplers);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (count < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- for (int i = 0; i < count; i++)
- {
- samplers[i] = context->createSampler();
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ samplers[i] = context->createSampler();
+ }
}
}
@@ -8891,31 +7313,24 @@
{
EVENT("(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)", count, samplers);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (count < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- for (int i = 0; i < count; i++)
- {
- context->deleteSampler(samplers[i]);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (count < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ context->deleteSampler(samplers[i]);
+ }
}
}
@@ -8923,23 +7338,16 @@
{
EVENT("(GLuint sampler = %u)", sampler);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION, GL_FALSE);
- }
-
- return context->isSampler(sampler);
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+
+ return context->isSampler(sampler);
}
return GL_FALSE;
@@ -8949,33 +7357,26 @@
{
EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (sampler != 0 && !context->isSampler(sampler))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (unit >= context->getMaximumCombinedTextureImageUnits())
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- context->bindSampler(unit, sampler);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (sampler != 0 && !context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (unit >= context->getMaximumCombinedTextureImageUnits())
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ context->bindSampler(unit, sampler);
}
}
@@ -8983,38 +7384,31 @@
{
EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!gl::ValidateSamplerObjectParameter(pname))
- {
- return;
- }
-
- if (!gl::ValidateTexParamParameters(context, pname, param))
- {
- return;
- }
-
- if (!context->isSampler(sampler))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- context->samplerParameteri(sampler, pname, param);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!gl::ValidateTexParamParameters(context, pname, param))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->samplerParameteri(sampler, pname, param);
}
}
@@ -9027,38 +7421,31 @@
{
EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)", sampler, pname, param);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!gl::ValidateSamplerObjectParameter(pname))
- {
- return;
- }
-
- if (!gl::ValidateTexParamParameters(context, pname, static_cast<GLint>(param)))
- {
- return;
- }
-
- if (!context->isSampler(sampler))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- context->samplerParameterf(sampler, pname, param);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!gl::ValidateTexParamParameters(context, pname, static_cast<GLint>(param)))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->samplerParameterf(sampler, pname, param);
}
}
@@ -9071,33 +7458,26 @@
{
EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!gl::ValidateSamplerObjectParameter(pname))
- {
- return;
- }
-
- if (!context->isSampler(sampler))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- *params = context->getSamplerParameteri(sampler, pname);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ *params = context->getSamplerParameteri(sampler, pname);
}
}
@@ -9105,33 +7485,26 @@
{
EVENT("(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", sampler, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!gl::ValidateSamplerObjectParameter(pname))
- {
- return;
- }
-
- if (!context->isSampler(sampler))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- *params = context->getSamplerParameterf(sampler, pname);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!gl::ValidateSamplerObjectParameter(pname))
+ {
+ return;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ *params = context->getSamplerParameterf(sampler, pname);
}
}
@@ -9139,28 +7512,21 @@
{
EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
- ANGLE_TRY
+ if (index >= gl::MAX_VERTEX_ATTRIBS)
{
- if (index >= gl::MAX_VERTEX_ATTRIBS)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
- {
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- context->setVertexAttribDivisor(index, divisor);
- }
+ return gl::error(GL_INVALID_VALUE);
}
- ANGLE_CATCH_ALL
+
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- return gl::error(GL_OUT_OF_MEMORY);
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->setVertexAttribDivisor(index, divisor);
}
}
@@ -9168,46 +7534,39 @@
{
EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- switch (target)
- {
- case GL_TRANSFORM_FEEDBACK:
- {
- // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1)
- gl::TransformFeedback *curTransformFeedback = context->getState().getCurrentTransformFeedback();
- if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1)
- if (context->getTransformFeedback(id) == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- context->bindTransformFeedback(id);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK:
+ {
+ // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1)
+ gl::TransformFeedback *curTransformFeedback = context->getState().getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1)
+ if (context->getTransformFeedback(id) == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->bindTransformFeedback(id);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -9215,26 +7574,19 @@
{
EVENT("(GLsizei n = %d, const GLuint* ids = 0x%0.8p)", n, ids);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- for (int i = 0; i < n; i++)
- {
- context->deleteTransformFeedback(ids[i]);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ for (int i = 0; i < n; i++)
+ {
+ context->deleteTransformFeedback(ids[i]);
+ }
}
}
@@ -9242,26 +7594,19 @@
{
EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- for (int i = 0; i < n; i++)
- {
- ids[i] = context->createTransformFeedback();
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ for (int i = 0; i < n; i++)
+ {
+ ids[i] = context->createTransformFeedback();
+ }
}
}
@@ -9269,23 +7614,16 @@
{
EVENT("(GLuint id = %u)", id);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION, GL_FALSE);
- }
-
- return ((context->getTransformFeedback(id) != NULL) ? GL_TRUE : GL_FALSE);
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+
+ return ((context->getTransformFeedback(id) != NULL) ? GL_TRUE : GL_FALSE);
}
return GL_FALSE;
@@ -9295,32 +7633,25 @@
{
EVENT("(void)");
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
- ASSERT(transformFeedback != NULL);
-
- // Current transform feedback must be started and not paused in order to pause (3.0.2 pg 86)
- if (!transformFeedback->isStarted() || transformFeedback->isPaused())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- transformFeedback->pause();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
+
+ // Current transform feedback must be started and not paused in order to pause (3.0.2 pg 86)
+ if (!transformFeedback->isStarted() || transformFeedback->isPaused())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ transformFeedback->pause();
}
}
@@ -9328,32 +7659,25 @@
{
EVENT("(void)");
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
- ASSERT(transformFeedback != NULL);
-
- // Current transform feedback must be started and paused in order to resume (3.0.2 pg 86)
- if (!transformFeedback->isStarted() || !transformFeedback->isPaused())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- transformFeedback->resume();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
+ ASSERT(transformFeedback != NULL);
+
+ // Current transform feedback must be started and paused in order to resume (3.0.2 pg 86)
+ if (!transformFeedback->isStarted() || !transformFeedback->isPaused())
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ transformFeedback->resume();
}
}
@@ -9362,24 +7686,17 @@
EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)",
program, bufSize, length, binaryFormat, binary);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // glGetProgramBinary
- UNIMPLEMENTED();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ // glGetProgramBinary
+ UNIMPLEMENTED();
}
}
@@ -9388,24 +7705,17 @@
EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)",
program, binaryFormat, binary, length);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // glProgramBinary
- UNIMPLEMENTED();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ // glProgramBinary
+ UNIMPLEMENTED();
}
}
@@ -9414,24 +7724,17 @@
EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)",
program, pname, value);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // glProgramParameteri
- UNIMPLEMENTED();
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ // glProgramParameteri
+ UNIMPLEMENTED();
}
}
@@ -9440,29 +7743,22 @@
EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p)",
target, numAttachments, attachments);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
- {
- return;
- }
-
- GLuint maxDimension = context->getCaps().maxRenderbufferSize;
- context->invalidateFrameBuffer(target, numAttachments, attachments, 0, 0, maxDimension, maxDimension);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
+ {
+ return;
+ }
+
+ GLuint maxDimension = context->getCaps().maxRenderbufferSize;
+ context->invalidateFrameBuffer(target, numAttachments, attachments, 0, 0, maxDimension, maxDimension);
}
}
@@ -9472,28 +7768,21 @@
"GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
target, numAttachments, attachments, x, y, width, height);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
- {
- return;
- }
-
- context->invalidateFrameBuffer(target, numAttachments, attachments, x, y, width, height);
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
+ {
+ return;
+ }
+
+ context->invalidateFrameBuffer(target, numAttachments, attachments, x, y, width, height);
}
}
@@ -9502,46 +7791,39 @@
EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
target, levels, internalformat, width, height);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1))
- {
- return;
- }
-
- switch (target)
- {
- case GL_TEXTURE_2D:
- {
- gl::Texture2D *texture2d = context->getTexture2D();
- texture2d->storage(levels, internalformat, width, height);
- }
- break;
-
- case GL_TEXTURE_CUBE_MAP:
- {
- gl::TextureCubeMap *textureCube = context->getTextureCubeMap();
- textureCube->storage(levels, internalformat, width);
- }
- break;
-
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1))
+ {
+ return;
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_2D:
+ {
+ gl::Texture2D *texture2d = context->getTexture2D();
+ texture2d->storage(levels, internalformat, width, height);
+ }
+ break;
+
+ case GL_TEXTURE_CUBE_MAP:
+ {
+ gl::TextureCubeMap *textureCube = context->getTextureCubeMap();
+ textureCube->storage(levels, internalformat, width);
+ }
+ break;
+
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -9551,46 +7833,39 @@
"GLsizei height = %d, GLsizei depth = %d)",
target, levels, internalformat, width, height, depth);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, depth))
- {
- return;
- }
-
- switch (target)
- {
- case GL_TEXTURE_3D:
- {
- gl::Texture3D *texture3d = context->getTexture3D();
- texture3d->storage(levels, internalformat, width, height, depth);
- }
- break;
-
- case GL_TEXTURE_2D_ARRAY:
- {
- gl::Texture2DArray *texture2darray = context->getTexture2DArray();
- texture2darray->storage(levels, internalformat, width, height, depth);
- }
- break;
-
- default:
- UNREACHABLE();
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, depth))
+ {
+ return;
+ }
+
+ switch (target)
+ {
+ case GL_TEXTURE_3D:
+ {
+ gl::Texture3D *texture3d = context->getTexture3D();
+ texture3d->storage(levels, internalformat, width, height, depth);
+ }
+ break;
+
+ case GL_TEXTURE_2D_ARRAY:
+ {
+ gl::Texture2DArray *texture2darray = context->getTexture2DArray();
+ texture2darray->storage(levels, internalformat, width, height, depth);
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ }
}
}
@@ -9600,50 +7875,43 @@
"GLint* params = 0x%0.8p)",
target, internalformat, pname, bufSize, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (context->getClientVersion() < 3)
{
- if (context->getClientVersion() < 3)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
- if (!formatCaps.renderable)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (target != GL_RENDERBUFFER)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (bufSize < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- switch (pname)
- {
- case GL_NUM_SAMPLE_COUNTS:
- if (bufSize != 0)
- *params = context->getNumSampleCounts(internalformat);
- break;
- case GL_SAMPLES:
- context->getSampleCounts(internalformat, bufSize, params);
- break;
- default:
- return gl::error(GL_INVALID_ENUM);
- }
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
+ if (!formatCaps.renderable)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (target != GL_RENDERBUFFER)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ if (bufSize < 0)
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ switch (pname)
+ {
+ case GL_NUM_SAMPLE_COUNTS:
+ if (bufSize != 0)
+ *params = context->getNumSampleCounts(internalformat);
+ break;
+ case GL_SAMPLES:
+ context->getSampleCounts(internalformat, bufSize, params);
+ break;
+ default:
+ return gl::error(GL_INVALID_ENUM);
+ }
}
}
@@ -9657,26 +7925,19 @@
"GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1, mask, filter,
+ true))
{
- if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
- dstX0, dstY0, dstX1, dstY1, mask, filter,
- true))
- {
- return;
- }
-
- context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
- mask, filter);
+ return;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
+ mask, filter);
}
}
@@ -9688,53 +7949,39 @@
"GLenum format = 0x%X, GLenum type = 0x%x, const GLvoid* pixels = 0x%0.8p)",
target, level, internalformat, width, height, depth, border, format, type, pixels);
- ANGLE_TRY
- {
- UNIMPLEMENTED(); // FIXME
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
- }
+ UNIMPLEMENTED(); // FIXME
}
-void __stdcall glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length,
+void __stdcall glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length,
GLenum *binaryFormat, void *binary)
{
EVENT("(GLenum program = 0x%X, bufSize = %d, length = 0x%0.8p, binaryFormat = 0x%0.8p, binary = 0x%0.8p)",
program, bufSize, length, binaryFormat, binary);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject || !programObject->isLinked())
{
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject || !programObject->isLinked())
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-
- if (!programBinary)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!programBinary->save(binary, bufSize, length))
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- *binaryFormat = GL_PROGRAM_BINARY_ANGLE;
+ return gl::error(GL_INVALID_OPERATION);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::ProgramBinary *programBinary = programObject->getProgramBinary();
+
+ if (!programBinary)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!programBinary->save(binary, bufSize, length))
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ *binaryFormat = GL_PROGRAM_BINARY_ANGLE;
}
}
@@ -9744,30 +7991,23 @@
EVENT("(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)",
program, binaryFormat, binary, length);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (binaryFormat != GL_PROGRAM_BINARY_ANGLE)
{
- if (binaryFormat != GL_PROGRAM_BINARY_ANGLE)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Program *programObject = context->getProgram(program);
-
- if (!programObject)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- context->setProgramBinary(program, binary, length);
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ gl::Program *programObject = context->getProgram(program);
+
+ if (!programObject)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ context->setProgramBinary(program, binary, length);
}
}
@@ -9775,57 +8015,50 @@
{
EVENT("(GLenum n = %d, bufs = 0x%0.8p)", n, bufs);
- ANGLE_TRY
+ gl::Context *context = gl::getNonLostContext();
+
+ if (context)
{
- gl::Context *context = gl::getNonLostContext();
-
- if (context)
+ if (n < 0 || static_cast<GLuint>(n) > context->getCaps().maxDrawBuffers)
{
- if (n < 0 || static_cast<GLuint>(n) > context->getCaps().maxDrawBuffers)
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ if (context->getState().getDrawFramebuffer()->id() == 0)
+ {
+ if (n != 1)
{
- return gl::error(GL_INVALID_VALUE);
+ return gl::error(GL_INVALID_OPERATION);
}
- if (context->getState().getDrawFramebuffer()->id() == 0)
+ if (bufs[0] != GL_NONE && bufs[0] != GL_BACK)
{
- if (n != 1)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (bufs[0] != GL_NONE && bufs[0] != GL_BACK)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- }
- else
- {
- for (int colorAttachment = 0; colorAttachment < n; colorAttachment++)
- {
- const GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + colorAttachment;
- if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != attachment)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
- }
- }
-
- gl::Framebuffer *framebuffer = context->getState().getDrawFramebuffer();
-
- for (unsigned int colorAttachment = 0; colorAttachment < static_cast<unsigned int>(n); colorAttachment++)
- {
- framebuffer->setDrawBufferState(colorAttachment, bufs[colorAttachment]);
- }
-
- for (unsigned int colorAttachment = n; colorAttachment < context->getCaps().maxDrawBuffers; colorAttachment++)
- {
- framebuffer->setDrawBufferState(colorAttachment, GL_NONE);
+ return gl::error(GL_INVALID_OPERATION);
}
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+ else
+ {
+ for (int colorAttachment = 0; colorAttachment < n; colorAttachment++)
+ {
+ const GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + colorAttachment;
+ if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != attachment)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+ }
+ }
+
+ gl::Framebuffer *framebuffer = context->getState().getDrawFramebuffer();
+
+ for (unsigned int colorAttachment = 0; colorAttachment < static_cast<unsigned int>(n); colorAttachment++)
+ {
+ framebuffer->setDrawBufferState(colorAttachment, bufs[colorAttachment]);
+ }
+
+ for (unsigned int colorAttachment = n; colorAttachment < context->getCaps().maxDrawBuffers; colorAttachment++)
+ {
+ framebuffer->setDrawBufferState(colorAttachment, GL_NONE);
+ }
}
}
@@ -9833,37 +8066,30 @@
{
EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
{
- if (!gl::ValidBufferTarget(context, target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- if (pname != GL_BUFFER_MAP_POINTER)
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Buffer *buffer = context->getState().getTargetBuffer(target);
-
- if (!buffer || !buffer->isMapped())
- {
- *params = NULL;
- }
- else
- {
- *params = buffer->getMapPointer();
- }
+ return gl::error(GL_INVALID_ENUM);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (pname != GL_BUFFER_MAP_POINTER)
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (!buffer || !buffer->isMapped())
+ {
+ *params = NULL;
+ }
+ else
+ {
+ *params = buffer->getMapPointer();
+ }
}
}
@@ -9871,40 +8097,33 @@
{
EVENT("(GLenum target = 0x%X, GLbitfield access = 0x%X)", target, access);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
{
- if (!gl::ValidBufferTarget(context, target))
- {
- return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL));
- }
-
- gl::Buffer *buffer = context->getState().getTargetBuffer(target);
-
- if (buffer == NULL)
- {
- return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
- }
-
- if (access != GL_WRITE_ONLY_OES)
- {
- return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL));
- }
-
- if (buffer->isMapped())
- {
- return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
- }
-
- return buffer->mapRange(0, buffer->getSize(), GL_MAP_WRITE_BIT);
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL));
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLvoid*>(NULL));
+
+ gl::Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (buffer == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if (access != GL_WRITE_ONLY_OES)
+ {
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if (buffer->isMapped())
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return buffer->mapRange(0, buffer->getSize(), GL_MAP_WRITE_BIT);
}
return NULL;
@@ -9914,34 +8133,27 @@
{
EVENT("(GLenum target = 0x%X)", target);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
{
- if (!gl::ValidBufferTarget(context, target))
- {
- return gl::error(GL_INVALID_ENUM, GL_FALSE);
- }
-
- gl::Buffer *buffer = context->getState().getTargetBuffer(target);
-
- if (buffer == NULL || !buffer->isMapped())
- {
- return gl::error(GL_INVALID_OPERATION, GL_FALSE);
- }
-
- // TODO: detect if we had corruption. if so, throw an error and return false.
-
- buffer->unmap();
-
- return GL_TRUE;
+ return gl::error(GL_INVALID_ENUM, GL_FALSE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
+
+ gl::Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (buffer == NULL || !buffer->isMapped())
+ {
+ return gl::error(GL_INVALID_OPERATION, GL_FALSE);
+ }
+
+ // TODO: detect if we had corruption. if so, throw an error and return false.
+
+ buffer->unmap();
+
+ return GL_TRUE;
}
return GL_FALSE;
@@ -9952,83 +8164,76 @@
EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)",
target, offset, length, access);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (!gl::ValidBufferTarget(context, target))
{
- if (!gl::ValidBufferTarget(context, target))
- {
- return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL));
- }
-
- if (offset < 0 || length < 0)
- {
- return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL));
- }
-
- gl::Buffer *buffer = context->getState().getTargetBuffer(target);
-
- if (buffer == NULL)
- {
- return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
- }
-
- // Check for buffer overflow
- size_t offsetSize = static_cast<size_t>(offset);
- size_t lengthSize = static_cast<size_t>(length);
-
- if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
- offsetSize + lengthSize > static_cast<size_t>(buffer->getSize()))
- {
- return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL));
- }
-
- // Check for invalid bits in the mask
- GLbitfield allAccessBits = GL_MAP_READ_BIT |
- GL_MAP_WRITE_BIT |
- GL_MAP_INVALIDATE_RANGE_BIT |
- GL_MAP_INVALIDATE_BUFFER_BIT |
- GL_MAP_FLUSH_EXPLICIT_BIT |
- GL_MAP_UNSYNCHRONIZED_BIT;
-
- if (access & ~(allAccessBits))
- {
- return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL));
- }
-
- if (length == 0 || buffer->isMapped())
- {
- return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
- }
-
- // Check for invalid bit combinations
- if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0)
- {
- return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
- }
-
- GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT |
- GL_MAP_INVALIDATE_BUFFER_BIT |
- GL_MAP_UNSYNCHRONIZED_BIT;
-
- if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0)
- {
- return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
- }
-
- if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0)
- {
- return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
- }
-
- return buffer->mapRange(offset, length, access);
+ return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL));
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast<GLvoid*>(NULL));
+
+ if (offset < 0 || length < 0)
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ gl::Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (buffer == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ // Check for buffer overflow
+ size_t offsetSize = static_cast<size_t>(offset);
+ size_t lengthSize = static_cast<size_t>(length);
+
+ if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
+ offsetSize + lengthSize > static_cast<size_t>(buffer->getSize()))
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ // Check for invalid bits in the mask
+ GLbitfield allAccessBits = GL_MAP_READ_BIT |
+ GL_MAP_WRITE_BIT |
+ GL_MAP_INVALIDATE_RANGE_BIT |
+ GL_MAP_INVALIDATE_BUFFER_BIT |
+ GL_MAP_FLUSH_EXPLICIT_BIT |
+ GL_MAP_UNSYNCHRONIZED_BIT;
+
+ if (access & ~(allAccessBits))
+ {
+ return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if (length == 0 || buffer->isMapped())
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ // Check for invalid bit combinations
+ if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT |
+ GL_MAP_INVALIDATE_BUFFER_BIT |
+ GL_MAP_UNSYNCHRONIZED_BIT;
+
+ if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0)
+ {
+ return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL));
+ }
+
+ return buffer->mapRange(offset, length, access);
}
return NULL;
@@ -10038,50 +8243,43 @@
{
EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ if (offset < 0 || length < 0)
{
- if (offset < 0 || length < 0)
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- if (!gl::ValidBufferTarget(context, target))
- {
- return gl::error(GL_INVALID_ENUM);
- }
-
- gl::Buffer *buffer = context->getState().getTargetBuffer(target);
-
- if (buffer == NULL)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0)
- {
- return gl::error(GL_INVALID_OPERATION);
- }
-
- // Check for buffer overflow
- size_t offsetSize = static_cast<size_t>(offset);
- size_t lengthSize = static_cast<size_t>(length);
-
- if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
- offsetSize + lengthSize > static_cast<size_t>(buffer->getMapLength()))
- {
- return gl::error(GL_INVALID_VALUE);
- }
-
- // We do not currently support a non-trivial implementation of FlushMappedBufferRange
+ return gl::error(GL_INVALID_VALUE);
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY);
+
+ if (!gl::ValidBufferTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM);
+ }
+
+ gl::Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (buffer == NULL)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0)
+ {
+ return gl::error(GL_INVALID_OPERATION);
+ }
+
+ // Check for buffer overflow
+ size_t offsetSize = static_cast<size_t>(offset);
+ size_t lengthSize = static_cast<size_t>(length);
+
+ if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
+ offsetSize + lengthSize > static_cast<size_t>(buffer->getMapLength()))
+ {
+ return gl::error(GL_INVALID_VALUE);
+ }
+
+ // We do not currently support a non-trivial implementation of FlushMappedBufferRange
}
}
@@ -10148,26 +8346,19 @@
EVENT("(egl::Surface* surface = 0x%0.8p)",
surface);
- ANGLE_TRY
- {
- gl::Context *context = gl::getNonLostContext();
+ gl::Context *context = gl::getNonLostContext();
- if (context)
+ if (context)
+ {
+ gl::Texture2D *textureObject = context->getTexture2D();
+ ASSERT(textureObject != NULL);
+
+ if (textureObject->isImmutable())
{
- gl::Texture2D *textureObject = context->getTexture2D();
- ASSERT(textureObject != NULL);
-
- if (textureObject->isImmutable())
- {
- return false;
- }
-
- textureObject->bindTexImage(surface);
+ return false;
}
- }
- ANGLE_CATCH_ALL
- {
- return gl::error(GL_OUT_OF_MEMORY, false);
+
+ textureObject->bindTexImage(surface);
}
return true;