renderer_base.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <memory>
  6. #include <boost/optional.hpp>
  7. #include "common/assert.h"
  8. #include "common/common_types.h"
  9. #include "video_core/gpu.h"
  10. #include "video_core/rasterizer_interface.h"
  11. class EmuWindow;
  12. class RendererBase : NonCopyable {
  13. public:
  14. /// Used to reference a framebuffer
  15. enum kFramebuffer { kFramebuffer_VirtualXFB = 0, kFramebuffer_EFB, kFramebuffer_Texture };
  16. virtual ~RendererBase() {}
  17. /// Swap buffers (render frame)
  18. virtual void SwapBuffers(boost::optional<const Tegra::FramebufferConfig&> framebuffer) = 0;
  19. /**
  20. * Set the emulator window to use for renderer
  21. * @param window EmuWindow handle to emulator window to use for rendering
  22. */
  23. virtual void SetWindow(EmuWindow* window) = 0;
  24. /// Initialize the renderer
  25. virtual bool Init() = 0;
  26. /// Shutdown the renderer
  27. virtual void ShutDown() = 0;
  28. // Getter/setter functions:
  29. // ------------------------
  30. f32 GetCurrentFPS() const {
  31. return m_current_fps;
  32. }
  33. int GetCurrentFrame() const {
  34. return m_current_frame;
  35. }
  36. VideoCore::RasterizerInterface* Rasterizer() const {
  37. return rasterizer.get();
  38. }
  39. void RefreshRasterizerSetting();
  40. protected:
  41. std::unique_ptr<VideoCore::RasterizerInterface> rasterizer;
  42. f32 m_current_fps = 0.0f; ///< Current framerate, should be set by the renderer
  43. int m_current_frame = 0; ///< Current frame, should be set by the renderer
  44. private:
  45. };