• 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 // IndexBuffer11.h: Defines the D3D11 IndexBuffer implementation.
8 
9 #ifndef LIBANGLE_RENDERER_D3D_D3D11_INDEXBUFFER11_H_
10 #define LIBANGLE_RENDERER_D3D_D3D11_INDEXBUFFER11_H_
11 
12 #include "libANGLE/renderer/d3d/IndexBuffer.h"
13 #include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
14 
15 namespace rx
16 {
17 class Renderer11;
18 
19 class IndexBuffer11 : public IndexBuffer
20 {
21   public:
22     explicit IndexBuffer11(Renderer11 *const renderer);
23     ~IndexBuffer11() override;
24 
25     angle::Result initialize(const gl::Context *context,
26                              unsigned int bufferSize,
27                              gl::DrawElementsType indexType,
28                              bool dynamic) override;
29 
30     angle::Result mapBuffer(const gl::Context *context,
31                             unsigned int offset,
32                             unsigned int size,
33                             void **outMappedMemory) override;
34     angle::Result unmapBuffer(const gl::Context *context) override;
35 
36     gl::DrawElementsType getIndexType() const override;
37     unsigned int getBufferSize() const override;
38     angle::Result setSize(const gl::Context *context,
39                           unsigned int bufferSize,
40                           gl::DrawElementsType indexType) override;
41 
42     angle::Result discard(const gl::Context *context) override;
43 
44     DXGI_FORMAT getIndexFormat() const;
45     const d3d11::Buffer &getBuffer() const;
46 
47   private:
48     Renderer11 *const mRenderer;
49 
50     d3d11::Buffer mBuffer;
51     unsigned int mBufferSize;
52     gl::DrawElementsType mIndexType;
53     bool mDynamicUsage;
54 };
55 
56 }  // namespace rx
57 
58 #endif  // LIBANGLE_RENDERER_D3D_D3D11_INDEXBUFFER11_H_
59