2015-12-31 15:59:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2020-10-04 21:24:14 +00:00
|
|
|
#include "Common/GPU/thin3d.h"
|
2015-12-31 15:59:40 +00:00
|
|
|
|
|
|
|
// Init is done differently on each platform, and done close to the creation, so it's
|
|
|
|
// expected to be implemented by subclasses.
|
|
|
|
class GraphicsContext {
|
|
|
|
public:
|
|
|
|
virtual ~GraphicsContext() {}
|
|
|
|
|
2018-01-16 13:16:56 +00:00
|
|
|
virtual bool InitFromRenderThread(std::string *errorMessage) { return true; }
|
2018-01-16 17:13:31 +00:00
|
|
|
virtual void ShutdownFromRenderThread() {}
|
2017-12-15 11:40:38 +00:00
|
|
|
|
2015-12-31 15:59:40 +00:00
|
|
|
virtual void Shutdown() = 0;
|
2016-01-01 11:14:09 +00:00
|
|
|
|
2015-12-31 15:59:40 +00:00
|
|
|
// Used during window resize. Must be called from the window thread,
|
|
|
|
// not the rendering thread or CPU thread.
|
|
|
|
virtual void Pause() {}
|
|
|
|
virtual void Resume() {}
|
|
|
|
|
|
|
|
virtual void Resize() = 0;
|
|
|
|
|
2016-01-05 20:18:43 +00:00
|
|
|
// Needs casting to the appropriate type, unfortunately. Should find a better solution..
|
|
|
|
virtual void *GetAPIContext() { return nullptr; }
|
|
|
|
|
2017-12-15 11:40:38 +00:00
|
|
|
// Called from the render thread from threaded backends.
|
2018-01-16 17:13:31 +00:00
|
|
|
virtual void ThreadStart() {}
|
|
|
|
virtual bool ThreadFrame() { return true; }
|
|
|
|
virtual void ThreadEnd() {}
|
2018-02-11 00:12:33 +00:00
|
|
|
virtual void StopThread() {}
|
2017-12-15 11:40:38 +00:00
|
|
|
|
2020-06-21 20:34:37 +00:00
|
|
|
// Useful for checks that need to be performed every frame.
|
|
|
|
// Should strive to get rid of these.
|
|
|
|
virtual void Poll() {}
|
|
|
|
|
2017-02-06 10:20:27 +00:00
|
|
|
virtual Draw::DrawContext *GetDrawContext() = 0;
|
2015-12-31 15:59:40 +00:00
|
|
|
};
|