PageRenderTime 37ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.h

https://bitbucket.org/vionika/spin.android
C Header | 125 lines | 95 code | 23 blank | 7 comment | 0 complexity | 302fe710db2305f4f69916078161db2b MD5 | raw file
Possible License(s): JSON, 0BSD, AGPL-1.0, BSD-2-Clause, GPL-3.0, LGPL-2.1, LGPL-3.0, CC0-1.0, AGPL-3.0, MPL-2.0, Apache-2.0, MIT, BSD-3-Clause, MPL-2.0-no-copyleft-exception, GPL-2.0, Unlicense
  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. // Image11.h: Defines the rx::Image11 class, which acts as the interface to
  7. // the actual underlying resources of a Texture
  8. #ifndef LIBANGLE_RENDERER_D3D_D3D11_IMAGE11_H_
  9. #define LIBANGLE_RENDERER_D3D_D3D11_IMAGE11_H_
  10. #include "common/debug.h"
  11. #include "libANGLE/ImageIndex.h"
  12. #include "libANGLE/renderer/d3d/ImageD3D.h"
  13. #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
  14. namespace gl
  15. {
  16. class Framebuffer;
  17. }
  18. namespace d3d11
  19. {
  20. template <typename T>
  21. class ScopedUnmapper;
  22. } // namespace d3d11
  23. namespace rx
  24. {
  25. class Renderer11;
  26. class TextureHelper11;
  27. class TextureStorage11;
  28. struct Renderer11DeviceCaps;
  29. class Image11 : public ImageD3D
  30. {
  31. public:
  32. Image11(Renderer11 *renderer);
  33. ~Image11() override;
  34. static angle::Result GenerateMipmap(const gl::Context *context,
  35. Image11 *dest,
  36. Image11 *src,
  37. const Renderer11DeviceCaps &rendererCaps);
  38. static angle::Result CopyImage(const gl::Context *context,
  39. Image11 *dest,
  40. Image11 *source,
  41. const gl::Box &sourceBox,
  42. const gl::Offset &destOffset,
  43. bool unpackFlipY,
  44. bool unpackPremultiplyAlpha,
  45. bool unpackUnmultiplyAlpha,
  46. const Renderer11DeviceCaps &rendererCaps);
  47. bool isDirty() const override;
  48. angle::Result copyToStorage(const gl::Context *context,
  49. TextureStorage *storage,
  50. const gl::ImageIndex &index,
  51. const gl::Box &region) override;
  52. bool redefine(gl::TextureType type,
  53. GLenum internalformat,
  54. const gl::Extents &size,
  55. bool forceRelease) override;
  56. DXGI_FORMAT getDXGIFormat() const;
  57. angle::Result loadData(const gl::Context *context,
  58. const gl::Box &area,
  59. const gl::PixelUnpackState &unpack,
  60. GLenum type,
  61. const void *input,
  62. bool applySkipImages) override;
  63. angle::Result loadCompressedData(const gl::Context *context,
  64. const gl::Box &area,
  65. const void *input) override;
  66. angle::Result copyFromTexStorage(const gl::Context *context,
  67. const gl::ImageIndex &imageIndex,
  68. TextureStorage *source) override;
  69. angle::Result copyFromFramebuffer(const gl::Context *context,
  70. const gl::Offset &destOffset,
  71. const gl::Rectangle &sourceArea,
  72. const gl::Framebuffer *source) override;
  73. angle::Result recoverFromAssociatedStorage(const gl::Context *context);
  74. void verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const;
  75. void disassociateStorage();
  76. protected:
  77. template <typename T>
  78. friend class d3d11::ScopedUnmapper;
  79. angle::Result map(const gl::Context *context, D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map);
  80. void unmap();
  81. private:
  82. angle::Result copyWithoutConversion(const gl::Context *context,
  83. const gl::Offset &destOffset,
  84. const gl::Box &sourceArea,
  85. const TextureHelper11 &textureHelper,
  86. UINT sourceSubResource);
  87. angle::Result getStagingTexture(const gl::Context *context,
  88. const TextureHelper11 **outStagingTexture,
  89. unsigned int *outSubresourceIndex);
  90. angle::Result createStagingTexture(const gl::Context *context);
  91. void releaseStagingTexture();
  92. Renderer11 *mRenderer;
  93. DXGI_FORMAT mDXGIFormat;
  94. TextureHelper11 mStagingTexture;
  95. unsigned int mStagingSubresource;
  96. bool mRecoverFromStorage;
  97. TextureStorage11 *mAssociatedStorage;
  98. gl::ImageIndex mAssociatedImageIndex;
  99. unsigned int mRecoveredFromStorageCount;
  100. };
  101. } // namespace rx
  102. #endif // LIBANGLE_RENDERER_D3D_D3D11_IMAGE11_H_