Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/Common/GraphicsContext.h
3185 views
1
#pragma once
2
3
#include <string>
4
5
#include "Common/GPU/thin3d.h"
6
7
// Init is done differently on each platform, and done close to the creation, so it's
8
// expected to be implemented by subclasses.
9
class GraphicsContext {
10
public:
11
virtual ~GraphicsContext() = default;
12
13
virtual bool InitFromRenderThread(std::string *errorMessage) { return true; }
14
virtual void ShutdownFromRenderThread() {}
15
16
virtual void Shutdown() = 0;
17
18
// Used during window resize. Must be called from the window thread,
19
// not the rendering thread or CPU thread.
20
virtual void Pause() {}
21
virtual void Resume() {}
22
23
virtual void Resize() = 0;
24
virtual void NotifyWindowRestored() {}
25
26
// Needs casting to the appropriate type, unfortunately. Should find a better solution..
27
virtual void *GetAPIContext() { return nullptr; }
28
29
// Called from the render thread from threaded backends.
30
virtual void ThreadStart() {}
31
virtual bool ThreadFrame() { return true; }
32
virtual void ThreadEnd() {}
33
virtual void StopThread() {}
34
35
// Useful for checks that need to be performed every frame.
36
// Should strive to get rid of these.
37
virtual void Poll() {}
38
39
virtual Draw::DrawContext *GetDrawContext() = 0;
40
};
41
42