1 //
2 // Copyright (c) 2002-2013 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 // TextureStorage.h: Defines the abstract rx::TextureStorage class.
8 
9 #ifndef LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
10 #define LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
11 
12 #include "libANGLE/Error.h"
13 
14 #include "common/debug.h"
15 #include "libANGLE/Error.h"
16 
17 #include <GLES2/gl2.h>
18 #include <stdint.h>
19 
20 namespace gl
21 {
22 struct ImageIndex;
23 struct Box;
24 struct PixelUnpackState;
25 }
26 
27 namespace rx
28 {
29 class SwapChainD3D;
30 class RenderTargetD3D;
31 class ImageD3D;
32 
33 class TextureStorage : angle::NonCopyable
34 {
35   public:
TextureStorage()36     TextureStorage() {}
~TextureStorage()37     virtual ~TextureStorage() {}
38 
39     virtual int getTopLevel() const = 0;
40     virtual bool isRenderTarget() const = 0;
41     virtual bool isManaged() const = 0;
42     virtual bool supportsNativeMipmapFunction() const = 0;
43     virtual int getLevelCount() const = 0;
44 
45     virtual gl::Error getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT) = 0;
46     virtual gl::Error generateMipmap(const gl::ImageIndex &sourceIndex, const gl::ImageIndex &destIndex) = 0;
47 
48     virtual gl::Error copyToStorage(TextureStorage *destStorage) = 0;
49     virtual gl::Error setData(const gl::ImageIndex &index, ImageD3D *image, const gl::Box *destBox, GLenum type,
50                               const gl::PixelUnpackState &unpack, const uint8_t *pixelData) = 0;
51 
52     // This is a no-op for most implementations of TextureStorage. Some (e.g. TextureStorage11_2D) might override it.
useLevelZeroWorkaroundTexture(bool useLevelZeroTexture)53     virtual gl::Error useLevelZeroWorkaroundTexture(bool useLevelZeroTexture) { return gl::Error(GL_NO_ERROR); }
54 };
55 
56 }
57 
58 #endif // LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
59