2015-12-31 16:59:40 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2020-10-04 23:24:14 +02:00
|
|
|
#include "Common/GPU/thin3d.h"
|
2015-12-31 16:59:40 +01: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 14:16:56 +01:00
|
|
|
virtual bool InitFromRenderThread(std::string *errorMessage) { return true; }
|
2018-01-16 18:13:31 +01:00
|
|
|
virtual void ShutdownFromRenderThread() {}
|
2017-12-15 12:40:38 +01:00
|
|
|
|
2015-12-31 16:59:40 +01:00
|
|
|
virtual void Shutdown() = 0;
|
2016-01-01 12:14:09 +01:00
|
|
|
|
2015-12-31 16:59:40 +01: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 21:18:43 +01:00
|
|
|
// Needs casting to the appropriate type, unfortunately. Should find a better solution..
|
|
|
|
virtual void *GetAPIContext() { return nullptr; }
|
|
|
|
|
2017-12-15 12:40:38 +01:00
|
|
|
// Called from the render thread from threaded backends.
|
2018-01-16 18:13:31 +01:00
|
|
|
virtual void ThreadStart() {}
|
|
|
|
virtual bool ThreadFrame() { return true; }
|
|
|
|
virtual void ThreadEnd() {}
|
2018-02-10 16:12:33 -08:00
|
|
|
virtual void StopThread() {}
|
2017-12-15 12:40:38 +01:00
|
|
|
|
2020-06-21 22:34:37 +02:00
|
|
|
// Useful for checks that need to be performed every frame.
|
|
|
|
// Should strive to get rid of these.
|
|
|
|
virtual void Poll() {}
|
|
|
|
|
2017-02-06 11:20:27 +01:00
|
|
|
virtual Draw::DrawContext *GetDrawContext() = 0;
|
2015-12-31 16:59:40 +01:00
|
|
|
};
|