Skip to content

Commit 4a92877

Browse files
committed
Reduce differences between files.
1 parent 08a3d68 commit 4a92877

File tree

2 files changed

+22
-73
lines changed

2 files changed

+22
-73
lines changed

src/Layers/xrRenderPC_R3/r3.cpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,9 @@ void CRender::create()
420420

421421
rmNormal();
422422
marker = 0;
423-
D3D10_QUERY_DESC qdesc;
423+
D3D_QUERY_DESC qdesc;
424424
qdesc.MiscFlags = 0;
425-
qdesc.Query = D3D10_QUERY_EVENT;
425+
qdesc.Query = D3D_QUERY_EVENT;
426426
ZeroMemory(q_sync_point, sizeof(q_sync_point));
427427
// R_CHK (HW.pDevice->CreateQuery(&qdesc,&q_sync_point[0]));
428428
// R_CHK (HW.pDevice->CreateQuery(&qdesc,&q_sync_point[1]));
@@ -500,9 +500,9 @@ void CRender::reset_begin()
500500

501501
void CRender::reset_end()
502502
{
503-
D3D10_QUERY_DESC qdesc;
503+
D3D_QUERY_DESC qdesc;
504504
qdesc.MiscFlags = 0;
505-
qdesc.Query = D3D10_QUERY_EVENT;
505+
qdesc.Query = D3D_QUERY_EVENT;
506506
// R_CHK (HW.pDevice->CreateQuery(&qdesc,&q_sync_point[0]));
507507
// R_CHK (HW.pDevice->CreateQuery(&qdesc,&q_sync_point[1]));
508508
for (u32 i = 0; i < HW.Caps.iGPUNum; ++i)
@@ -767,20 +767,7 @@ void CRender::DumpStatistics(IGameFont& font, IPerformanceAlert* alert)
767767
Sectors_xrc.DumpStatistics(font, alert);
768768
}
769769

770-
static inline bool match_shader_id(
771-
LPCSTR const debug_shader_id, LPCSTR const full_shader_id, FS_FileSet const& file_set, string_path& result);
772-
773-
/////////
774-
#pragma comment(lib, "d3dx9.lib")
775-
/*
776-
extern "C"
777-
{
778-
LPCSTR WINAPI D3DXGetPixelShaderProfile (LPDIRECT3DDEVICE9 pDevice);
779-
LPCSTR WINAPI D3DXGetVertexShaderProfile (LPDIRECT3DDEVICE9 pDevice);
780-
};
781-
*/
782-
static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 const buffer_size, LPCSTR const file_name,
783-
void*& result, bool const disasm)
770+
static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 const buffer_size, LPCSTR const file_name, void*& result, bool const disasm)
784771
{
785772
HRESULT _result = E_FAIL;
786773
if (pTarget[0] == 'p')
@@ -910,6 +897,10 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
910897
Msg("! D3DReflectShader hr == 0x%08x", _result);
911898
}
912899
}
900+
else
901+
{
902+
NODEFAULT;
903+
}
913904

914905
if (disasm)
915906
{
@@ -964,6 +955,9 @@ class includer : public ID3DInclude
964955
}
965956
};
966957

958+
static inline bool match_shader_id(
959+
LPCSTR const debug_shader_id, LPCSTR const full_shader_id, FS_FileSet const& file_set, string_path& result);
960+
967961
HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcDataLen, LPCSTR pFunctionName,
968962
LPCSTR pTarget, DWORD Flags, void*& result)
969963
{
@@ -1351,15 +1345,17 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData
13511345
sh_name[len] = '0' + char(o.dx10_minmax_sm != 0);
13521346
++len;
13531347

1348+
// Be carefull!!!!! this should be at the end to correctly generate
1349+
// compiled shader name;
13541350
// add a #define for DX10_1 MSAA support
13551351
if (o.dx10_msaa)
13561352
{
1357-
static char samples[2];
1358-
13591353
defines[def_it].Name = "USE_MSAA";
13601354
defines[def_it].Definition = "1";
13611355
def_it++;
13621356

1357+
static char samples[2];
1358+
13631359
defines[def_it].Name = "MSAA_SAMPLES";
13641360
samples[0] = char(o.dx10_msaa_samples) + '0';
13651361
samples[1] = 0;

src/Layers/xrRenderPC_R4/r4.cpp

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -779,16 +779,6 @@ void CRender::DumpStatistics(IGameFont& font, IPerformanceAlert* alert)
779779
Sectors_xrc.DumpStatistics(font, alert);
780780
}
781781

782-
/////////
783-
#pragma comment(lib, "d3dx9.lib")
784-
/*
785-
extern "C"
786-
{
787-
LPCSTR WINAPI D3DXGetPixelShaderProfile (LPDIRECT3DDEVICE9 pDevice);
788-
LPCSTR WINAPI D3DXGetVertexShaderProfile (LPDIRECT3DDEVICE9 pDevice);
789-
};
790-
*/
791-
792782
void CRender::addShaderOption(const char* name, const char* value)
793783
{
794784
D3D_SHADER_MACRO macro = {name, value};
@@ -803,7 +793,7 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
803793

804794
ID3DShaderReflection* pReflection = 0;
805795

806-
HRESULT const _hr = D3DReflect(buffer, buffer_size, IID_ID3D11ShaderReflection, (void**)&pReflection);
796+
HRESULT const _hr = D3DReflect(buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
807797
if (SUCCEEDED(_hr) && pReflection)
808798
{
809799
// Parse constant table data
@@ -819,8 +809,7 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
819809
return _hr;
820810
}
821811

822-
static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 const buffer_size, LPCSTR const file_name,
823-
void*& result, bool const disasm)
812+
static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 const buffer_size, LPCSTR const file_name, void*& result, bool const disasm)
824813
{
825814
HRESULT _result = E_FAIL;
826815
if (pTarget[0] == 'p')
@@ -841,7 +830,7 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
841830
ID3DShaderReflection* pReflection = 0;
842831

843832
#ifdef USE_DX11
844-
_result = D3DReflect(buffer, buffer_size, IID_ID3D11ShaderReflection, (void**)&pReflection);
833+
_result = D3DReflect(buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
845834
#else
846835
_result = D3D10ReflectShader(buffer, buffer_size, &pReflection);
847836
#endif
@@ -879,7 +868,7 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
879868

880869
ID3DShaderReflection* pReflection = 0;
881870
#ifdef USE_DX11
882-
_result = D3DReflect(buffer, buffer_size, IID_ID3D11ShaderReflection, (void**)&pReflection);
871+
_result = D3DReflect(buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
883872
#else
884873
_result = D3D10ReflectShader(buffer, buffer_size, &pReflection);
885874
#endif
@@ -930,7 +919,7 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
930919
ID3DShaderReflection* pReflection = 0;
931920

932921
#ifdef USE_DX11
933-
_result = D3DReflect(buffer, buffer_size, IID_ID3D11ShaderReflection, (void**)&pReflection);
922+
_result = D3DReflect(buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
934923
#else
935924
_result = D3D10ReflectShader(buffer, buffer_size, &pReflection);
936925
#endif
@@ -950,42 +939,6 @@ static HRESULT create_shader(LPCSTR const pTarget, DWORD const* buffer, u32 cons
950939
Msg("! D3DReflectShader hr == 0x%08x", _result);
951940
}
952941
}
953-
// else if (pTarget[0] == 'c') {
954-
// SCS* scs_result = (SCS*)result;
955-
//#ifdef USE_DX11
956-
// _result = HW.pDevice->CreateComputeShader(buffer, buffer_size, 0, &scs_result->sh);
957-
//#else // #ifdef USE_DX11
958-
// _result = HW.pDevice->CreateComputeShader(buffer, buffer_size, &scs_result->sh);
959-
//#endif // #ifdef USE_DX11
960-
// if ( !SUCCEEDED(_result) ) {
961-
// Log ("! CS: ", file_name);
962-
// Msg ("! CreateComputeShaderhr == 0x%08x", _result);
963-
// return E_FAIL;
964-
// }
965-
//
966-
// ID3DShaderReflection *pReflection = 0;
967-
//
968-
//#ifdef USE_DX11
969-
// _result = D3DReflect( buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
970-
//#else
971-
// _result = D3D10ReflectShader( buffer, buffer_size, &pReflection);
972-
//#endif
973-
//
974-
// // Parse constant, texture, sampler binding
975-
// // Store input signature blob
976-
// if (SUCCEEDED(_result) && pReflection)
977-
// {
978-
// // Let constant table parse it's data
979-
// scs_result->constants.parse(pReflection,RC_dest_pixel);
980-
//
981-
// _RELEASE(pReflection);
982-
// }
983-
// else
984-
// {
985-
// Log ("! PS: ", file_name);
986-
// Msg ("! D3DReflectShader hr == 0x%08x", _result);
987-
// }
988-
// }
989942
else if (pTarget[0] == 'c')
990943
{
991944
_result = create_shader(pTarget, buffer, buffer_size, file_name, (SCS*&)result, disasm);
@@ -1576,7 +1529,7 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData
15761529
++len;
15771530
}
15781531

1579-
sh_name[len] = 0;
1532+
sh_name[len] = '\0';
15801533

15811534
// finish
15821535
defines[def_it].Name = 0;

0 commit comments

Comments
 (0)