• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2002 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 // ImageD3D.h: Defines the rx::ImageD3D class, an abstract base class for the
8 // renderer-specific classes which will define the interface to the underlying
9 // surfaces or resources.
10 
11 #ifndef LIBANGLE_RENDERER_D3D_IMAGED3D_H_
12 #define LIBANGLE_RENDERER_D3D_IMAGED3D_H_
13 
14 #include "common/debug.h"
15 
16 #include "common/PackedEnums.h"
17 #include "libANGLE/Error.h"
18 
19 namespace gl
20 {
21 class Context;
22 class Framebuffer;
23 class ImageIndex;
24 struct Box;
25 struct Extents;
26 struct Offset;
27 struct Rectangle;
28 struct PixelUnpackState;
29 }  // namespace gl
30 
31 namespace rx
32 {
33 class TextureStorage;
34 class RendererD3D;
35 class RenderTargetD3D;
36 
37 class ImageD3D : angle::NonCopyable
38 {
39   public:
40     ImageD3D();
~ImageD3D()41     virtual ~ImageD3D() {}
42 
getWidth()43     GLsizei getWidth() const { return mWidth; }
getHeight()44     GLsizei getHeight() const { return mHeight; }
getDepth()45     GLsizei getDepth() const { return mDepth; }
getInternalFormat()46     GLenum getInternalFormat() const { return mInternalFormat; }
getType()47     gl::TextureType getType() const { return mType; }
isRenderableFormat()48     bool isRenderableFormat() const { return mRenderable; }
49 
markDirty()50     void markDirty() { mDirty = true; }
markClean()51     void markClean() { mDirty = false; }
52     virtual bool isDirty() const = 0;
53 
54     virtual bool redefine(gl::TextureType type,
55                           GLenum internalformat,
56                           const gl::Extents &size,
57                           bool forceRelease) = 0;
58 
59     virtual angle::Result loadData(const gl::Context *context,
60                                    const gl::Box &area,
61                                    const gl::PixelUnpackState &unpack,
62                                    GLenum type,
63                                    const void *input,
64                                    bool applySkipImages)        = 0;
65     virtual angle::Result loadCompressedData(const gl::Context *context,
66                                              const gl::Box &area,
67                                              const void *input) = 0;
68 
69     virtual angle::Result setManagedSurface2D(const gl::Context *context,
70                                               TextureStorage *storage,
71                                               int level);
72     virtual angle::Result setManagedSurfaceCube(const gl::Context *context,
73                                                 TextureStorage *storage,
74                                                 int face,
75                                                 int level);
76     virtual angle::Result setManagedSurface3D(const gl::Context *context,
77                                               TextureStorage *storage,
78                                               int level);
79     virtual angle::Result setManagedSurface2DArray(const gl::Context *context,
80                                                    TextureStorage *storage,
81                                                    int layer,
82                                                    int level);
83     virtual angle::Result copyToStorage(const gl::Context *context,
84                                         TextureStorage *storage,
85                                         const gl::ImageIndex &index,
86                                         const gl::Box &region) = 0;
87 
88     virtual angle::Result copyFromTexStorage(const gl::Context *context,
89                                              const gl::ImageIndex &imageIndex,
90                                              TextureStorage *source)         = 0;
91     virtual angle::Result copyFromFramebuffer(const gl::Context *context,
92                                               const gl::Offset &destOffset,
93                                               const gl::Rectangle &sourceArea,
94                                               const gl::Framebuffer *source) = 0;
95 
96   protected:
97     GLsizei mWidth;
98     GLsizei mHeight;
99     GLsizei mDepth;
100     GLenum mInternalFormat;
101     bool mRenderable;
102     gl::TextureType mType;
103 
104     bool mDirty;
105 };
106 }  // namespace rx
107 
108 #endif  // LIBANGLE_RENDERER_D3D_IMAGED3D_H_
109