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 // VertexArray9.h: Defines the rx::VertexArray9 class which implements rx::VertexArrayImpl.
8
9 #ifndef LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_
10 #define LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_
11
12 #include "libANGLE/Context.h"
13 #include "libANGLE/renderer/VertexArrayImpl.h"
14 #include "libANGLE/renderer/d3d/d3d9/Context9.h"
15 #include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
16
17 namespace rx
18 {
19 class Renderer9;
20
21 class VertexArray9 : public VertexArrayImpl
22 {
23 public:
VertexArray9(const gl::VertexArrayState & data)24 VertexArray9(const gl::VertexArrayState &data) : VertexArrayImpl(data) {}
25
26 angle::Result syncState(const gl::Context *context,
27 const gl::VertexArray::DirtyBits &dirtyBits,
28 gl::VertexArray::DirtyAttribBitsArray *attribBits,
29 gl::VertexArray::DirtyBindingBitsArray *bindingBits) override;
30
~VertexArray9()31 ~VertexArray9() override {}
32
getCurrentStateSerial()33 Serial getCurrentStateSerial() const { return mCurrentStateSerial; }
34
35 private:
36 Serial mCurrentStateSerial;
37 };
38
syncState(const gl::Context * context,const gl::VertexArray::DirtyBits & dirtyBits,gl::VertexArray::DirtyAttribBitsArray * attribBits,gl::VertexArray::DirtyBindingBitsArray * bindingBits)39 inline angle::Result VertexArray9::syncState(const gl::Context *context,
40 const gl::VertexArray::DirtyBits &dirtyBits,
41 gl::VertexArray::DirtyAttribBitsArray *attribBits,
42 gl::VertexArray::DirtyBindingBitsArray *bindingBits)
43 {
44
45 ASSERT(dirtyBits.any());
46 Renderer9 *renderer = GetImplAs<Context9>(context)->getRenderer();
47 mCurrentStateSerial = renderer->generateSerial();
48
49 // Clear the dirty bits in the back-end here.
50 memset(attribBits, 0, sizeof(gl::VertexArray::DirtyAttribBitsArray));
51 memset(bindingBits, 0, sizeof(gl::VertexArray::DirtyBindingBitsArray));
52
53 return angle::Result::Continue;
54 }
55 } // namespace rx
56
57 #endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_
58