aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLVertexArray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gl/GrGLVertexArray.cpp')
-rw-r--r--src/gpu/gl/GrGLVertexArray.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gpu/gl/GrGLVertexArray.cpp b/src/gpu/gl/GrGLVertexArray.cpp
index 74e609e9b8..59f2be9831 100644
--- a/src/gpu/gl/GrGLVertexArray.cpp
+++ b/src/gpu/gl/GrGLVertexArray.cpp
@@ -53,8 +53,10 @@ void GrGLAttribArrayState::set(GrGLGpu* gpu,
const GrBuffer* vertexBuffer,
GrVertexAttribType type,
GrGLsizei stride,
- size_t offsetInBytes) {
+ size_t offsetInBytes,
+ int divisor) {
SkASSERT(index >= 0 && index < fAttribArrayStates.count());
+ SkASSERT(0 == divisor || gpu->caps()->instanceAttribSupport());
AttribArrayState* array = &fAttribArrayStates[index];
if (array->fVertexBufferUniqueID != vertexBuffer->uniqueID() ||
array->fType != type ||
@@ -84,10 +86,18 @@ void GrGLAttribArrayState::set(GrGLGpu* gpu,
array->fStride = stride;
array->fOffset = offsetInBytes;
}
+ if (gpu->caps()->instanceAttribSupport() && array->fDivisor != divisor) {
+ SkASSERT(0 == divisor || 1 == divisor); // not necessarily a requirement but what we expect.
+ GR_GL_CALL(gpu->glInterface(), VertexAttribDivisor(index, divisor));
+ array->fDivisor = divisor;
+ }
}
void GrGLAttribArrayState::enableVertexArrays(const GrGLGpu* gpu, int enabledCount) {
SkASSERT(enabledCount <= fAttribArrayStates.count());
+ if (fEnabledCountIsValid && enabledCount == fNumEnabledArrays) {
+ return;
+ }
int firstIdxToEnable = fEnabledCountIsValid ? fNumEnabledArrays : 0;
for (int i = firstIdxToEnable; i < enabledCount; ++i) {