1 // 2 // Copyright (c) 2002-2014 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/d3d/ImageD3D.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 26 class Image9 : public ImageD3D 27 { 28 public: 29 Image9(); 30 ~Image9(); 31 32 static Image9 *makeImage9(Image *img); 33 34 static void generateMipmap(Image9 *dest, Image9 *source); 35 static void generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface); 36 static void copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source); 37 38 virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease); 39 40 D3DFORMAT getD3DFormat() const; 41 42 virtual bool isDirty() const; 43 IDirect3DSurface9 *getSurface(); 44 45 virtual void setManagedSurface2D(TextureStorage *storage, int level); 46 virtual void setManagedSurfaceCube(TextureStorage *storage, int face, int level); 47 virtual bool copyToStorage2D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); 48 virtual bool copyToStorageCube(TextureStorage *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); 49 virtual bool copyToStorage3D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); 50 virtual bool copyToStorage2DArray(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height); 51 52 virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, 53 GLint unpackAlignment, GLenum type, const void *input); 54 virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, 55 const void *input); 56 57 virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset,GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source); 58 59 private: 60 DISALLOW_COPY_AND_ASSIGN(Image9); 61 62 void createSurface(); 63 void setManagedSurface(IDirect3DSurface9 *surface); 64 bool copyToSurface(IDirect3DSurface9 *dest, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); 65 66 HRESULT lock(D3DLOCKED_RECT *lockedRect, const RECT *rect); 67 void unlock(); 68 69 Renderer9 *mRenderer; 70 71 D3DPOOL mD3DPool; // can only be D3DPOOL_SYSTEMMEM or D3DPOOL_MANAGED since it needs to be lockable. 72 D3DFORMAT mD3DFormat; 73 74 IDirect3DSurface9 *mSurface; 75 }; 76 } 77 78 #endif // LIBGLESV2_RENDERER_IMAGE9_H_ 79