2 // Copyright (c) 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.
7 // Image11.h: Defines the rx::Image11 class, which acts as the interface to
8 // the actual underlying resources of a Texture
10 #ifndef LIBGLESV2_RENDERER_IMAGE11_H_
11 #define LIBGLESV2_RENDERER_IMAGE11_H_
13 #include "libGLESv2/renderer/d3d/ImageD3D.h"
15 #include "common/debug.h"
26 class TextureStorage11;
28 class Image11 : public ImageD3D
34 static Image11 *makeImage11(Image *img);
36 static void generateMipmap(Image11 *dest, Image11 *src);
38 virtual bool isDirty() const;
40 virtual bool copyToStorage2D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
41 virtual bool copyToStorageCube(TextureStorage *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
42 virtual bool copyToStorage3D(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
43 virtual bool copyToStorage2DArray(TextureStorage *storage, int level, GLint xoffset, GLint yoffset, GLint arrayLayer, GLsizei width, GLsizei height);
45 virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
47 DXGI_FORMAT getDXGIFormat() const;
49 virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
50 GLint unpackAlignment, GLenum type, const void *input);
51 virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
54 virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source);
56 bool recoverFromAssociatedStorage();
57 bool isAssociatedStorageValid(TextureStorage11* textureStorage) const;
58 void disassociateStorage();
61 HRESULT map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map);
65 DISALLOW_COPY_AND_ASSIGN(Image11);
67 bool copyToStorageImpl(TextureStorage11 *storage11, int level, int layerTarget, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
69 ID3D11Resource *getStagingTexture();
70 unsigned int getStagingSubresource();
71 void createStagingTexture();
72 void releaseStagingTexture();
74 Renderer11 *mRenderer;
76 DXGI_FORMAT mDXGIFormat;
77 ID3D11Resource *mStagingTexture;
78 unsigned int mStagingSubresource;
80 bool mRecoverFromStorage;
81 TextureStorage11 *mAssociatedStorage;
82 int mAssociatedStorageLevel;
83 int mAssociatedStorageLayerTarget;
84 unsigned int mRecoveredFromStorageCount;
89 #endif // LIBGLESV2_RENDERER_IMAGE11_H_