/src/mozilla-central/dom/canvas/WebGLVertexAttribData.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
3 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | | |
6 | | #ifndef WEBGL_VERTEX_ATTRIB_DATA_H_ |
7 | | #define WEBGL_VERTEX_ATTRIB_DATA_H_ |
8 | | |
9 | | #include "GLDefs.h" |
10 | | #include "WebGLObjectModel.h" |
11 | | |
12 | | namespace mozilla { |
13 | | |
14 | | class WebGLBuffer; |
15 | | |
16 | | class WebGLVertexAttribData final |
17 | | { |
18 | | public: |
19 | | uint32_t mDivisor; |
20 | | bool mEnabled; |
21 | | |
22 | | private: |
23 | | bool mIntegerFunc; |
24 | | public: |
25 | | WebGLRefPtr<WebGLBuffer> mBuf; |
26 | | private: |
27 | | GLenum mType; |
28 | | GLenum mBaseType; |
29 | | uint8_t mSize; // num of mType vals per vert |
30 | | uint8_t mBytesPerVertex; |
31 | | bool mNormalized; |
32 | | uint32_t mStride; // bytes |
33 | | uint32_t mExplicitStride; |
34 | | uint64_t mByteOffset; |
35 | | |
36 | | public: |
37 | | |
38 | 0 | #define GETTER(X) const decltype(m##X)& X() const { return m##X; } Unexecuted instantiation: mozilla::WebGLVertexAttribData::IntegerFunc() const Unexecuted instantiation: mozilla::WebGLVertexAttribData::Type() const Unexecuted instantiation: mozilla::WebGLVertexAttribData::BaseType() const Unexecuted instantiation: mozilla::WebGLVertexAttribData::Size() const Unexecuted instantiation: mozilla::WebGLVertexAttribData::BytesPerVertex() const Unexecuted instantiation: mozilla::WebGLVertexAttribData::Normalized() const Unexecuted instantiation: mozilla::WebGLVertexAttribData::Stride() const Unexecuted instantiation: mozilla::WebGLVertexAttribData::ExplicitStride() const Unexecuted instantiation: mozilla::WebGLVertexAttribData::ByteOffset() const |
39 | | |
40 | | GETTER(IntegerFunc) |
41 | | GETTER(Type) |
42 | | GETTER(BaseType) |
43 | | GETTER(Size) |
44 | | GETTER(BytesPerVertex) |
45 | | GETTER(Normalized) |
46 | | GETTER(Stride) |
47 | | GETTER(ExplicitStride) |
48 | | GETTER(ByteOffset) |
49 | | |
50 | | #undef GETTER |
51 | | |
52 | | // note that these initial values are what GL initializes vertex attribs to |
53 | | WebGLVertexAttribData() |
54 | | : mDivisor(0) |
55 | | , mEnabled(false) |
56 | | , mIntegerFunc(false) |
57 | | , mType(0) |
58 | | , mBaseType(0) |
59 | | , mSize(0) |
60 | | , mBytesPerVertex(0) |
61 | | , mNormalized(false) |
62 | | , mStride(0) |
63 | | , mExplicitStride(0) |
64 | | , mByteOffset(0) |
65 | 0 | { |
66 | 0 | VertexAttribPointer(false, nullptr, 4, LOCAL_GL_FLOAT, false, 0, 0); |
67 | 0 | } |
68 | | |
69 | | void VertexAttribPointer(bool integerFunc, WebGLBuffer* buf, uint8_t size, |
70 | | GLenum type, bool normalized, uint32_t stride, |
71 | | uint64_t byteOffset); |
72 | | |
73 | | void DoVertexAttribPointer(gl::GLContext* gl, GLuint index) const; |
74 | | }; |
75 | | |
76 | | } // namespace mozilla |
77 | | |
78 | | inline void |
79 | | ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback, |
80 | | mozilla::WebGLVertexAttribData& field, |
81 | | const char* name, |
82 | | uint32_t flags = 0) |
83 | 0 | { |
84 | 0 | CycleCollectionNoteChild(callback, field.mBuf.get(), name, flags); |
85 | 0 | } |
86 | | |
87 | | #endif // WEBGL_VERTEX_ATTRIB_DATA_H_ |