-
-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CBlender_Compile: Add OpenGL-specific implementation.
- Loading branch information
Showing
7 changed files
with
102 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#include "stdafx.h" | ||
#pragma hdrstop | ||
|
||
#include "Layers/xrRender/ResourceManager.h" | ||
#include "Layers/xrRender/blenders/Blender_Recorder.h" | ||
#include "Layers/xrRender/blenders/Blender.h" | ||
#include "Layers/xrRender/tss.h" | ||
|
||
void fix_texture_name(LPSTR fn); | ||
|
||
void CBlender_Compile::r_Stencil(BOOL Enable, u32 Func, u32 Mask, u32 WriteMask, u32 Fail, u32 Pass, u32 ZFail) | ||
{ | ||
RS.SetRS( D3DRS_STENCILENABLE, BC(Enable) ); | ||
if (!Enable) return; | ||
RS.SetRS( D3DRS_STENCILFUNC, Func); | ||
RS.SetRS( D3DRS_STENCILMASK, Mask); | ||
RS.SetRS( D3DRS_STENCILWRITEMASK, WriteMask); | ||
RS.SetRS( D3DRS_STENCILFAIL, Fail); | ||
RS.SetRS( D3DRS_STENCILPASS, Pass); | ||
RS.SetRS( D3DRS_STENCILZFAIL, ZFail); | ||
} | ||
|
||
void CBlender_Compile::r_StencilRef(u32 Ref) | ||
{ | ||
RS.SetRS( D3DRS_STENCILREF, Ref); | ||
} | ||
|
||
void CBlender_Compile::r_CullMode(D3DCULL Mode) | ||
{ | ||
RS.SetRS( D3DRS_CULLMODE, (u32)Mode); | ||
} | ||
|
||
void CBlender_Compile::i_Comparison(u32 s, u32 func) | ||
{ | ||
RS.SetSAMP(s, (u32)GL_TEXTURE_COMPARE_MODE, (u32)GL_COMPARE_REF_TO_TEXTURE); | ||
RS.SetSAMP(s, (u32)GL_TEXTURE_COMPARE_FUNC, func); | ||
} | ||
|
||
void CBlender_Compile::r_Sampler_cmp(LPCSTR name, LPCSTR texture, bool b_ps1x_ProjectiveDivide) | ||
{ | ||
u32 s = r_Sampler(name, texture, b_ps1x_ProjectiveDivide, D3DTADDRESS_CLAMP, D3DTEXF_LINEAR, D3DTEXF_NONE, D3DTEXF_LINEAR); | ||
if (u32(-1) != s) | ||
{ | ||
RS.SetSAMP(s, XRDX10SAMP_COMPARISONFILTER, TRUE); | ||
RS.SetSAMP(s, XRDX10SAMP_COMPARISONFUNC, (u32)D3D_COMPARISON_LESS_EQUAL); | ||
} | ||
} | ||
|
||
void CBlender_Compile::r_Pass (LPCSTR _vs, LPCSTR _gs, LPCSTR _ps, bool bFog, BOOL bZtest, BOOL bZwrite, BOOL bABlend, D3DBLEND abSRC, D3DBLEND abDST, BOOL aTest, u32 aRef) | ||
{ | ||
RS.Invalidate (); | ||
ctable.clear (); | ||
passTextures.clear (); | ||
passMatrices.clear (); | ||
passConstants.clear (); | ||
dwStage = 0; | ||
|
||
// Setup FF-units (Z-buffer, blender) | ||
PassSET_ZB (bZtest,bZwrite); | ||
PassSET_Blend (bABlend,abSRC,abDST,aTest,aRef); | ||
PassSET_LightFog (FALSE,bFog); | ||
|
||
// Create shaders | ||
SPS* ps = RImplementation.Resources->_CreatePS(_ps); | ||
SVS* vs = RImplementation.Resources->_CreateVS(_vs); | ||
SGS* gs = RImplementation.Resources->_CreateGS(_gs); | ||
dest.ps = ps; | ||
dest.vs = vs; | ||
dest.gs = gs; | ||
#ifdef USE_DX11 | ||
dest.hs = RImplementation.Resources->_CreateHS("null"); | ||
dest.ds = RImplementation.Resources->_CreateDS("null"); | ||
#endif | ||
ctable.merge (&ps->constants); | ||
ctable.merge (&vs->constants); | ||
ctable.merge (&gs->constants); | ||
|
||
// Last Stage - disable | ||
if (0==stricmp(_ps,"null")) { | ||
RS.SetTSS (0,D3DTSS_COLOROP,D3DTOP_DISABLE); | ||
RS.SetTSS (0,D3DTSS_ALPHAOP,D3DTOP_DISABLE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters