Skip to content

Commit eb54dac

Browse files
committed
New console command: r2_smap_size
You can adjust shadow map size from 1024x1024 up to 16384x16384 pixels with this command.
1 parent 86fefe3 commit eb54dac

File tree

5 files changed

+46
-6
lines changed

5 files changed

+46
-6
lines changed

src/Layers/xrRender/xrRender_console.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@
77
u32 ps_Preset = 2;
88
const xr_token qpreset_token[] = {{"Minimum", 0}, {"Low", 1}, {"Default", 2}, {"High", 3}, {"Extreme", 4}, {nullptr, 0}};
99

10+
u32 ps_r2_smapsize = 2048;
11+
const xr_token qsmapsize_token[] =
12+
{
13+
#ifndef MASTER_GOLD
14+
{ "256", 256 }, // Too bad
15+
{ "512", 512 }, // But works
16+
#endif
17+
{ "1024", 1024 },
18+
{ "1032", 1032 },
19+
{ "1536", 1536 },
20+
{ "2048", 2048 },
21+
{ "2560", 2560 },
22+
{ "3072", 3072 },
23+
{ "3584", 3584 },
24+
{ "4096", 4096 },
25+
{ "6144", 6144 },
26+
{ "8192", 8192 },
27+
{ "10240", 10240 },
28+
{ "12288", 12288 },
29+
{ "14336", 14336 },
30+
{ "16384", 16384 },
31+
{ nullptr, 0 }
32+
};
33+
1034
u32 ps_r_ssao_mode = 2;
1135
const xr_token qssao_mode_token[] = {{"disabled", 0}, {"default", 1}, {"hdao", 2}, {"hbao", 3}, {nullptr, 0}};
1236

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

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

823848
tw_min.set(0, 0, 0);
824849
tw_max.set(1, 1, 1);

src/Layers/xrRender/xrRender_console.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
extern ECORE_API u32 ps_r_sun_shafts; //= 0;
77
extern ECORE_API const xr_token qsun_shafts_token[];
88

9+
extern ECORE_API u32 ps_r2_smapsize;
10+
extern ECORE_API const xr_token qsmapsize_token[];
11+
912
extern ECORE_API u32 ps_r_ssao; // = 0;
1013
extern ECORE_API const xr_token qssao_token[];
1114

src/Layers/xrRenderPC_R2/r2.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void CRender::create()
117117
m_skinning = -1;
118118

119119
// hardware
120-
o.smapsize = 2048;
120+
o.smapsize = ps_r2_smapsize;
121121
o.mrt = (HW.Caps.raster.dwMRT_count >= 3);
122122
o.mrtmixdepth = (HW.Caps.raster.b_MRT_mixdepth);
123123

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

255255
// options (smap-pool-size)
256+
if (strstr(Core.Params, "-smap1024"))
257+
o.smapsize = 1024;
256258
if (strstr(Core.Params, "-smap1536"))
257259
o.smapsize = 1536;
258260
if (strstr(Core.Params, "-smap2048"))
@@ -263,6 +265,8 @@ void CRender::create()
263265
o.smapsize = 3072;
264266
if (strstr(Core.Params, "-smap4096"))
265267
o.smapsize = 4096;
268+
if (strstr(Core.Params, "-smap8192"))
269+
o.smapsize = 8192;
266270

267271
// gloss
268272
char* g = strstr(Core.Params, "-gloss ");
@@ -731,7 +735,7 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData
731735
defines[def_it].Name = "SMAP_size";
732736
defines[def_it].Definition = c_smapsize;
733737
def_it++;
734-
VERIFY(xr_strlen(c_smapsize) == 4);
738+
VERIFY(xr_strlen(c_smapsize) == 4 || atoi(c_smapsize) < 16384);
735739
xr_strcat(sh_name, c_smapsize);
736740
len += 4;
737741
}

src/Layers/xrRenderPC_R3/r3.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void CRender::create()
134134
m_MSAASample = -1;
135135

136136
// hardware
137-
o.smapsize = 2048;
137+
o.smapsize = ps_r2_smapsize;
138138
o.mrt = (HW.Caps.raster.dwMRT_count >= 3);
139139
o.mrtmixdepth = (HW.Caps.raster.b_MRT_mixdepth);
140140

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

275275
// options (smap-pool-size)
276+
if (strstr(Core.Params, "-smap1024"))
277+
o.smapsize = 1024;
276278
if (strstr(Core.Params, "-smap1536"))
277279
o.smapsize = 1536;
278280
if (strstr(Core.Params, "-smap2048"))
@@ -283,6 +285,8 @@ void CRender::create()
283285
o.smapsize = 3072;
284286
if (strstr(Core.Params, "-smap4096"))
285287
o.smapsize = 4096;
288+
if (strstr(Core.Params, "-smap8192"))
289+
o.smapsize = 8192;
286290

287291
// gloss
288292
char* g = strstr(Core.Params, "-gloss ");
@@ -934,7 +938,7 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData
934938
defines[def_it].Name = "SMAP_size";
935939
defines[def_it].Definition = c_smapsize;
936940
def_it++;
937-
VERIFY(xr_strlen(c_smapsize) == 4);
941+
VERIFY(xr_strlen(c_smapsize) == 4 || atoi(c_smapsize) < 16384);
938942
xr_strcat(sh_name, c_smapsize);
939943
len += 4;
940944
}

src/Layers/xrRenderPC_R4/r4.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void CRender::create()
139139
m_MSAASample = -1;
140140

141141
// hardware
142-
o.smapsize = 2048;
142+
o.smapsize = ps_r2_smapsize;
143143
o.mrt = (HW.Caps.raster.dwMRT_count >= 3);
144144
o.mrtmixdepth = (HW.Caps.raster.b_MRT_mixdepth);
145145

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

280280
// options (smap-pool-size)
281+
if (strstr(Core.Params, "-smap1024"))
282+
o.smapsize = 1024;
281283
if (strstr(Core.Params, "-smap1536"))
282284
o.smapsize = 1536;
283285
if (strstr(Core.Params, "-smap2048"))
@@ -288,6 +290,8 @@ void CRender::create()
288290
o.smapsize = 3072;
289291
if (strstr(Core.Params, "-smap4096"))
290292
o.smapsize = 4096;
293+
if (strstr(Core.Params, "-smap8192"))
294+
o.smapsize = 8192;
291295

292296
// gloss
293297
char* g = strstr(Core.Params, "-gloss ");
@@ -968,7 +972,7 @@ HRESULT CRender::shader_compile(LPCSTR name, DWORD const* pSrcData, UINT SrcData
968972
defines[def_it].Name = "SMAP_size";
969973
defines[def_it].Definition = c_smapsize;
970974
def_it++;
971-
VERIFY(xr_strlen(c_smapsize) == 4);
975+
VERIFY(xr_strlen(c_smapsize) == 4 || atoi(c_smapsize) < 16384);
972976
xr_strcat(sh_name, c_smapsize);
973977
len += 4;
974978
}

0 commit comments

Comments
 (0)