DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Implementation

Mercurial (7b5b4eed4707)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "WebGLFormats.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;
  webgl::AttribBaseType mBaseType = webgl::AttribBaseType::Float;
  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),
        mIntegerFunc(false),
        mType(0),
        mSize(0),
        mBytesPerVertex(0),
        mNormalized(false),
        mStride(0),
        mExplicitStride(0),
        mByteOffset(0) {
    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

#endif  // WEBGL_VERTEX_ATTRIB_DATA_H_