Skip to content

Commit

Permalink
New console command: r2_smap_size
Browse files Browse the repository at this point in the history
You can adjust shadow map size from 1024x1024 up to 16384x16384 pixels with this
command.
  • Loading branch information
Xottab-DUTY committed Jun 17, 2018
1 parent 86fefe3 commit eb54dac
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 6 deletions.
25 changes: 25 additions & 0 deletions src/Layers/xrRender/xrRender_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,30 @@
u32 ps_Preset = 2;
const xr_token qpreset_token[] = {{"Minimum", 0}, {"Low", 1}, {"Default", 2}, {"High", 3}, {"Extreme", 4}, {nullptr, 0}};

u32 ps_r2_smapsize = 2048;
const xr_token qsmapsize_token[] =
{
#ifndef MASTER_GOLD
{ "256", 256 }, // Too bad
{ "512", 512 }, // But works
#endif
{ "1024", 1024 },
{ "1032", 1032 },
{ "1536", 1536 },
{ "2048", 2048 },
{ "2560", 2560 },
{ "3072", 3072 },
{ "3584", 3584 },
{ "4096", 4096 },
{ "6144", 6144 },
{ "8192", 8192 },
{ "10240", 10240 },
{ "12288", 12288 },
{ "14336", 14336 },
{ "16384", 16384 },
{ nullptr, 0 }
};

u32 ps_r_ssao_mode = 2;
const xr_token qssao_mode_token[] = {{"disabled", 0}, {"default", 1}, {"hdao", 2}, {"hbao", 3}, {nullptr, 0}};

Expand Down Expand Up @@ -819,6 +843,7 @@ void xrRender_initconsole()
// CMD4(CCC_Float, "r2_parallax_range", &ps_r2_df_parallax_range, 5.0f, 175.0f );

CMD4(CCC_Float, "r2_slight_fade", &ps_r2_slight_fade, .2f, 1.f);
CMD3(CCC_Token, "r2_smap_size", &ps_r2_smapsize, qsmapsize_token);

tw_min.set(0, 0, 0);
tw_max.set(1, 1, 1);
Expand Down
3 changes: 3 additions & 0 deletions src/Layers/xrRender/xrRender_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
extern ECORE_API u32 ps_r_sun_shafts; //= 0;
extern ECORE_API const xr_token qsun_shafts_token[];

extern ECORE_API u32 ps_r2_smapsize;
extern ECORE_API const xr_token qsmapsize_token[];

extern ECORE_API u32 ps_r_ssao; // = 0;
extern ECORE_API const xr_token qssao_token[];

Expand Down
8 changes: 6 additions & 2 deletions src/Layers/xrRenderPC_R2/r2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void CRender::create()
m_skinning = -1;

// hardware
o.smapsize = 2048;
o.smapsize = ps_r2_smapsize;
o.mrt = (HW.Caps.raster.dwMRT_count >= 3);
o.mrtmixdepth = (HW.Caps.raster.b_MRT_mixdepth);

Expand Down Expand Up @@ -253,6 +253,8 @@ void CRender::create()
Msg("* NV-DBT supported and used");

// options (smap-pool-size)
if (strstr(Core.Params, "-smap1024"))
o.smapsize = 1024;
if (strstr(Core.Params, "-smap1536"))
o.smapsize = 1536;
if (strstr(Core.Params, "-smap2048"))
Expand All @@ -263,6 +265,8 @@ void CRender::create()
o.smapsize = 3072;
if (strstr(Core.Params, "-smap4096"))
o.smapsize = 4096;
if (strstr(Core.Params, "-smap8192"))
o.smapsize = 8192;

// gloss
char* g = strstr(Core.Params, "-gloss ");
Expand Down Expand Up @@ -731,7 +735,7 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData
defines[def_it].Name = "SMAP_size";
defines[def_it].Definition = c_smapsize;
def_it++;
VERIFY(xr_strlen(c_smapsize) == 4);
VERIFY(xr_strlen(c_smapsize) == 4 || atoi(c_smapsize) < 16384);
xr_strcat(sh_name, c_smapsize);
len += 4;
}
Expand Down
8 changes: 6 additions & 2 deletions src/Layers/xrRenderPC_R3/r3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void CRender::create()
m_MSAASample = -1;

// hardware
o.smapsize = 2048;
o.smapsize = ps_r2_smapsize;
o.mrt = (HW.Caps.raster.dwMRT_count >= 3);
o.mrtmixdepth = (HW.Caps.raster.b_MRT_mixdepth);

Expand Down Expand Up @@ -273,6 +273,8 @@ void CRender::create()
Msg("* NV-DBT supported and used");

// options (smap-pool-size)
if (strstr(Core.Params, "-smap1024"))
o.smapsize = 1024;
if (strstr(Core.Params, "-smap1536"))
o.smapsize = 1536;
if (strstr(Core.Params, "-smap2048"))
Expand All @@ -283,6 +285,8 @@ void CRender::create()
o.smapsize = 3072;
if (strstr(Core.Params, "-smap4096"))
o.smapsize = 4096;
if (strstr(Core.Params, "-smap8192"))
o.smapsize = 8192;

// gloss
char* g = strstr(Core.Params, "-gloss ");
Expand Down Expand Up @@ -934,7 +938,7 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData
defines[def_it].Name = "SMAP_size";
defines[def_it].Definition = c_smapsize;
def_it++;
VERIFY(xr_strlen(c_smapsize) == 4);
VERIFY(xr_strlen(c_smapsize) == 4 || atoi(c_smapsize) < 16384);
xr_strcat(sh_name, c_smapsize);
len += 4;
}
Expand Down
8 changes: 6 additions & 2 deletions src/Layers/xrRenderPC_R4/r4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void CRender::create()
m_MSAASample = -1;

// hardware
o.smapsize = 2048;
o.smapsize = ps_r2_smapsize;
o.mrt = (HW.Caps.raster.dwMRT_count >= 3);
o.mrtmixdepth = (HW.Caps.raster.b_MRT_mixdepth);

Expand Down Expand Up @@ -278,6 +278,8 @@ void CRender::create()
Msg("* NV-DBT supported and used");

// options (smap-pool-size)
if (strstr(Core.Params, "-smap1024"))
o.smapsize = 1024;
if (strstr(Core.Params, "-smap1536"))
o.smapsize = 1536;
if (strstr(Core.Params, "-smap2048"))
Expand All @@ -288,6 +290,8 @@ void CRender::create()
o.smapsize = 3072;
if (strstr(Core.Params, "-smap4096"))
o.smapsize = 4096;
if (strstr(Core.Params, "-smap8192"))
o.smapsize = 8192;

// gloss
char* g = strstr(Core.Params, "-gloss ");
Expand Down Expand Up @@ -968,7 +972,7 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData
defines[def_it].Name = "SMAP_size";
defines[def_it].Definition = c_smapsize;
def_it++;
VERIFY(xr_strlen(c_smapsize) == 4);
VERIFY(xr_strlen(c_smapsize) == 4 || atoi(c_smapsize) < 16384);
xr_strcat(sh_name, c_smapsize);
len += 4;
}
Expand Down

0 comments on commit eb54dac

Please sign in to comment.