SWGfx.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright 2023 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include "VideoCommon/AbstractGfx.h"
  5. class SWOGLWindow;
  6. namespace SW
  7. {
  8. class SWGfx final : public AbstractGfx
  9. {
  10. public:
  11. explicit SWGfx(std::unique_ptr<SWOGLWindow> window);
  12. ~SWGfx() override;
  13. bool IsHeadless() const override;
  14. bool SupportsUtilityDrawing() const override;
  15. std::unique_ptr<AbstractTexture> CreateTexture(const TextureConfig& config,
  16. std::string_view name) override;
  17. std::unique_ptr<AbstractStagingTexture>
  18. CreateStagingTexture(StagingTextureType type, const TextureConfig& config) override;
  19. std::unique_ptr<AbstractFramebuffer>
  20. CreateFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment,
  21. std::vector<AbstractTexture*> additional_color_attachments) override;
  22. bool BindBackbuffer(const ClearColor& clear_color = {}) override;
  23. std::unique_ptr<AbstractShader> CreateShaderFromSource(ShaderStage stage, std::string_view source,
  24. std::string_view name) override;
  25. std::unique_ptr<AbstractShader> CreateShaderFromBinary(ShaderStage stage, const void* data,
  26. size_t length,
  27. std::string_view name) override;
  28. std::unique_ptr<NativeVertexFormat>
  29. CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) override;
  30. std::unique_ptr<AbstractPipeline> CreatePipeline(const AbstractPipelineConfig& config,
  31. const void* cache_data = nullptr,
  32. size_t cache_data_length = 0) override;
  33. void ShowImage(const AbstractTexture* source_texture,
  34. const MathUtil::Rectangle<int>& source_rc) override;
  35. void ScaleTexture(AbstractFramebuffer* dst_framebuffer, const MathUtil::Rectangle<int>& dst_rect,
  36. const AbstractTexture* src_texture,
  37. const MathUtil::Rectangle<int>& src_rect) override;
  38. void SetScissorRect(const MathUtil::Rectangle<int>& rc) override;
  39. void ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool colorEnable, bool alphaEnable,
  40. bool zEnable, u32 color, u32 z) override;
  41. SurfaceInfo GetSurfaceInfo() const override;
  42. private:
  43. std::unique_ptr<SWOGLWindow> m_window;
  44. };
  45. } // namespace SW