Home | History | Annotate | Download | only in d3d9
      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 // Image9.h: Defines the rx::Image9 class, which acts as the interface to
      8 // the actual underlying surfaces of a Texture.
      9 
     10 #ifndef LIBGLESV2_RENDERER_IMAGE9_H_
     11 #define LIBGLESV2_RENDERER_IMAGE9_H_
     12 
     13 #include "libGLESv2/renderer/Image.h"
     14 #include "common/debug.h"
     15 
     16 namespace gl
     17 {
     18 class Framebuffer;
     19 }
     20 
     21 namespace rx
     22 {
     23 class Renderer;
     24 class Renderer9;
     25 class TextureStorageInterface2D;
     26 class TextureStorageInterfaceCube;
     27 
     28 class Image9 : public Image
     29 {
     30   public:
     31     Image9();
     32     ~Image9();
     33 
     34     static Image9 *makeImage9(Image *img);
     35 
     36     static void generateMipmap(Image9 *dest, Image9 *source);
     37     static void generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface);
     38     static void copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source);
     39 
     40     virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
     41 
     42     D3DFORMAT getD3DFormat() const;
     43 
     44     virtual bool isDirty() const;
     45     IDirect3DSurface9 *getSurface();
     46 
     47     virtual void setManagedSurface(TextureStorageInterface2D *storage, int level);
     48     virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level);
     49     virtual bool copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
     50     virtual bool copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
     51     virtual bool copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
     52     virtual bool copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height);
     53 
     54     virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
     55                           GLint unpackAlignment, GLenum type, const void *input);
     56     virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
     57                                     const void *input);
     58 
     59     virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset,GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
     60 
     61   private:
     62     DISALLOW_COPY_AND_ASSIGN(Image9);
     63 
     64     void createSurface();
     65     void setManagedSurface(IDirect3DSurface9 *surface);
     66     bool copyToSurface(IDirect3DSurface9 *dest, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
     67 
     68     HRESULT lock(D3DLOCKED_RECT *lockedRect, const RECT *rect);
     69     void unlock();
     70 
     71     Renderer9 *mRenderer;
     72 
     73     D3DPOOL mD3DPool;   // can only be D3DPOOL_SYSTEMMEM or D3DPOOL_MANAGED since it needs to be lockable.
     74     D3DFORMAT mD3DFormat;
     75 
     76     IDirect3DSurface9 *mSurface;
     77 };
     78 }
     79 
     80 #endif   // LIBGLESV2_RENDERER_IMAGE9_H_
     81