michael@0: // michael@0: // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: // Image9.h: Defines the rx::Image9 class, which acts as the interface to michael@0: // the actual underlying surfaces of a Texture. michael@0: michael@0: #ifndef LIBGLESV2_RENDERER_IMAGE9_H_ michael@0: #define LIBGLESV2_RENDERER_IMAGE9_H_ michael@0: michael@0: #include "libGLESv2/renderer/Image.h" michael@0: #include "common/debug.h" michael@0: michael@0: namespace gl michael@0: { michael@0: class Framebuffer; michael@0: } michael@0: michael@0: namespace rx michael@0: { michael@0: class Renderer; michael@0: class Renderer9; michael@0: class TextureStorageInterface2D; michael@0: class TextureStorageInterfaceCube; michael@0: michael@0: class Image9 : public Image michael@0: { michael@0: public: michael@0: Image9(); michael@0: ~Image9(); michael@0: michael@0: static Image9 *makeImage9(Image *img); michael@0: michael@0: static void generateMipmap(Image9 *dest, Image9 *source); michael@0: static void generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface); michael@0: static void copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source); michael@0: michael@0: virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease); michael@0: michael@0: virtual bool isRenderableFormat() const; michael@0: D3DFORMAT getD3DFormat() const; michael@0: michael@0: virtual bool isDirty() const {return mSurface && mDirty;} michael@0: IDirect3DSurface9 *getSurface(); michael@0: michael@0: virtual void setManagedSurface(TextureStorageInterface2D *storage, int level); michael@0: virtual void setManagedSurface(TextureStorageInterfaceCube *storage, int face, int level); michael@0: virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); michael@0: virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); michael@0: michael@0: virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, michael@0: GLint unpackAlignment, const void *input); michael@0: virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, michael@0: const void *input); michael@0: michael@0: virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source); michael@0: michael@0: private: michael@0: DISALLOW_COPY_AND_ASSIGN(Image9); michael@0: michael@0: void createSurface(); michael@0: void setManagedSurface(IDirect3DSurface9 *surface); michael@0: bool updateSurface(IDirect3DSurface9 *dest, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); michael@0: michael@0: HRESULT lock(D3DLOCKED_RECT *lockedRect, const RECT *rect); michael@0: void unlock(); michael@0: michael@0: Renderer9 *mRenderer; michael@0: michael@0: D3DPOOL mD3DPool; // can only be D3DPOOL_SYSTEMMEM or D3DPOOL_MANAGED since it needs to be lockable. michael@0: D3DFORMAT mD3DFormat; michael@0: michael@0: IDirect3DSurface9 *mSurface; michael@0: }; michael@0: } michael@0: michael@0: #endif // LIBGLESV2_RENDERER_IMAGE9_H_