1c5b784beda48d756909f222b56b77572af10af9
[platform/framework/web/crosswalk.git] / src / third_party / angle / src / libGLESv2 / renderer / d3d / TextureStorage.h
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 LIBGLESV2_RENDERER_TEXTURESTORAGE_H_
10 #define LIBGLESV2_RENDERER_TEXTURESTORAGE_H_
11
12 #include "libGLESv2/Error.h"
13
14 #include "common/debug.h"
15 #include "libGLESv2/Error.h"
16
17 #include <GLES2/gl2.h>
18 #include <cstdint>
19
20 namespace gl
21 {
22 struct ImageIndex;
23 struct Box;
24 struct PixelUnpackState;
25 }
26
27 namespace rx
28 {
29 class Renderer;
30 class SwapChain;
31 class RenderTarget;
32 class Image;
33
34 class TextureStorage
35 {
36   public:
37     TextureStorage();
38     virtual ~TextureStorage() {};
39
40     virtual int getTopLevel() const = 0;
41     virtual bool isRenderTarget() const = 0;
42     virtual bool isManaged() const = 0;
43     virtual int getLevelCount() const = 0;
44
45     virtual gl::Error getRenderTarget(const gl::ImageIndex &index, RenderTarget **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, Image *image, const gl::Box *destBox, GLenum type,
50                               const gl::PixelUnpackState &unpack, const uint8_t *pixelData) = 0;
51
52     unsigned int getRenderTargetSerial(const gl::ImageIndex &index) const;
53     unsigned int getTextureSerial() const;
54
55   protected:
56     void initializeSerials(unsigned int rtSerialsToReserve, unsigned int rtSerialsLayerStride);
57
58   private:
59     DISALLOW_COPY_AND_ASSIGN(TextureStorage);
60
61     unsigned int mFirstRenderTargetSerial;
62     unsigned int mRenderTargetSerialsLayerStride;
63 };
64
65 }
66
67 #endif // LIBGLESV2_RENDERER_TEXTURESTORAGE_H_