Edit

kc3-lang/angle/src/libANGLE/VertexAttribute.h

Branch :

  • Show log

    Commit

  • Author : Geoff Lang
    Date : 2015-08-27 14:40:48
    Hash : 3cf12ce6
    Message : Implement the instanced draw calls in RendererGL. BUG=angleproject:1136 Change-Id: I1167365618bdc3ca37ac0f4c60809de32c7a9d78 Reviewed-on: https://chromium-review.googlesource.com/295733 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>

  • src/libANGLE/VertexAttribute.h
  • //
    // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
    // 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
    //
    
    #ifndef LIBANGLE_VERTEXATTRIBUTE_H_
    #define LIBANGLE_VERTEXATTRIBUTE_H_
    
    #include "libANGLE/Buffer.h"
    
    namespace gl
    {
    
    struct VertexAttribute
    {
        bool enabled; // From 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;
    
        VertexAttribute();
    };
    
    bool operator==(const VertexAttribute &a, const VertexAttribute &b);
    bool operator!=(const VertexAttribute &a, const VertexAttribute &b);
    
    template <typename T>
    T QuerySingleVertexAttributeParameter(const VertexAttribute& attrib, GLenum pname);
    
    size_t ComputeVertexAttributeTypeSize(const VertexAttribute& attrib);
    size_t ComputeVertexAttributeStride(const VertexAttribute& attrib);
    size_t ComputeVertexAttributeElementCount(const VertexAttribute &attrib,
                                              size_t drawCount,
                                              size_t instanceCount);
    
    struct VertexAttribCurrentValueData
    {
        union
        {
            GLfloat FloatValues[4];
            GLint IntValues[4];
            GLuint UnsignedIntValues[4];
        };
        GLenum Type;
    
        VertexAttribCurrentValueData();
    
        void setFloatValues(const GLfloat floatValues[4]);
        void setIntValues(const GLint intValues[4]);
        void setUnsignedIntValues(const GLuint unsignedIntValues[4]);
    };
    
    bool operator==(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b);
    bool operator!=(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b);
    
    }
    
    #include "VertexAttribute.inl"
    
    #endif // LIBANGLE_VERTEXATTRIBUTE_H_