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