Skip to content

Commit

Permalink
Merge pull request #199 from SkyLoaderr/patch-1
Browse files Browse the repository at this point in the history
Try to fix "SMAP_size" crash in OpenGL render on AMD video cards part #1
  • Loading branch information
Xottab-DUTY committed May 6, 2018
2 parents 5732c80 + c9a4ff7 commit f696716
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/Layers/xrRenderPC_GL/rgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void CRender::create()
o.nvdbt = false;
if (o.nvdbt) Msg("* NV-DBT supported and used");

// options (smap-pool-size)
// options (smap-pool-size) // skyloader: if you want to resize smaps, then do not forget to change them in shaders too (common_defines.h)
if (strstr(Core.Params, "-smap1536")) o.smapsize = 1536;
if (strstr(Core.Params, "-smap2048")) o.smapsize = 2048;
if (strstr(Core.Params, "-smap2560")) o.smapsize = 2560;
Expand Down Expand Up @@ -798,13 +798,22 @@ HRESULT CRender::shader_compile(
u32 len = 0;
// options
{
xr_sprintf(c_smapsize, "%04d", u32(o.smapsize));
defines[def_it].Name = "SMAP_size";
defines[def_it].Definition = c_smapsize;
// skyloader: smap size changed to smap quality because something wrong happens with the conversion of defines to float data on amd videocards
u8 uSmapQuality = 2;
switch (o.smapsize)
{
case 1536: uSmapQuality = 1; break;
case 2048: uSmapQuality = 2; break;
case 2560: uSmapQuality = 3; break;
case 3072: uSmapQuality = 4; break;
case 4096: uSmapQuality = 5; break;
}
xr_sprintf (c_smapsize, "%d", uSmapQuality);
defines[def_it].Name = "SMAP_QUALITY";
defines[def_it].Definition = c_smapsize;
def_it++;
VERIFY(xr_strlen(c_smapsize) == 4);
xr_strcat(sh_name, c_smapsize);
len += 4;
xr_strcat (sh_name, c_smapsize);
++len;
}

if (o.fp16_filter)
Expand Down

0 comments on commit f696716

Please sign in to comment.