Inline ValidateBindBuffer.
This method is only called in one place. Inlining reduces the need to
make a jump and push/pop variables from the stack.
It also adds a specialized error handler for validation errors. This
reduces the amount of code generated for errors. The prior method
generates a lot of code when dealing with string streams.
Improves performance of the binding performance test.
Bug: angleproject:2763
Change-Id: I52af7046b398072975bf5bda583efac9a9b9a8cb
Reviewed-on: https://chromium-review.googlesource.com/c/1270219
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index 1573017..df5b6db 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -4512,36 +4512,18 @@
return GetValidProgram(context, program) != nullptr;
}
-bool ValidateBindBuffer(Context *context, BufferBinding target, GLuint buffer)
-{
- if (!context->isValidBufferBinding(target))
- {
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
- return false;
- }
-
- if (!context->getGLState().isBindGeneratesResourceEnabled() &&
- !context->isBufferGenerated(buffer))
- {
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ObjectNotGenerated);
- return false;
- }
-
- return true;
-}
-
bool ValidateBindFramebuffer(Context *context, GLenum target, GLuint framebuffer)
{
if (!ValidFramebufferTarget(context, target))
{
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidFramebufferTarget);
return false;
}
if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isFramebufferGenerated(framebuffer))
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ObjectNotGenerated);
+ context->validationError(GL_INVALID_OPERATION, kErrorObjectNotGenerated);
return false;
}