Skip to content

Commit c9a4ff7

Browse files
authored
Try to fix "SMAP_size" crash in OpenGL render on AMD video cards part #1
1 parent 5732c80 commit c9a4ff7

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/Layers/xrRenderPC_GL/rgl.cpp

Lines changed: 16 additions & 7 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)
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)
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,13 +798,22 @@ HRESULT CRender::shader_compile(
798798
u32 len = 0;
799799
// options
800800
{
801-
xr_sprintf(c_smapsize, "%04d", u32(o.smapsize));
802-
defines[def_it].Name = "SMAP_size";
803-
defines[def_it].Definition = c_smapsize;
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;
804814
def_it++;
805-
VERIFY(xr_strlen(c_smapsize) == 4);
806-
xr_strcat(sh_name, c_smapsize);
807-
len += 4;
815+
xr_strcat (sh_name, c_smapsize);
816+
++len;
808817
}
809818

810819
if (o.fp16_filter)

0 commit comments

Comments
 (0)