Implement EXT_instanced_arrays

Bug: angleproject:3015
Change-Id: Ib01cc5e0df6db27981cb843a6bd386de5d10c2db
Reviewed-on: https://chromium-review.googlesource.com/c/1452740
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Jonah Ryan-Davis 2019-02-08 10:07:21 -05:00 коммит произвёл Commit Bot
Родитель d058774b0a
Коммит 2b0553ce59
27 изменённых файлов: 540 добавлений и 99 удалений

Просмотреть файл

@ -39,8 +39,8 @@ Dependencies
the OpenGL ES 3.0 specification, and the OpenGL ES Shading Language 3.0
specification.
The presence of the GL_ANGLE_instanced_arrays extension affects the
definition of this extension.
The presence of the GL_ANGLE_instanced_arrays or GL_EXT_instanced_arrays
extensions affects the definition of this extension.
Overview
@ -210,15 +210,16 @@ Modifications to the OpenGL ES Shading Language Specification, Version 3.00
Dependencies on GL_ANGLE_instanced_arrays
If GL_ANGLE_instanced_arrays is enabled, append the lanuage in "Additions to
Chapter 2 of the OpenGL ES 3.0 Specification, Section 2.9.3 Drawing
Commands" to the language in "Additions to Chapter 2 of the OpenGL ES 2.0
Specification, Section 2.8 Vertex Arrays".
If GL_ANGLE_instanced_arrays or GL_EXT_instanced_arrays is enabled,
append the lanuage in "Additions to Chapter 2 of the OpenGL ES 3.0
Specification, Section 2.9.3 Drawing Commands" to the language in
"Additions to Chapter 2 of the OpenGL ES 2.0 Specification, Section
2.8 Vertex Arrays".
If GL_ANGLE_instanced_arrays is not enabled and the context is less than a
OpenGL ES 3.0 context, the error INVALID_OPERATION is generated by any call
to the functions MultiDrawArraysInstancedANGLE and
MultiDrawElementsInstancedANGLE.
If GL_ANGLE_instanced_arrays or GL_EXT_instanced_arrays is not enabled
and the context is less than a OpenGL ES 3.0 context, the error
INVALID_OPERATION is generated by any call to the functions
MultiDrawArraysInstancedANGLE and MultiDrawElementsInstancedANGLE.
Issues
None

Просмотреть файл

@ -163,8 +163,10 @@ typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTCONTEXTANGLEPROC)(GLeglContext c
typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *arrays);
typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments);
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLint start, GLsizei count, GLsizei primcount);
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLenum *bufs);
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLeglImageOES image);
typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLeglImageOES image);
typedef void (GL_APIENTRYP PFNGLENDQUERYEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
@ -225,6 +227,7 @@ typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTCONTEXTANGLEPROC)(GLeglContext ct
typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLuint divisor);
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLuint divisor);
typedef void (GL_APIENTRYP PFNGLBINDUNIFORMLOCATIONCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, const GLchar* name);
typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum components);
typedef void (GL_APIENTRYP PFNGLMATRIXLOADFCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum matrixMode, const GLfloat * matrix);
@ -490,8 +493,10 @@ GL_APICALL void GL_APIENTRY glDeleteQueriesEXTContextANGLE(GLeglContext ctx, GLs
GL_APICALL void GL_APIENTRY glDeleteVertexArraysOESContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *arrays);
GL_APICALL void GL_APIENTRY glDiscardFramebufferEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments);
GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLEContextANGLE(GLeglContext ctx, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXTContextANGLE(GLeglContext ctx, GLenum mode, GLint start, GLsizei count, GLsizei primcount);
GL_APICALL void GL_APIENTRY glDrawBuffersEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLenum *bufs);
GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLEContextANGLE(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXTContextANGLE(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOESContextANGLE(GLeglContext ctx, GLenum target, GLeglImageOES image);
GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOESContextANGLE(GLeglContext ctx, GLenum target, GLeglImageOES image);
GL_APICALL void GL_APIENTRY glEndQueryEXTContextANGLE(GLeglContext ctx, GLenum target);
@ -552,6 +557,7 @@ GL_APICALL void GL_APIENTRY glTexStorage3DEXTContextANGLE(GLeglContext ctx, GLen
GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOESContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOESContextANGLE(GLeglContext ctx, GLenum target);
GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLEContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor);
GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXTContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor);
GL_APICALL void GL_APIENTRY glBindUniformLocationCHROMIUMContextANGLE(GLeglContext ctx, GLuint program, GLint location, const GLchar* name);
GL_APICALL void GL_APIENTRY glCoverageModulationCHROMIUMContextANGLE(GLeglContext ctx, GLenum components);
GL_APICALL void GL_APIENTRY glMatrixLoadfCHROMIUMContextANGLE(GLeglContext ctx, GLenum matrixMode, const GLfloat * matrix);

Просмотреть файл

@ -109,6 +109,9 @@
"glDrawArraysInstancedANGLE": {
"mode": "PrimitiveMode"
},
"glDrawArraysInstancedEXT": {
"mode": "PrimitiveMode"
},
"glDrawElements": {
"mode": "PrimitiveMode",
"type": "DrawElementsType"
@ -125,6 +128,10 @@
"mode": "PrimitiveMode",
"type": "DrawElementsType"
},
"glDrawElementsInstancedEXT": {
"mode": "PrimitiveMode",
"type": "DrawElementsType"
},
"glDrawRangeElements": {
"mode": "PrimitiveMode",
"type": "DrawElementsType"

Просмотреть файл

@ -50,6 +50,7 @@ supported_extensions = sorted(angle_extensions + gles1_extensions + [
"GL_EXT_disjoint_timer_query",
"GL_EXT_draw_buffers",
"GL_EXT_geometry_shader",
"GL_EXT_instanced_arrays",
"GL_EXT_map_buffer_range",
"GL_EXT_occlusion_query_boolean",
"GL_EXT_robustness",

Просмотреть файл

@ -60,7 +60,7 @@
"GL/EGL entry points:scripts/egl_angle_ext.xml":
"745534010f31fbe8e1a1fcddce15ed2d",
"GL/EGL entry points:scripts/entry_point_packed_gl_enums.json":
"be6c1cfbaf1e3180cad07fb7d98871c7",
"afe2284956be2360463d0d036ad9cdde",
"GL/EGL entry points:scripts/generate_entry_points.py":
"a959669b31f086510fb60c5b55de56d1",
"GL/EGL entry points:scripts/gl.xml":
@ -68,7 +68,7 @@
"GL/EGL entry points:scripts/gl_angle_ext.xml":
"56fb2634ebb3d8240b1a92aeb5518f1a",
"GL/EGL entry points:scripts/registry_xml.py":
"d9f9d394f3e71ac7dba84c203452d9e1",
"be6628bdeb99e50868cf4af51ea63f54",
"GL/EGL/WGL loader:scripts/egl.xml":
"842e24514c4cfe09fba703c17a0fd292",
"GL/EGL/WGL loader:scripts/egl_angle_ext.xml":
@ -76,7 +76,7 @@
"GL/EGL/WGL loader:scripts/generate_loader.py":
"2d9be1d0f4f54905f3372411522133d1",
"GL/EGL/WGL loader:scripts/registry_xml.py":
"d9f9d394f3e71ac7dba84c203452d9e1",
"be6628bdeb99e50868cf4af51ea63f54",
"GL/EGL/WGL loader:scripts/wgl.xml":
"aa96419c582af2f6673430e2847693f4",
"OpenGL dispatch table:scripts/gl.xml":
@ -120,7 +120,7 @@
"proc table:src/libGLESv2/gen_proc_table.py":
"ee265eada3dd238646010dd03874d242",
"proc table:src/libGLESv2/proc_table_data.json":
"81412cd66c53732e7e9d0cfc86b1ec92",
"6deb74c7709ecb664b917a2f1e598399",
"uniform type:src/common/gen_uniform_type_table.py":
"e185802e66950dfc5fc7a8fc19751206"
}

Просмотреть файл

@ -191,7 +191,8 @@ Extensions::Extensions()
blendMinMax(false),
framebufferBlit(false),
framebufferMultisample(false),
instancedArrays(false),
instancedArraysANGLE(false),
instancedArraysEXT(false),
packReverseRowOrder(false),
standardDerivatives(false),
shaderTextureLOD(false),
@ -853,7 +854,8 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_EXT_blend_minmax"] = enableableExtension(&Extensions::blendMinMax);
map["GL_ANGLE_framebuffer_blit"] = enableableExtension(&Extensions::framebufferBlit);
map["GL_ANGLE_framebuffer_multisample"] = enableableExtension(&Extensions::framebufferMultisample);
map["GL_ANGLE_instanced_arrays"] = enableableExtension(&Extensions::instancedArrays);
map["GL_ANGLE_instanced_arrays"] = enableableExtension(&Extensions::instancedArraysANGLE);
map["GL_EXT_instanced_arrays"] = enableableExtension(&Extensions::instancedArraysEXT);
map["GL_ANGLE_pack_reverse_row_order"] = enableableExtension(&Extensions::packReverseRowOrder);
map["GL_OES_standard_derivatives"] = enableableExtension(&Extensions::standardDerivatives);
map["GL_EXT_shader_texture_lod"] = enableableExtension(&Extensions::shaderTextureLOD);

Просмотреть файл

@ -284,7 +284,10 @@ struct Extensions
bool framebufferMultisample;
// GL_ANGLE_instanced_arrays
bool instancedArrays;
bool instancedArraysANGLE;
// GL_EXT_instanced_arrays
bool instancedArraysEXT;
// GL_ANGLE_pack_reverse_row_order
bool packReverseRowOrder;

Просмотреть файл

@ -1595,7 +1595,8 @@ void GenerateCaps(ID3D11Device *device,
extensions->blendMinMax = true;
extensions->framebufferBlit = GetFramebufferBlitSupport(featureLevel);
extensions->framebufferMultisample = GetFramebufferMultisampleSupport(featureLevel);
extensions->instancedArrays = GetInstancingSupport(featureLevel);
extensions->instancedArraysANGLE = GetInstancingSupport(featureLevel);
extensions->instancedArraysEXT = GetInstancingSupport(featureLevel);
extensions->packReverseRowOrder = true;
extensions->standardDerivatives = GetDerivativeInstructionSupport(featureLevel);
extensions->shaderTextureLOD = GetShaderTextureLODSupport(featureLevel);

Просмотреть файл

@ -711,7 +711,10 @@ void GenerateCaps(IDirect3D9 *d3d9,
extensions->blendMinMax = true;
extensions->framebufferBlit = true;
extensions->framebufferMultisample = true;
extensions->instancedArrays = deviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0);
extensions->instancedArraysANGLE = deviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0);
// D3D9 requires at least one attribute that has a divisor of 0, which isn't required by the EXT
// extension
extensions->instancedArraysEXT = false;
extensions->packReverseRowOrder = true;
extensions->standardDerivatives =
(deviceCaps.PS20Caps.Caps & D3DPS20CAPS_GRADIENTINSTRUCTIONS) != 0;

Просмотреть файл

@ -1123,12 +1123,13 @@ void GenerateCaps(const FunctionsGL *functions,
functions->hasGLESExtension("GL_OES_texture_border_clamp") ||
functions->hasGLESExtension("GL_EXT_texture_border_clamp") ||
functions->hasGLESExtension("GL_NV_texture_border_clamp");
extensions->instancedArrays = functions->isAtLeastGL(gl::Version(3, 1)) ||
(functions->hasGLExtension("GL_ARB_instanced_arrays") &&
(functions->hasGLExtension("GL_ARB_draw_instanced") ||
functions->hasGLExtension("GL_EXT_draw_instanced"))) ||
functions->isAtLeastGLES(gl::Version(3, 0)) ||
functions->hasGLESExtension("GL_EXT_instanced_arrays");
extensions->instancedArraysANGLE = functions->isAtLeastGL(gl::Version(3, 1)) ||
(functions->hasGLExtension("GL_ARB_instanced_arrays") &&
(functions->hasGLExtension("GL_ARB_draw_instanced") ||
functions->hasGLExtension("GL_EXT_draw_instanced"))) ||
functions->isAtLeastGLES(gl::Version(3, 0)) ||
functions->hasGLESExtension("GL_EXT_instanced_arrays");
extensions->instancedArraysEXT = extensions->instancedArraysANGLE;
extensions->unpackSubimage = functions->standard == STANDARD_GL_DESKTOP ||
functions->isAtLeastGLES(gl::Version(3, 0)) ||
functions->hasGLESExtension("GL_EXT_unpack_subimage");

Просмотреть файл

@ -68,7 +68,8 @@ ContextNULL::ContextNULL(const gl::State &state,
mExtensions = gl::Extensions();
mExtensions.fence = true;
mExtensions.instancedArrays = true;
mExtensions.instancedArraysANGLE = true;
mExtensions.instancedArraysEXT = true;
mExtensions.pixelBufferObject = true;
mExtensions.mapBuffer = true;
mExtensions.mapBufferRange = true;

Просмотреть файл

@ -2840,7 +2840,7 @@ bool ValidateDrawArraysInstancedANGLE(Context *context,
GLsizei count,
GLsizei primcount)
{
if (!context->getExtensions().instancedArrays)
if (!context->getExtensions().instancedArraysANGLE)
{
context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
@ -2854,6 +2854,26 @@ bool ValidateDrawArraysInstancedANGLE(Context *context,
return ValidateDrawInstancedANGLE(context);
}
bool ValidateDrawArraysInstancedEXT(Context *context,
PrimitiveMode mode,
GLint first,
GLsizei count,
GLsizei primcount)
{
if (!context->getExtensions().instancedArraysEXT)
{
context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
if (!ValidateDrawArraysInstancedBase(context, mode, first, count, primcount))
{
return false;
}
return true;
}
const char *ValidateDrawElementsStates(Context *context)
{
const State &state = context->getState();
@ -2906,16 +2926,6 @@ const char *ValidateDrawElementsStates(Context *context)
return nullptr;
}
bool ValidateDrawElementsInstancedCommon(Context *context,
PrimitiveMode mode,
GLsizei count,
DrawElementsType type,
const void *indices,
GLsizei primcount)
{
return ValidateDrawElementsInstancedBase(context, mode, count, type, indices, primcount);
}
bool ValidateDrawElementsInstancedANGLE(Context *context,
PrimitiveMode mode,
GLsizei count,
@ -2923,7 +2933,7 @@ bool ValidateDrawElementsInstancedANGLE(Context *context,
const void *indices,
GLsizei primcount)
{
if (!context->getExtensions().instancedArrays)
if (!context->getExtensions().instancedArraysANGLE)
{
context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
@ -2937,6 +2947,27 @@ bool ValidateDrawElementsInstancedANGLE(Context *context,
return ValidateDrawInstancedANGLE(context);
}
bool ValidateDrawElementsInstancedEXT(Context *context,
PrimitiveMode mode,
GLsizei count,
DrawElementsType type,
const void *indices,
GLsizei primcount)
{
if (!context->getExtensions().instancedArraysEXT)
{
context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
if (!ValidateDrawElementsInstancedBase(context, mode, count, type, indices, primcount))
{
return false;
}
return true;
}
bool ValidateFramebufferTextureBase(Context *context,
GLenum target,
GLenum attachment,
@ -5231,7 +5262,8 @@ bool ValidateGetVertexAttribBase(Context *context,
GL_VERTEX_ATTRIB_ARRAY_DIVISOR == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE,
"ANGLE extension enums not equal to GL enums.");
if (context->getClientMajorVersion() < 3 &&
!context->getExtensions().instancedArrays)
!context->getExtensions().instancedArraysANGLE &&
!context->getExtensions().instancedArraysEXT)
{
context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false;

Просмотреть файл

@ -325,20 +325,33 @@ bool ValidateDrawArraysInstancedANGLE(Context *context,
GLint first,
GLsizei count,
GLsizei primcount);
bool ValidateDrawArraysInstancedEXT(Context *context,
PrimitiveMode mode,
GLint first,
GLsizei count,
GLsizei primcount);
bool ValidateDrawElementsInstancedCommon(Context *context,
PrimitiveMode mode,
GLsizei count,
DrawElementsType type,
const void *indices,
GLsizei primcount);
bool ValidateDrawElementsInstancedBase(Context *context,
PrimitiveMode mode,
GLsizei count,
DrawElementsType type,
const void *indices,
GLsizei primcount);
bool ValidateDrawElementsInstancedANGLE(Context *context,
PrimitiveMode mode,
GLsizei count,
DrawElementsType type,
const void *indices,
GLsizei primcount);
bool ValidateDrawElementsInstancedEXT(Context *context,
PrimitiveMode mode,
GLsizei count,
DrawElementsType type,
const void *indices,
GLsizei primcount);
bool ValidateDrawInstancedANGLE(Context *context);
bool ValidateDrawInstancedEXT(Context *context);
bool ValidateFramebufferTextureBase(Context *context,
GLenum target,

Просмотреть файл

@ -6419,7 +6419,7 @@ bool ValidateTexStorage2DEXT(Context *context,
bool ValidateVertexAttribDivisorANGLE(Context *context, GLuint index, GLuint divisor)
{
if (!context->getExtensions().instancedArrays)
if (!context->getExtensions().instancedArraysANGLE)
{
context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
@ -6447,6 +6447,23 @@ bool ValidateVertexAttribDivisorANGLE(Context *context, GLuint index, GLuint div
return true;
}
bool ValidateVertexAttribDivisorEXT(Context *context, GLuint index, GLuint divisor)
{
if (!context->getExtensions().instancedArraysEXT)
{
context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
if (index >= MAX_VERTEX_ATTRIBS)
{
context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute);
return false;
}
return true;
}
bool ValidateTexImage3DOES(Context *context,
GLenum target,
GLint level,

Просмотреть файл

@ -3083,7 +3083,7 @@ bool ValidateDrawElementsInstanced(Context *context,
return false;
}
return ValidateDrawElementsInstancedCommon(context, mode, count, type, indices, instanceCount);
return ValidateDrawElementsInstancedBase(context, mode, count, type, indices, instanceCount);
}
bool ValidateMultiDrawArraysInstancedANGLE(Context *context,
@ -3100,7 +3100,8 @@ bool ValidateMultiDrawArraysInstancedANGLE(Context *context,
}
if (context->getClientMajorVersion() < 3)
{
if (!context->getExtensions().instancedArrays)
if (!context->getExtensions().instancedArraysANGLE &&
!context->getExtensions().instancedArraysEXT)
{
context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
@ -3136,7 +3137,8 @@ bool ValidateMultiDrawElementsInstancedANGLE(Context *context,
}
if (context->getClientMajorVersion() < 3)
{
if (!context->getExtensions().instancedArrays)
if (!context->getExtensions().instancedArraysANGLE &&
!context->getExtensions().instancedArraysEXT)
{
context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
@ -3148,8 +3150,8 @@ bool ValidateMultiDrawElementsInstancedANGLE(Context *context,
}
for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
{
if (!ValidateDrawElementsInstancedCommon(context, mode, counts[drawID], type,
indices[drawID], instanceCounts[drawID]))
if (!ValidateDrawElementsInstancedBase(context, mode, counts[drawID], type, indices[drawID],
instanceCounts[drawID]))
{
return false;
}

Просмотреть файл

@ -784,6 +784,20 @@ bool ValidateFramebufferTextureEXT(Context *context,
GLuint texture,
GLint level);
// GL_EXT_instanced_arrays
bool ValidateDrawArraysInstancedEXT(Context *context,
PrimitiveMode modePacked,
GLint start,
GLsizei count,
GLsizei primcount);
bool ValidateDrawElementsInstancedEXT(Context *context,
PrimitiveMode modePacked,
GLsizei count,
DrawElementsType typePacked,
const void *indices,
GLsizei primcount);
bool ValidateVertexAttribDivisorEXT(Context *context, GLuint index, GLuint divisor);
// GL_EXT_map_buffer_range
bool ValidateFlushMappedBufferRangeEXT(Context *context,
BufferBinding targetPacked,

Просмотреть файл

@ -138,12 +138,14 @@ enum class EntryPoint
DrawArraysIndirect,
DrawArraysInstanced,
DrawArraysInstancedANGLE,
DrawArraysInstancedEXT,
DrawBuffers,
DrawBuffersEXT,
DrawElements,
DrawElementsIndirect,
DrawElementsInstanced,
DrawElementsInstancedANGLE,
DrawElementsInstancedEXT,
DrawRangeElements,
DrawTexfOES,
DrawTexfvOES,
@ -625,6 +627,7 @@ enum class EntryPoint
VertexAttribBinding,
VertexAttribDivisor,
VertexAttribDivisorANGLE,
VertexAttribDivisorEXT,
VertexAttribFormat,
VertexAttribI4i,
VertexAttribI4iv,

Просмотреть файл

@ -3137,6 +3137,66 @@ void GL_APIENTRY FramebufferTextureEXT(GLenum target,
}
}
// GL_EXT_instanced_arrays
void GL_APIENTRY DrawArraysInstancedEXT(GLenum mode, GLint start, GLsizei count, GLsizei primcount)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EVENT("(GLenum mode = 0x%X, GLint start = %d, GLsizei count = %d, GLsizei primcount = %d)",
mode, start, count, primcount);
Context *context = GetValidGlobalContext();
if (context)
{
PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
if (context->skipValidation() ||
ValidateDrawArraysInstancedEXT(context, modePacked, start, count, primcount))
{
context->drawArraysInstanced(modePacked, start, count, primcount);
}
}
}
void GL_APIENTRY DrawElementsInstancedEXT(GLenum mode,
GLsizei count,
GLenum type,
const void *indices,
GLsizei primcount)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EVENT(
"(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = "
"0x%016" PRIxPTR ", GLsizei primcount = %d)",
mode, count, type, (uintptr_t)indices, primcount);
Context *context = GetValidGlobalContext();
if (context)
{
PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
if (context->skipValidation() ||
ValidateDrawElementsInstancedEXT(context, modePacked, count, typePacked, indices,
primcount))
{
context->drawElementsInstanced(modePacked, count, typePacked, indices, primcount);
}
}
}
void GL_APIENTRY VertexAttribDivisorEXT(GLuint index, GLuint divisor)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
Context *context = GetValidGlobalContext();
if (context)
{
if (context->skipValidation() || ValidateVertexAttribDivisorEXT(context, index, divisor))
{
context->vertexAttribDivisor(index, divisor);
}
}
}
// GL_EXT_map_buffer_range
void GL_APIENTRY FlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length)
{
@ -6799,6 +6859,29 @@ void GL_APIENTRY DrawArraysInstancedANGLEContextANGLE(GLeglContext ctx,
}
}
void GL_APIENTRY DrawArraysInstancedEXTContextANGLE(GLeglContext ctx,
GLenum mode,
GLint start,
GLsizei count,
GLsizei primcount)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EVENT("(GLenum mode = 0x%X, GLint start = %d, GLsizei count = %d, GLsizei primcount = %d)",
mode, start, count, primcount);
Context *context = static_cast<gl::Context *>(ctx);
if (context)
{
ASSERT(context == GetValidGlobalContext());
PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
if (context->skipValidation() ||
ValidateDrawArraysInstancedEXT(context, modePacked, start, count, primcount))
{
context->drawArraysInstanced(modePacked, start, count, primcount);
}
}
}
void GL_APIENTRY DrawBuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLenum *bufs)
{
ANGLE_SCOPED_GLOBAL_LOCK();
@ -6936,6 +7019,34 @@ void GL_APIENTRY DrawElementsInstancedANGLEContextANGLE(GLeglContext ctx,
}
}
void GL_APIENTRY DrawElementsInstancedEXTContextANGLE(GLeglContext ctx,
GLenum mode,
GLsizei count,
GLenum type,
const void *indices,
GLsizei primcount)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EVENT(
"(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = "
"0x%016" PRIxPTR ", GLsizei primcount = %d)",
mode, count, type, (uintptr_t)indices, primcount);
Context *context = static_cast<gl::Context *>(ctx);
if (context)
{
ASSERT(context == GetValidGlobalContext());
PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
if (context->skipValidation() ||
ValidateDrawElementsInstancedEXT(context, modePacked, count, typePacked, indices,
primcount))
{
context->drawElementsInstanced(modePacked, count, typePacked, indices, primcount);
}
}
}
void GL_APIENTRY DrawRangeElementsContextANGLE(GLeglContext ctx,
GLenum mode,
GLuint start,
@ -14900,6 +15011,22 @@ void GL_APIENTRY VertexAttribDivisorANGLEContextANGLE(GLeglContext ctx,
}
}
void GL_APIENTRY VertexAttribDivisorEXTContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
Context *context = static_cast<gl::Context *>(ctx);
if (context)
{
ASSERT(context == GetValidGlobalContext());
if (context->skipValidation() || ValidateVertexAttribDivisorEXT(context, index, divisor))
{
context->vertexAttribDivisor(index, divisor);
}
}
}
void GL_APIENTRY VertexAttribFormatContextANGLE(GLeglContext ctx,
GLuint attribindex,
GLint size,

Просмотреть файл

@ -685,6 +685,18 @@ ANGLE_EXPORT void GL_APIENTRY FramebufferTextureEXT(GLenum target,
GLuint texture,
GLint level);
// GL_EXT_instanced_arrays
ANGLE_EXPORT void GL_APIENTRY DrawArraysInstancedEXT(GLenum mode,
GLint start,
GLsizei count,
GLsizei primcount);
ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedEXT(GLenum mode,
GLsizei count,
GLenum type,
const void *indices,
GLsizei primcount);
ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorEXT(GLuint index, GLuint divisor);
// GL_EXT_map_buffer_range
ANGLE_EXPORT void GL_APIENTRY FlushMappedBufferRangeEXT(GLenum target,
GLintptr offset,
@ -1279,6 +1291,11 @@ ANGLE_EXPORT void GL_APIENTRY DrawArraysInstancedANGLEContextANGLE(GLeglContext
GLint first,
GLsizei count,
GLsizei primcount);
ANGLE_EXPORT void GL_APIENTRY DrawArraysInstancedEXTContextANGLE(GLeglContext ctx,
GLenum mode,
GLint start,
GLsizei count,
GLsizei primcount);
ANGLE_EXPORT void GL_APIENTRY DrawBuffersContextANGLE(GLeglContext ctx,
GLsizei n,
const GLenum *bufs);
@ -1306,6 +1323,12 @@ ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedANGLEContextANGLE(GLeglContex
GLenum type,
const void *indices,
GLsizei primcount);
ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedEXTContextANGLE(GLeglContext ctx,
GLenum mode,
GLsizei count,
GLenum type,
const void *indices,
GLsizei primcount);
ANGLE_EXPORT void GL_APIENTRY DrawRangeElementsContextANGLE(GLeglContext ctx,
GLenum mode,
GLuint start,
@ -2767,6 +2790,9 @@ ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorContextANGLE(GLeglContext ctx,
ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorANGLEContextANGLE(GLeglContext ctx,
GLuint index,
GLuint divisor);
ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorEXTContextANGLE(GLeglContext ctx,
GLuint index,
GLuint divisor);
ANGLE_EXPORT void GL_APIENTRY VertexAttribFormatContextANGLE(GLeglContext ctx,
GLuint attribindex,
GLint size,

Просмотреть файл

@ -3636,6 +3636,29 @@ void GL_APIENTRY glFramebufferTextureEXT(GLenum target,
return gl::FramebufferTextureEXT(target, attachment, texture, level);
}
// GL_EXT_instanced_arrays
void GL_APIENTRY glDrawArraysInstancedEXT(GLenum mode,
GLint start,
GLsizei count,
GLsizei primcount)
{
return gl::DrawArraysInstancedEXT(mode, start, count, primcount);
}
void GL_APIENTRY glDrawElementsInstancedEXT(GLenum mode,
GLsizei count,
GLenum type,
const void *indices,
GLsizei primcount)
{
return gl::DrawElementsInstancedEXT(mode, count, type, indices, primcount);
}
void GL_APIENTRY glVertexAttribDivisorEXT(GLuint index, GLuint divisor)
{
return gl::VertexAttribDivisorEXT(index, divisor);
}
// GL_EXT_map_buffer_range
void GL_APIENTRY glFlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length)
{
@ -4924,6 +4947,15 @@ void GL_APIENTRY glDrawArraysInstancedANGLEContextANGLE(GLeglContext ctx,
return gl::DrawArraysInstancedANGLEContextANGLE(ctx, mode, first, count, primcount);
}
void GL_APIENTRY glDrawArraysInstancedEXTContextANGLE(GLeglContext ctx,
GLenum mode,
GLint start,
GLsizei count,
GLsizei primcount)
{
return gl::DrawArraysInstancedEXTContextANGLE(ctx, mode, start, count, primcount);
}
void GL_APIENTRY glDrawBuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLenum *bufs)
{
return gl::DrawBuffersContextANGLE(ctx, n, bufs);
@ -4971,6 +5003,16 @@ void GL_APIENTRY glDrawElementsInstancedANGLEContextANGLE(GLeglContext ctx,
return gl::DrawElementsInstancedANGLEContextANGLE(ctx, mode, count, type, indices, primcount);
}
void GL_APIENTRY glDrawElementsInstancedEXTContextANGLE(GLeglContext ctx,
GLenum mode,
GLsizei count,
GLenum type,
const void *indices,
GLsizei primcount)
{
return gl::DrawElementsInstancedEXTContextANGLE(ctx, mode, count, type, indices, primcount);
}
void GL_APIENTRY glDrawRangeElementsContextANGLE(GLeglContext ctx,
GLenum mode,
GLuint start,
@ -7879,6 +7921,13 @@ void GL_APIENTRY glVertexAttribDivisorANGLEContextANGLE(GLeglContext ctx,
return gl::VertexAttribDivisorANGLEContextANGLE(ctx, index, divisor);
}
void GL_APIENTRY glVertexAttribDivisorEXTContextANGLE(GLeglContext ctx,
GLuint index,
GLuint divisor)
{
return gl::VertexAttribDivisorEXTContextANGLE(ctx, index, divisor);
}
void GL_APIENTRY glVertexAttribFormatContextANGLE(GLeglContext ctx,
GLuint attribindex,
GLint size,

Просмотреть файл

@ -595,6 +595,11 @@ EXPORTS
; GL_EXT_geometry_shader
glFramebufferTextureEXT
; GL_EXT_instanced_arrays
glDrawArraysInstancedEXT
glDrawElementsInstancedEXT
glVertexAttribDivisorEXT
; GL_EXT_map_buffer_range
glFlushMappedBufferRangeEXT
glMapBufferRangeEXT
@ -842,12 +847,14 @@ EXPORTS
glDrawArraysIndirectContextANGLE
glDrawArraysInstancedContextANGLE
glDrawArraysInstancedANGLEContextANGLE
glDrawArraysInstancedEXTContextANGLE
glDrawBuffersContextANGLE
glDrawBuffersEXTContextANGLE
glDrawElementsContextANGLE
glDrawElementsIndirectContextANGLE
glDrawElementsInstancedContextANGLE
glDrawElementsInstancedANGLEContextANGLE
glDrawElementsInstancedEXTContextANGLE
glDrawRangeElementsContextANGLE
glDrawTexfOESContextANGLE
glDrawTexfvOESContextANGLE
@ -1329,6 +1336,7 @@ EXPORTS
glVertexAttribBindingContextANGLE
glVertexAttribDivisorContextANGLE
glVertexAttribDivisorANGLEContextANGLE
glVertexAttribDivisorEXTContextANGLE
glVertexAttribFormatContextANGLE
glVertexAttribI4iContextANGLE
glVertexAttribI4ivContextANGLE

Просмотреть файл

@ -359,6 +359,8 @@ ProcEntry g_procTable[] = {
{"glDrawArraysInstancedANGLE", P(gl::DrawArraysInstancedANGLE)},
{"glDrawArraysInstancedANGLEContextANGLE", P(gl::DrawArraysInstancedANGLEContextANGLE)},
{"glDrawArraysInstancedContextANGLE", P(gl::DrawArraysInstancedContextANGLE)},
{"glDrawArraysInstancedEXT", P(gl::DrawArraysInstancedEXT)},
{"glDrawArraysInstancedEXTContextANGLE", P(gl::DrawArraysInstancedEXTContextANGLE)},
{"glDrawBuffers", P(gl::DrawBuffers)},
{"glDrawBuffersContextANGLE", P(gl::DrawBuffersContextANGLE)},
{"glDrawBuffersEXT", P(gl::DrawBuffersEXT)},
@ -371,6 +373,8 @@ ProcEntry g_procTable[] = {
{"glDrawElementsInstancedANGLE", P(gl::DrawElementsInstancedANGLE)},
{"glDrawElementsInstancedANGLEContextANGLE", P(gl::DrawElementsInstancedANGLEContextANGLE)},
{"glDrawElementsInstancedContextANGLE", P(gl::DrawElementsInstancedContextANGLE)},
{"glDrawElementsInstancedEXT", P(gl::DrawElementsInstancedEXT)},
{"glDrawElementsInstancedEXTContextANGLE", P(gl::DrawElementsInstancedEXTContextANGLE)},
{"glDrawRangeElements", P(gl::DrawRangeElements)},
{"glDrawRangeElementsContextANGLE", P(gl::DrawRangeElementsContextANGLE)},
{"glDrawTexfOES", P(gl::DrawTexfOES)},
@ -1341,6 +1345,8 @@ ProcEntry g_procTable[] = {
{"glVertexAttribDivisorANGLE", P(gl::VertexAttribDivisorANGLE)},
{"glVertexAttribDivisorANGLEContextANGLE", P(gl::VertexAttribDivisorANGLEContextANGLE)},
{"glVertexAttribDivisorContextANGLE", P(gl::VertexAttribDivisorContextANGLE)},
{"glVertexAttribDivisorEXT", P(gl::VertexAttribDivisorEXT)},
{"glVertexAttribDivisorEXTContextANGLE", P(gl::VertexAttribDivisorEXTContextANGLE)},
{"glVertexAttribFormat", P(gl::VertexAttribFormat)},
{"glVertexAttribFormatContextANGLE", P(gl::VertexAttribFormatContextANGLE)},
{"glVertexAttribI4i", P(gl::VertexAttribI4i)},
@ -1368,5 +1374,5 @@ ProcEntry g_procTable[] = {
{"glWeightPointerOES", P(gl::WeightPointerOES)},
{"glWeightPointerOESContextANGLE", P(gl::WeightPointerOESContextANGLE)}};
size_t g_numProcs = 1284;
size_t g_numProcs = 1290;
} // namespace egl

Просмотреть файл

@ -428,6 +428,12 @@
"glVertexAttribDivisorANGLE"
],
"GL_EXT_instanced_arrays": [
"glDrawArraysInstancedEXT",
"glDrawElementsInstancedEXT",
"glVertexAttribDivisorEXT"
],
"GL_OES_get_program_binary": [
"glGetProgramBinaryOES",
"glProgramBinaryOES"

Просмотреть файл

@ -26,6 +26,11 @@ enum Draw
Indexed,
NonIndexed
};
enum Vendor
{
Angle,
Ext
};
} // namespace
class InstancingTest : public ANGLETest
@ -94,9 +99,17 @@ class InstancingTest : public ANGLETest
Geometry geometry,
Draw draw,
Storage storage,
Vendor vendor,
unsigned offset) // for NonIndexed/DrawArrays only
{
ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_ANGLE_instanced_arrays"));
if (vendor == Angle)
{
ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_ANGLE_instanced_arrays"));
}
else if (vendor == Ext)
{
ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_EXT_instanced_arrays"));
}
// TODO: Fix these. http://anglebug.com/3129
ANGLE_SKIP_TEST_IF(IsD3D9() && draw == Indexed && geometry == Point);
@ -128,31 +141,49 @@ class InstancingTest : public ANGLETest
glVertexAttribPointer(instanceAttrib, 1, GL_FLOAT, GL_FALSE, 0,
storage == Buffer ? nullptr : mInstanceData);
glEnableVertexAttribArray(instanceAttrib);
glVertexAttribDivisorANGLE(instanceAttrib, divisor);
if (vendor == Angle)
glVertexAttribDivisorANGLE(instanceAttrib, divisor);
else if (vendor == Ext)
glVertexAttribDivisorEXT(instanceAttrib, divisor);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glVertexAttribPointer(positionAttrib, 2, GL_FLOAT, GL_FALSE, 0,
geometry == Point ? kPointVertices : kQuadVertices);
glEnableVertexAttribArray(positionAttrib);
glVertexAttribDivisorANGLE(positionAttrib, 0);
if (vendor == Angle)
glVertexAttribDivisorANGLE(positionAttrib, 0);
else if (vendor == Ext)
glVertexAttribDivisorEXT(positionAttrib, 0);
glClear(GL_COLOR_BUFFER_BIT);
if (geometry == Point)
{
if (draw == Indexed)
glDrawElementsInstancedANGLE(GL_POINTS, ArraySize(kPointIndices), GL_UNSIGNED_SHORT,
kPointIndices, numInstance);
else
if (vendor == Angle)
glDrawElementsInstancedANGLE(GL_POINTS, ArraySize(kPointIndices),
GL_UNSIGNED_SHORT, kPointIndices, numInstance);
else
glDrawElementsInstancedEXT(GL_POINTS, ArraySize(kPointIndices),
GL_UNSIGNED_SHORT, kPointIndices, numInstance);
else if (vendor == Angle)
glDrawArraysInstancedANGLE(GL_POINTS, offset, 4 /*vertices*/, numInstance);
else
glDrawArraysInstancedEXT(GL_POINTS, offset, 4 /*vertices*/, numInstance);
}
else
{
if (draw == Indexed)
glDrawElementsInstancedANGLE(GL_TRIANGLES, ArraySize(kQuadIndices),
GL_UNSIGNED_SHORT, kQuadIndices, numInstance);
else
if (vendor == Angle)
glDrawElementsInstancedANGLE(GL_TRIANGLES, ArraySize(kQuadIndices),
GL_UNSIGNED_SHORT, kQuadIndices, numInstance);
else
glDrawElementsInstancedEXT(GL_TRIANGLES, ArraySize(kQuadIndices),
GL_UNSIGNED_SHORT, kQuadIndices, numInstance);
else if (vendor == Angle)
glDrawArraysInstancedANGLE(GL_TRIANGLES, offset, 6 /*vertices*/, numInstance);
else
glDrawArraysInstancedEXT(GL_TRIANGLES, offset, 6 /*vertices*/, numInstance);
}
ASSERT_GL_NO_ERROR();
@ -225,22 +256,22 @@ constexpr GLfloat InstancingTest::kPointVertices[];
constexpr GLushort InstancingTest::kQuadIndices[];
constexpr GLushort InstancingTest::kPointIndices[];
#define TEST_INDEXED(attrib, geometry, storage) \
TEST_P(InstancingTest, IndexedAttrib##attrib##geometry##storage) \
{ \
runTest(11, 2, attrib, geometry, Indexed, storage, 0); \
#define TEST_INDEXED(attrib, geometry, storage, vendor) \
TEST_P(InstancingTest, IndexedAttrib##attrib##geometry##storage##vendor) \
{ \
runTest(11, 2, attrib, geometry, Indexed, storage, vendor, 0); \
}
#define TEST_NONINDEXED(attrib, geometry, storage, offset) \
TEST_P(InstancingTest, NonIndexedAttrib##attrib##geometry##storage##Offset##offset) \
{ \
runTest(11, 2, attrib, geometry, NonIndexed, storage, offset); \
#define TEST_NONINDEXED(attrib, geometry, storage, vendor, offset) \
TEST_P(InstancingTest, NonIndexedAttrib##attrib##geometry##storage##vendor##Offset##offset) \
{ \
runTest(11, 2, attrib, geometry, NonIndexed, storage, vendor, offset); \
}
#define TEST_DIVISOR(numInstance, divisor) \
TEST_P(InstancingTest, Instances##numInstance##Divisor##divisor) \
{ \
runTest(numInstance, divisor, 1, Quad, NonIndexed, Buffer, 0); \
#define TEST_DIVISOR(numInstance, divisor) \
TEST_P(InstancingTest, Instances##numInstance##Divisor##divisor) \
{ \
runTest(numInstance, divisor, 1, Quad, NonIndexed, Buffer, Angle, 0); \
}
// D3D9 and D3D11 FL9_3, have a special codepath that rearranges the input layout sent to D3D,
@ -249,35 +280,58 @@ constexpr GLushort InstancingTest::kPointIndices[];
//
// Tests with a non-zero 'offset' check that "first" parameter to glDrawArraysInstancedANGLE is only
// an offset into the non-instanced vertex attributes.
TEST_INDEXED(0, Quad, Buffer)
TEST_INDEXED(0, Quad, Memory)
TEST_INDEXED(1, Quad, Buffer)
TEST_INDEXED(1, Quad, Memory)
TEST_INDEXED(0, Point, Buffer)
TEST_INDEXED(0, Point, Memory)
TEST_INDEXED(1, Point, Buffer)
TEST_INDEXED(1, Point, Memory)
TEST_INDEXED(0, Quad, Buffer, Angle)
TEST_INDEXED(0, Quad, Memory, Angle)
TEST_INDEXED(1, Quad, Buffer, Angle)
TEST_INDEXED(1, Quad, Memory, Angle)
TEST_INDEXED(0, Point, Buffer, Angle)
TEST_INDEXED(0, Point, Memory, Angle)
TEST_INDEXED(1, Point, Buffer, Angle)
TEST_INDEXED(1, Point, Memory, Angle)
TEST_INDEXED(0, Quad, Buffer, Ext)
TEST_INDEXED(0, Quad, Memory, Ext)
TEST_INDEXED(1, Quad, Buffer, Ext)
TEST_INDEXED(1, Quad, Memory, Ext)
TEST_INDEXED(0, Point, Buffer, Ext)
TEST_INDEXED(0, Point, Memory, Ext)
TEST_INDEXED(1, Point, Buffer, Ext)
TEST_INDEXED(1, Point, Memory, Ext)
// offset should be 0 or 4 for quads
TEST_NONINDEXED(0, Quad, Buffer, 0)
TEST_NONINDEXED(0, Quad, Buffer, 4)
TEST_NONINDEXED(0, Quad, Memory, 0)
TEST_NONINDEXED(0, Quad, Memory, 4)
TEST_NONINDEXED(1, Quad, Buffer, 0)
TEST_NONINDEXED(1, Quad, Buffer, 4)
TEST_NONINDEXED(1, Quad, Memory, 0)
TEST_NONINDEXED(1, Quad, Memory, 4)
TEST_NONINDEXED(0, Quad, Buffer, Angle, 0)
TEST_NONINDEXED(0, Quad, Buffer, Angle, 4)
TEST_NONINDEXED(0, Quad, Memory, Angle, 0)
TEST_NONINDEXED(0, Quad, Memory, Angle, 4)
TEST_NONINDEXED(1, Quad, Buffer, Angle, 0)
TEST_NONINDEXED(1, Quad, Buffer, Angle, 4)
TEST_NONINDEXED(1, Quad, Memory, Angle, 0)
TEST_NONINDEXED(1, Quad, Memory, Angle, 4)
TEST_NONINDEXED(0, Quad, Buffer, Ext, 0)
TEST_NONINDEXED(0, Quad, Buffer, Ext, 4)
TEST_NONINDEXED(0, Quad, Memory, Ext, 0)
TEST_NONINDEXED(0, Quad, Memory, Ext, 4)
TEST_NONINDEXED(1, Quad, Buffer, Ext, 0)
TEST_NONINDEXED(1, Quad, Buffer, Ext, 4)
TEST_NONINDEXED(1, Quad, Memory, Ext, 0)
TEST_NONINDEXED(1, Quad, Memory, Ext, 4)
// offset should be 0 or 2 for points
TEST_NONINDEXED(0, Point, Buffer, 0)
TEST_NONINDEXED(0, Point, Buffer, 2)
TEST_NONINDEXED(0, Point, Memory, 0)
TEST_NONINDEXED(0, Point, Memory, 2)
TEST_NONINDEXED(1, Point, Buffer, 0)
TEST_NONINDEXED(1, Point, Buffer, 2)
TEST_NONINDEXED(1, Point, Memory, 0)
TEST_NONINDEXED(1, Point, Memory, 2)
TEST_NONINDEXED(0, Point, Buffer, Angle, 0)
TEST_NONINDEXED(0, Point, Buffer, Angle, 2)
TEST_NONINDEXED(0, Point, Memory, Angle, 0)
TEST_NONINDEXED(0, Point, Memory, Angle, 2)
TEST_NONINDEXED(1, Point, Buffer, Angle, 0)
TEST_NONINDEXED(1, Point, Buffer, Angle, 2)
TEST_NONINDEXED(1, Point, Memory, Angle, 0)
TEST_NONINDEXED(1, Point, Memory, Angle, 2)
TEST_NONINDEXED(0, Point, Buffer, Ext, 0)
TEST_NONINDEXED(0, Point, Buffer, Ext, 2)
TEST_NONINDEXED(0, Point, Memory, Ext, 0)
TEST_NONINDEXED(0, Point, Memory, Ext, 2)
TEST_NONINDEXED(1, Point, Buffer, Ext, 0)
TEST_NONINDEXED(1, Point, Buffer, Ext, 2)
TEST_NONINDEXED(1, Point, Memory, Ext, 0)
TEST_NONINDEXED(1, Point, Memory, Ext, 2)
// The following tests produce each value of 'lastDrawn' in runTest() from 1 to kMaxDrawn, a few
// different ways.
@ -544,6 +598,7 @@ ANGLE_INSTANTIATE_TEST(InstancingTest,
ES2_D3D9(),
ES2_D3D11(),
ES2_D3D11_FL9_3(),
ES2_OPENGL(3, 0),
ES2_OPENGL(),
ES2_OPENGLES(),
ES2_VULKAN());

Просмотреть файл

@ -793,7 +793,7 @@ TEST_P(WebGLCompatibilityTest, EnableFramebufferMultisampleExtension)
}
// Test enabling the GL_ANGLE_instanced_arrays extension
TEST_P(WebGLCompatibilityTest, EnableInstancedArraysExtension)
TEST_P(WebGLCompatibilityTest, EnableInstancedArraysExtensionANGLE)
{
EXPECT_FALSE(extensionEnabled("GL_ANGLE_instanced_arrays"));
@ -818,6 +818,32 @@ TEST_P(WebGLCompatibilityTest, EnableInstancedArraysExtension)
}
}
// Test enabling the GL_EXT_instanced_arrays extension
TEST_P(WebGLCompatibilityTest, EnableInstancedArraysExtensionEXT)
{
EXPECT_FALSE(extensionEnabled("GL_EXT_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);
glVertexAttribDivisorEXT(0, 1);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
if (extensionRequestable("GL_EXT_instanced_arrays"))
{
glRequestExtensionANGLE("GL_EXT_instanced_arrays");
EXPECT_GL_NO_ERROR();
glGetVertexAttribiv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, &divisor);
glVertexAttribDivisorEXT(0, 1);
EXPECT_GL_NO_ERROR();
}
}
// Test enabling the GL_ANGLE_pack_reverse_row_order extension
TEST_P(WebGLCompatibilityTest, EnablePackReverseRowOrderExtension)
{

Просмотреть файл

@ -556,6 +556,9 @@ ANGLE_UTIL_EXPORT PFNGLISQUERYEXTPROC glIsQueryEXT;
ANGLE_UTIL_EXPORT PFNGLQUERYCOUNTEREXTPROC glQueryCounterEXT;
ANGLE_UTIL_EXPORT PFNGLDRAWBUFFERSEXTPROC glDrawBuffersEXT;
ANGLE_UTIL_EXPORT PFNGLFRAMEBUFFERTEXTUREEXTPROC glFramebufferTextureEXT;
ANGLE_UTIL_EXPORT PFNGLDRAWARRAYSINSTANCEDEXTPROC glDrawArraysInstancedEXT;
ANGLE_UTIL_EXPORT PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstancedEXT;
ANGLE_UTIL_EXPORT PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisorEXT;
ANGLE_UTIL_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC glFlushMappedBufferRangeEXT;
ANGLE_UTIL_EXPORT PFNGLMAPBUFFERRANGEEXTPROC glMapBufferRangeEXT;
ANGLE_UTIL_EXPORT PFNGLGETGRAPHICSRESETSTATUSEXTPROC glGetGraphicsResetStatusEXT;
@ -1304,6 +1307,10 @@ ANGLE_UTIL_EXPORT PFNGLISQUERYEXTCONTEXTANGLEPROC glIsQueryEXTContextANGLE;
ANGLE_UTIL_EXPORT PFNGLQUERYCOUNTEREXTCONTEXTANGLEPROC glQueryCounterEXTContextANGLE;
ANGLE_UTIL_EXPORT PFNGLDRAWBUFFERSEXTCONTEXTANGLEPROC glDrawBuffersEXTContextANGLE;
ANGLE_UTIL_EXPORT PFNGLFRAMEBUFFERTEXTUREEXTCONTEXTANGLEPROC glFramebufferTextureEXTContextANGLE;
ANGLE_UTIL_EXPORT PFNGLDRAWARRAYSINSTANCEDEXTCONTEXTANGLEPROC glDrawArraysInstancedEXTContextANGLE;
ANGLE_UTIL_EXPORT PFNGLDRAWELEMENTSINSTANCEDEXTCONTEXTANGLEPROC
glDrawElementsInstancedEXTContextANGLE;
ANGLE_UTIL_EXPORT PFNGLVERTEXATTRIBDIVISOREXTCONTEXTANGLEPROC glVertexAttribDivisorEXTContextANGLE;
ANGLE_UTIL_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEEXTCONTEXTANGLEPROC
glFlushMappedBufferRangeEXTContextANGLE;
ANGLE_UTIL_EXPORT PFNGLMAPBUFFERRANGEEXTCONTEXTANGLEPROC glMapBufferRangeEXTContextANGLE;
@ -2270,6 +2277,12 @@ void LoadGLES(LoadProc loadProc)
glDrawBuffersEXT = reinterpret_cast<PFNGLDRAWBUFFERSEXTPROC>(loadProc("glDrawBuffersEXT"));
glFramebufferTextureEXT =
reinterpret_cast<PFNGLFRAMEBUFFERTEXTUREEXTPROC>(loadProc("glFramebufferTextureEXT"));
glDrawArraysInstancedEXT =
reinterpret_cast<PFNGLDRAWARRAYSINSTANCEDEXTPROC>(loadProc("glDrawArraysInstancedEXT"));
glDrawElementsInstancedEXT =
reinterpret_cast<PFNGLDRAWELEMENTSINSTANCEDEXTPROC>(loadProc("glDrawElementsInstancedEXT"));
glVertexAttribDivisorEXT =
reinterpret_cast<PFNGLVERTEXATTRIBDIVISOREXTPROC>(loadProc("glVertexAttribDivisorEXT"));
glFlushMappedBufferRangeEXT = reinterpret_cast<PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC>(
loadProc("glFlushMappedBufferRangeEXT"));
glMapBufferRangeEXT =
@ -3667,6 +3680,15 @@ void LoadGLES(LoadProc loadProc)
glFramebufferTextureEXTContextANGLE =
reinterpret_cast<PFNGLFRAMEBUFFERTEXTUREEXTCONTEXTANGLEPROC>(
loadProc("glFramebufferTextureEXTContextANGLE"));
glDrawArraysInstancedEXTContextANGLE =
reinterpret_cast<PFNGLDRAWARRAYSINSTANCEDEXTCONTEXTANGLEPROC>(
loadProc("glDrawArraysInstancedEXTContextANGLE"));
glDrawElementsInstancedEXTContextANGLE =
reinterpret_cast<PFNGLDRAWELEMENTSINSTANCEDEXTCONTEXTANGLEPROC>(
loadProc("glDrawElementsInstancedEXTContextANGLE"));
glVertexAttribDivisorEXTContextANGLE =
reinterpret_cast<PFNGLVERTEXATTRIBDIVISOREXTCONTEXTANGLEPROC>(
loadProc("glVertexAttribDivisorEXTContextANGLE"));
glFlushMappedBufferRangeEXTContextANGLE =
reinterpret_cast<PFNGLFLUSHMAPPEDBUFFERRANGEEXTCONTEXTANGLEPROC>(
loadProc("glFlushMappedBufferRangeEXTContextANGLE"));

Просмотреть файл

@ -584,6 +584,9 @@ ANGLE_UTIL_EXPORT extern PFNGLISQUERYEXTPROC glIsQueryEXT;
ANGLE_UTIL_EXPORT extern PFNGLQUERYCOUNTEREXTPROC glQueryCounterEXT;
ANGLE_UTIL_EXPORT extern PFNGLDRAWBUFFERSEXTPROC glDrawBuffersEXT;
ANGLE_UTIL_EXPORT extern PFNGLFRAMEBUFFERTEXTUREEXTPROC glFramebufferTextureEXT;
ANGLE_UTIL_EXPORT extern PFNGLDRAWARRAYSINSTANCEDEXTPROC glDrawArraysInstancedEXT;
ANGLE_UTIL_EXPORT extern PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstancedEXT;
ANGLE_UTIL_EXPORT extern PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisorEXT;
ANGLE_UTIL_EXPORT extern PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC glFlushMappedBufferRangeEXT;
ANGLE_UTIL_EXPORT extern PFNGLMAPBUFFERRANGEEXTPROC glMapBufferRangeEXT;
ANGLE_UTIL_EXPORT extern PFNGLGETGRAPHICSRESETSTATUSEXTPROC glGetGraphicsResetStatusEXT;
@ -1392,6 +1395,12 @@ ANGLE_UTIL_EXPORT extern PFNGLQUERYCOUNTEREXTCONTEXTANGLEPROC glQueryCounterEXTC
ANGLE_UTIL_EXPORT extern PFNGLDRAWBUFFERSEXTCONTEXTANGLEPROC glDrawBuffersEXTContextANGLE;
ANGLE_UTIL_EXPORT extern PFNGLFRAMEBUFFERTEXTUREEXTCONTEXTANGLEPROC
glFramebufferTextureEXTContextANGLE;
ANGLE_UTIL_EXPORT extern PFNGLDRAWARRAYSINSTANCEDEXTCONTEXTANGLEPROC
glDrawArraysInstancedEXTContextANGLE;
ANGLE_UTIL_EXPORT extern PFNGLDRAWELEMENTSINSTANCEDEXTCONTEXTANGLEPROC
glDrawElementsInstancedEXTContextANGLE;
ANGLE_UTIL_EXPORT extern PFNGLVERTEXATTRIBDIVISOREXTCONTEXTANGLEPROC
glVertexAttribDivisorEXTContextANGLE;
ANGLE_UTIL_EXPORT extern PFNGLFLUSHMAPPEDBUFFERRANGEEXTCONTEXTANGLEPROC
glFlushMappedBufferRangeEXTContextANGLE;
ANGLE_UTIL_EXPORT extern PFNGLMAPBUFFERRANGEEXTCONTEXTANGLEPROC glMapBufferRangeEXTContextANGLE;