VertexArrayImpl.h (2680B)
1 // 2 // Copyright 2014 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // VertexAttribImpl.h: Defines the abstract rx::VertexAttribImpl class. 8 9 #ifndef LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_ 10 #define LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_ 11 12 #include "common/angleutils.h" 13 #include "libANGLE/Buffer.h" 14 #include "libANGLE/VertexArray.h" 15 16 // This is a helper X macro for iterating over all dirty attribs/bindings. Useful for dirty bits. 17 static_assert(gl::MAX_VERTEX_ATTRIBS == 16, "Invalid max vertex attribs"); 18 static_assert(gl::MAX_VERTEX_ATTRIB_BINDINGS == 16, "Invalid max vertex bindings"); 19 #define ANGLE_VERTEX_INDEX_CASES(FUNC) \ 20 FUNC(0) \ 21 FUNC(1) \ 22 FUNC(2) \ 23 FUNC(3) \ 24 FUNC(4) \ 25 FUNC(5) FUNC(6) FUNC(7) FUNC(8) FUNC(9) FUNC(10) FUNC(11) FUNC(12) FUNC(13) FUNC(14) FUNC(15) 26 27 namespace rx 28 { 29 class ContextImpl; 30 31 class VertexArrayImpl : angle::NonCopyable 32 { 33 public: 34 VertexArrayImpl(const gl::VertexArrayState &state) : mState(state) {} 35 36 // It's up to the implementation to reset the attrib and binding dirty bits. 37 // This is faster than the front-end having to clear all the bits after they have been scanned. 38 virtual angle::Result syncState(const gl::Context *context, 39 const gl::VertexArray::DirtyBits &dirtyBits, 40 gl::VertexArray::DirtyAttribBitsArray *attribBits, 41 gl::VertexArray::DirtyBindingBitsArray *bindingBits); 42 43 virtual void destroy(const gl::Context *context) {} 44 virtual ~VertexArrayImpl() {} 45 46 const gl::VertexArrayState &getState() const { return mState; } 47 48 void setContentsObservers(gl::VertexArrayBufferContentsObservers *observers) 49 { 50 mContentsObservers = observers; 51 } 52 53 virtual angle::Result onLabelUpdate(const gl::Context *context); 54 55 protected: 56 const gl::VertexArrayState &mState; 57 gl::VertexArrayBufferContentsObservers *mContentsObservers = nullptr; 58 }; 59 60 inline angle::Result VertexArrayImpl::syncState(const gl::Context *context, 61 const gl::VertexArray::DirtyBits &dirtyBits, 62 gl::VertexArray::DirtyAttribBitsArray *attribBits, 63 gl::VertexArray::DirtyBindingBitsArray *bindingBits) 64 { 65 return angle::Result::Continue; 66 } 67 68 } // namespace rx 69 70 #endif // LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_