Skip to content

Commit

Permalink
gsdx: defer init of GSUtil global object
Browse files Browse the repository at this point in the history
Close #1935
  • Loading branch information
gregory38 committed May 21, 2017
1 parent e043822 commit 5c7d9d0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions plugins/GSdx/GS.cpp
Expand Up @@ -128,6 +128,7 @@ EXPORT_C_(int) GSinit()
// const type qualifier from all the affected variables.
theApp.Init();

GSUtil::Init();
GSBlock::InitVectors();
GSClut::InitVectors();
#ifdef ENABLE_OPENCL
Expand Down
8 changes: 7 additions & 1 deletion plugins/GSdx/GSUtil.cpp
Expand Up @@ -102,7 +102,8 @@ static class GSUtilMaps
uint32 CompatibleBitsField[64][2];
uint32 SharedBitsField[64][2];

GSUtilMaps()
// Defer init to avoid AVX2 illegal instructions
void Init()
{
PrimClassField[GS_POINTLIST] = GS_POINT_CLASS;
PrimClassField[GS_LINELIST] = GS_LINE_CLASS;
Expand Down Expand Up @@ -163,6 +164,11 @@ static class GSUtilMaps

} s_maps;

void GSUtil::Init()
{
s_maps.Init();
}

GS_PRIM_CLASS GSUtil::GetPrimClass(uint32 prim)
{
return (GS_PRIM_CLASS)s_maps.PrimClassField[prim];
Expand Down
2 changes: 2 additions & 0 deletions plugins/GSdx/GSUtil.h
Expand Up @@ -37,6 +37,8 @@ struct OCLDeviceDesc
class GSUtil
{
public:
static void Init();

static const char* GetLibName();

static GS_PRIM_CLASS GetPrimClass(uint32 prim);
Expand Down

0 comments on commit 5c7d9d0

Please sign in to comment.