NullTexture.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright 2017 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <memory>
  5. #include <vector>
  6. #include "Common/CommonTypes.h"
  7. #include "VideoCommon/AbstractFramebuffer.h"
  8. #include "VideoCommon/AbstractStagingTexture.h"
  9. #include "VideoCommon/AbstractTexture.h"
  10. namespace Null
  11. {
  12. class NullTexture final : public AbstractTexture
  13. {
  14. public:
  15. explicit NullTexture(const TextureConfig& config);
  16. void CopyRectangleFromTexture(const AbstractTexture* src,
  17. const MathUtil::Rectangle<int>& src_rect, u32 src_layer,
  18. u32 src_level, const MathUtil::Rectangle<int>& dst_rect,
  19. u32 dst_layer, u32 dst_level) override;
  20. void ResolveFromTexture(const AbstractTexture* src, const MathUtil::Rectangle<int>& rect,
  21. u32 layer, u32 level) override;
  22. void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer, size_t buffer_size,
  23. u32 layer) override;
  24. };
  25. class NullStagingTexture final : public AbstractStagingTexture
  26. {
  27. public:
  28. explicit NullStagingTexture(StagingTextureType type, const TextureConfig& config);
  29. ~NullStagingTexture();
  30. void CopyFromTexture(const AbstractTexture* src, const MathUtil::Rectangle<int>& src_rect,
  31. u32 src_layer, u32 src_level,
  32. const MathUtil::Rectangle<int>& dst_rect) override;
  33. void CopyToTexture(const MathUtil::Rectangle<int>& src_rect, AbstractTexture* dst,
  34. const MathUtil::Rectangle<int>& dst_rect, u32 dst_layer,
  35. u32 dst_level) override;
  36. bool Map() override;
  37. void Unmap() override;
  38. void Flush() override;
  39. private:
  40. std::vector<u8> m_texture_buf;
  41. };
  42. class NullFramebuffer final : public AbstractFramebuffer
  43. {
  44. public:
  45. explicit NullFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment,
  46. std::vector<AbstractTexture*> additional_color_attachments,
  47. AbstractTextureFormat color_format, AbstractTextureFormat depth_format,
  48. u32 width, u32 height, u32 layers, u32 samples);
  49. static std::unique_ptr<NullFramebuffer>
  50. Create(NullTexture* color_attachment, NullTexture* depth_attachment,
  51. std::vector<AbstractTexture*> additional_color_attachments);
  52. };
  53. } // namespace Null