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