Add PackedEnumBitSet, use it for buffer binding validation
Includes angle::BitSetT changes from jmadill@chromium.org
BUG=angleproject:2169
Change-Id: I9f896613f5c6cdc91281cb9a00134f67291870d9
Reviewed-on: https://chromium-review.googlesource.com/804177
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index fe97d78..3a29a33 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -649,36 +649,6 @@
}
}
-bool ValidBufferType(const ValidationContext *context, BufferBinding target)
-{
- switch (target)
- {
- case BufferBinding::ElementArray:
- case BufferBinding::Array:
- return true;
-
- case BufferBinding::PixelPack:
- case BufferBinding::PixelUnpack:
- return (context->getExtensions().pixelBufferObject ||
- context->getClientMajorVersion() >= 3);
-
- case BufferBinding::CopyRead:
- case BufferBinding::CopyWrite:
- case BufferBinding::TransformFeedback:
- case BufferBinding::Uniform:
- return (context->getClientMajorVersion() >= 3);
-
- case BufferBinding::AtomicCounter:
- case BufferBinding::ShaderStorage:
- case BufferBinding::DrawIndirect:
- case BufferBinding::DispatchIndirect:
- return context->getClientVersion() >= Version(3, 1);
-
- default:
- return false;
- }
-}
-
bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level)
{
const auto &caps = context->getCaps();
@@ -3497,7 +3467,7 @@
return false;
}
- if (!ValidBufferType(context, target))
+ if (!context->isValidBufferBinding(target))
{
context->handleError(InvalidEnum() << "Buffer target not valid");
return false;
@@ -3533,7 +3503,7 @@
bool ValidateUnmapBufferBase(Context *context, BufferBinding target)
{
- if (!ValidBufferType(context, target))
+ if (!context->isValidBufferBinding(target))
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
return false;
@@ -3556,7 +3526,7 @@
GLsizeiptr length,
GLbitfield access)
{
- if (!ValidBufferType(context, target))
+ if (!context->isValidBufferBinding(target))
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
return false;
@@ -3663,7 +3633,7 @@
return false;
}
- if (!ValidBufferType(context, target))
+ if (!context->isValidBufferBinding(target))
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
return false;
@@ -4704,7 +4674,7 @@
*numParams = 0;
}
- if (!ValidBufferType(context, target))
+ if (!context->isValidBufferBinding(target))
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidBufferTypes);
return false;