Skip to content

Commit 6728a54

Browse files
committed
xrRender_GL: now dll is loaded without error on linux
1 parent 59086d0 commit 6728a54

File tree

5 files changed

+42
-26
lines changed

5 files changed

+42
-26
lines changed

src/Layers/xrRenderPC_GL/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ list(APPEND DIRS
55
"../xrRender"
66
"../xrRender/blenders"
77
"../xrRenderGL"
8+
"../xrRenderGL/MSAA"
9+
"../xrRenderGL/GL Rain"
810
"../../Include/xrRender"
911
)
1012

src/Layers/xrRenderPC_GL/gl_rendertarget.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
#include "Layers/xrRenderDX10/MSAA/dx10MSAABlender.h"
1515
#include "Layers/xrRenderDX10/DX10 Rain/dx10RainBlender.h"
1616

17+
#if defined(LINUX)
18+
float OLES_SUN_LIMIT_27_01_07 = 100.f;
19+
#endif
20+
1721
void CRenderTarget::u_setrt(const ref_rt& _1, const ref_rt& _2, const ref_rt& _3, GLuint zb)
1822
{
1923
if (_1)
@@ -188,7 +192,7 @@ Ivector vpack(Fvector src)
188192
float e_best = flt_max;
189193
int r = bx, g = by, b = bz;
190194
#ifdef DEBUG
191-
int d=0;
195+
int d=0;
192196
#else
193197
int d = 3;
194198
#endif
@@ -248,11 +252,11 @@ CRenderTarget::CRenderTarget()
248252
SampleCount = RImplementation.o.dx10_msaa_samples;
249253

250254
#ifdef DEBUG
251-
Msg ("MSAA samples = %d", SampleCount );
255+
Msg ("MSAA samples = %d", SampleCount );
252256
if( RImplementation.o.dx10_msaa_opt )
253-
Msg ("dx10_MSAA_opt = on" );
257+
Msg ("dx10_MSAA_opt = on" );
254258
if( RImplementation.o.dx10_gbuffer_opt )
255-
Msg ("dx10_gbuffer_opt = on" );
259+
Msg ("dx10_gbuffer_opt = on" );
256260
#endif // DEBUG
257261
param_blur = 0.f;
258262
param_gray = 0.f;
@@ -897,7 +901,7 @@ CRenderTarget::CRenderTarget()
897901
s_flip.create("effects\\screen_set", r2_base);
898902
g_flip.create(FVF::F_TL, RCache.Vertex.Buffer(), RCache.QuadIB);
899903

900-
//
904+
//
901905
dwWidth = Device.dwWidth;
902906
dwHeight = Device.dwHeight;
903907
}
@@ -914,13 +918,13 @@ CRenderTarget::~CRenderTarget()
914918
t_LUM_dest->surface_set(GL_TEXTURE_2D, NULL);
915919

916920
#ifdef DEBUG
917-
GLuint pSurf = 0;
921+
GLuint pSurf = 0;
918922

919-
pSurf = t_envmap_0->surface_get();
920-
glDeleteTextures(1, &pSurf);
923+
pSurf = t_envmap_0->surface_get();
924+
glDeleteTextures(1, &pSurf);
921925

922-
pSurf = t_envmap_1->surface_get();
923-
glDeleteTextures(1, &pSurf);
926+
pSurf = t_envmap_1->surface_get();
927+
glDeleteTextures(1, &pSurf);
924928
#endif // DEBUG
925929
t_envmap_0->surface_set(GL_TEXTURE_CUBE_MAP, NULL);
926930
t_envmap_1->surface_set(GL_TEXTURE_CUBE_MAP, NULL);
@@ -940,7 +944,7 @@ CRenderTarget::~CRenderTarget()
940944
t_noise_mipped->surface_set(GL_TEXTURE_2D, NULL);
941945
glDeleteTextures(1, &t_noise_surf_mipped);
942946

943-
//
947+
//
944948
accum_spot_geom_destroy();
945949
accum_omnip_geom_destroy();
946950
accum_point_geom_destroy();

src/Layers/xrRenderPC_GL/rgl.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void CRender::create()
147147

148148
//. _tzset ();
149149
//. ??? _strdate ( date, 128 ); ???
150-
//. ??? if (date < 22-march-07)
150+
//. ??? if (date < 22-march-07)
151151
if (false)
152152
{
153153
u32 device_id = HW.Caps.id_device;
@@ -441,11 +441,11 @@ void CRender::reset_end()
441441
/*
442442
void CRender::OnFrame()
443443
{
444-
Models->DeleteQueue ();
445-
if (ps_r2_ls_flags.test(R2FLAG_EXP_MT_CALC)) {
446-
Device.seqParallel.insert (Device.seqParallel.begin(),
447-
fastdelegate::FastDelegate0<>(&HOM,&CHOM::MT_RENDER));
448-
}
444+
Models->DeleteQueue ();
445+
if (ps_r2_ls_flags.test(R2FLAG_EXP_MT_CALC)) {
446+
Device.seqParallel.insert (Device.seqParallel.begin(),
447+
fastdelegate::FastDelegate0<>(&HOM,&CHOM::MT_RENDER));
448+
}
449449
}*/
450450
void CRender::OnFrame()
451451
{
@@ -679,7 +679,9 @@ void CRender::rmNormal()
679679
CRender::CRender()
680680
: m_bFirstFrameAfterReset(false)
681681
{
682+
#if defined(WINDOWS) // remove this after port r2_R_sun.cpp
682683
init_cacades();
684+
#endif
683685
}
684686

685687
CRender::~CRender() {}
@@ -1276,7 +1278,7 @@ HRESULT CRender::shader_compile(
12761278
sprintf_s(name_comment, "// %s\n", name);
12771279
const char** sources = xr_alloc<const char*>(sources_len);
12781280
#ifdef DEBUG
1279-
sources[0] = "#version 450\n#pragma optimize (off)\n";
1281+
sources[0] = "#version 450\n#pragma optimize (off)\n";
12801282
#else
12811283
sources[0] = "#version 450\n";
12821284
#endif

src/Layers/xrRenderPC_GL/rgl.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class CRender : public D3DXRenderBase
9191
u32 dx10_msaa : 1; // DX10.0 path
9292
u32 dx10_msaa_hybrid : 1; // DX10.0 main path with DX10.1 A-test msaa allowed
9393
u32 dx10_msaa_opt : 1; // DX10.1 path
94-
u32 dx10_gbuffer_opt : 1; //
94+
u32 dx10_gbuffer_opt : 1; //
9595
u32 dx10_sm4_1 : 1; // DX10.1 path
9696
u32 dx10_msaa_alphatest : 2; // A-test mode
9797
u32 dx10_msaa_samples : 4;
@@ -215,7 +215,9 @@ class CRender : public D3DXRenderBase
215215
void render_rain();
216216

217217
void render_sun_cascade(u32 cascade_ind);
218+
#if defined(WINDOWS) // remove this after port r2_R_sun.cpp
218219
void init_cacades();
220+
#endif
219221
void render_sun_cascades();
220222

221223
ShaderElement* rimp_select_sh_static(dxRender_Visual* pVisual, float cdist_sq);
@@ -307,7 +309,7 @@ class CRender : public D3DXRenderBase
307309
IRender_Sector* detectSector(const Fvector& P) override;
308310
IRender_Target* getTarget() override;
309311

310-
// Main
312+
// Main
311313
void flush() override;
312314
void set_Object(IRenderable* O) override;
313315
void add_Occluder(Fbox2& bb_screenspace) override; // mask screen region as oclluded

src/xrEngine/EngineAPI.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void CEngineAPI::InitializeRenderers()
150150
// XXX: Unloading disabled due to typeids invalidation
151151
/*if (GEnv.CurrentRenderer != 5)
152152
hRenderRGL->close();
153-
153+
154154
if (GEnv.CurrentRenderer != 4)
155155
hRenderR4->close();
156156
@@ -220,37 +220,43 @@ void CEngineAPI::CreateRendererList()
220220
if (!VidQualityToken.empty())
221221
return;
222222

223+
hRenderRGL = XRay::LoadModule("xrRender_GL");
224+
#if defined(WINDOWS)
223225
hRenderR1 = XRay::LoadModule("xrRender_R1");
226+
#endif
224227

225228
if (GEnv.isDedicatedServer)
226229
{
230+
#if defined(WINDOWS)
227231
R_ASSERT2(hRenderR1->IsLoaded(), "Dedicated server needs xrRender_R1 to work");
228232
VidQualityToken.emplace_back("renderer_r1", 0);
233+
#elif defined(LINUX)
234+
R_ASSERT2(hRenderRGL->IsLoaded(), "Dedicated server needs xrRender_GL to work");
235+
VidQualityToken.emplace_back("renderer_gl", 0);
236+
#endif
229237
VidQualityToken.emplace_back(nullptr, -1);
230238
return;
231239
}
232240

241+
auto& modes = VidQualityToken;
242+
233243
#if defined(WINDOWS)
234244
// Hide "d3d10.dll not found" message box for XP
235245
SetErrorMode(SEM_FAILCRITICALERRORS);
236246

237247
hRenderR2 = XRay::LoadModule("xrRender_R2");
238248
hRenderR3 = XRay::LoadModule("xrRender_R3");
239249
hRenderR4 = XRay::LoadModule("xrRender_R4");
240-
#endif
241-
hRenderRGL = XRay::LoadModule("xrRender_GL");
242250

243251
// Restore error handling
244252
SetErrorMode(0);
245253

246-
auto& modes = VidQualityToken;
247-
248254
if (hRenderR1->IsLoaded())
249255
{
250256
modes.emplace_back("renderer_r1", 0);
251257
}
252258

253-
#if defined(WINDOWS)
259+
254260
if (hRenderR2->IsLoaded())
255261
{
256262
modes.emplace_back("renderer_r2a", 1);

0 commit comments

Comments
 (0)