Skip to content

Commit 33affdb

Browse files
committed
xrRender: Add missing OpenGL implementations.
1 parent e19d65f commit 33affdb

File tree

6 files changed

+57
-28
lines changed

6 files changed

+57
-28
lines changed

src/Layers/xrRender/D3DXRenderBase.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class D3DXRenderBase : public IRender, public pureFrame
4848

4949
// Runtime structures
5050
xr_vector<R_dsgraph::mapNormalVS::TNode*,render_alloc<R_dsgraph::mapNormalVS::TNode*> > nrmVS;
51-
#if defined(USE_DX10) || defined(USE_DX11)
51+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
5252
xr_vector<R_dsgraph::mapNormalGS::TNode*,render_alloc<R_dsgraph::mapNormalGS::TNode*> > nrmGS;
5353
#endif // USE_DX10
5454
xr_vector<R_dsgraph::mapNormalPS::TNode*,render_alloc<R_dsgraph::mapNormalPS::TNode*> > nrmPS;
@@ -58,7 +58,7 @@ class D3DXRenderBase : public IRender, public pureFrame
5858
xr_vector<R_dsgraph::mapNormalTextures::TNode*,render_alloc<R_dsgraph::mapNormalTextures::TNode*> > nrmTexturesTemp;
5959

6060
xr_vector<R_dsgraph::mapMatrixVS::TNode*,render_alloc<R_dsgraph::mapMatrixVS::TNode*> > matVS;
61-
#if defined(USE_DX10) || defined(USE_DX11)
61+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
6262
xr_vector<R_dsgraph::mapMatrixGS::TNode*,render_alloc<R_dsgraph::mapMatrixGS::TNode*> > matGS;
6363
#endif // USE_DX10
6464
xr_vector<R_dsgraph::mapMatrixPS::TNode*,render_alloc<R_dsgraph::mapMatrixPS::TNode*> > matPS;
@@ -228,5 +228,7 @@ class D3DXRenderBase : public IRender, public pureFrame
228228
ref_shader m_SelectionShader;
229229

230230
private:
231-
CGammaControl m_Gamma;
231+
#ifndef USE_OGL
232+
CGammaControl m_Gamma;
233+
#endif // !USE_OGL
232234
};

src/Layers/xrRender/r__dsgraph_build.cpp

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void D3DXRenderBase::r_dsgraph_insert_dynamic (dxRender_Visual *pVisual, Fvector
161161

162162

163163
#ifdef USE_RESOURCE_DEBUGGER
164-
#if defined(USE_DX10) || defined(USE_DX11)
164+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
165165
mapMatrixVS::TNode* Nvs = map.insert (pass.vs);
166166
mapMatrixGS::TNode* Ngs = Nvs->val.insert (pass.gs);
167167
mapMatrixPS::TNode* Nps = Ngs->val.insert (pass.ps);
@@ -170,7 +170,11 @@ void D3DXRenderBase::r_dsgraph_insert_dynamic (dxRender_Visual *pVisual, Fvector
170170
mapMatrixPS::TNode* Nps = Nvs->val.insert (pass.ps);
171171
#endif // USE_DX10
172172
#else
173-
#if defined(USE_DX10) || defined(USE_DX11)
173+
#if defined(USE_OGL)
174+
mapMatrixVS::TNode* Nvs = map.insert (pass.vs->vs);
175+
mapMatrixGS::TNode* Ngs = Nvs->val.insert (pass.gs->gs);
176+
mapMatrixPS::TNode* Nps = Ngs->val.insert (pass.ps->ps);
177+
#elif defined(USE_DX10) || defined(USE_DX11)
174178
mapMatrixVS::TNode* Nvs = map.insert (&*pass.vs);
175179
mapMatrixGS::TNode* Ngs = Nvs->val.insert (pass.gs->gs);
176180
mapMatrixPS::TNode* Nps = Ngs->val.insert (pass.ps->ps);
@@ -207,11 +211,11 @@ void D3DXRenderBase::r_dsgraph_insert_dynamic (dxRender_Visual *pVisual, Fvector
207211
#else
208212
if (SSA>Nps->val.ssa) { Nps->val.ssa = SSA;
209213
#endif
210-
#if defined(USE_DX10) || defined(USE_DX11)
214+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
211215
if (SSA>Ngs->val.ssa) { Ngs->val.ssa = SSA;
212216
#endif // USE_DX10
213217
if (SSA>Nvs->val.ssa) { Nvs->val.ssa = SSA;
214-
#if defined(USE_DX10) || defined(USE_DX11)
218+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
215219
} } } } } }
216220
#else // USE_DX10
217221
} } } } }
@@ -322,7 +326,7 @@ void D3DXRenderBase::r_dsgraph_insert_static (dxRender_Visual *pVisual)
322326
//#endif
323327

324328
#ifdef USE_RESOURCE_DEBUGGER
325-
# if defined(USE_DX10) || defined(USE_DX11)
329+
# if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
326330
mapNormalVS::TNode* Nvs = map.insert (pass.vs);
327331
mapNormalGS::TNode* Ngs = Nvs->val.insert (pass.gs);
328332
mapNormalPS::TNode* Nps = Ngs->val.insert (pass.ps);
@@ -331,7 +335,11 @@ void D3DXRenderBase::r_dsgraph_insert_static (dxRender_Visual *pVisual)
331335
mapNormalPS::TNode* Nps = Nvs->val.insert (pass.ps);
332336
# endif // USE_DX10
333337
#else // USE_RESOURCE_DEBUGGER
334-
# if defined(USE_DX10) || defined(USE_DX11)
338+
# if defined(USE_OGL)
339+
mapNormalVS::TNode* Nvs = map.insert (pass.vs->vs);
340+
mapNormalGS::TNode* Ngs = Nvs->val.insert (pass.gs->gs);
341+
mapNormalPS::TNode* Nps = Ngs->val.insert (pass.ps->ps);
342+
# elif defined(USE_DX10) || defined(USE_DX11)
335343
mapNormalVS::TNode* Nvs = map.insert (&*pass.vs);
336344
mapNormalGS::TNode* Ngs = Nvs->val.insert (pass.gs->gs);
337345
mapNormalPS::TNode* Nps = Ngs->val.insert (pass.ps->ps);
@@ -764,16 +772,32 @@ void D3DXRenderBase::Copy(IRender &_in)
764772
{ *this = *(D3DXRenderBase*)&_in; }
765773

766774
void D3DXRenderBase::setGamma(float fGamma)
767-
{ m_Gamma.Gamma(fGamma); }
775+
{
776+
#ifndef USE_OGL
777+
m_Gamma.Gamma(fGamma);
778+
#endif // !USE_OGL
779+
}
768780

769781
void D3DXRenderBase::setBrightness(float fGamma)
770-
{ m_Gamma.Brightness(fGamma); }
782+
{
783+
#ifndef USE_OGL
784+
m_Gamma.Brightness(fGamma);
785+
#endif // !USE_OGL
786+
}
771787

772788
void D3DXRenderBase::setContrast(float fGamma)
773-
{ m_Gamma.Contrast(fGamma); }
789+
{
790+
#ifndef USE_OGL
791+
m_Gamma.Contrast(fGamma);
792+
#endif // !USE_OGL
793+
}
774794

775795
void D3DXRenderBase::updateGamma()
776-
{ m_Gamma.Update(); }
796+
{
797+
#ifndef USE_OGL
798+
m_Gamma.Update();
799+
#endif // !USE_OGL
800+
}
777801

778802
void D3DXRenderBase::OnDeviceDestroy(bool bKeepTextures)
779803
{
@@ -875,7 +899,9 @@ void D3DXRenderBase::OnDeviceCreate(const char *shName)
875899
{
876900
// Signal everyone - device created
877901
RCache.OnDeviceCreate();
902+
#ifndef USE_OGL
878903
m_Gamma.Update();
904+
#endif // !USE_OGL
879905
Resources->OnDeviceCreate(shName);
880906
create();
881907
if (!g_dedicated_server)

src/Layers/xrRender/r__dsgraph_render.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ IC bool cmp_ps_mat (mapMatrixPS::TNode* N1, mapMatrixPS::TNode* N2)
102102
#endif
103103
}
104104

105-
#if defined(USE_DX10) || defined(USE_DX11)
105+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
106106
IC bool cmp_gs_nrm (mapNormalGS::TNode* N1, mapNormalGS::TNode* N2) { return (N1->val.ssa > N2->val.ssa); }
107107
IC bool cmp_gs_mat (mapMatrixGS::TNode* N1, mapMatrixGS::TNode* N2) { return (N1->val.ssa > N2->val.ssa); }
108108
#endif // USE_DX10
@@ -282,7 +282,7 @@ void D3DXRenderBase::r_dsgraph_render_graph (u32 _priority, bool _clear)
282282
mapNormalVS::TNode* Nvs = nrmVS[vs_id];
283283
RCache.set_VS (Nvs->key);
284284

285-
#if defined(USE_DX10) || defined(USE_DX11)
285+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
286286
// GS setup
287287
mapNormalGS& gs = Nvs->val; gs.ssa = 0;
288288

@@ -351,7 +351,7 @@ void D3DXRenderBase::r_dsgraph_render_graph (u32 _priority, bool _clear)
351351
}
352352
nrmPS.clear ();
353353
if(_clear) ps.clear ();
354-
#if defined(USE_DX10) || defined(USE_DX11)
354+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
355355
}
356356
nrmGS.clear ();
357357
if(_clear) gs.clear ();
@@ -376,7 +376,7 @@ void D3DXRenderBase::r_dsgraph_render_graph (u32 _priority, bool _clear)
376376
mapMatrixVS::TNode* Nvs = matVS[vs_id];
377377
RCache.set_VS (Nvs->key);
378378

379-
#if defined(USE_DX10) || defined(USE_DX11)
379+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
380380
mapMatrixGS& gs = Nvs->val; gs.ssa = 0;
381381

382382
gs.getANY_P (matGS);
@@ -443,7 +443,7 @@ void D3DXRenderBase::r_dsgraph_render_graph (u32 _priority, bool _clear)
443443
}
444444
matPS.clear ();
445445
if(_clear) ps.clear ();
446-
#if defined(USE_DX10) || defined(USE_DX11)
446+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
447447
}
448448
matGS.clear ();
449449
if(_clear) gs.clear ();

src/Layers/xrRender/r__dsgraph_types.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ namespace R_dsgraph
9494
#ifdef USE_OGL
9595
typedef GLuint vs_type;
9696
typedef GLuint ps_type;
97+
typedef GLuint gs_type;
9798
#else
9899
#if defined(USE_DX10) || defined(USE_DX11) // DX10 needs shader signature to propperly bind deometry to shader
99100
typedef SVS* vs_type;
@@ -127,7 +128,7 @@ namespace R_dsgraph
127128
#else
128129
struct mapNormalPS : public FixedMAP<ps_type, mapNormalCS,render_allocator> { float ssa; };
129130
#endif // USE_DX11
130-
#if defined(USE_DX10) || defined(USE_DX11)
131+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
131132
struct mapNormalGS : public FixedMAP<gs_type, mapNormalPS,render_allocator> { float ssa; };
132133
struct mapNormalVS : public FixedMAP<vs_type, mapNormalGS,render_allocator> { };
133134
#else // USE_DX10
@@ -153,7 +154,7 @@ namespace R_dsgraph
153154
#else
154155
struct mapMatrixPS : public FixedMAP<ps_type, mapMatrixCS,render_allocator> { float ssa; };
155156
#endif // USE_DX11
156-
#if defined(USE_DX10) || defined(USE_DX11)
157+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
157158
struct mapMatrixGS : public FixedMAP<gs_type, mapMatrixPS,render_allocator> { float ssa; };
158159
struct mapMatrixVS : public FixedMAP<vs_type, mapMatrixGS,render_allocator> { };
159160
#else // USE_DX10

src/Layers/xrRender/r_constants.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#include "stdafx.h"
22
#pragma hdrstop
33

4-
#pragma warning(disable:4995)
5-
#include <d3dx9.h>
6-
#pragma warning(default:4995)
7-
84
#include "ResourceManager.h"
95
#include "xrCore/xrPool.h"
106
#include "r_constants.h"
@@ -52,7 +48,7 @@ ref_constant R_constant_table::get (shared_str& S)
5248
return 0;
5349
}
5450

55-
#if !defined(USE_DX10) && !defined(USE_DX11)
51+
#if !defined(USE_DX10) && !defined(USE_DX11) && !defined(USE_OGL)
5652
BOOL R_constant_table::parse (void* _desc, u32 destination)
5753
{
5854
D3DXSHADER_CONSTANTTABLE* desc = (D3DXSHADER_CONSTANTTABLE*) _desc;
@@ -201,7 +197,7 @@ void R_constant_table::merge(R_constant_table* T)
201197
C->type = src->type;
202198
C->ps = src->ps;
203199
C->vs = src->vs;
204-
#if defined(USE_DX10) || defined(USE_DX11)
200+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
205201
C->gs = src->gs;
206202
# ifdef USE_DX11
207203
C->hs = src->hs;
@@ -221,6 +217,10 @@ void R_constant_table::merge(R_constant_table* T)
221217
R_constant_load& dL = C->get_load(src->destination);
222218
dL.index = sL.index;
223219
dL.cls = sL.cls;
220+
#ifdef USE_OGL
221+
dL.location = sL.location;
222+
dL.program = sL.program;
223+
#endif // USE_OGL
224224
}
225225
}
226226

src/Layers/xrRender/r_constants.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ struct ECORE_API R_constant :public xr_resource
9999

100100
R_constant_load ps;
101101
R_constant_load vs;
102-
#if defined(USE_DX10) || defined(USE_DX11)
102+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
103103
R_constant_load gs;
104104
# ifdef USE_DX11
105105
R_constant_load hs;
@@ -121,7 +121,7 @@ struct ECORE_API R_constant :public xr_resource
121121
return vs;
122122
case RC_dest_pixel:
123123
return ps;
124-
#if defined(USE_DX10) || defined(USE_DX11)
124+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
125125
case RC_dest_geometry:
126126
return gs;
127127
# ifdef USE_DX11

0 commit comments

Comments
 (0)