Skip to content

Commit

Permalink
Revert "Try to fix "SMAP_size" crash in OpenGL render on AMD video ca…
Browse files Browse the repository at this point in the history
…rds"

This reverts commit c9a4ff7.
This reverts commit dbb4342.
  • Loading branch information
Xottab-DUTY committed May 28, 2018
1 parent 41f23c5 commit 33cf655
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 37 deletions.
30 changes: 9 additions & 21 deletions res/gamedata/shaders/gl/common_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,23 @@
#define common_defines_h_included

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

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

//////////////////////////////////////////////////////////////////////////////////////////
// skyloader: if you want to resize smaps in renderer, then do not forget to change this file too
#ifndef SMAP_QUALITY
const float SMAP_size = 2048.f;
#elif SMAP_QUALITY == 1
const float SMAP_size = 1536.f;
#elif SMAP_QUALITY == 2
const float SMAP_size = 2048.f;
#elif SMAP_QUALITY == 3
const float SMAP_size = 2560.f;
#elif SMAP_QUALITY == 4
const float SMAP_size = 3072.f;
#elif SMAP_QUALITY == 5
const float SMAP_size = 4096.f;
#ifndef SMAP_size
#define SMAP_size 1024
#endif
//////////////////////////////////////////////////////////////////////////////////////////
#define PARALLAX_H float(0.02f)
#define parallax float2(PARALLAX_H, -PARALLAX_H/2)
#define PARALLAX_H 0.02
#define parallax float2(PARALLAX_H, -PARALLAX_H/2)
//////////////////////////////////////////////////////////////////////////////////////////

#endif // common_defines_h_included
#endif // common_defines_h_included
23 changes: 7 additions & 16 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) // skyloader: if you want to resize smaps, then do not forget to change them in shaders too (common_defines.h)
// options (smap-pool-size)
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,22 +798,13 @@ HRESULT CRender::shader_compile(
u32 len = 0;
// options
{
// 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;
xr_sprintf(c_smapsize, "%04d", u32(o.smapsize));
defines[def_it].Name = "SMAP_size";
defines[def_it].Definition = c_smapsize;
def_it++;
xr_strcat (sh_name, c_smapsize);
++len;
VERIFY(xr_strlen(c_smapsize) == 4);
xr_strcat(sh_name, c_smapsize);
len += 4;
}

if (o.fp16_filter)
Expand Down

0 comments on commit 33cf655

Please sign in to comment.