Photon Editor Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
GraphicsContext.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <Common/assertion.h>
7
8#include <utility>
9
10#if PH_DEBUG
11#include <thread>
12#endif
13
14namespace ph::editor { class GHIThreadUpdateContext; }
15
16namespace ph::editor::ghi
17{
18
19class GHI;
20class GraphicsObjectManager;
21class GraphicsMemoryManager;
22
24{
25public:
27
28 virtual GHI& getGHI() = 0;
31
34 void load();
35
38 void unload();
39
42 void beginFrameUpdate(const GHIThreadUpdateContext& updateCtx);
43
46 void endFrameUpdate(const GHIThreadUpdateContext& updateCtx);
47
48 void addQuery(ghi::Query query);
49
50private:
52
53#if PH_DEBUG
54private:
55 bool isOnContextThread() const
56 {
57 return std::this_thread::get_id() == m_ctxThreadId;
58 }
59
60 std::thread::id m_ctxThreadId;
61#endif
62};
63
65{
66 m_queryManager.addQuery(std::move(query));
67}
68
69}// end namespace ph::editor::ghi
Definition GHIThreadUpdateContext.h:11
Definition TConcurrentQueryManager.h:21
Definition TQuery.h:29
Graphics API abstraction.
Definition GHI.h:35
Definition GraphicsContext.h:24
virtual GraphicsObjectManager & getObjectManager()=0
void addQuery(ghi::Query query)
Definition GraphicsContext.h:64
void unload()
Called by GHI thread to unload and cleanup GHI.
Definition GraphicsContext.cpp:33
void endFrameUpdate(const GHIThreadUpdateContext &updateCtx)
Called by GHI thread when a frame ends.
Definition GraphicsContext.cpp:61
void load()
Called by GHI thread to load and initiate GHI.
Definition GraphicsContext.cpp:16
virtual GraphicsMemoryManager & getMemoryManager()=0
void beginFrameUpdate(const GHIThreadUpdateContext &updateCtx)
Called by GHI thread when a frame begins.
Definition GraphicsContext.cpp:50
Manages memory for graphics.
Definition GraphicsMemoryManager.h:26
Manages the creation and deletion of graphics-related resource objects. All create<XXX>() and delete<...
Definition GraphicsObjectManager.h:26
Definition PlatformDisplay.h:13
Definition ph_editor.h:10