Skip to content

Commit 4e84c8e

Browse files
committed
Merge remote-tracking branch 'upstream/xd_dev' into xd_dev
2 parents 79767df + 3291f1a commit 4e84c8e

File tree

7 files changed

+32
-37
lines changed

7 files changed

+32
-37
lines changed

src/Common/Common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
#include "Common/Config.hpp"
44
#include "Common/Platform.hpp"
55
#include "Common/CommonImportExport.inl"
6+
#include "Common/FSMacros.hpp"
67
#include "Include/xrAPI/xrAPI.h"

src/TypeHelper.natvis

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,9 @@
6363

6464
<Type Name="Shader">
6565
<DisplayString>{cName.p_->value, s}, $(Type)</DisplayString>
66-
</Type>
66+
</Type>
67+
68+
<Type Name="MessageObject">
69+
<DisplayString>{Object}</DisplayString>
70+
</Type>
6771
</AutoVisualizer>

src/xrEngine/Device_destroy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ void CRenderDevice::Reset(bool precache)
6060
// TODO: Remove this! It may hide crash
6161
Memory.mem_compact();
6262

63-
seqDeviceReset.Process(rp_DeviceReset);
63+
seqDeviceReset.Process();
6464
if (dwWidth_before != dwWidth || dwHeight_before != dwHeight)
65-
seqResolutionChanged.Process(rp_ScreenResolutionChanged);
65+
seqResolutionChanged.Process();
6666

6767
if (!GEnv.isDedicatedServer)
6868
pInput->ClipCursor(true);

src/xrEngine/Stats.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
int g_ErrorLineCount = 15;
1818
Flags32 g_stats_flags = {0};
1919

20-
// stats
21-
DECLARE_RP(Stats);
22-
2320
class optimizer
2421
{
2522
float average_;

src/xrEngine/device.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void CRenderDevice::RenderThreadProc(void* context)
134134
renderTotalReal.Begin();
135135
if (device.b_is_Active && device.Begin())
136136
{
137-
device.seqRender.Process(rp_Render);
137+
device.seqRender.Process();
138138
device.CalcFrameStats();
139139
device.Statistic->Show();
140140
device.End(); // Present goes here
@@ -162,7 +162,7 @@ void CRenderDevice::SecondaryThreadProc(void* context)
162162
for (u32 pit = 0; pit < device.seqParallel.size(); pit++)
163163
device.seqParallel[pit]();
164164
device.seqParallel.clear();
165-
device.seqFrameMT.Process(rp_Frame);
165+
device.seqFrameMT.Process();
166166
device.syncFrameDone.Set();
167167
}
168168
}
@@ -285,7 +285,7 @@ void CRenderDevice::on_idle()
285285
renderTotalReal.Begin();
286286
if (b_is_Active && Begin())
287287
{
288-
seqRender.Process(rp_Render);
288+
seqRender.Process();
289289
CalcFrameStats();
290290
Statistic->Show();
291291
End(); // Present goes here
@@ -364,13 +364,13 @@ void CRenderDevice::Run()
364364
thread_spawn(SecondaryThreadProc, "X-RAY Secondary thread", 0, this);
365365
//thread_spawn(RenderThreadProc, "X-RAY Render thread", 0, this);
366366
// Message cycle
367-
seqAppStart.Process(rp_AppStart);
367+
seqAppStart.Process();
368368
GEnv.Render->ClearTarget();
369369
splash::hide();
370370
ShowWindow(m_hWnd, SW_SHOWNORMAL);
371371
pInput->ClipCursor(true);
372372
message_loop();
373-
seqAppEnd.Process(rp_AppEnd);
373+
seqAppEnd.Process();
374374
// Stop Balance-Thread
375375
mt_bMustExit = TRUE;
376376
//renderProcessFrame.Set();
@@ -428,7 +428,7 @@ void CRenderDevice::FrameMove()
428428
stats.EngineTotal.Begin();
429429
// TODO: HACK to test loading screen.
430430
// if(!g_bLoaded)
431-
Device.seqFrame.Process(rp_Frame);
431+
Device.seqFrame.Process();
432432
g_bLoaded = TRUE;
433433
// else
434434
// seqFrame.Process(rp_Frame);
@@ -506,13 +506,13 @@ void CRenderDevice::OnWM_Activate(WPARAM wParam, LPARAM /*lParam*/)
506506
Device.b_is_Active = isGameActive;
507507
if (Device.b_is_Active)
508508
{
509-
Device.seqAppActivate.Process(rp_AppActivate);
509+
Device.seqAppActivate.Process();
510510
app_inactive_time += TimerMM.GetElapsed_ms() - app_inactive_time_start;
511511
}
512512
else
513513
{
514514
app_inactive_time_start = TimerMM.GetElapsed_ms();
515-
Device.seqAppDeactivate.Process(rp_AppDeactivate);
515+
Device.seqAppDeactivate.Process();
516516
}
517517
}
518518
}

src/xrEngine/pure.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,2 @@
11
#include "stdafx.h"
22
#include "pure.h"
3-
4-
DECLARE_RP(Frame);
5-
DECLARE_RP(FrameEnd);
6-
DECLARE_RP(Render);
7-
DECLARE_RP(AppActivate);
8-
DECLARE_RP(AppDeactivate);
9-
DECLARE_RP(AppStart);
10-
DECLARE_RP(AppEnd);
11-
DECLARE_RP(DeviceReset);
12-
DECLARE_RP(ScreenResolutionChanged);

src/xrEngine/pure.h

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@
88
#define REG_PRIORITY_CAPTURE 0x7ffffffful
99
#define REG_PRIORITY_INVALID 0xfffffffful
1010

11-
using MessageFunction = void __fastcall(void* obj);
12-
#define DECLARE_MESSAGE(name) \
13-
extern ENGINE_API MessageFunction rp_##name; \
14-
struct ENGINE_API pure##name \
15-
{ \
16-
virtual void On##name() = 0; \
17-
}
11+
struct IPure
12+
{
13+
virtual ~IPure() = default;
14+
virtual void OnPure() = 0;
15+
};
1816

19-
#define DECLARE_RP(name) \
20-
void __fastcall rp_##name(void* p) { ((pure##name*)p)->On##name(); }
17+
#define DECLARE_MESSAGE(name)\
18+
struct pure##name : IPure\
19+
{\
20+
virtual void On##name() = 0;\
21+
private:\
22+
void OnPure() override { On##name(); }\
23+
};
2124

2225
DECLARE_MESSAGE(Frame); // XXX: rename to FrameStart
2326
DECLARE_MESSAGE(FrameEnd);
@@ -31,7 +34,7 @@ DECLARE_MESSAGE(ScreenResolutionChanged);
3134

3235
struct MessageObject
3336
{
34-
void* Object;
37+
IPure* Object;
3538
int Prio;
3639
u32 Flags;
3740
};
@@ -91,20 +94,20 @@ class MessageRegistry
9194
Resort();
9295
}
9396

94-
void Process(MessageFunction* func)
97+
void Process()
9598
{
9699
if (messages.empty())
97100
return;
98101

99102
inProcess = true;
100103

101104
if (messages[0].Prio == REG_PRIORITY_CAPTURE)
102-
func(messages[0].Object);
105+
messages[0].Object->OnPure();
103106
else
104107
{
105108
for (auto& message : messages)
106109
if (message.Prio != REG_PRIORITY_INVALID)
107-
func(message.Object);
110+
message.Object->OnPure();
108111
}
109112

110113
if (changed)

0 commit comments

Comments
 (0)