Commit 63c5a597 by Geoff Lang Committed by Commit Bot

Make GL_ANGLE_instanced_arrays enableable.

BUG=angleproject:1523 Change-Id: Id1dd5d0426c1b55bfd6cca8b0c8c73596080f2a9 Reviewed-on: https://chromium-review.googlesource.com/688101Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent ce8602ab
......@@ -651,7 +651,7 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_EXT_blend_minmax"] = enableableExtension(&Extensions::blendMinMax);
map["GL_ANGLE_framebuffer_blit"] = esOnlyExtension(&Extensions::framebufferBlit);
map["GL_ANGLE_framebuffer_multisample"] = enableableExtension(&Extensions::framebufferMultisample);
map["GL_ANGLE_instanced_arrays"] = esOnlyExtension(&Extensions::instancedArrays);
map["GL_ANGLE_instanced_arrays"] = enableableExtension(&Extensions::instancedArrays);
map["GL_ANGLE_pack_reverse_row_order"] = esOnlyExtension(&Extensions::packReverseRowOrder);
map["GL_OES_standard_derivatives"] = enableableExtension(&Extensions::standardDerivatives);
map["GL_EXT_shader_texture_lod"] = enableableExtension(&Extensions::shaderTextureLOD);
......
......@@ -2734,6 +2734,12 @@ bool ValidateDrawArraysInstancedANGLE(Context *context,
GLsizei count,
GLsizei primcount)
{
if (!context->getExtensions().instancedArrays)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
return false;
}
if (!ValidateDrawArraysInstancedBase(context, mode, first, count, primcount))
{
return false;
......@@ -2950,6 +2956,12 @@ bool ValidateDrawElementsInstancedANGLE(Context *context,
const void *indices,
GLsizei primcount)
{
if (!context->getExtensions().instancedArrays)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
return false;
}
if (!ValidateDrawElementsInstancedBase(context, mode, count, type, indices, primcount))
{
return false;
......
......@@ -12,6 +12,7 @@
#include "libANGLE/Buffer.h"
#include "libANGLE/Context.h"
#include "libANGLE/Error.h"
#include "libANGLE/ErrorStrings.h"
#include "libANGLE/Fence.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/Query.h"
......@@ -665,6 +666,12 @@ void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->getExtensions().instancedArrays)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
return;
}
if (index >= MAX_VERTEX_ATTRIBS)
{
context->handleError(InvalidValue());
......
......@@ -672,6 +672,32 @@ TEST_P(WebGLCompatibilityTest, EnableFramebufferMultisampleExtension)
}
}
// Test enabling the GL_ANGLE_instanced_arrays extension
TEST_P(WebGLCompatibilityTest, EnableInstancedArraysExtension)
{
EXPECT_FALSE(extensionEnabled("GL_ANGLE_instanced_arrays"));
// This extensions become core in in ES3/WebGL2.
ANGLE_SKIP_TEST_IF(getClientMajorVersion() >= 3);
GLint divisor = 0;
glGetVertexAttribiv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, &divisor);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
glVertexAttribDivisorANGLE(0, 1);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
if (extensionRequestable("GL_ANGLE_instanced_arrays"))
{
glRequestExtensionANGLE("GL_ANGLE_instanced_arrays");
EXPECT_GL_NO_ERROR();
glGetVertexAttribiv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, &divisor);
glVertexAttribDivisorANGLE(0, 1);
EXPECT_GL_NO_ERROR();
}
}
// Verify that the context generates the correct error when the framebuffer attachments are
// different sizes
TEST_P(WebGLCompatibilityTest, FramebufferAttachmentSizeMissmatch)
......
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