summaryrefslogtreecommitdiffstats
path: root/dom/canvas/WebGLVertexAttribData.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/canvas/WebGLVertexAttribData.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/canvas/WebGLVertexAttribData.h')
-rw-r--r--dom/canvas/WebGLVertexAttribData.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/dom/canvas/WebGLVertexAttribData.h b/dom/canvas/WebGLVertexAttribData.h
new file mode 100644
index 000000000..9d79b4f94
--- /dev/null
+++ b/dom/canvas/WebGLVertexAttribData.h
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef WEBGL_VERTEX_ATTRIB_DATA_H_
+#define WEBGL_VERTEX_ATTRIB_DATA_H_
+
+#include "GLDefs.h"
+#include "WebGLObjectModel.h"
+
+namespace mozilla {
+
+class WebGLBuffer;
+
+class WebGLVertexAttribData final
+{
+public:
+ uint32_t mDivisor;
+ bool mEnabled;
+
+private:
+ bool mIntegerFunc;
+public:
+ WebGLRefPtr<WebGLBuffer> mBuf;
+private:
+ GLenum mType;
+ GLenum mBaseType;
+ uint8_t mSize; // num of mType vals per vert
+ uint8_t mBytesPerVertex;
+ bool mNormalized;
+ uint32_t mStride; // bytes
+ uint32_t mExplicitStride;
+ uint64_t mByteOffset;
+
+public:
+
+#define GETTER(X) const decltype(m##X)& X() const { return m##X; }
+
+ GETTER(IntegerFunc)
+ GETTER(Type)
+ GETTER(BaseType)
+ GETTER(Size)
+ GETTER(BytesPerVertex)
+ GETTER(Normalized)
+ GETTER(Stride)
+ GETTER(ExplicitStride)
+ GETTER(ByteOffset)
+
+#undef GETTER
+
+ // note that these initial values are what GL initializes vertex attribs to
+ WebGLVertexAttribData()
+ : mDivisor(0)
+ , mEnabled(false)
+ {
+ VertexAttribPointer(false, nullptr, 4, LOCAL_GL_FLOAT, false, 0, 0);
+ }
+
+ void VertexAttribPointer(bool integerFunc, WebGLBuffer* buf, uint8_t size,
+ GLenum type, bool normalized, uint32_t stride,
+ uint64_t byteOffset);
+
+ void DoVertexAttribPointer(gl::GLContext* gl, GLuint index) const;
+};
+
+} // namespace mozilla
+
+inline void
+ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback,
+ mozilla::WebGLVertexAttribData& field,
+ const char* name,
+ uint32_t flags = 0)
+{
+ CycleCollectionNoteChild(callback, field.mBuf.get(), name, flags);
+}
+
+#endif // WEBGL_VERTEX_ATTRIB_DATA_H_