summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp')
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp b/src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp
index 19934e7fac..13d78fd13c 100644
--- a/src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp
+++ b/src/3rdparty/angle/src/libANGLE/VertexAttribute.cpp
@@ -23,24 +23,6 @@ VertexAttribute::VertexAttribute()
{
}
-bool operator==(const VertexAttribute &a, const VertexAttribute &b)
-{
- return a.enabled == b.enabled &&
- a.type == b.type &&
- a.size == b.size &&
- a.normalized == b.normalized &&
- a.pureInteger == b.pureInteger &&
- a.stride == b.stride &&
- a.pointer == b.pointer &&
- a.buffer.get() == b.buffer.get() &&
- a.divisor == b.divisor;
-}
-
-bool operator!=(const VertexAttribute &a, const VertexAttribute &b)
-{
- return !(a == b);
-}
-
size_t ComputeVertexAttributeTypeSize(const VertexAttribute& attrib)
{
GLuint size = attrib.size;
@@ -70,4 +52,23 @@ size_t ComputeVertexAttributeStride(const VertexAttribute& attrib)
return attrib.stride ? attrib.stride : ComputeVertexAttributeTypeSize(attrib);
}
+size_t ComputeVertexAttributeElementCount(const VertexAttribute &attrib,
+ size_t drawCount,
+ size_t instanceCount)
+{
+ // For instanced rendering, we draw "instanceDrawCount" sets of "vertexDrawCount" vertices.
+ //
+ // A vertex attribute with a positive divisor loads one instanced vertex for every set of
+ // non-instanced vertices, and the instanced vertex index advances once every "mDivisor"
+ // instances.
+ if (instanceCount > 0 && attrib.divisor > 0)
+ {
+ // When instanceDrawCount is not a multiple attrib.divisor, the division must round up.
+ // For instance, with 5 non-instanced vertices and a divisor equal to 3, we need 2 instanced
+ // vertices.
+ return (instanceCount + attrib.divisor - 1u) / attrib.divisor;
+ }
+
+ return drawCount;
+}
}