aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLVertexArray.h
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-05-31 12:51:23 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-31 20:40:20 +0000
commit1d6163577c8a4f1372208e2c9e03b1a69906d385 (patch)
treefdacaa2e860d507bafca16cef0cb6e6e7861a1aa /src/gpu/gl/GrGLVertexArray.h
parentfa6d865215b48fac4ee24c120736e500d418f641 (diff)
Add support for instanced draws
Adds an instance buffer to GrMesh and instance attribs to GrPrimitiveProcessor. Implements support in GL and Vulkan. Adds unit tests for instanced rendering with GrMesh. Bug: skia: Change-Id: If1a9920feb9366f346b8c37cf914713c49129b3a Reviewed-on: https://skia-review.googlesource.com/16200 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/gl/GrGLVertexArray.h')
-rw-r--r--src/gpu/gl/GrGLVertexArray.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gpu/gl/GrGLVertexArray.h b/src/gpu/gl/GrGLVertexArray.h
index 1970e30425..553df4f3fd 100644
--- a/src/gpu/gl/GrGLVertexArray.h
+++ b/src/gpu/gl/GrGLVertexArray.h
@@ -42,7 +42,8 @@ public:
const GrBuffer* vertexBuffer,
GrVertexAttribType type,
GrGLsizei stride,
- size_t offsetInBytes);
+ size_t offsetInBytes,
+ int divisor = 0);
/**
* This function enables the first 'enabledCount' vertex arrays and disables the rest.
@@ -63,16 +64,22 @@ public:
int count() const { return fAttribArrayStates.count(); }
private:
+ static constexpr int kInvalidDivisor = -1;
+
/**
* Tracks the state of glVertexAttribArray for an attribute index.
*/
struct AttribArrayState {
- void invalidate() { fVertexBufferUniqueID.makeInvalid(); }
+ void invalidate() {
+ fVertexBufferUniqueID.makeInvalid();
+ fDivisor = kInvalidDivisor;
+ }
GrGpuResource::UniqueID fVertexBufferUniqueID;
GrVertexAttribType fType;
GrGLsizei fStride;
size_t fOffset;
+ int fDivisor;
};
SkSTArray<16, AttribArrayState, true> fAttribArrayStates;