File tree Expand file tree Collapse file tree 9 files changed +165
-265
lines changed Expand file tree Collapse file tree 9 files changed +165
-265
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,6 @@ class UICore;
1515
1616class XRAPI_API EngineGlobalEnvironment
1717{
18- using SupportCheck = bool (*)();
19- using SetupEnv = void (*)();
20-
2118public:
2219 IRender* Render;
2320 IDebugRender* DRender;
@@ -34,16 +31,6 @@ class XRAPI_API EngineGlobalEnvironment
3431 bool isDedicatedServer;
3532
3633 int CurrentRenderer;
37- SupportCheck CheckR2;
38- SupportCheck CheckR3;
39- SupportCheck CheckR4;
40- SupportCheck CheckRGL;
41- SetupEnv SetupR1;
42- SetupEnv SetupR2;
43- SetupEnv SetupR3;
44- SetupEnv SetupR4;
45- SetupEnv SetupRGL;
46- SetupEnv SetupCurrentRenderer;
4734};
4835
4936extern XRAPI_API EngineGlobalEnvironment GEnv;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ void CHW::DestroyD3D()
2929{
3030 _SHOW_REF (" refCount:pD3D" , pD3D);
3131 _RELEASE (pD3D);
32+ hD3D = nullptr ;
3233}
3334
3435void CHW::CreateDevice (SDL_Window* m_sdlWnd)
Original file line number Diff line number Diff line change 1- // xrRender_GL.cpp : Defines the entry point for the DLL application.
2- //
31#include " stdafx.h"
42#include " Layers/xrRender/dxRenderFactory.h"
53#include " Layers/xrRender/dxUIRender.h"
64#include " Layers/xrRender/dxDebugRender.h"
75
8- void SetupEnvRGL ()
6+ extern " C"
7+ {
8+ XR_EXPORT void SetupEnv ()
99{
1010 GEnv.Render = &RImplementation;
1111 GEnv.RenderFactory = &RenderFactoryImpl;
@@ -17,25 +17,14 @@ void SetupEnvRGL()
1717 xrRender_initconsole ();
1818}
1919
20- bool SupportsOpenGLRendering ()
20+ XR_EXPORT pcstr GetModeName ()
2121{
22- // XXX: do a real check
23- return true ;
22+ return " renderer_gl" ;
2423}
2524
26- // This must not be optimized by compiler
27- static const volatile class GEnvHelper
25+ XR_EXPORT bool CheckRendererSupport ()
2826{
29- public:
30- GEnvHelper ()
31- {
32- GEnv.CheckRGL = SupportsOpenGLRendering;
33- GEnv.SetupRGL = SetupEnvRGL;
34- }
35-
36- ~GEnvHelper ()
37- {
38- GEnv.SetupRGL = nullptr ;
39- GEnv.SetupRGL = nullptr ;
40- }
41- } helper;
27+ // XXX: do a real check
28+ return true ;
29+ }
30+ }
Original file line number Diff line number Diff line change 33#include " Layers/xrRender/dxUIRender.h"
44#include " Layers/xrRender/dxDebugRender.h"
55
6- void SetupEnvR1 ()
6+ extern " C"
7+ {
8+ XR_EXPORT void SetupEnv ()
79{
810 GEnv.Render = &RImplementation;
911 GEnv.RenderFactory = &RenderFactoryImpl;
@@ -15,16 +17,17 @@ void SetupEnvR1()
1517 xrRender_initconsole ();
1618}
1719
18- // This must not be optimized by compiler
19- static const volatile class GEnvHelper
20+ XR_EXPORT pcstr GetModeName ()
21+ {
22+ return " renderer_r1" ;
23+ }
24+
25+ XR_EXPORT bool CheckRendererSupport ()
2026{
21- public:
22- GEnvHelper ()
23- {
24- GEnv.SetupR1 = SetupEnvR1;
25- }
26- ~GEnvHelper ()
27- {
28- GEnv.SetupR1 = nullptr ;
29- }
30- } helper;
27+ CHW _HW;
28+ _HW.CreateD3D ();
29+ if (_HW.pD3D )
30+ return true ;
31+ return false ;
32+ }
33+ }
Original file line number Diff line number Diff line change 33#include " Layers/xrRender/dxUIRender.h"
44#include " Layers/xrRender/dxDebugRender.h"
55
6- void SetupEnvR2 ()
6+ extern " C"
7+ {
8+ XR_EXPORT void SetupEnv ()
79{
810 GEnv.Render = &RImplementation;
911 GEnv.RenderFactory = &RenderFactoryImpl;
@@ -15,7 +17,12 @@ void SetupEnvR2()
1517 xrRender_initconsole ();
1618}
1719
18- bool SupportsAdvancedRendering ()
20+ XR_EXPORT pcstr GetModeName ()
21+ {
22+ return " renderer_r2" ;
23+ }
24+
25+ XR_EXPORT bool CheckRendererSupport ()
1926{
2027 D3DCAPS9 caps;
2128 CHW _HW;
@@ -26,22 +33,7 @@ bool SupportsAdvancedRendering()
2633
2734 if (ps_ver_major < 3 )
2835 return false ;
29- else
30- return true ;
31- }
3236
33- // This must not be optimized by compiler
34- static const volatile class GEnvHelper
35- {
36- public:
37- GEnvHelper ()
38- {
39- GEnv.CheckR2 = SupportsAdvancedRendering;
40- GEnv.SetupR2 = SetupEnvR2;
41- }
42- ~GEnvHelper ()
43- {
44- GEnv.CheckR2 = nullptr ;
45- GEnv.SetupR2 = nullptr ;
46- }
47- } helper;
37+ return true ;
38+ }
39+ }
Original file line number Diff line number Diff line change 33#include " Layers/xrRender/dxUIRender.h"
44#include " Layers/xrRender/dxDebugRender.h"
55
6- void SetupEnvR3 ()
6+ extern " C"
7+ {
8+ XR_EXPORT void SetupEnv ()
79{
810 GEnv.Render = &RImplementation;
911 GEnv.RenderFactory = &RenderFactoryImpl;
@@ -15,36 +17,13 @@ void SetupEnvR3()
1517 xrRender_initconsole ();
1618}
1719
18- bool SupportsDX10Rendering ()
20+ XR_EXPORT pcstr GetModeName ()
1921{
20- return xrRender_test_hw () ? true : false ;
21- /*
22- D3DCAPS9 caps;
23- CHW _HW;
24- _HW.CreateD3D ();
25- _HW.pD3D->GetDeviceCaps (D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,&caps);
26- _HW.DestroyD3D ();
27- u16 ps_ver_major = u16 ( u32(u32(caps.PixelShaderVersion)&u32(0xf << 8ul))>>8 );
28-
29- if (ps_ver_major<3)
30- return false;
31- else
32- return true;
33- */
22+ return " renderer_r3" ;
3423}
3524
36- // This must not be optimized by compiler
37- static const volatile class GEnvHelper
25+ XR_EXPORT bool CheckRendererSupport ()
3826{
39- public:
40- GEnvHelper ()
41- {
42- GEnv.CheckR3 = SupportsDX10Rendering;
43- GEnv.SetupR3 = SetupEnvR3;
44- }
45- ~GEnvHelper ()
46- {
47- GEnv.CheckR3 = nullptr ;
48- GEnv.SetupR3 = nullptr ;
49- }
50- } helper;
27+ return xrRender_test_hw () ? true : false ;
28+ }
29+ }
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"
65
7- void SetupEnvR4 ()
6+ extern " C"
7+ {
8+ XR_EXPORT void SetupEnv ()
89{
910 GEnv.Render = &RImplementation;
1011 GEnv.RenderFactory = &RenderFactoryImpl;
@@ -16,36 +17,13 @@ void SetupEnvR4()
1617 xrRender_initconsole ();
1718}
1819
19- bool SupportsDX11Rendering ()
20+ XR_EXPORT pcstr GetModeName ()
2021{
21- return xrRender_test_hw () ? true : false ;
22- /*
23- D3DCAPS9 caps;
24- CHW _HW;
25- _HW.CreateD3D ();
26- _HW.pD3D->GetDeviceCaps (D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,&caps);
27- _HW.DestroyD3D ();
28- u16 ps_ver_major = u16 ( u32(u32(caps.PixelShaderVersion)&u32(0xf << 8ul))>>8 );
29-
30- if (ps_ver_major<3)
31- return false;
32- else
33- return true;
34- */
22+ return " renderer_r4" ;
3523}
3624
37- // This must not be optimized by compiler
38- static const volatile class GEnvHelper
25+ XR_EXPORT bool CheckRendererSupport ()
3926{
40- public:
41- GEnvHelper ()
42- {
43- GEnv.CheckR4 = SupportsDX11Rendering;
44- GEnv.SetupR4 = SetupEnvR4;
45- }
46- ~GEnvHelper ()
47- {
48- GEnv.CheckR4 = nullptr ;
49- GEnv.SetupR4 = nullptr ;
50- }
51- } helper;
27+ return xrRender_test_hw () ? true : false ;
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments