1 // 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. 5 // 6 7 // Image11.h: Defines the rx::Image11 class, which acts as the interface to 8 // the actual underlying resources of a Texture 9 10 #ifndef LIBGLESV2_RENDERER_IMAGE11_H_ 11 #define LIBGLESV2_RENDERER_IMAGE11_H_ 12 13 #include "libGLESv2/renderer/Image.h" 14 15 #include "common/debug.h" 16 17 namespace gl 18 { 19 class Framebuffer; 20 } 21 22 namespace rx 23 { 24 class Renderer; 25 class Renderer11; 26 class TextureStorageInterface2D; 27 class TextureStorageInterfaceCube; 28 29 class Image11 : public Image 30 { 31 public: 32 Image11(); 33 virtual ~Image11(); 34 35 static Image11 *makeImage11(Image *img); 36 37 static void generateMipmap(GLuint clientVersion, Image11 *dest, Image11 *src); 38 39 virtual bool isDirty() const; 40 41 virtual bool copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); 42 virtual bool copyToStorage(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); 43 virtual bool copyToStorage(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); 44 virtual bool copyToStorage(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint arrayLayer, GLsizei width, GLsizei height); 45 46 virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease); 47 48 DXGI_FORMAT getDXGIFormat() const; 49 50 virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, 51 GLint unpackAlignment, GLenum type, const void *input); 52 virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, 53 const void *input); 54 55 virtual void copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source); 56 57 protected: 58 HRESULT map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map); 59 void unmap(); 60 61 private: 62 DISALLOW_COPY_AND_ASSIGN(Image11); 63 64 ID3D11Resource *getStagingTexture(); 65 unsigned int getStagingSubresource(); 66 void createStagingTexture(); 67 68 Renderer11 *mRenderer; 69 70 DXGI_FORMAT mDXGIFormat; 71 ID3D11Resource *mStagingTexture; 72 unsigned int mStagingSubresource; 73 }; 74 75 } 76 77 #endif // LIBGLESV2_RENDERER_IMAGE11_H_ 78