Commit 675fe718 by Jamie Madill Committed by Commit Bot

Don't return Error from Context draw methods.

The Error should be consumed in the Context call. BUG=angleproject:747 Change-Id: I5daae602e8f6c7feed89573c6c9387c295ba9a32 Reviewed-on: https://chromium-review.googlesource.com/421258Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 77ba408a
...@@ -1618,35 +1618,39 @@ void Context::getBooleani_v(GLenum target, GLuint index, GLboolean *data) ...@@ -1618,35 +1618,39 @@ void Context::getBooleani_v(GLenum target, GLuint index, GLboolean *data)
} }
} }
Error Context::drawArrays(GLenum mode, GLint first, GLsizei count) void Context::drawArrays(GLenum mode, GLint first, GLsizei count)
{ {
syncRendererState(); syncRendererState();
ANGLE_TRY(mImplementation->drawArrays(mode, first, count)); auto error = mImplementation->drawArrays(mode, first, count);
handleError(error);
if (!error.isError())
{
MarkTransformFeedbackBufferUsage(mGLState.getCurrentTransformFeedback()); MarkTransformFeedbackBufferUsage(mGLState.getCurrentTransformFeedback());
}
return NoError();
} }
Error Context::drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) void Context::drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
{ {
syncRendererState(); syncRendererState();
ANGLE_TRY(mImplementation->drawArraysInstanced(mode, first, count, instanceCount)); auto error = mImplementation->drawArraysInstanced(mode, first, count, instanceCount);
handleError(error);
if (!error.isError())
{
MarkTransformFeedbackBufferUsage(mGLState.getCurrentTransformFeedback()); MarkTransformFeedbackBufferUsage(mGLState.getCurrentTransformFeedback());
}
return NoError();
} }
Error Context::drawElements(GLenum mode, void Context::drawElements(GLenum mode,
GLsizei count, GLsizei count,
GLenum type, GLenum type,
const GLvoid *indices, const GLvoid *indices,
const IndexRange &indexRange) const IndexRange &indexRange)
{ {
syncRendererState(); syncRendererState();
return mImplementation->drawElements(mode, count, type, indices, indexRange); handleError(mImplementation->drawElements(mode, count, type, indices, indexRange));
} }
Error Context::drawElementsInstanced(GLenum mode, void Context::drawElementsInstanced(GLenum mode,
GLsizei count, GLsizei count,
GLenum type, GLenum type,
const GLvoid *indices, const GLvoid *indices,
...@@ -1654,11 +1658,11 @@ Error Context::drawElementsInstanced(GLenum mode, ...@@ -1654,11 +1658,11 @@ Error Context::drawElementsInstanced(GLenum mode,
const IndexRange &indexRange) const IndexRange &indexRange)
{ {
syncRendererState(); syncRendererState();
return mImplementation->drawElementsInstanced(mode, count, type, indices, instances, handleError(
indexRange); mImplementation->drawElementsInstanced(mode, count, type, indices, instances, indexRange));
} }
Error Context::drawRangeElements(GLenum mode, void Context::drawRangeElements(GLenum mode,
GLuint start, GLuint start,
GLuint end, GLuint end,
GLsizei count, GLsizei count,
...@@ -1667,7 +1671,8 @@ Error Context::drawRangeElements(GLenum mode, ...@@ -1667,7 +1671,8 @@ Error Context::drawRangeElements(GLenum mode,
const IndexRange &indexRange) const IndexRange &indexRange)
{ {
syncRendererState(); syncRendererState();
return mImplementation->drawRangeElements(mode, start, end, count, type, indices, indexRange); handleError(
mImplementation->drawRangeElements(mode, start, end, count, type, indices, indexRange));
} }
void Context::drawArraysIndirect(GLenum mode, const GLvoid *indirect) void Context::drawArraysIndirect(GLenum mode, const GLvoid *indirect)
...@@ -1682,14 +1687,14 @@ void Context::drawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indir ...@@ -1682,14 +1687,14 @@ void Context::drawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indir
handleError(mImplementation->drawElementsIndirect(mode, type, indirect)); handleError(mImplementation->drawElementsIndirect(mode, type, indirect));
} }
Error Context::flush() void Context::flush()
{ {
return mImplementation->flush(); handleError(mImplementation->flush());
} }
Error Context::finish() void Context::finish()
{ {
return mImplementation->finish(); handleError(mImplementation->finish());
} }
void Context::insertEventMarker(GLsizei length, const char *marker) void Context::insertEventMarker(GLsizei length, const char *marker)
......
...@@ -289,21 +289,21 @@ class Context final : public ValidationContext ...@@ -289,21 +289,21 @@ class Context final : public ValidationContext
void clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values); void clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values);
void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
Error drawArrays(GLenum mode, GLint first, GLsizei count); void drawArrays(GLenum mode, GLint first, GLsizei count);
Error drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
Error drawElements(GLenum mode, void drawElements(GLenum mode,
GLsizei count, GLsizei count,
GLenum type, GLenum type,
const GLvoid *indices, const GLvoid *indices,
const IndexRange &indexRange); const IndexRange &indexRange);
Error drawElementsInstanced(GLenum mode, void drawElementsInstanced(GLenum mode,
GLsizei count, GLsizei count,
GLenum type, GLenum type,
const GLvoid *indices, const GLvoid *indices,
GLsizei instances, GLsizei instances,
const IndexRange &indexRange); const IndexRange &indexRange);
Error drawRangeElements(GLenum mode, void drawRangeElements(GLenum mode,
GLuint start, GLuint start,
GLuint end, GLuint end,
GLsizei count, GLsizei count,
...@@ -488,8 +488,8 @@ class Context final : public ValidationContext ...@@ -488,8 +488,8 @@ class Context final : public ValidationContext
void generateMipmap(GLenum target); void generateMipmap(GLenum target);
Error flush(); void flush();
Error finish(); void finish();
void getBufferPointerv(GLenum target, GLenum pname, void **params); void getBufferPointerv(GLenum target, GLenum pname, void **params);
GLvoid *mapBuffer(GLenum target, GLenum access); GLvoid *mapBuffer(GLenum target, GLenum access);
......
...@@ -764,12 +764,7 @@ void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count) ...@@ -764,12 +764,7 @@ void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count)
return; return;
} }
Error error = context->drawArrays(mode, first, count); context->drawArrays(mode, first, count);
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
...@@ -787,12 +782,7 @@ void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const GLv ...@@ -787,12 +782,7 @@ void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const GLv
return; return;
} }
Error error = context->drawElements(mode, count, type, indices, indexRange); context->drawElements(mode, count, type, indices, indexRange);
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
...@@ -836,12 +826,7 @@ void GL_APIENTRY Finish(void) ...@@ -836,12 +826,7 @@ void GL_APIENTRY Finish(void)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
Error error = context->finish(); context->finish();
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
...@@ -852,12 +837,7 @@ void GL_APIENTRY Flush(void) ...@@ -852,12 +837,7 @@ void GL_APIENTRY Flush(void)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
Error error = context->flush(); context->flush();
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
......
...@@ -276,12 +276,7 @@ void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode, ...@@ -276,12 +276,7 @@ void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode,
return; return;
} }
Error error = context->drawArraysInstanced(mode, first, count, primcount); context->drawArraysInstanced(mode, first, count, primcount);
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
...@@ -306,13 +301,7 @@ void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode, ...@@ -306,13 +301,7 @@ void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode,
return; return;
} }
Error error =
context->drawElementsInstanced(mode, count, type, indices, primcount, indexRange); context->drawElementsInstanced(mode, count, type, indices, primcount, indexRange);
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
......
...@@ -61,17 +61,7 @@ void GL_APIENTRY DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsize ...@@ -61,17 +61,7 @@ void GL_APIENTRY DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsize
return; return;
} }
// As long as index validation is done, it doesn't matter whether the context receives a drawElements or
// a drawRangeElements call - the GL back-end is free to choose to call drawRangeElements based on the
// validated index range. If index validation is removed, adding drawRangeElements to the context interface
// should be reconsidered.
Error error =
context->drawRangeElements(mode, start, end, count, type, indices, indexRange); context->drawRangeElements(mode, start, end, count, type, indices, indexRange);
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
...@@ -1702,12 +1692,7 @@ void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GL ...@@ -1702,12 +1692,7 @@ void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GL
return; return;
} }
Error error = context->drawArraysInstanced(mode, first, count, instanceCount); context->drawArraysInstanced(mode, first, count, instanceCount);
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
...@@ -1731,13 +1716,7 @@ void GL_APIENTRY DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, ...@@ -1731,13 +1716,7 @@ void GL_APIENTRY DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
return; return;
} }
Error error =
context->drawElementsInstanced(mode, count, type, indices, instanceCount, indexRange); context->drawElementsInstanced(mode, count, type, indices, instanceCount, indexRange);
if (error.isError())
{
context->handleError(error);
return;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment