Home | History | Annotate | Download | only in renderer
      1 //
      2 // Copyright (c) 2002-2012 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 // Image.h: Defines the rx::Image 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 LIBGLESV2_RENDERER_IMAGE_H_
     12 #define LIBGLESV2_RENDERER_IMAGE_H_
     13 
     14 #include "common/debug.h"
     15 
     16 namespace gl
     17 {
     18 class Framebuffer;
     19 }
     20 
     21 namespace rx
     22 {
     23 class Renderer;
     24 class TextureStorageInterface2D;
     25 class TextureStorageInterfaceCube;
     26 class TextureStorageInterface3D;
     27 class TextureStorageInterface2DArray;
     28 
     29 class Image
     30 {
     31   public:
     32     Image();
     33     virtual ~Image() {};
     34 
     35     GLsizei getWidth() const { return mWidth; }
     36     GLsizei getHeight() const { return mHeight; }
     37     GLsizei getDepth() const { return mDepth; }
     38     GLenum getInternalFormat() const { return mInternalFormat; }
     39     GLenum getActualFormat() const { return mActualFormat; }
     40     GLenum getTarget() const { return mTarget; }
     41     bool isRenderableFormat() const { return mRenderable; }
     42 
     43     void markDirty() {mDirty = true;}
     44     void markClean() {mDirty = false;}
     45     virtual bool isDirty() const = 0;
     46 
     47     virtual void setManagedSurface(TextureStorageInterface2D *storage, int level) {};
     48     virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level) {};
     49     virtual void setManagedSurface(TextureStorageInterface3D *storage, int level) {};
     50     virtual void setManagedSurface(TextureStorageInterface2DArray *storage, int layer, int level) {};
     51     virtual bool copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
     52     virtual bool copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) = 0;
     53     virtual bool copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth) = 0;
     54     virtual bool copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height) = 0;
     55 
     56     virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease) = 0;
     57 
     58     virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
     59                           GLint unpackAlignment, GLenum type, const void *input) = 0;
     60     virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
     61                                     const void *input) = 0;
     62 
     63     virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) = 0;
     64 
     65   protected:
     66     GLsizei mWidth;
     67     GLsizei mHeight;
     68     GLsizei mDepth;
     69     GLenum mInternalFormat;
     70     GLenum mActualFormat;
     71     bool mRenderable;
     72     GLenum mTarget;
     73 
     74     bool mDirty;
     75 
     76   private:
     77     DISALLOW_COPY_AND_ASSIGN(Image);
     78 };
     79 
     80 }
     81 
     82 #endif // LIBGLESV2_RENDERER_IMAGE_H_
     83