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.
7 // Image9.h: Defines the rx::Image9 class, which acts as the interface to
8 // the actual underlying surfaces of a Texture.
10 #ifndef LIBGLESV2_RENDERER_IMAGE9_H_
11 #define LIBGLESV2_RENDERER_IMAGE9_H_
13 #include "libGLESv2/renderer/d3d/ImageD3D.h"
14 #include "common/debug.h"
25 class TextureStorageInterface2D;
26 class TextureStorageInterfaceCube;
28 class Image9 : public ImageD3D
34 static Image9 *makeImage9(Image *img);
36 static void generateMipmap(Image9 *dest, Image9 *source);
37 static void generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface);
38 static void copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source);
40 virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
42 D3DFORMAT getD3DFormat() const;
44 virtual bool isDirty() const;
45 IDirect3DSurface9 *getSurface();
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);
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,
59 virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset,GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
62 DISALLOW_COPY_AND_ASSIGN(Image9);
65 void setManagedSurface(IDirect3DSurface9 *surface);
66 bool copyToSurface(IDirect3DSurface9 *dest, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
68 HRESULT lock(D3DLOCKED_RECT *lockedRect, const RECT *rect);
73 D3DPOOL mD3DPool; // can only be D3DPOOL_SYSTEMMEM or D3DPOOL_MANAGED since it needs to be lockable.
76 IDirect3DSurface9 *mSurface;
80 #endif // LIBGLESV2_RENDERER_IMAGE9_H_