Skip to content

Commit

Permalink
gles: Separate draw calls from transform feedback calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-clayton committed Aug 24, 2017
1 parent 5b5e325 commit dab1ab3
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 27 deletions.
39 changes: 29 additions & 10 deletions gapis/api/gles/api/draw_commands.api
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,18 @@ sub void checkIndicesType(GLenum indices_type) {
}
}

sub bool isDrawCall() {
return !isTransformFeedback()
}

sub bool isTransformFeedback() {
ctx := GetContext()
return ctx.Bound.TransformFeedback.Active == GL_TRUE
}

@if(Version.GLES10)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/opengles/sdk/docs/man/xhtml/glDrawArrays.xml", Version.GLES20)
@doc("https://www.khronos.org/opengles/sdk/docs/man3/html/glDrawArrays.xhtml", Version.GLES30)
@doc("https://www.khronos.org/opengles/sdk/docs/man31/html/glDrawArrays.xhtml", Version.GLES31)
Expand All @@ -59,7 +69,8 @@ cmd void glDrawArrays(GLenum draw_mode, GLint first_index, GLsizei indices_count
}

@if(Version.GLES31)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/opengles/sdk/docs/man31/html/glDrawArraysIndirect.xhtml", Version.GLES31)
@doc("https://www.khronos.org/opengles/sdk/docs/man32/html/glDrawArraysIndirect.xhtml", Version.GLES32)
cmd void glDrawArraysIndirect(GLenum draw_mode, const void* indirect) {
Expand All @@ -72,7 +83,8 @@ cmd void glDrawArraysIndirect(GLenum draw_mode, const void* indirect) {
}

@if(Version.GLES30)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/opengles/sdk/docs/man3/html/glDrawArraysInstanced.xhtml", Version.GLES30)
@doc("https://www.khronos.org/opengles/sdk/docs/man31/html/glDrawArraysInstanced.xhtml", Version.GLES31)
@doc("https://www.khronos.org/opengles/sdk/docs/man32/html/glDrawArraysInstanced.xhtml", Version.GLES32)
Expand Down Expand Up @@ -132,7 +144,8 @@ sub void DrawElements(ref!Context ctx,
}

@if(Version.GLES10)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/opengles/sdk/docs/man/xhtml/glDrawElements.xml", Version.GLES20)
@doc("https://www.khronos.org/opengles/sdk/docs/man3/html/glDrawElements.xhtml", Version.GLES30)
@doc("https://www.khronos.org/opengles/sdk/docs/man31/html/glDrawElements.xhtml", Version.GLES31)
Expand All @@ -146,7 +159,8 @@ cmd void glDrawElements(GLenum draw_mode,
}

@if(Version.GLES32)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/opengles/sdk/docs/man32/html/glDrawElementsBaseVertex.xhtml", Version.GLES32)
cmd void glDrawElementsBaseVertex(GLenum draw_mode,
GLsizei indices_count,
Expand All @@ -162,7 +176,8 @@ sub void DrawElementsBaseVertex(GLenum draw_mode, GLsizei indices_count, GLenum
}

@if(Version.GLES31)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/opengles/sdk/docs/man31/html/glDrawElementsIndirect.xhtml", Version.GLES31)
@doc("https://www.khronos.org/opengles/sdk/docs/man32/html/glDrawElementsIndirect.xhtml", Version.GLES32)
cmd void glDrawElementsIndirect(GLenum draw_mode, GLenum indices_type, const void* indirect) {
Expand All @@ -178,7 +193,8 @@ cmd void glDrawElementsIndirect(GLenum draw_mode, GLenum indices_type, const voi
}

@if(Version.GLES30)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/opengles/sdk/docs/man3/html/glDrawElementsInstanced.xhtml", Version.GLES30)
@doc("https://www.khronos.org/opengles/sdk/docs/man31/html/glDrawElementsInstanced.xhtml", Version.GLES31)
@doc("https://www.khronos.org/opengles/sdk/docs/man32/html/glDrawElementsInstanced.xhtml", Version.GLES32)
Expand All @@ -196,7 +212,8 @@ sub void DrawElementsInstanced(GLenum draw_mode, GLsizei indices_count, GLenum i
}

@if(Version.GLES32)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/opengles/sdk/docs/man32/html/glDrawElementsInstancedBaseVertex.xhtml", Version.GLES32)
cmd void glDrawElementsInstancedBaseVertex(GLenum draw_mode,
GLsizei indices_count,
Expand All @@ -213,7 +230,8 @@ sub void DrawElementsInstancedBaseVertex(GLenum draw_mode, GLsizei indices_count
}

@if(Version.GLES30)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/opengles/sdk/docs/man3/html/glDrawRangeElements.xhtml", Version.GLES30)
@doc("https://www.khronos.org/opengles/sdk/docs/man31/html/glDrawRangeElements.xhtml", Version.GLES31)
@doc("https://www.khronos.org/opengles/sdk/docs/man32/html/glDrawRangeElements.xhtml", Version.GLES32)
Expand All @@ -229,7 +247,8 @@ cmd void glDrawRangeElements(GLenum draw_mode,
}

@if(Version.GLES32)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/opengles/sdk/docs/man32/html/glDrawRangeElementsBaseVertex.xhtml", Version.GLES32)
cmd void glDrawRangeElementsBaseVertex(GLenum draw_mode,
GLuint start,
Expand Down
51 changes: 34 additions & 17 deletions gapis/api/gles/api/extensions.api
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,16 @@ cmd void glDiscardFramebufferEXT(GLenum target,
}

@if(Extension.GL_ANGLE_instanced_arrays)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/ANGLE/ANGLE_instanced_arrays.txt", Extension.GL_ANGLE_instanced_arrays)
cmd void glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount) {
DrawArraysInstanced(mode, first, count, primcount)
}

@if(Extension.GL_EXT_base_instance)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_base_instance.txt", Extension.GL_EXT_base_instance)
cmd void glDrawArraysInstancedBaseInstanceEXT(GLenum mode,
GLint first,
Expand All @@ -438,15 +440,17 @@ cmd void glDrawArraysInstancedBaseInstanceEXT(GLenum mode,
}

@if(Extension.GL_EXT_draw_instanced || Extension.GL_EXT_instanced_arrays)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_draw_instanced.txt", Extension.GL_EXT_draw_instanced)
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_instanced_arrays.txt", Extension.GL_EXT_instanced_arrays)
cmd void glDrawArraysInstancedEXT(GLenum mode, GLint start, GLsizei count, GLsizei primcount) {
DrawArraysInstanced(mode, start, count, primcount)
}

@if(Extension.GL_NV_draw_instanced)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/NV/NV_draw_instanced.txt", Extension.GL_NV_draw_instanced)
cmd void glDrawArraysInstancedNV(GLenum mode, GLint first, GLsizei count, GLsizei primcount) {
DrawArraysInstanced(mode, first, count, primcount)
Expand All @@ -471,7 +475,8 @@ cmd void glDrawBuffersNV(GLsizei n, const GLenum* bufs) {
}

@if(Extension.GL_EXT_draw_elements_base_vertex)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_draw_elements_base_vertex.txt", Extension.GL_EXT_draw_elements_base_vertex)
cmd void glDrawElementsBaseVertexEXT(GLenum mode,
GLsizei count,
Expand All @@ -482,7 +487,8 @@ cmd void glDrawElementsBaseVertexEXT(GLenum mode,
}

@if(Extension.GL_OES_draw_elements_base_vertex)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/OES/OES_draw_elements_base_vertex.txt", Extension.GL_OES_draw_elements_base_vertex)
cmd void glDrawElementsBaseVertexOES(GLenum mode,
GLsizei count,
Expand All @@ -493,7 +499,8 @@ cmd void glDrawElementsBaseVertexOES(GLenum mode,
}

@if(Extension.GL_ANGLE_instanced_arrays)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/ANGLE/ANGLE_instanced_arrays.txt", Extension.GL_ANGLE_instanced_arrays)
cmd void glDrawElementsInstancedANGLE(GLenum mode,
GLsizei count,
Expand All @@ -504,7 +511,8 @@ cmd void glDrawElementsInstancedANGLE(GLenum mode,
}

@if(Extension.GL_EXT_base_instance)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_base_instance.txt", Extension.GL_EXT_base_instance)
cmd void glDrawElementsInstancedBaseInstanceEXT(GLenum mode,
GLsizei count,
Expand All @@ -516,7 +524,8 @@ cmd void glDrawElementsInstancedBaseInstanceEXT(GLenum mode,
}

@if(Extension.GL_EXT_base_instance)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_base_instance.txt", Extension.GL_EXT_base_instance)
cmd void glDrawElementsInstancedBaseVertexBaseInstanceEXT(GLenum mode,
GLsizei count,
Expand All @@ -529,7 +538,8 @@ cmd void glDrawElementsInstancedBaseVertexBaseInstanceEXT(GLenum mode,
}

@if(Extension.GL_EXT_draw_elements_base_vertex)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_draw_elements_base_vertex.txt", Extension.GL_EXT_draw_elements_base_vertex)
cmd void glDrawElementsInstancedBaseVertexEXT(GLenum mode,
GLsizei count,
Expand All @@ -541,7 +551,8 @@ cmd void glDrawElementsInstancedBaseVertexEXT(GLenum mode,
}

@if(Extension.GL_OES_draw_elements_base_vertex)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/OES/OES_draw_elements_base_vertex.txt", Extension.GL_OES_draw_elements_base_vertex)
cmd void glDrawElementsInstancedBaseVertexOES(GLenum mode,
GLsizei count,
Expand All @@ -553,7 +564,8 @@ cmd void glDrawElementsInstancedBaseVertexOES(GLenum mode,
}

@if(Extension.GL_EXT_draw_instanced || Extension.GL_EXT_instanced_arrays)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_draw_instanced.txt", Extension.GL_EXT_draw_instanced)
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_instanced_arrays.txt", Extension.GL_EXT_instanced_arrays)
cmd void glDrawElementsInstancedEXT(GLenum mode,
Expand All @@ -565,7 +577,8 @@ cmd void glDrawElementsInstancedEXT(GLenum mode,
}

@if(Extension.GL_NV_draw_instanced)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/NV/NV_draw_instanced.txt", Extension.GL_NV_draw_instanced)
cmd void glDrawElementsInstancedNV(GLenum mode,
GLsizei count,
Expand All @@ -576,7 +589,8 @@ cmd void glDrawElementsInstancedNV(GLenum mode,
}

@if(Extension.GL_EXT_draw_elements_base_vertex)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_draw_elements_base_vertex.txt", Extension.GL_EXT_draw_elements_base_vertex)
cmd void glDrawRangeElementsBaseVertexEXT(GLenum mode,
GLuint start,
Expand All @@ -589,7 +603,8 @@ cmd void glDrawRangeElementsBaseVertexEXT(GLenum mode,
}

@if(Extension.GL_OES_draw_elements_base_vertex)
@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@doc("https://www.khronos.org/registry/gles/extensions/OES/OES_draw_elements_base_vertex.txt", Extension.GL_OES_draw_elements_base_vertex)
cmd void glDrawRangeElementsBaseVertexOES(GLenum mode,
GLuint start,
Expand Down Expand Up @@ -2871,13 +2886,15 @@ cmd void glDepthRangeArrayfvOES(GLuint first, GLsizei count, const GLfloat* v) {
cmd void glDepthRangeIndexedfOES(GLuint index, GLfloat n, GLfloat f) {
}

@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@if(Extension.GL_EXT_draw_transform_feedback)
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_draw_transform_feedback.txt", Extension.GL_EXT_draw_transform_feedback)
cmd void glDrawTransformFeedbackEXT(GLenum mode, GLuint id) {
}

@draw_call
@draw_call(isDrawCall())
@transform_feedback(isTransformFeedback())
@if(Extension.GL_EXT_draw_transform_feedback)
@doc("https://www.khronos.org/registry/gles/extensions/EXT/EXT_draw_transform_feedback.txt", Extension.GL_EXT_draw_transform_feedback)
cmd void glDrawTransformFeedbackInstancedEXT(GLenum mode, GLuint id, GLsizei instancecount) {
Expand Down

0 comments on commit dab1ab3

Please sign in to comment.