File tree Expand file tree Collapse file tree 7 files changed +161
-96
lines changed Expand file tree Collapse file tree 7 files changed +161
-96
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ class ISoundManager;
1414
1515class XRAPI_API EngineGlobalEnvironment
1616{
17+ using SupportCheck = bool (*)();
18+ using SetupEnv = void (*)();
1719public:
1820#ifdef _EDITOR
1921 CRender* Render;
@@ -31,6 +33,15 @@ class XRAPI_API EngineGlobalEnvironment
3133 ISoundManager* Sound;
3234
3335 bool isDedicatedServer;
36+
37+ SupportCheck CheckR2;
38+ SupportCheck CheckR3;
39+ SupportCheck CheckR4;
40+ SetupEnv SetupR1;
41+ SetupEnv SetupR2;
42+ SetupEnv SetupR3;
43+ SetupEnv SetupR4;
44+ SetupEnv SetupCurrentRenderer;
3445};
3546
3647extern XRAPI_API EngineGlobalEnvironment GEnv;
Original file line number Diff line number Diff line change 55
66#pragma comment(lib, "xrEngine.lib")
77
8- extern " C " void XR_EXPORT SetupEnv ()
8+ void SetupEnvR1 ()
99{
1010 GEnv.Render = &RImplementation;
1111 GEnv.RenderFactory = &RenderFactoryImpl;
@@ -14,5 +14,18 @@ extern "C" void XR_EXPORT SetupEnv()
1414#ifdef DEBUG
1515 GEnv.DRender = &DebugRenderImpl;
1616#endif
17- xrRender_initconsole (); // XXX: Xottab_DUTY: move somewhere
17+ xrRender_initconsole ();
1818}
19+
20+ // This must not be optimized by compiler
21+ #pragma optimize("", off)
22+ static const volatile class GEnvHelper
23+ {
24+ public:
25+ GEnvHelper ()
26+ {
27+ GEnv.SetupR1 = SetupEnvR1;
28+ }
29+ } helper;
30+ #pragma optimize("", on)
31+
Original file line number Diff line number Diff line change 55
66#pragma comment(lib, "xrEngine.lib")
77
8- extern " C " void XR_EXPORT SetupEnv ()
8+ void SetupEnvR2 ()
99{
1010 GEnv.Render = &RImplementation;
1111 GEnv.RenderFactory = &RenderFactoryImpl;
@@ -14,10 +14,10 @@ extern "C" void XR_EXPORT SetupEnv()
1414#ifdef DEBUG
1515 GEnv.DRender = &DebugRenderImpl;
1616#endif
17- xrRender_initconsole (); // XXX: Xottab_DUTY: move somewhere
17+ xrRender_initconsole ();
1818}
1919
20- extern " C " bool XR_EXPORT SupportsAdvancedRendering ()
20+ bool SupportsAdvancedRendering ()
2121{
2222 D3DCAPS9 caps;
2323 CHW _HW;
@@ -31,3 +31,16 @@ extern "C" bool XR_EXPORT SupportsAdvancedRendering()
3131 else
3232 return true ;
3333}
34+
35+ // This must not be optimized by compiler
36+ #pragma optimize("", off)
37+ static const volatile class GEnvHelper
38+ {
39+ public:
40+ GEnvHelper ()
41+ {
42+ GEnv.CheckR2 = SupportsAdvancedRendering;
43+ GEnv.SetupR2 = SetupEnvR2;
44+ }
45+ } helper;
46+ #pragma optimize("", on)
Original file line number Diff line number Diff line change 55
66#pragma comment(lib, "xrEngine.lib")
77
8- extern " C " void XR_EXPORT SetupEnv ()
8+ void SetupEnvR3 ()
99{
1010 GEnv.Render = &RImplementation;
1111 GEnv.RenderFactory = &RenderFactoryImpl;
@@ -14,10 +14,10 @@ extern "C" void XR_EXPORT SetupEnv()
1414#ifdef DEBUG
1515 GEnv.DRender = &DebugRenderImpl;
1616#endif
17- xrRender_initconsole (); // XXX: Xottab_DUTY: move somewhere
17+ xrRender_initconsole ();
1818}
1919
20- extern " C " bool XR_EXPORT SupportsDX10Rendering ()
20+ bool SupportsDX10Rendering ()
2121{
2222 return xrRender_test_hw () ? true : false ;
2323 /*
@@ -34,3 +34,16 @@ extern "C" bool XR_EXPORT SupportsDX10Rendering()
3434 return true;
3535 */
3636}
37+
38+ // This must not be optimized by compiler
39+ #pragma optimize("", off)
40+ static const volatile class GEnvHelper
41+ {
42+ public:
43+ GEnvHelper ()
44+ {
45+ GEnv.CheckR3 = SupportsDX10Rendering;
46+ GEnv.SetupR3 = SetupEnvR3;
47+ }
48+ } helper;
49+ #pragma optimize("", on)
Original file line number Diff line number Diff line change 22#include " Layers/xrRender/dxRenderFactory.h"
33#include " Layers/xrRender/dxUIRender.h"
44#include " Layers/xrRender/dxDebugRender.h"
5+ #include " Include/xrAPI/xrAPI.h"
56
67#pragma comment(lib, "xrEngine.lib")
78
8- extern " C " void XR_EXPORT SetupEnv ()
9+ void SetupEnvR4 ()
910{
1011 GEnv.Render = &RImplementation;
1112 GEnv.RenderFactory = &RenderFactoryImpl;
@@ -14,10 +15,10 @@ extern "C" void XR_EXPORT SetupEnv()
1415#ifdef DEBUG
1516 GEnv.DRender = &DebugRenderImpl;
1617#endif
17- xrRender_initconsole (); // XXX: Xottab_DUTY: move somewhere
18+ xrRender_initconsole ();
1819}
1920
20- extern " C " bool XR_EXPORT SupportsDX11Rendering ()
21+ bool SupportsDX11Rendering ()
2122{
2223 return xrRender_test_hw () ? true : false ;
2324 /*
@@ -34,3 +35,16 @@ extern "C" bool XR_EXPORT SupportsDX11Rendering()
3435 return true;
3536 */
3637}
38+
39+ // This must not be optimized by compiler
40+ #pragma optimize("", off)
41+ static const volatile class GEnvHelper
42+ {
43+ public:
44+ GEnvHelper ()
45+ {
46+ GEnv.CheckR4 = SupportsDX11Rendering;
47+ GEnv.SetupR4 = SetupEnvR4;
48+ }
49+ } helper;
50+ #pragma optimize("", on)
You can’t perform that action at this time.
0 commit comments