// // Copyright 2014 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // Implementation of the state classes for mananging GLES 3.1 Vertex Array Objects. //
// Use the special integer overflow value if there was a math error. if (!elementLimit.IsValid())
{
static_assert(kIntegerOverflow < 0, "Unexpected value");
mCachedElementLimit = kIntegerOverflow; return;
}
mCachedElementLimit = elementLimit.ValueOrDie(); if (mCachedElementLimit < 0)
{ return;
}
if (binding.getStride() == 0)
{ // Special case for a zero stride. If we can fit one vertex we can fit infinite vertices.
mCachedElementLimit = std::numeric_limits<GLint64>::max(); return;
}
if (binding.getDivisor() > 0)
{ // For instanced draws, the element count is floor(instanceCount - 1) / binding.divisor.
angle::CheckedNumeric<GLint64> bindingDivisor(binding.getDivisor());
elementLimit *= bindingDivisor;
// We account for the floor() part rounding by adding a rounding constant.
elementLimit += bindingDivisor - 1;
}
size_t ComputeVertexAttributeStride(const VertexAttribute &attrib, const VertexBinding &binding)
{ // In ES 3.1, VertexAttribPointer will store the type size in the binding stride. // Hence, rendering always uses the binding's stride. return attrib.enabled ? binding.getStride() : 16u;
}
// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
GLintptr ComputeVertexAttributeOffset(const VertexAttribute &attrib, const VertexBinding &binding)
{ return attrib.relativeOffset + binding.getOffset();
}
size_t ComputeVertexBindingElementCount(GLuint divisor, 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 && 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 + divisor - 1u) / divisor;
}
return drawCount;
}
} // namespace gl
Messung V0.5
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.