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