Skip to content

Commit 2641b74

Browse files
committed
Blender_Recorder: Implement R3 recorder for OpenGL.
1 parent 6392d30 commit 2641b74

File tree

9 files changed

+249
-216
lines changed

9 files changed

+249
-216
lines changed

src/Layers/xrRender/blenders/Blender_Recorder.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class CBlender_Compile
5252

5353
string128 pass_vs;
5454
string128 pass_ps;
55-
#if defined(USE_DX10) || defined(USE_DX11)
55+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
5656
string128 pass_gs;
5757
# ifdef USE_DX11
5858
string128 pass_hs;
@@ -92,7 +92,7 @@ class CBlender_Compile
9292
void StageSET_Color (u32 a1, u32 op, u32 a2);
9393
void StageSET_Color3 (u32 a1, u32 op, u32 a2, u32 a3);
9494
void StageSET_Alpha (u32 a1, u32 op, u32 a2);
95-
#if !defined(USE_DX10) && !defined(USE_DX11)
95+
#if !defined(USE_DX10) && !defined(USE_DX11) && !defined(USE_OGL)
9696
void StageSET_TMC (LPCSTR T, LPCSTR M, LPCSTR C, int UVW_channel);
9797
void Stage_Texture (LPCSTR name, u32 address=D3DTADDRESS_WRAP, u32 fmin=D3DTEXF_LINEAR, u32 fmip=D3DTEXF_LINEAR, u32 fmag=D3DTEXF_LINEAR);
9898
void StageTemplate_LMAP0 ();
@@ -102,7 +102,7 @@ class CBlender_Compile
102102
void StageEnd ();
103103

104104
// R1/R2-compiler [programmable]
105-
#if defined(USE_DX10) || defined(USE_DX11)
105+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
106106
void i_dx10Address (u32 s, u32 address);
107107
void i_dx10Filter_Min (u32 s, u32 f);
108108
void i_dx10Filter_Mip (u32 s, u32 f);
@@ -125,7 +125,7 @@ class CBlender_Compile
125125
// R1/R2-compiler [programmable] - templates
126126
void r_Pass (LPCSTR vs, LPCSTR ps, bool bFog, BOOL bZtest=TRUE, BOOL bZwrite=TRUE, BOOL bABlend=FALSE, D3DBLEND abSRC=D3DBLEND_ONE, D3DBLEND abDST=D3DBLEND_ZERO, BOOL aTest=FALSE, u32 aRef=0);
127127
void r_Constant (LPCSTR name, R_constant_setup* s);
128-
#if defined(USE_DX10) || defined(USE_DX11)
128+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
129129
void r_Pass (LPCSTR vs, LPCSTR gs, LPCSTR ps, bool bFog, BOOL bZtest=TRUE, BOOL bZwrite=TRUE, BOOL bABlend=FALSE, D3DBLEND abSRC=D3DBLEND_ONE, D3DBLEND abDST=D3DBLEND_ZERO, BOOL aTest=FALSE, u32 aRef=0);
130130
# ifdef USE_DX11
131131
void r_TessPass (LPCSTR vs, LPCSTR hs, LPCSTR ds, LPCSTR gs, LPCSTR ps, bool bFog, BOOL bZtest=TRUE, BOOL bZwrite=TRUE, BOOL bABlend=FALSE, D3DBLEND abSRC=D3DBLEND_ONE, D3DBLEND abDST=D3DBLEND_ZERO, BOOL aTest=FALSE, u32 aRef=0);

src/Layers/xrRender/dxEnvironmentRender.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class CBlender_skybox : public IBlender
1515
virtual void Compile (CBlender_Compile& C)
1616
{
1717
C.r_Pass ("sky2", "sky2", FALSE, TRUE, FALSE);
18-
#if defined(USE_DX10) || defined(USE_DX11)
18+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
1919
//C.r_Sampler_clf ("s_sky0", "$null" );
2020
//C.r_Sampler_clf ("s_sky1", "$null" );
2121
C.r_dx10Texture ("s_sky0", "$null" );

src/Layers/xrRender/tss.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include "tss_def.h"
66

7-
#if defined(USE_DX10) || defined(USE_DX11)
7+
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
88
enum XRDX10SAMPLERSTATETYPE
99
{
1010
XRDX10SAMP_ANISOTROPICFILTER = 256,

src/Layers/xrRender/xrD3DDefs.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ typedef enum D3D_CLEAR_FLAG {
1515
D3D_CLEAR_STENCIL = 0x2L
1616
} D3D_CLEAR_FLAG;
1717

18+
#define D3D_COMPARISON_NEVER GL_NEVER
19+
#define D3D_COMPARISON_LESS GL_LESS
20+
#define D3D_COMPARISON_EQUAL GL_EQUAL
21+
#define D3D_COMPARISON_LESS_EQUAL GL_LEQUAL
22+
#define D3D_COMPARISON_GREATER GL_GREATER
23+
#define D3D_COMPARISON_NOT_EQUAL GL_NEQUAL
24+
#define D3D_COMPARISON_GREATER_EQUAL GL_GEQUAL
25+
#define D3D_COMPARISON_ALWAYS GL_ALWAYS
26+
1827
#define DX10_ONLY(expr) do {} while (0)
1928

2029
#elif defined(USE_DX11) || defined(USE_DX10)

src/Layers/xrRenderDX10/Blender_Recorder_R3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ u32 CBlender_Compile::r_dx10Sampler(LPCSTR ResourceName)
167167
i_dx10Address( stage, D3DTADDRESS_CLAMP);
168168
i_dx10Filter(stage, D3DTEXF_LINEAR, D3DTEXF_NONE, D3DTEXF_LINEAR);
169169
RS.SetSAMP(stage, XRDX10SAMP_COMPARISONFILTER, TRUE);
170-
RS.SetSAMP(stage, XRDX10SAMP_COMPARISONFUNC, D3D_COMPARISON_LESS_EQUAL);
170+
RS.SetSAMP(stage, XRDX10SAMP_COMPARISONFUNC, (u32)D3D_COMPARISON_LESS_EQUAL);
171171
}
172172

173173
if (0==xr_strcmp(ResourceName,"smp_jitter"))

src/Layers/xrRenderPC_GL/glResourceManager_Scripting.cpp

Lines changed: 207 additions & 204 deletions
Large diffs are not rendered by default.

src/Layers/xrRenderPC_GL/stdafx.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,15 @@
4343

4444
IC void jitter(CBlender_Compile& C)
4545
{
46-
C.r_Sampler("jitter0", JITTER(0), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
47-
C.r_Sampler("jitter1", JITTER(1), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
48-
C.r_Sampler("jitter2", JITTER(2), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
49-
C.r_Sampler("jitter3", JITTER(3), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
50-
C.r_Sampler("jitter4", JITTER(4), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
46+
// C.r_Sampler ("jitter0", JITTER(0), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
47+
// C.r_Sampler ("jitter1", JITTER(1), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
48+
// C.r_Sampler ("jitter2", JITTER(2), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
49+
// C.r_Sampler ("jitter3", JITTER(3), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
50+
C.r_dx10Texture ("jitter0", JITTER(0));
51+
C.r_dx10Texture ("jitter1", JITTER(1));
52+
C.r_dx10Texture ("jitter2", JITTER(2));
53+
C.r_dx10Texture ("jitter3", JITTER(3));
54+
C.r_dx10Texture ("jitter4", JITTER(4));
55+
C.r_dx10Texture ("jitterMipped", r2_jitter_mipped);
56+
C.r_dx10Sampler ("smp_jitter");
5157
}

src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
</Link>
204204
</ItemDefinitionGroup>
205205
<ItemGroup>
206+
<ClCompile Include="..\xrRenderDX10\Blender_Recorder_R3.cpp" />
206207
<ClCompile Include="..\xrRenderGL\glHW.cpp" />
207208
<ClCompile Include="..\xrRenderGL\glBufferUtils.cpp" />
208209
<ClCompile Include="..\xrRenderGL\glDetailManager_VS.cpp" />
@@ -211,6 +212,7 @@
211212
<ClCompile Include="..\xrRenderGL\glState.cpp" />
212213
<ClCompile Include="..\xrRenderGL\glStateUtils.cpp" />
213214
<ClCompile Include="..\xrRenderGL\glTextureUtils.cpp" />
215+
<ClCompile Include="..\xrRender\ColorMapManager.cpp" />
214216
<ClCompile Include="..\xrRender\D3DUtils.cpp" />
215217
<ClCompile Include="..\xrRender\DetailManager_VS.cpp" />
216218
<ClCompile Include="..\xrRender\du_box.cpp" />
@@ -402,6 +404,7 @@
402404
<ClInclude Include="..\xrRenderGL\glState.h" />
403405
<ClInclude Include="..\xrRenderGL\glStateUtils.h" />
404406
<ClInclude Include="..\xrRenderGL\glTextureUtils.h" />
407+
<ClInclude Include="..\xrRender\ColorMapManager.h" />
405408
<ClInclude Include="..\xrRender\D3DUtils.h" />
406409
<ClInclude Include="..\xrRender\D3DXRenderBase.h" />
407410
<ClInclude Include="..\xrRender\du_box.h" />

src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj.filters

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@
166166
<Filter Include="Interface implementations\MSAARender">
167167
<UniqueIdentifier>{b5644c37-6f04-44e4-8343-56fec645ad53}</UniqueIdentifier>
168168
</Filter>
169+
<Filter Include="Core_Target\ColorMap">
170+
<UniqueIdentifier>{7fdc926e-8c7d-4cba-a662-332feb1aada8}</UniqueIdentifier>
171+
</Filter>
169172
</ItemGroup>
170173
<ItemGroup>
171174
<ClCompile Include="stdafx.cpp">
@@ -633,6 +636,12 @@
633636
<ClCompile Include="glTexture.cpp">
634637
<Filter>Core</Filter>
635638
</ClCompile>
639+
<ClCompile Include="..\xrRender\ColorMapManager.cpp">
640+
<Filter>Core_Target\ColorMap</Filter>
641+
</ClCompile>
642+
<ClCompile Include="..\xrRenderDX10\Blender_Recorder_R3.cpp">
643+
<Filter>Refactored\Execution &amp; 3D\Shaders\Blender</Filter>
644+
</ClCompile>
636645
<ClCompile Include="..\xrRender\D3DUtils.cpp">
637646
<Filter>Refactored\Execution &amp; 3D\DebugDraw</Filter>
638647
</ClCompile>
@@ -1064,6 +1073,9 @@
10641073
<ClInclude Include="..\xrRender\D3DXRenderBase.h">
10651074
<Filter>Core</Filter>
10661075
</ClInclude>
1076+
<ClInclude Include="..\xrRender\ColorMapManager.h">
1077+
<Filter>Core_Target\ColorMap</Filter>
1078+
</ClInclude>
10671079
<ClInclude Include="..\xrRender\D3DUtils.h">
10681080
<Filter>Refactored\Execution &amp; 3D\DebugDraw</Filter>
10691081
</ClInclude>

0 commit comments

Comments
 (0)