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/. */
6 #ifndef WEBGLVERTEXATTRIBDATA_H_
7 #define WEBGLVERTEXATTRIBDATA_H_
13 struct WebGLVertexAttribData
{
14 // note that these initial values are what GL initializes vertex attribs to
15 WebGLVertexAttribData()
19 , divisor(0) // OpenGL ES 3.0 specs paragraphe 6.2 p240
21 , type(LOCAL_GL_FLOAT
)
26 WebGLRefPtr
<WebGLBuffer
> buf
;
35 GLuint
componentSize() const {
38 return sizeof(GLbyte
);
40 case LOCAL_GL_UNSIGNED_BYTE
:
41 return sizeof(GLubyte
);
44 return sizeof(GLshort
);
46 case LOCAL_GL_UNSIGNED_SHORT
:
47 return sizeof(GLushort
);
49 // XXX case LOCAL_GL_FIXED:
51 return sizeof(GLfloat
);
54 NS_ERROR("Should never get here!");
59 GLuint
actualStride() const {
60 if (stride
) return stride
;
61 return size
* componentSize();
65 } // namespace mozilla
67 inline void ImplCycleCollectionUnlink(mozilla::WebGLVertexAttribData
& aField
)
73 ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback
& aCallback
,
74 mozilla::WebGLVertexAttribData
& aField
,
78 CycleCollectionNoteChild(aCallback
, aField
.buf
.get(), aName
, aFlags
);