Edit

kc3-lang/angle/src/libANGLE/renderer/gl/VertexArrayGL.h

Branch :

  • Show log

    Commit

  • Author : Geoff Lang
    Date : 2015-05-26 15:11:23
    Hash : 294cad9d
    Message : When applying vertex array objects, update the currently applied index buffer. When binding a vertex array object, it was not changing the tracked index buffer binding. This was causing the buffer bindings to sometimes not be updated between index and non-indexed draw calls. Fixes: * Intermittent crashes in chromium startup. * conformance/rendering/many-draw-calls.html * conformance/rendering/framebuffer-switch.html * conformance/attribs/gl-bindAttribLocation-aliasing.html * conformance/attribs/gl-vertex-attrib-render.html * conformance/buffers/index-validation-verifies-too-many-indices.html BUG=angleproject:883 Change-Id: I34ed1ebc65b339329c0f9ab9c28a392f552ed3d8 Reviewed-on: https://chromium-review.googlesource.com/273300 Reviewed-by: Brandon Jones <bajones@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>

  • src/libANGLE/renderer/gl/VertexArrayGL.h
  • //
    // Copyright 2015 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.
    //
    
    // VertexArrayGL.h: Defines the class interface for VertexArrayGL.
    
    #ifndef LIBANGLE_RENDERER_GL_VERTEXARRAYGL_H_
    #define LIBANGLE_RENDERER_GL_VERTEXARRAYGL_H_
    
    #include "libANGLE/renderer/VertexArrayImpl.h"
    
    namespace rx
    {
    
    class FunctionsGL;
    class StateManagerGL;
    
    class VertexArrayGL : public VertexArrayImpl
    {
      public:
        VertexArrayGL(const FunctionsGL *functions, StateManagerGL *stateManager);
        ~VertexArrayGL() override;
    
        void setElementArrayBuffer(const gl::Buffer *buffer) override;
        void setAttribute(size_t idx, const gl::VertexAttribute &attr) override;
        void setAttributeDivisor(size_t idx, GLuint divisor) override;
        void enableAttribute(size_t idx, bool enabledState) override;
    
        gl::Error syncDrawArraysState(GLint first, GLsizei count) const;
        gl::Error syncDrawElementsState(GLsizei count, GLenum type, const GLvoid *indices, const GLvoid **outIndices) const;
    
        GLuint getVertexArrayID() const;
        GLuint getAppliedElementArrayBufferID() const;
    
      private:
        gl::Error syncDrawState(GLint first, GLsizei count, GLenum type, const GLvoid *indices, const GLvoid **outIndices) const;
    
        // Check if any vertex attributes need to be streamed
        bool doAttributesNeedStreaming() const;
    
        // Apply attribute state, returns the amount of space needed to stream all attributes that need streaming
        // and the data size of the largest attribute
        gl::Error syncAttributeState(bool attributesNeedStreaming, const gl::RangeUI &indexRange, size_t *outStreamingDataSize,
                                     size_t *outMaxAttributeDataSize) const;
    
        // Apply index data, only sets outIndexRange if attributesNeedStreaming is true
        gl::Error syncIndexData(GLsizei count, GLenum type, const GLvoid *indices, bool attributesNeedStreaming,
                                gl::RangeUI *outIndexRange, const GLvoid **outIndices) const;
    
        // Stream attributes that have client data
        gl::Error streamAttributes(size_t streamingDataSize, size_t maxAttributeDataSize, const gl::RangeUI &indexRange) const;
    
        const FunctionsGL *mFunctions;
        StateManagerGL *mStateManager;
    
        GLuint mVertexArrayID;
    
        BindingPointer<const gl::Buffer> mElementArrayBuffer;
        std::vector<gl::VertexAttribute> mAttributes;
    
        mutable GLuint mAppliedElementArrayBuffer;
        mutable std::vector<gl::VertexAttribute> mAppliedAttributes;
    
        mutable size_t mStreamingElementArrayBufferSize;
        mutable GLuint mStreamingElementArrayBuffer;
    
        mutable size_t mStreamingArrayBufferSize;
        mutable GLuint mStreamingArrayBuffer;
    };
    
    }
    
    #endif // LIBANGLE_RENDERER_GL_VERTEXARRAYGL_H_