• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:
VertexArrayImpl(const gl::VertexArrayState & state)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 
destroy(const gl::Context * context)43     virtual void destroy(const gl::Context *context) {}
~VertexArrayImpl()44     virtual ~VertexArrayImpl() {}
45 
getState()46     const gl::VertexArrayState &getState() const { return mState; }
47 
48   protected:
49     const gl::VertexArrayState &mState;
50 };
51 
syncState(const gl::Context * context,const gl::VertexArray::DirtyBits & dirtyBits,gl::VertexArray::DirtyAttribBitsArray * attribBits,gl::VertexArray::DirtyBindingBitsArray * bindingBits)52 inline angle::Result VertexArrayImpl::syncState(const gl::Context *context,
53                                                 const gl::VertexArray::DirtyBits &dirtyBits,
54                                                 gl::VertexArray::DirtyAttribBitsArray *attribBits,
55                                                 gl::VertexArray::DirtyBindingBitsArray *bindingBits)
56 {
57     return angle::Result::Continue;
58 }
59 
60 }  // namespace rx
61 
62 #endif  // LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_
63