Skip to content

Commit

Permalink
Reduce differences between files.
Browse files Browse the repository at this point in the history
  • Loading branch information
intorr committed Jan 8, 2018
1 parent 9b9526a commit dd7e5e8
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 119 deletions.
16 changes: 9 additions & 7 deletions src/Layers/xrRenderPC_R1/FStaticRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,7 @@ void CRender::DumpStatistics(IGameFont& font, IPerformanceAlert* alert)
Sectors_xrc.DumpStatistics(font, alert);
}

static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 const buffer_size, LPCSTR const file_name,
void*& result, bool const disasm)
static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 const buffer_size, LPCSTR const file_name, void*& result, bool const disasm)
{
HRESULT _result = E_FAIL;
if (pTarget[0] == 'p')
Expand All @@ -751,7 +750,7 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
Msg("! D3DXFindShaderComment hr == 0x%08x", _result);
}
}
else
else if (pTarget[0] == 'v')
{
SVS* svs_result = (SVS*)result;
_result = HW.pDevice->CreateVertexShader(buffer, &svs_result->vs);
Expand All @@ -775,6 +774,10 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
Msg("! D3DXFindShaderComment hr == 0x%08x", _result);
}
}
else
{
NODEFAULT;
}

if (disasm)
{
Expand All @@ -791,9 +794,6 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
return _result;
}

static inline bool match_shader_id(
LPCSTR const debug_shader_id, LPCSTR const full_shader_id, FS_FileSet const& file_set, string_path& result);

class includer : public ID3DXInclude
{
public:
Expand Down Expand Up @@ -829,6 +829,9 @@ class includer : public ID3DXInclude
}
};

static inline bool match_shader_id(
LPCSTR const debug_shader_id, LPCSTR const full_shader_id, FS_FileSet const& file_set, string_path& result);

HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcDataLen, LPCSTR pFunctionName,
LPCSTR pTarget, DWORD Flags, void*& result)
{
Expand All @@ -837,7 +840,6 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData

char sh_name[MAX_PATH] = "";
u32 len = 0;

// options
if (o.forceskinw)
{
Expand Down
11 changes: 2 additions & 9 deletions src/Layers/xrRenderPC_R1/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,9 @@
#define D3D_DEBUG_INFO
#endif

#pragma warning(push)
#pragma warning(disable : 4995)
#include "xrEngine/stdafx.h"
#include <d3d9.h>
#include <d3dx9.h>
#pragma warning(pop)

#pragma warning(disable : 4714)
#pragma warning(4 : 4018)
#pragma warning(4 : 4244)

#include "Layers/xrRender/xrD3DDefs.h"
#include "Layers/xrRender/HW.h"
Expand All @@ -35,8 +28,8 @@
#include "Common/_d3d_extensions.h"
#ifndef _EDITOR
#include "xrEngine/IGame_Level.h"
#include "Layers/xrRender/blenders\Blender.h"
#include "Layers/xrRender/blenders\Blender_CLSID.h"
#include "Layers/xrRender/blenders/Blender.h"
#include "Layers/xrRender/blenders/Blender_CLSID.h"
#include "xrParticles/psystem.h"
#include "Layers/xrRender/xrRender_console.h"
#include "FStaticRender.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,5 @@ void CLight_Compute_XFORM_and_VIS::compute_xf_spot(light* L)
// _min(L->cone + deg2rad(4.5f), PI*0.98f) - Here, it is needed to enlarge the shadow map frustum to include also
// displaced pixels and the pixels neighbor to the examining one.
L->X.S.project.build_projection(std::min(L->cone + deg2rad(5.f), PI * 0.98f), 1.f, SMAP_near_plane, L->range + EPS_S);

L->X.S.combine.mul(L->X.S.project, L->X.S.view);
}
17 changes: 9 additions & 8 deletions src/Layers/xrRenderPC_R2/r2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ void CRender::reset_begin()
}
//-AVO


xr_delete(Target);
HWOCC.occq_destroy();
//_RELEASE (q_sync_point[1]);
Expand Down Expand Up @@ -629,8 +628,7 @@ void CRender::DumpStatistics(IGameFont& font, IPerformanceAlert* alert)
Sectors_xrc.DumpStatistics(font, alert);
}

static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 const buffer_size, LPCSTR const file_name,
void*& result, bool const disasm)
static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 const buffer_size, LPCSTR const file_name, void*& result, bool const disasm)
{
HRESULT _result = E_FAIL;
if (pTarget[0] == 'p')
Expand All @@ -657,7 +655,7 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
Msg("! D3DXFindShaderComment hr == 0x%08x", _result);
}
}
else
else if (pTarget[0] == 'v')
{
SVS* svs_result = (SVS*)result;
_result = HW.pDevice->CreateVertexShader(buffer, &svs_result->vs);
Expand All @@ -681,6 +679,10 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
Msg("! D3DXFindShaderComment hr == 0x%08x", _result);
}
}
else
{
NODEFAULT;
}

if (disasm)
{
Expand All @@ -697,9 +699,6 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
return _result;
}

static inline bool match_shader_id(
LPCSTR const debug_shader_id, LPCSTR const full_shader_id, FS_FileSet const& file_set, string_path& result);

class includer : public ID3DXInclude
{
public:
Expand Down Expand Up @@ -735,6 +734,9 @@ class includer : public ID3DXInclude
}
};

static inline bool match_shader_id(
LPCSTR const debug_shader_id, LPCSTR const full_shader_id, FS_FileSet const& file_set, string_path& result);

HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcDataLen, LPCSTR pFunctionName,
LPCSTR pTarget, DWORD Flags, void*& result)
{
Expand All @@ -748,7 +750,6 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData

char sh_name[MAX_PATH] = "";
u32 len = 0;

// options
{
xr_sprintf(c_smapsize, "%04d", u32(o.smapsize));
Expand Down
1 change: 0 additions & 1 deletion src/Layers/xrRenderPC_R2/r2_sector_detect.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "stdafx.h"
#include "r2.h"

int CRender::translateSector(IRender_Sector* pSector)
{
Expand Down
8 changes: 0 additions & 8 deletions src/Layers/xrRenderPC_R2/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,9 @@
#define D3D_DEBUG_INFO
#endif

#pragma warning(push)
#pragma warning(disable : 4995)
#include "xrEngine/stdafx.h"
#include <d3d9.h>
#include <d3dx9.h>
#pragma warning(pop)

#pragma warning(disable : 4714)
#pragma warning(4 : 4018)
#pragma warning(4 : 4244)
#pragma warning(disable : 4237)

#include "Layers/xrRender/xrD3DDefs.h"
#include "Layers/xrRender/HW.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,5 @@ void CLight_Compute_XFORM_and_VIS::compute_xf_spot(light* L)
// _min(L->cone + deg2rad(4.5f), PI*0.98f) - Here, it is needed to enlarge the shadow map frustum to include also
// displaced pixels and the pixels neighbor to the examining one.
L->X.S.project.build_projection(std::min(L->cone + deg2rad(5.f), PI * 0.98f), 1.f, SMAP_near_plane, L->range + EPS_S);

L->X.S.combine.mul(L->X.S.project, L->X.S.view);
}
2 changes: 1 addition & 1 deletion src/Layers/xrRenderPC_R3/blender_light_occq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void CBlender_light_occq::Compile(CBlender_Compile& C)
// Clear all bits except the last one
C.r_Stencil(TRUE, D3DCMP_ALWAYS, 0x00, 0xFE, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO);
}
//C.r_Stencil(TRUE,D3DCMP_ALWAYS,0x00,0xFF, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO);
// C.r_Stencil(TRUE,D3DCMP_ALWAYS,0x00,0xFF, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO);
// keep/keep/keep
C.r_End();
break;
Expand Down
1 change: 0 additions & 1 deletion src/Layers/xrRenderPC_R3/r2_sector_detect.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "stdafx.h"
#include "r3.h"

int CRender::translateSector(IRender_Sector* pSector)
{
Expand Down
40 changes: 14 additions & 26 deletions src/Layers/xrRenderPC_R3/r3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ void CRender::destroy()
//_RELEASE (q_sync_point[0]);
for (u32 i = 0; i < HW.Caps.iGPUNum; ++i)
_RELEASE(q_sync_point[i]);

HWOCC.occq_destroy();
xr_delete(Models);
xr_delete(Target);
Expand Down Expand Up @@ -531,15 +530,7 @@ void CRender::reset_end()
// that some data is not ready in the first frame (for example device camera position)
m_bFirstFrameAfterReset = true;
}
/*
void CRender::OnFrame()
{
Models->DeleteQueue ();
if (ps_r2_ls_flags.test(R2FLAG_EXP_MT_CALC)) {
Device.seqParallel.insert (Device.seqParallel.begin(),
fastdelegate::FastDelegate0<>(&HOM,&CHOM::MT_RENDER));
}
}*/

void CRender::OnFrame()
{
Models->DeleteQueue();
Expand All @@ -564,7 +555,7 @@ void CRender::model_Delete(IRenderVisual*& V, BOOL bDiscard)
{
dxRender_Visual* pVisual = (dxRender_Visual*)V;
Models->Delete(pVisual, bDiscard);
V = 0;
V = nullptr;
}
IRender_DetailModel* CRender::model_CreateDM(IReader* F)
{
Expand All @@ -579,7 +570,7 @@ void CRender::model_Delete(IRender_DetailModel*& F)
CDetail* D = (CDetail*)F;
D->Unload();
xr_delete(D);
F = NULL;
F = nullptr;
}
}
IRenderVisual* CRender::model_CreatePE(LPCSTR name)
Expand Down Expand Up @@ -919,7 +910,6 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
return _result;
}

//--------------------------------------------------------------------------------------------------------------
class includer : public ID3DInclude
{
public:
Expand All @@ -929,11 +919,11 @@ class includer : public ID3DInclude
string_path pname;
strconcat(sizeof(pname), pname, GEnv.Render->getShaderPath(), pFileName);
IReader* R = FS.r_open("$game_shaders$", pname);
if (0 == R)
if (nullptr == R)
{
// possibly in shared directory or somewhere else - open directly
R = FS.r_open("$game_shaders$", pFileName);
if (0 == R)
if (nullptr == R)
return E_FAIL;
}

Expand Down Expand Up @@ -1454,33 +1444,32 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData
sh_name[len] = '\0';

// finish
defines[def_it].Name = 0;
defines[def_it].Definition = 0;
defines[def_it].Name = nullptr;
defines[def_it].Definition = nullptr;
def_it++;

//
if (0 == xr_strcmp(pFunctionName, "main"))
{
if ('v' == pTarget[0])
{
if (HW.pDevice1 == 0)
pTarget = D3D10GetVertexShaderProfile(HW.pDevice); // vertex "vs_4_0"; //
pTarget = D3D10GetVertexShaderProfile(HW.pDevice); // vertex "vs_4_0";
else
pTarget = "vs_4_1"; // pixel "ps_4_0"; //
pTarget = "vs_4_1"; // pixel "ps_4_0";
}
else if ('p' == pTarget[0])
{
if (HW.pDevice1 == 0)
pTarget = D3D10GetPixelShaderProfile(HW.pDevice); // pixel "ps_4_0"; //
pTarget = D3D10GetPixelShaderProfile(HW.pDevice); // pixel "ps_4_0";
else
pTarget = "ps_4_1"; // pixel "ps_4_0"; //
pTarget = "ps_4_1"; // pixel "ps_4_0";
}
else if ('g' == pTarget[0])
{
if (HW.pDevice1 == 0)
pTarget = D3D10GetGeometryShaderProfile(HW.pDevice); // geometry "gs_4_0"; //
pTarget = D3D10GetGeometryShaderProfile(HW.pDevice); // geometry "gs_4_0";
else
pTarget = "gs_4_1"; // pixel "ps_4_0"; //
pTarget = "gs_4_1"; // pixel "ps_4_0";
}
}

Expand Down Expand Up @@ -1549,12 +1538,11 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData
file->w(pShaderBuf->GetBufferPointer(), (u32)pShaderBuf->GetBufferSize());
FS.w_close(file);

_result = create_shader(pTarget, (DWORD*)pShaderBuf->GetBufferPointer(), (u32)pShaderBuf->GetBufferSize(),
_result = create_shader(pTarget, (DWORD*)pShaderBuf->GetBufferPointer(), pShaderBuf->GetBufferSize(),
file_name, result, o.disasm);
}
else
{
// Msg ( "! shader compilation failed" );
Log("! ", file_name);
if (pErrorBuf)
Log("! error: ", (LPCSTR)pErrorBuf->GetBufferPointer());
Expand Down
12 changes: 1 addition & 11 deletions src/Layers/xrRenderPC_R3/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,10 @@
#define D3D_DEBUG_INFO
#endif

#pragma warning(push)
#pragma warning(disable : 4995)
#include "xrEngine/stdafx.h"
#include <d3d9.h>
#include <d3dx9.h>
#pragma warning(pop)

#pragma warning(disable : 4714)
#pragma warning(4 : 4018)
#pragma warning(4 : 4244)
#pragma warning(disable : 4237)

#include <d3d10_1.h>
#include <d3d11.h>
#include <D3D10_1.h>
#include <D3Dx10core.h>
#include <D3DCompiler.h>

Expand Down
9 changes: 4 additions & 5 deletions src/Layers/xrRenderPC_R4/blender_light_occq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

CBlender_light_occq::CBlender_light_occq() { description.CLS = 0; }
CBlender_light_occq::~CBlender_light_occq() {}
// TODO: DX10: if nesessary for NV stencil optimisation implement pass 1
// TODO: DX10: if nesessary for NV stencil optimisation implement pass 1
void CBlender_light_occq::Compile(CBlender_Compile& C)
{
IBlender::Compile(C);
Expand All @@ -15,7 +15,7 @@ void CBlender_light_occq::Compile(CBlender_Compile& C)
case 0: // occlusion testing
C.r_Pass("dumb", "dumb", false, TRUE, FALSE, FALSE);
C.r_End();
// Color write as well as culling and stencil are set up manually in code.
// Color write as well as culling and stencil are set up manually in code.
break;
case 1: // NV40 optimization :)
C.r_Pass("stub_notransform_t", "dumb", false, FALSE, FALSE, FALSE);
Expand All @@ -32,11 +32,10 @@ void CBlender_light_occq::Compile(CBlender_Compile& C)
C.r_Stencil(TRUE, D3DCMP_ALWAYS, 0x00, 0x7E, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO);
else
{
// Clear all bits except the last one
// Clear all bits except the last one
C.r_Stencil(TRUE, D3DCMP_ALWAYS, 0x00, 0xFE, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO);
}
// C.r_Stencil (TRUE,D3DCMP_ALWAYS,0x00,0xFF, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO);
// //
// C.r_Stencil(TRUE,D3DCMP_ALWAYS,0x00,0xFF, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO, D3DSTENCILOP_ZERO);
// keep/keep/keep
C.r_End();
break;
Expand Down
8 changes: 3 additions & 5 deletions src/Layers/xrRenderPC_R4/r2_blenders.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include "stdafx.h"

#include "Layers/xrRender/uber_deffer.h"

#include "Layers/xrRender/blender_BmmD.h"
#include "blender_deffer_flat.h"
#include "blender_deffer_model.h"
#include "blender_deffer_aref.h"
#include "Blender_deffer_flat.h"
#include "Blender_deffer_model.h"
#include "Blender_deffer_aref.h"
#include "Layers/xrRender/blender_screen_set.h"
#include "Layers/xrRender/blender_editor_wire.h"
#include "Layers/xrRender/blender_editor_selection.h"
Expand Down
Loading

0 comments on commit dd7e5e8

Please sign in to comment.