Skip to content

Commit 33cf655

Browse files
committed
Revert "Try to fix "SMAP_size" crash in OpenGL render on AMD video cards"
This reverts commit c9a4ff7. This reverts commit dbb4342.
1 parent 41f23c5 commit 33cf655

File tree

2 files changed

+16
-37
lines changed

2 files changed

+16
-37
lines changed

res/gamedata/shaders/gl/common_defines.h

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,23 @@
22
#define common_defines_h_included
33

44
//////////////////////////////////////////////////////////////////////////////////////////
5-
// Defines
5+
// Defines //
66
#define def_gloss float(2.f /255.f)
77
#define def_aref float(200.f/255.f)
88
#define def_dbumph float(0.333f)
99
#define def_virtualh float(0.05f) // 5cm
10-
#define def_distort float(0.05f) // we get -0.5 .. 0.5 range, this is -512 .. 512 for 1024, so scale it
11-
#define def_hdr float(9.f) // hight luminance range float(3.h)
12-
#define def_hdr_clip float(0.75f) //
10+
#define def_distort float(0.05f) // we get -0.5 .. 0.5 range, this is -512 .. 512 for 1024, so scale it
11+
#define def_hdr float(9.f) // hight luminance range float(3.h)
12+
#define def_hdr_clip float(0.75f) //
1313

1414
#define LUMINANCE_VECTOR float3(0.3f, 0.38f, 0.22f)
1515

1616
//////////////////////////////////////////////////////////////////////////////////////////
17-
// skyloader: if you want to resize smaps in renderer, then do not forget to change this file too
18-
#ifndef SMAP_QUALITY
19-
const float SMAP_size = 2048.f;
20-
#elif SMAP_QUALITY == 1
21-
const float SMAP_size = 1536.f;
22-
#elif SMAP_QUALITY == 2
23-
const float SMAP_size = 2048.f;
24-
#elif SMAP_QUALITY == 3
25-
const float SMAP_size = 2560.f;
26-
#elif SMAP_QUALITY == 4
27-
const float SMAP_size = 3072.f;
28-
#elif SMAP_QUALITY == 5
29-
const float SMAP_size = 4096.f;
17+
#ifndef SMAP_size
18+
#define SMAP_size 1024
3019
#endif
31-
//////////////////////////////////////////////////////////////////////////////////////////
32-
#define PARALLAX_H float(0.02f)
33-
#define parallax float2(PARALLAX_H, -PARALLAX_H/2)
20+
#define PARALLAX_H 0.02
21+
#define parallax float2(PARALLAX_H, -PARALLAX_H/2)
3422
//////////////////////////////////////////////////////////////////////////////////////////
3523

36-
#endif // common_defines_h_included
24+
#endif // common_defines_h_included

src/Layers/xrRenderPC_GL/rgl.cpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void CRender::create()
225225
o.nvdbt = false;
226226
if (o.nvdbt) Msg("* NV-DBT supported and used");
227227

228-
// options (smap-pool-size) // skyloader: if you want to resize smaps, then do not forget to change them in shaders too (common_defines.h)
228+
// options (smap-pool-size)
229229
if (strstr(Core.Params, "-smap1536")) o.smapsize = 1536;
230230
if (strstr(Core.Params, "-smap2048")) o.smapsize = 2048;
231231
if (strstr(Core.Params, "-smap2560")) o.smapsize = 2560;
@@ -798,22 +798,13 @@ HRESULT CRender::shader_compile(
798798
u32 len = 0;
799799
// options
800800
{
801-
// skyloader: smap size changed to smap quality because something wrong happens with the conversion of defines to float data on amd videocards
802-
u8 uSmapQuality = 2;
803-
switch (o.smapsize)
804-
{
805-
case 1536: uSmapQuality = 1; break;
806-
case 2048: uSmapQuality = 2; break;
807-
case 2560: uSmapQuality = 3; break;
808-
case 3072: uSmapQuality = 4; break;
809-
case 4096: uSmapQuality = 5; break;
810-
}
811-
xr_sprintf (c_smapsize, "%d", uSmapQuality);
812-
defines[def_it].Name = "SMAP_QUALITY";
813-
defines[def_it].Definition = c_smapsize;
801+
xr_sprintf(c_smapsize, "%04d", u32(o.smapsize));
802+
defines[def_it].Name = "SMAP_size";
803+
defines[def_it].Definition = c_smapsize;
814804
def_it++;
815-
xr_strcat (sh_name, c_smapsize);
816-
++len;
805+
VERIFY(xr_strlen(c_smapsize) == 4);
806+
xr_strcat(sh_name, c_smapsize);
807+
len += 4;
817808
}
818809

819810
if (o.fp16_filter)

0 commit comments

Comments
 (0)