skia: Make the validate match interface for *_draw_instanced

For whatever reason, on the Mac, the command buffer is reporting
ARB_draw_instanced as a valid extension. This is probably a bug in the
command buffer and I'll look into this later.

In Skia, we don't check for ARB_draw_instanced in GLES2 when building
the interface, but during the validate, we do, so we ended up failing
the validation.

Looking a bit further at the specs, ARB_draw_instanced is GL only,
whereas EXT_draw_instanced is both GL and GLES.  I've updated the code
to reflect this.

See:
https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/specs/ARB/draw_instanced.txt
https://www.opengl.org/registry/specs/EXT/draw_instanced.txt

Everything above also applies to ARB/EXT_instanced_arrays

https://www.khronos.org/registry/gles/extensions/EXT/EXT_instanced_arrays.txt
https://www.opengl.org/registry/specs/ARB/instanced_arrays.txt

Review URL: https://codereview.chromium.org/1409053003
This commit is contained in:
hendrikw 2015-10-19 06:13:55 -07:00 committed by Commit bot
parent 44d85d1748
commit b3f1636ec8
2 changed files with 29 additions and 16 deletions

View File

@ -317,7 +317,8 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
GET_PROC(GetProgramResourceLocation);
}
if (glVer >= GR_GL_VER(3,1) || extensions.has("GL_ARB_draw_instanced")) {
if (glVer >= GR_GL_VER(3,1) || extensions.has("GL_ARB_draw_instanced") ||
extensions.has("GL_EXT_draw_instanced")) {
GET_PROC(DrawArraysInstanced);
GET_PROC(DrawElementsInstanced);
}

View File

@ -544,23 +544,35 @@ bool GrGLInterface::validate() const {
}
}
if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,1)) ||
(kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) ||
fExtensions.has("GL_ARB_draw_instanced") ||
fExtensions.has("GL_EXT_draw_instanced")) {
if (nullptr == fFunctions.fDrawArraysInstanced ||
nullptr == fFunctions.fDrawElementsInstanced) {
RETURN_FALSE_INTERFACE
}
if (kGL_GrGLStandard == fStandard) {
if (glVer >= GR_GL_VER(3,1) ||
fExtensions.has("GL_EXT_draw_instanced") || fExtensions.has("GL_ARB_draw_instanced")) {
if (nullptr == fFunctions.fDrawArraysInstanced ||
nullptr == fFunctions.fDrawElementsInstanced) {
RETURN_FALSE_INTERFACE
}
}
} else if (kGLES_GrGLStandard == fStandard) {
if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_draw_instanced")) {
if (nullptr == fFunctions.fDrawArraysInstanced ||
nullptr == fFunctions.fDrawElementsInstanced) {
RETURN_FALSE_INTERFACE
}
}
}
if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,2)) ||
(kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) ||
fExtensions.has("GL_ARB_instanced_arrays") ||
fExtensions.has("GL_EXT_instanced_arrays")) {
if (nullptr == fFunctions.fVertexAttribDivisor) {
RETURN_FALSE_INTERFACE
}
if (kGL_GrGLStandard == fStandard) {
if (glVer >= GR_GL_VER(3,2) || fExtensions.has("GL_ARB_instanced_arrays")) {
if (nullptr == fFunctions.fVertexAttribDivisor) {
RETURN_FALSE_INTERFACE
}
}
} else if (kGLES_GrGLStandard == fStandard) {
if (glVer >= GR_GL_VER(3,0) || fExtensions.has("GL_EXT_instanced_arrays")) {
if (nullptr == fFunctions.fVertexAttribDivisor) {
RETURN_FALSE_INTERFACE
}
}
}
if (fExtensions.has("GL_NV_bindless_texture")) {