michael@0: // michael@0: // Copyright (c) 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: // Image11.h: Defines the rx::Image11 class, which acts as the interface to michael@0: // the actual underlying resources of a Texture michael@0: michael@0: #ifndef LIBGLESV2_RENDERER_IMAGE11_H_ michael@0: #define LIBGLESV2_RENDERER_IMAGE11_H_ michael@0: michael@0: #include "libGLESv2/renderer/Image.h" michael@0: 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 Renderer11; michael@0: class TextureStorageInterface2D; michael@0: class TextureStorageInterfaceCube; michael@0: michael@0: class Image11 : public Image michael@0: { michael@0: public: michael@0: Image11(); michael@0: virtual ~Image11(); michael@0: michael@0: static Image11 *makeImage11(Image *img); michael@0: michael@0: static void generateMipmap(Image11 *dest, Image11 *src); michael@0: michael@0: virtual bool isDirty() const; michael@0: 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 bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease); michael@0: michael@0: virtual bool isRenderableFormat() const; michael@0: DXGI_FORMAT getDXGIFormat() const; 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: protected: michael@0: HRESULT map(D3D11_MAPPED_SUBRESOURCE *map); michael@0: void unmap(); michael@0: michael@0: private: michael@0: DISALLOW_COPY_AND_ASSIGN(Image11); michael@0: michael@0: ID3D11Texture2D *getStagingTexture(); michael@0: unsigned int getStagingSubresource(); michael@0: void createStagingTexture(); michael@0: michael@0: Renderer11 *mRenderer; michael@0: michael@0: DXGI_FORMAT mDXGIFormat; michael@0: ID3D11Texture2D *mStagingTexture; michael@0: unsigned int mStagingSubresource; michael@0: }; michael@0: michael@0: } michael@0: michael@0: #endif // LIBGLESV2_RENDERER_IMAGE11_H_