Skip to content

Commit feb1091

Browse files
committed
修复部分退出
1 parent 2916bad commit feb1091

5 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎src/Context/Context.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ namespace FCT {
163163

164164
Context::~Context() {
165165
m_ctxRunning = false;
166+
FCT_SAFE_DELETE(m_renderGraph);
166167
m_submitThread.join();
167168
}
168169

‎src/Context/Context.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ namespace FCT
199199
}
200200
constexpr inline void _waitForNextFrame()
201201
{
202-
FCT_WAIT_FOR(m_nextFrame);
202+
FCT_WAIT_FOR_WITH_TERM(m_nextFrame,!m_ctxRunning);
203203
}
204204
void advanceLogicFrame()
205205
{

‎src/Context/RenderGraph.cpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ namespace FCT
105105
syncTickers.update();
106106
}
107107

108+
RenderGraph::~RenderGraph()
109+
{
110+
auto& syncTickers = m_flowControl->syncTickers();
111+
syncTickers.removeNode(RenderGraphTickers::CheckRecompiledSync);
112+
syncTickers.update();
113+
auto& submitGraph = m_flowControl->submitTickers();
114+
submitGraph.removeNode(RenderGraphTickers::RenderGraphSubmit);
115+
submitGraph.update();
116+
}
117+
108118
RenderGraphImageNode* RenderGraph::getOrCreateImageNode(const std::string& name, const Texture& texture)
109119
{
110120
auto it = m_imageNodes.find(name);

‎src/Context/RenderGraph.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ namespace FCT
299299
public:
300300
RenderGraph(PipeHub& pipeHub, Device* device, FlowControl* flowControl, CommandBufferGraph* commandBufferGraph,
301301
ResourceManager* resourceManager);
302+
~RenderGraph();
302303
void recompile();
303304
std::vector<PassDesc> getOriginalPasses() const
304305
{

‎src/ToolDefine.h‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@
88
//#define FCT_SAFE_ADDREF(p) if (p) { p->addRef(); }
99
#define FCT_WAIT_FOR(condition) \
1010
do { \
11-
while(!condition) \
11+
while(!(condition)) \
1212
{\
1313
std::this_thread::sleep_for(std::chrono::milliseconds(0)); \
1414
}\
1515
condition = false;\
1616
} while(0)
17+
#define FCT_WAIT_FOR_WITH_TERM(condition,termCondition) \
18+
do { \
19+
while(!condition && !(termCondition)) \
20+
{\
21+
std::this_thread::sleep_for(std::chrono::milliseconds(0)); \
22+
}\
23+
condition = false;\
24+
} while(0)
1725
#endif //FCT_TOOLDEFINE_H

0 commit comments

Comments
 (0)