• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2012 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 // VertexBuffer11.h: Defines the D3D11 VertexBuffer implementation.
8 
9 #ifndef LIBANGLE_RENDERER_D3D_D3D11_VERTEXBUFFER11_H_
10 #define LIBANGLE_RENDERER_D3D_D3D11_VERTEXBUFFER11_H_
11 
12 #include <stdint.h>
13 
14 #include "libANGLE/renderer/d3d/VertexBuffer.h"
15 #include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
16 
17 namespace rx
18 {
19 class Renderer11;
20 
21 class VertexBuffer11 : public VertexBuffer
22 {
23   public:
24     explicit VertexBuffer11(Renderer11 *const renderer);
25 
26     angle::Result initialize(const gl::Context *context,
27                              unsigned int size,
28                              bool dynamicUsage) override;
29 
30     // Warning: you should ensure binding really matches attrib.bindingIndex before using this
31     // function.
32     angle::Result storeVertexAttributes(const gl::Context *context,
33                                         const gl::VertexAttribute &attrib,
34                                         const gl::VertexBinding &binding,
35                                         gl::VertexAttribType currentValueType,
36                                         GLint start,
37                                         size_t count,
38                                         GLsizei instances,
39                                         unsigned int offset,
40                                         const uint8_t *sourceData) override;
41 
42     unsigned int getBufferSize() const override;
43     angle::Result setBufferSize(const gl::Context *context, unsigned int size) override;
44     angle::Result discard(const gl::Context *context) override;
45 
46     void hintUnmapResource() override;
47 
48     const d3d11::Buffer &getBuffer() const;
49 
50   private:
51     ~VertexBuffer11() override;
52     angle::Result mapResource(const gl::Context *context);
53 
54     Renderer11 *const mRenderer;
55 
56     d3d11::Buffer mBuffer;
57     unsigned int mBufferSize;
58     bool mDynamicUsage;
59 
60     uint8_t *mMappedResourceData;
61 };
62 
63 }  // namespace rx
64 
65 #endif  // LIBANGLE_RENDERER_D3D_D3D11_VERTEXBUFFER11_H_
66