|
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(Image11 *dest, Image11 *src); |
|
38 |
|
39 virtual bool isDirty() const; |
|
40 |
|
41 virtual bool updateSurface(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); |
|
42 virtual bool updateSurface(TextureStorageInterfaceCube *storage, int face, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height); |
|
43 |
|
44 virtual bool redefine(Renderer *renderer, GLint internalformat, GLsizei width, GLsizei height, bool forceRelease); |
|
45 |
|
46 virtual bool isRenderableFormat() const; |
|
47 DXGI_FORMAT getDXGIFormat() const; |
|
48 |
|
49 virtual void loadData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, |
|
50 GLint unpackAlignment, const void *input); |
|
51 virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, |
|
52 const void *input); |
|
53 |
|
54 virtual void copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source); |
|
55 |
|
56 protected: |
|
57 HRESULT map(D3D11_MAPPED_SUBRESOURCE *map); |
|
58 void unmap(); |
|
59 |
|
60 private: |
|
61 DISALLOW_COPY_AND_ASSIGN(Image11); |
|
62 |
|
63 ID3D11Texture2D *getStagingTexture(); |
|
64 unsigned int getStagingSubresource(); |
|
65 void createStagingTexture(); |
|
66 |
|
67 Renderer11 *mRenderer; |
|
68 |
|
69 DXGI_FORMAT mDXGIFormat; |
|
70 ID3D11Texture2D *mStagingTexture; |
|
71 unsigned int mStagingSubresource; |
|
72 }; |
|
73 |
|
74 } |
|
75 |
|
76 #endif // LIBGLESV2_RENDERER_IMAGE11_H_ |