summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libANGLE/VertexAttribute.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/VertexAttribute.h')
-rw-r--r--src/3rdparty/angle/src/libANGLE/VertexAttribute.h84
1 files changed, 58 insertions, 26 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/VertexAttribute.h b/src/3rdparty/angle/src/libANGLE/VertexAttribute.h
index d1ee1b47a2..c531bece7c 100644
--- a/src/3rdparty/angle/src/libANGLE/VertexAttribute.h
+++ b/src/3rdparty/angle/src/libANGLE/VertexAttribute.h
@@ -3,7 +3,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// Helper structure describing a single vertex attribute
+// Helper structures about Generic Vertex Attribute.
//
#ifndef LIBANGLE_VERTEXATTRIBUTE_H_
@@ -13,45 +13,77 @@
namespace gl
{
+class VertexArray;
-struct VertexAttribute
+//
+// Implementation of Generic Vertex Attribute Bindings for ES3.1. The members are intentionally made
+// private in order to hide implementation details.
+//
+class VertexBinding final : angle::NonCopyable
{
- bool enabled; // From glEnable/DisableVertexAttribArray
+ public:
+ VertexBinding();
+ VertexBinding(VertexBinding &&binding);
+ ~VertexBinding();
+ VertexBinding &operator=(VertexBinding &&binding);
+
+ GLuint getStride() const { return mStride; }
+ void setStride(GLuint strideIn) { mStride = strideIn; }
+
+ GLuint getDivisor() const { return mDivisor; }
+ void setDivisor(GLuint divisorIn) { mDivisor = divisorIn; }
+
+ GLintptr getOffset() const { return mOffset; }
+ void setOffset(GLintptr offsetIn) { mOffset = offsetIn; }
+
+ const BindingPointer<Buffer> &getBuffer() const { return mBuffer; }
+ void setBuffer(const gl::Context *context, Buffer *bufferIn) { mBuffer.set(context, bufferIn); }
+
+ private:
+ GLuint mStride;
+ GLuint mDivisor;
+ GLintptr mOffset;
+
+ BindingPointer<Buffer> mBuffer;
+};
+//
+// Implementation of Generic Vertex Attributes for ES3.1
+//
+struct VertexAttribute final : private angle::NonCopyable
+{
+ explicit VertexAttribute(GLuint bindingIndex);
+ explicit VertexAttribute(VertexAttribute &&attrib);
+ VertexAttribute &operator=(VertexAttribute &&attrib);
+
+ bool enabled; // For glEnable/DisableVertexAttribArray
GLenum type;
GLuint size;
bool normalized;
bool pureInteger;
- GLuint stride; // 0 means natural stride
- union
- {
- const GLvoid *pointer;
- GLintptr offset;
- };
- BindingPointer<Buffer> buffer; // Captured when glVertexAttribPointer is called.
-
- GLuint divisor;
+ const void *pointer;
+ GLuint relativeOffset;
- VertexAttribute();
+ GLuint vertexAttribArrayStride; // ONLY for queries of VERTEX_ATTRIB_ARRAY_STRIDE
+ GLuint bindingIndex;
};
-bool operator==(const VertexAttribute &a, const VertexAttribute &b);
-bool operator!=(const VertexAttribute &a, const VertexAttribute &b);
+size_t ComputeVertexAttributeTypeSize(const VertexAttribute &attrib);
+
+// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
+size_t ComputeVertexAttributeStride(const VertexAttribute &attrib, const VertexBinding &binding);
+
+// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
+GLintptr ComputeVertexAttributeOffset(const VertexAttribute &attrib, const VertexBinding &binding);
-template <typename T>
-T QuerySingleVertexAttributeParameter(const VertexAttribute& attrib, GLenum pname);
+size_t ComputeVertexBindingElementCount(GLuint divisor, size_t drawCount, size_t instanceCount);
-size_t ComputeVertexAttributeTypeSize(const VertexAttribute& attrib);
-size_t ComputeVertexAttributeStride(const VertexAttribute& attrib);
-size_t ComputeVertexAttributeElementCount(const VertexAttribute &attrib,
- size_t drawCount,
- size_t instanceCount);
+GLenum GetVertexAttributeBaseType(const VertexAttribute &attrib);
struct VertexAttribCurrentValueData
{
- union
- {
+ union {
GLfloat FloatValues[4];
GLint IntValues[4];
GLuint UnsignedIntValues[4];
@@ -68,8 +100,8 @@ struct VertexAttribCurrentValueData
bool operator==(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b);
bool operator!=(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b);
-}
+} // namespace gl
#include "VertexAttribute.inl"
-#endif // LIBANGLE_VERTEXATTRIBUTE_H_
+#endif // LIBANGLE_VERTEXATTRIBUTE_H_