From 06604b95622359640a1c2028b885646deda28d52 Mon Sep 17 00:00:00 2001 From: cdalton Date: Fri, 5 Feb 2016 10:09:51 -0800 Subject: Add GL indirect drawing APIs BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1666803002 Review URL: https://codereview.chromium.org/1666803002 --- include/gpu/gl/GrGLFunctions.h | 22 ++++++++-------------- include/gpu/gl/GrGLInterface.h | 14 ++++++++------ include/gpu/gl/GrGLTypes.h | 32 +++++++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/gpu/gl/GrGLFunctions.h b/include/gpu/gl/GrGLFunctions.h index 1086186df8..ad59ec0c00 100644 --- a/include/gpu/gl/GrGLFunctions.h +++ b/include/gpu/gl/GrGLFunctions.h @@ -13,14 +13,6 @@ extern "C" { -typedef void (GR_GL_FUNCTION_TYPE* GRGLDEBUGPROC)(GrGLenum source, - GrGLenum type, - GrGLuint id, - GrGLenum severity, - GrGLsizei length, - const GrGLchar* message, - const void* userParam); - /////////////////////////////////////////////////////////////////////////////// typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLActiveTextureProc)(GrGLenum texture); @@ -66,9 +58,13 @@ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDepthMaskProc)(GrGLboolean flag); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDisableProc)(GrGLenum cap); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDisableVertexAttribArrayProc)(GrGLuint index); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawArraysProc)(GrGLenum mode, GrGLint first, GrGLsizei count); +typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawArraysInstancedProc)(GrGLenum mode, GrGLint first, GrGLsizei count, GrGLsizei primcount); +typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawArraysIndirectProc)(GrGLenum mode, GrGLvoid* indirect); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawBufferProc)(GrGLenum mode); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawBuffersProc)(GrGLsizei n, const GrGLenum* bufs); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawElementsProc)(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid* indices); +typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawElementsInstancedProc)(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid *indices, GrGLsizei primcount); +typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawElementsIndirectProc)(GrGLenum mode, GrGLenum type, GrGLvoid* indirect); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEGLImageTargetTexture2DProc)(GrGLenum target, GrGLeglImage image); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEnableProc)(GrGLenum cap); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEnableVertexAttribArrayProc)(GrGLuint index); @@ -179,6 +175,7 @@ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexAttrib1fProc)(GrGLuint indx, co typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexAttrib2fvProc)(GrGLuint indx, const GrGLfloat* values); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexAttrib3fvProc)(GrGLuint indx, const GrGLfloat* values); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexAttrib4fvProc)(GrGLuint indx, const GrGLfloat* values); +typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexAttribDivisorProc)(GrGLuint index, GrGLuint divisor); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexAttribPointerProc)(GrGLuint indx, GrGLint size, GrGLenum type, GrGLboolean normalized, GrGLsizei stride, const GrGLvoid* ptr); typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLViewportProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height); @@ -216,12 +213,9 @@ typedef GrGLint (GR_GL_FUNCTION_TYPE* GrGLGetProgramResourceLocationProc)(GrGLui /* GL_NV_framebuffer_mixed_samples */ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCoverageModulationProc)(GrGLenum components); -/* ARB_draw_instanced */ -typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawArraysInstancedProc)(GrGLenum mode, GrGLint first, GrGLsizei count, GrGLsizei primcount); -typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawElementsInstancedProc)(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid *indices, GrGLsizei primcount); - -/* ARB_instanced_arrays */ -typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexAttribDivisorProc)(GrGLuint index, GrGLuint divisor); +/* EXT_multi_draw_indirect */ +typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLMultiDrawArraysIndirectProc)(GrGLenum mode, const GrGLvoid *indirect, GrGLsizei drawcount, GrGLsizei stride); +typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLMultiDrawElementsIndirectProc)(GrGLenum mode, GrGLenum type, const GrGLvoid *indirect, GrGLsizei drawcount, GrGLsizei stride); /* NV_bindless_texture */ typedef GrGLuint64 (GR_GL_FUNCTION_TYPE* GrGLGetTextureHandleProc)(GrGLuint texture); diff --git a/include/gpu/gl/GrGLInterface.h b/include/gpu/gl/GrGLInterface.h index 5fa31eda94..dd9a9fb386 100644 --- a/include/gpu/gl/GrGLInterface.h +++ b/include/gpu/gl/GrGLInterface.h @@ -196,9 +196,13 @@ public: GLPtr fDisable; GLPtr fDisableVertexAttribArray; GLPtr fDrawArrays; + GLPtr fDrawArraysIndirect; + GLPtr fDrawArraysInstanced; GLPtr fDrawBuffer; GLPtr fDrawBuffers; GLPtr fDrawElements; + GLPtr fDrawElementsIndirect; + GLPtr fDrawElementsInstanced; GLPtr fEnable; GLPtr fEnableVertexAttribArray; GLPtr fEndQuery; @@ -327,6 +331,7 @@ public: GLPtr fVertexAttrib2fv; GLPtr fVertexAttrib3fv; GLPtr fVertexAttrib4fv; + GLPtr fVertexAttribDivisor; GLPtr fVertexAttribPointer; GLPtr fViewport; @@ -362,12 +367,9 @@ public: /* NV_framebuffer_mixed_samples */ GLPtr fCoverageModulation; - /* ARB_draw_instanced */ - GLPtr fDrawArraysInstanced; - GLPtr fDrawElementsInstanced; - - /* ARB_instanced_arrays */ - GLPtr fVertexAttribDivisor; + /* EXT_multi_draw_indirect */ + GLPtr fMultiDrawArraysIndirect; + GLPtr fMultiDrawElementsIndirect; /* NV_bindless_texture */ // We use the NVIDIA verson for now because it does not require dynamically uniform handles. diff --git a/include/gpu/gl/GrGLTypes.h b/include/gpu/gl/GrGLTypes.h index 248ce8886d..d0edcf101e 100644 --- a/include/gpu/gl/GrGLTypes.h +++ b/include/gpu/gl/GrGLTypes.h @@ -58,10 +58,40 @@ typedef signed long int GrGLintptr; typedef signed long int GrGLsizeiptr; #endif typedef void* GrGLeglImage; + +struct GrGLDrawArraysIndirectCommand { + GrGLuint fCount; + GrGLuint fInstanceCount; + GrGLuint fFirst; + GrGLuint fBaseInstance; // Requires EXT_base_instance on ES. +}; + +GR_STATIC_ASSERT(16 == sizeof(GrGLDrawArraysIndirectCommand)); + +struct GrGLDrawElementsIndirectCommand { + GrGLuint fCount; + GrGLuint fInstanceCount; + GrGLuint fFirstIndex; + GrGLuint fBaseVertex; + GrGLuint fBaseInstance; // Requires EXT_base_instance on ES. +}; + +GR_STATIC_ASSERT(20 == sizeof(GrGLDrawElementsIndirectCommand)); + /** - * EGL types. + * KHR_debug */ +typedef void (GR_GL_FUNCTION_TYPE* GRGLDEBUGPROC)(GrGLenum source, + GrGLenum type, + GrGLuint id, + GrGLenum severity, + GrGLsizei length, + const GrGLchar* message, + const void* userParam); +/** + * EGL types. + */ typedef void* GrEGLImage; typedef void* GrEGLDisplay; typedef void* GrEGLContext; -- cgit v1.2.3