Skip to content

Commit

Permalink
Blender_Recorder: Implement R3 recorder for OpenGL.
Browse files Browse the repository at this point in the history
  • Loading branch information
CrossVR committed Nov 24, 2015
1 parent 6392d30 commit 2641b74
Show file tree
Hide file tree
Showing 9 changed files with 249 additions and 216 deletions.
8 changes: 4 additions & 4 deletions src/Layers/xrRender/blenders/Blender_Recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CBlender_Compile

string128 pass_vs;
string128 pass_ps;
#if defined(USE_DX10) || defined(USE_DX11)
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
string128 pass_gs;
# ifdef USE_DX11
string128 pass_hs;
Expand Down Expand Up @@ -92,7 +92,7 @@ class CBlender_Compile
void StageSET_Color (u32 a1, u32 op, u32 a2);
void StageSET_Color3 (u32 a1, u32 op, u32 a2, u32 a3);
void StageSET_Alpha (u32 a1, u32 op, u32 a2);
#if !defined(USE_DX10) && !defined(USE_DX11)
#if !defined(USE_DX10) && !defined(USE_DX11) && !defined(USE_OGL)
void StageSET_TMC (LPCSTR T, LPCSTR M, LPCSTR C, int UVW_channel);
void Stage_Texture (LPCSTR name, u32 address=D3DTADDRESS_WRAP, u32 fmin=D3DTEXF_LINEAR, u32 fmip=D3DTEXF_LINEAR, u32 fmag=D3DTEXF_LINEAR);
void StageTemplate_LMAP0 ();
Expand All @@ -102,7 +102,7 @@ class CBlender_Compile
void StageEnd ();

// R1/R2-compiler [programmable]
#if defined(USE_DX10) || defined(USE_DX11)
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
void i_dx10Address (u32 s, u32 address);
void i_dx10Filter_Min (u32 s, u32 f);
void i_dx10Filter_Mip (u32 s, u32 f);
Expand All @@ -125,7 +125,7 @@ class CBlender_Compile
// R1/R2-compiler [programmable] - templates
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);
void r_Constant (LPCSTR name, R_constant_setup* s);
#if defined(USE_DX10) || defined(USE_DX11)
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
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);
# ifdef USE_DX11
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);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/dxEnvironmentRender.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CBlender_skybox : public IBlender
virtual void Compile (CBlender_Compile& C)
{
C.r_Pass ("sky2", "sky2", FALSE, TRUE, FALSE);
#if defined(USE_DX10) || defined(USE_DX11)
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
//C.r_Sampler_clf ("s_sky0", "$null" );
//C.r_Sampler_clf ("s_sky1", "$null" );
C.r_dx10Texture ("s_sky0", "$null" );
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/tss.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "tss_def.h"

#if defined(USE_DX10) || defined(USE_DX11)
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
enum XRDX10SAMPLERSTATETYPE
{
XRDX10SAMP_ANISOTROPICFILTER = 256,
Expand Down
9 changes: 9 additions & 0 deletions src/Layers/xrRender/xrD3DDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ typedef enum D3D_CLEAR_FLAG {
D3D_CLEAR_STENCIL = 0x2L
} D3D_CLEAR_FLAG;

#define D3D_COMPARISON_NEVER GL_NEVER
#define D3D_COMPARISON_LESS GL_LESS
#define D3D_COMPARISON_EQUAL GL_EQUAL
#define D3D_COMPARISON_LESS_EQUAL GL_LEQUAL
#define D3D_COMPARISON_GREATER GL_GREATER
#define D3D_COMPARISON_NOT_EQUAL GL_NEQUAL
#define D3D_COMPARISON_GREATER_EQUAL GL_GEQUAL
#define D3D_COMPARISON_ALWAYS GL_ALWAYS

#define DX10_ONLY(expr) do {} while (0)

#elif defined(USE_DX11) || defined(USE_DX10)
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderDX10/Blender_Recorder_R3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ u32 CBlender_Compile::r_dx10Sampler(LPCSTR ResourceName)
i_dx10Address( stage, D3DTADDRESS_CLAMP);
i_dx10Filter(stage, D3DTEXF_LINEAR, D3DTEXF_NONE, D3DTEXF_LINEAR);
RS.SetSAMP(stage, XRDX10SAMP_COMPARISONFILTER, TRUE);
RS.SetSAMP(stage, XRDX10SAMP_COMPARISONFUNC, D3D_COMPARISON_LESS_EQUAL);
RS.SetSAMP(stage, XRDX10SAMP_COMPARISONFUNC, (u32)D3D_COMPARISON_LESS_EQUAL);
}

if (0==xr_strcmp(ResourceName,"smp_jitter"))
Expand Down
411 changes: 207 additions & 204 deletions src/Layers/xrRenderPC_GL/glResourceManager_Scripting.cpp

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions src/Layers/xrRenderPC_GL/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@

IC void jitter(CBlender_Compile& C)
{
C.r_Sampler("jitter0", JITTER(0), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
C.r_Sampler("jitter1", JITTER(1), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
C.r_Sampler("jitter2", JITTER(2), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
C.r_Sampler("jitter3", JITTER(3), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
C.r_Sampler("jitter4", JITTER(4), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
// C.r_Sampler ("jitter0", JITTER(0), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
// C.r_Sampler ("jitter1", JITTER(1), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
// C.r_Sampler ("jitter2", JITTER(2), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
// C.r_Sampler ("jitter3", JITTER(3), true, D3DTADDRESS_WRAP, D3DTEXF_POINT, D3DTEXF_NONE, D3DTEXF_POINT);
C.r_dx10Texture ("jitter0", JITTER(0));
C.r_dx10Texture ("jitter1", JITTER(1));
C.r_dx10Texture ("jitter2", JITTER(2));
C.r_dx10Texture ("jitter3", JITTER(3));
C.r_dx10Texture ("jitter4", JITTER(4));
C.r_dx10Texture ("jitterMipped", r2_jitter_mipped);
C.r_dx10Sampler ("smp_jitter");
}
3 changes: 3 additions & 0 deletions src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\xrRenderDX10\Blender_Recorder_R3.cpp" />
<ClCompile Include="..\xrRenderGL\glHW.cpp" />
<ClCompile Include="..\xrRenderGL\glBufferUtils.cpp" />
<ClCompile Include="..\xrRenderGL\glDetailManager_VS.cpp" />
Expand All @@ -211,6 +212,7 @@
<ClCompile Include="..\xrRenderGL\glState.cpp" />
<ClCompile Include="..\xrRenderGL\glStateUtils.cpp" />
<ClCompile Include="..\xrRenderGL\glTextureUtils.cpp" />
<ClCompile Include="..\xrRender\ColorMapManager.cpp" />
<ClCompile Include="..\xrRender\D3DUtils.cpp" />
<ClCompile Include="..\xrRender\DetailManager_VS.cpp" />
<ClCompile Include="..\xrRender\du_box.cpp" />
Expand Down Expand Up @@ -402,6 +404,7 @@
<ClInclude Include="..\xrRenderGL\glState.h" />
<ClInclude Include="..\xrRenderGL\glStateUtils.h" />
<ClInclude Include="..\xrRenderGL\glTextureUtils.h" />
<ClInclude Include="..\xrRender\ColorMapManager.h" />
<ClInclude Include="..\xrRender\D3DUtils.h" />
<ClInclude Include="..\xrRender\D3DXRenderBase.h" />
<ClInclude Include="..\xrRender\du_box.h" />
Expand Down
12 changes: 12 additions & 0 deletions src/Layers/xrRenderPC_GL/xrRender_GL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@
<Filter Include="Interface implementations\MSAARender">
<UniqueIdentifier>{b5644c37-6f04-44e4-8343-56fec645ad53}</UniqueIdentifier>
</Filter>
<Filter Include="Core_Target\ColorMap">
<UniqueIdentifier>{7fdc926e-8c7d-4cba-a662-332feb1aada8}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
Expand Down Expand Up @@ -633,6 +636,12 @@
<ClCompile Include="glTexture.cpp">
<Filter>Core</Filter>
</ClCompile>
<ClCompile Include="..\xrRender\ColorMapManager.cpp">
<Filter>Core_Target\ColorMap</Filter>
</ClCompile>
<ClCompile Include="..\xrRenderDX10\Blender_Recorder_R3.cpp">
<Filter>Refactored\Execution &amp; 3D\Shaders\Blender</Filter>
</ClCompile>
<ClCompile Include="..\xrRender\D3DUtils.cpp">
<Filter>Refactored\Execution &amp; 3D\DebugDraw</Filter>
</ClCompile>
Expand Down Expand Up @@ -1064,6 +1073,9 @@
<ClInclude Include="..\xrRender\D3DXRenderBase.h">
<Filter>Core</Filter>
</ClInclude>
<ClInclude Include="..\xrRender\ColorMapManager.h">
<Filter>Core_Target\ColorMap</Filter>
</ClInclude>
<ClInclude Include="..\xrRender\D3DUtils.h">
<Filter>Refactored\Execution &amp; 3D\DebugDraw</Filter>
</ClInclude>
Expand Down

0 comments on commit 2641b74

Please sign in to comment.