gsdx: Use alignas instead of __aligned

__aligned is defined in FreeBSD headers and will cause compile errors.
This commit is contained in:
Jonathan Li 2016-05-12 00:24:37 +01:00
parent 6362b9c9b2
commit da2046e90e
28 changed files with 56 additions and 56 deletions

View File

@ -1022,7 +1022,7 @@ const GSVector4i GPUDrawScanlineCodeGenerator::m_test[8] =
GSVector4i::zero(), GSVector4i::zero(),
}; };
__aligned(const uint16, 32) GPUDrawScanlineCodeGenerator::m_dither[4][16] = alignas(32) const uint16_t GPUDrawScanlineCodeGenerator::m_dither[4][16] =
{ {
{7, 0, 6, 1, 7, 0, 6, 1, 7, 0, 6, 1, 7, 0, 6, 1}, {7, 0, 6, 1, 7, 0, 6, 1, 7, 0, 6, 1, 7, 0, 6, 1},
{2, 5, 3, 4, 2, 5, 3, 4, 2, 5, 3, 4, 2, 5, 3, 4}, {2, 5, 3, 4, 2, 5, 3, 4, 2, 5, 3, 4, 2, 5, 3, 4},

View File

@ -56,5 +56,5 @@ public:
GPUDrawScanlineCodeGenerator(void* param, uint32 key, void* code, size_t maxsize); GPUDrawScanlineCodeGenerator(void* param, uint32 key, void* code, size_t maxsize);
static const GSVector4i m_test[8]; static const GSVector4i m_test[8];
static __aligned(const uint16, 32) m_dither[4][16]; alignas(32) static const uint16 m_dither[4][16];
}; };

View File

@ -23,7 +23,7 @@
#include "GPU.h" #include "GPU.h"
__aligned(class, 32) GPUDrawingEnvironment class alignas(32) GPUDrawingEnvironment
{ {
public: public:
GPURegSTATUS STATUS; GPURegSTATUS STATUS;

View File

@ -56,7 +56,7 @@ union GPUScanlineSelector
operator uint32() const {return key;} operator uint32() const {return key;}
}; };
__aligned(struct, 32) GPUScanlineGlobalData struct alignas(32) GPUScanlineGlobalData
{ {
GPUScanlineSelector sel; GPUScanlineSelector sel;
@ -66,7 +66,7 @@ __aligned(struct, 32) GPUScanlineGlobalData
GSVector4i twin; // TWW, TWH, TWX, TWY GSVector4i twin; // TWW, TWH, TWX, TWY
}; };
__aligned(struct, 32) GPUScanlineLocalData struct alignas(32) GPUScanlineLocalData
{ {
const GPUScanlineGlobalData* gd; const GPUScanlineGlobalData* gd;

View File

@ -26,7 +26,7 @@
#pragma pack(push, 1) #pragma pack(push, 1)
__aligned(struct, 32) GPUVertex struct alignas(32) GPUVertex
{ {
union union
{ {

View File

@ -1101,7 +1101,7 @@ REG128_SET(GIFPackedReg)
GIFPackedNOP NOP; GIFPackedNOP NOP;
REG_SET_END REG_SET_END
__aligned(struct, 32) GIFPath struct alignas(32) GIFPath
{ {
GIFTag tag; GIFTag tag;
uint32 nloop; uint32 nloop;

View File

@ -1917,7 +1917,7 @@ public:
#else #else
__aligned(uint16, 32) block[16 * 8]; alignas(32) uint16 block[16 * 8];
ReadBlock16(src, (uint8*)block, sizeof(block) / 8); ReadBlock16(src, (uint8*)block, sizeof(block) / 8);
@ -1976,7 +1976,7 @@ public:
#else #else
__aligned(uint8, 32) block[16 * 16]; alignas(32) uint8 block[16 * 16];
ReadBlock8(src, (uint8*)block, sizeof(block) / 16); ReadBlock8(src, (uint8*)block, sizeof(block) / 16);
@ -2053,7 +2053,7 @@ public:
#else #else
__aligned(uint8, 32) block[(32 / 2) * 16]; alignas(32) uint8 block[(32 / 2) * 16];
ReadBlock4(src, (uint8*)block, sizeof(block) / 16); ReadBlock4(src, (uint8*)block, sizeof(block) / 16);
@ -2096,7 +2096,7 @@ public:
#else #else
__aligned(uint32, 32) block[8 * 8]; alignas(32) uint32 block[8 * 8];
ReadBlock32(src, (uint8*)block, sizeof(block) / 8); ReadBlock32(src, (uint8*)block, sizeof(block) / 8);
@ -2139,7 +2139,7 @@ public:
#else #else
__aligned(uint32, 32) block[8 * 8]; alignas(32) uint32 block[8 * 8];
ReadBlock32(src, (uint8*)block, sizeof(block) / 8); ReadBlock32(src, (uint8*)block, sizeof(block) / 8);
@ -2182,7 +2182,7 @@ public:
#else #else
__aligned(uint32, 32) block[8 * 8]; alignas(32) uint32 block[8 * 8];
ReadBlock32(src, (uint8*)block, sizeof(block) / 8); ReadBlock32(src, (uint8*)block, sizeof(block) / 8);

View File

@ -28,7 +28,7 @@
class GSLocalMemory; class GSLocalMemory;
__aligned(class, 32) GSClut : public GSAlignedClass<32> class alignas(32) GSClut : public GSAlignedClass<32>
{ {
GSLocalMemory* m_mem; GSLocalMemory* m_mem;
@ -37,7 +37,7 @@ __aligned(class, 32) GSClut : public GSAlignedClass<32>
uint32* m_buff32; uint32* m_buff32;
uint64* m_buff64; uint64* m_buff64;
__aligned(struct, 32) WriteState struct alignas(32) WriteState
{ {
GIFRegTEX0 TEX0; GIFRegTEX0 TEX0;
GIFRegTEXCLUT TEXCLUT; GIFRegTEXCLUT TEXCLUT;
@ -45,7 +45,7 @@ __aligned(class, 32) GSClut : public GSAlignedClass<32>
bool IsDirty(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT); bool IsDirty(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT);
} m_write; } m_write;
__aligned(struct, 32) ReadState struct alignas(32) ReadState
{ {
GIFRegTEX0 TEX0; GIFRegTEX0 TEX0;
GIFRegTEXA TEXA; GIFRegTEXA TEXA;

View File

@ -30,7 +30,7 @@ class GSDeviceDX : public GSDevice
public: public:
#pragma pack(push, 1) #pragma pack(push, 1)
__aligned(struct, 32) VSConstantBuffer struct alignas(32) VSConstantBuffer
{ {
GSVector4 VertexScale; GSVector4 VertexScale;
GSVector4 VertexOffset; GSVector4 VertexOffset;
@ -86,7 +86,7 @@ public:
VSSelector() : key(0) {} VSSelector() : key(0) {}
}; };
__aligned(struct, 32) PSConstantBuffer struct alignas(32) PSConstantBuffer
{ {
GSVector4 FogColor_AREF; GSVector4 FogColor_AREF;
GSVector4 HalfTexel; GSVector4 HalfTexel;

View File

@ -116,8 +116,8 @@ public:
class GSDeviceOGL final : public GSDevice class GSDeviceOGL final : public GSDevice
{ {
public: public:
__aligned(struct, 32) VSConstantBuffer struct alignas(32) VSConstantBuffer
{ {
GSVector4 Vertex_Scale_Offset; GSVector4 Vertex_Scale_Offset;
GSVector4 TextureScale; GSVector4 TextureScale;
@ -187,7 +187,7 @@ class GSDeviceOGL final : public GSDevice
GSSelector(uint32 k) : key(k) {} GSSelector(uint32 k) : key(k) {}
}; };
__aligned(struct, 32) PSConstantBuffer struct alignas(32) PSConstantBuffer
{ {
GSVector4 FogColor_AREF; GSVector4 FogColor_AREF;
GSVector4 WH; GSVector4 WH;

View File

@ -186,7 +186,7 @@ public:
} }
}; };
__aligned(class, 16) ShaderFactorBlend : public ShaderBase class alignas(16) ShaderFactorBlend : public ShaderBase
{ {
GSVector4i m_f; GSVector4i m_f;

View File

@ -24,7 +24,7 @@
#if _M_SSE >= 0x501 #if _M_SSE >= 0x501
__aligned(const uint8, 8) GSDrawScanlineCodeGenerator::m_test[16][8] = alignas(8) const uint8 GSDrawScanlineCodeGenerator::m_test[16][8] =
{ {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},

View File

@ -135,7 +135,7 @@ public:
GSDrawScanlineCodeGenerator(void* param, uint64 key, void* code, size_t maxsize); GSDrawScanlineCodeGenerator(void* param, uint64 key, void* code, size_t maxsize);
#if _M_SSE >= 0x501 #if _M_SSE >= 0x501
static __aligned(const uint8, 8) m_test[16][8]; alignas(8) static const uint8 m_test[16][8];
static const GSVector8 m_log2_coef[4]; static const GSVector8 m_log2_coef[4];
#else #else
static const GSVector4i m_test[8]; static const GSVector4i m_test[8];

View File

@ -24,7 +24,7 @@
#include "GS.h" #include "GS.h"
#include "GSLocalMemory.h" #include "GSLocalMemory.h"
__aligned(class, 32) GSDrawingContext class alignas(32) GSDrawingContext
{ {
public: public:
GIFRegXYOFFSET XYOFFSET; GIFRegXYOFFSET XYOFFSET;

View File

@ -23,7 +23,7 @@
#include "GS.h" #include "GS.h"
__aligned(class, 32) GSDrawingEnvironment class alignas(32) GSDrawingEnvironment
{ {
public: public:
GIFRegPRIM PRIM; GIFRegPRIM PRIM;

View File

@ -770,7 +770,7 @@ void GSLocalMemory::WriteImageLeftRight(int l, int r, int y, int h, const uint8*
template<int psm, int bsx, int bsy, int trbpp> template<int psm, int bsx, int bsy, int trbpp>
void GSLocalMemory::WriteImageTopBottom(int l, int r, int y, int h, const uint8* src, int srcpitch, const GIFRegBITBLTBUF& BITBLTBUF) void GSLocalMemory::WriteImageTopBottom(int l, int r, int y, int h, const uint8* src, int srcpitch, const GIFRegBITBLTBUF& BITBLTBUF)
{ {
__aligned(uint8, 32) buff[64]; // merge buffer for one column alignas(32) uint8 buff[64]; // merge buffer for one column
uint32 bp = BITBLTBUF.DBP; uint32 bp = BITBLTBUF.DBP;
uint32 bw = BITBLTBUF.DBW; uint32 bw = BITBLTBUF.DBW;
@ -2055,7 +2055,7 @@ uint32* GSOffset::GetPages(const GSVector4i& rect, uint32* pages, GSVector4i* bb
pages = new uint32[limit]; pages = new uint32[limit];
} }
__aligned(uint32, 16) tmp[16]; alignas(16) uint32 tmp[16];
((GSVector4i*)tmp)[0] = GSVector4i::zero(); ((GSVector4i*)tmp)[0] = GSVector4i::zero();
((GSVector4i*)tmp)[1] = GSVector4i::zero(); ((GSVector4i*)tmp)[1] = GSVector4i::zero();

View File

@ -30,13 +30,13 @@
class GSOffset : public GSAlignedClass<32> class GSOffset : public GSAlignedClass<32>
{ {
public: public:
__aligned(struct, 32) Block struct alignas(32) Block
{ {
short row[256]; // yn (n = 0 8 16 ...) short row[256]; // yn (n = 0 8 16 ...)
short* col; // blockOffset* short* col; // blockOffset*
}; };
__aligned(struct, 32) Pixel struct alignas(32) Pixel
{ {
int row[4096]; // yn (n = 0 1 2 ...) NOTE: this wraps around above 2048, only transfers should address the upper half (dark cloud 2 inventing) int row[4096]; // yn (n = 0 1 2 ...) NOTE: this wraps around above 2048, only transfers should address the upper half (dark cloud 2 inventing)
int* col[8]; // rowOffset* int* col[8]; // rowOffset*
@ -95,7 +95,7 @@ public:
typedef void (GSLocalMemory::*readTexture)(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA); typedef void (GSLocalMemory::*readTexture)(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
typedef void (GSLocalMemory::*readTextureBlock)(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const; typedef void (GSLocalMemory::*readTextureBlock)(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const;
__aligned(struct, 128) psm_t struct alignas(128) psm_t
{ {
pixelAddress pa, bn; pixelAddress pa, bn;
readPixel rp; readPixel rp;

View File

@ -28,7 +28,7 @@
#include "GSPerfMon.h" #include "GSPerfMon.h"
#include "GSThread_CXX11.h" #include "GSThread_CXX11.h"
__aligned(class, 32) GSRasterizerData : public GSAlignedClass<32> class alignas(32) GSRasterizerData : public GSAlignedClass<32>
{ {
static int s_counter; static int s_counter;
@ -122,7 +122,7 @@ public:
virtual void PrintStats() = 0; virtual void PrintStats() = 0;
}; };
__aligned(class, 32) GSRasterizer : public IRasterizer class alignas(32) GSRasterizer : public IRasterizer
{ {
protected: protected:
GSPerfMon* m_perfmon; GSPerfMon* m_perfmon;

View File

@ -25,7 +25,7 @@
#ifdef ENABLE_OPENCL #ifdef ENABLE_OPENCL
__aligned(struct, 32) GSVertexCL struct alignas(32) GSVertexCL
{ {
GSVector4 p, t; GSVector4 p, t;
}; };
@ -145,7 +145,7 @@ class GSRendererCL : public GSRenderer
} }
}; };
__aligned(struct, 32) TFXParameter struct alignas(32) TFXParameter
{ {
GSVector4i scissor; GSVector4i scissor;
GSVector4i dimx; // 4x4 signed char GSVector4i dimx; // 4x4 signed char

View File

@ -44,7 +44,7 @@ class GSRendererCS : public GSRenderer
VSSelector() : key(0) {} VSSelector() : key(0) {}
}; };
__aligned(struct, 32) VSConstantBuffer struct alignas(32) VSConstantBuffer
{ {
GSVector4 VertexScale; GSVector4 VertexScale;
GSVector4 VertexOffset; GSVector4 VertexOffset;
@ -86,7 +86,7 @@ class GSRendererCS : public GSRenderer
PSSelector() : key(0) {} PSSelector() : key(0) {}
}; };
__aligned(struct, 32) PSConstantBuffer struct alignas(32) PSConstantBuffer
{ {
uint32 fm; uint32 fm;
uint32 zm; uint32 zm;

View File

@ -29,7 +29,7 @@ class GSRendererSW : public GSRenderer
{ {
class SharedData : public GSDrawScanline::SharedData class SharedData : public GSDrawScanline::SharedData
{ {
__aligned(struct, 16) TextureLevel struct alignas(16) TextureLevel
{ {
GSVector4i r; GSVector4i r;
GSTextureCacheSW::Texture* t; GSTextureCacheSW::Texture* t;

View File

@ -105,7 +105,7 @@ union GSScanlineSelector
} }
}; };
__aligned(struct, 32) GSScanlineGlobalData // per batch variables, this is like a pixel shader constant buffer struct alignas(32) GSScanlineGlobalData // per batch variables, this is like a pixel shader constant buffer
{ {
GSScanlineSelector sel; GSScanlineSelector sel;
@ -150,7 +150,7 @@ __aligned(struct, 32) GSScanlineGlobalData // per batch variables, this is like
#endif #endif
}; };
__aligned(struct, 32) GSScanlineLocalData // per prim variables, each thread has its own struct alignas(32) GSScanlineLocalData // per prim variables, each thread has its own
{ {
#if _M_SSE >= 0x501 #if _M_SSE >= 0x501

View File

@ -90,7 +90,7 @@ class GSVector8i;
#endif #endif
__aligned(class, 16) GSVector4i class alignas(16) GSVector4i
{ {
static const GSVector4i m_xff[17]; static const GSVector4i m_xff[17];
static const GSVector4i m_x0f[17]; static const GSVector4i m_x0f[17];
@ -2421,7 +2421,7 @@ public:
__forceinline static GSVector4i x0f(int n) {return m_x0f[n];} __forceinline static GSVector4i x0f(int n) {return m_x0f[n];}
}; };
__aligned(class, 16) GSVector4 class alignas(16) GSVector4
{ {
public: public:
union union
@ -3341,7 +3341,7 @@ GSVector.h:2973:15: error: shadows template parm 'int i'
#if _M_SSE >= 0x501 #if _M_SSE >= 0x501
__aligned(class, 32) GSVector8i class alignas(32) GSVector8i
{ {
static const GSVector8i m_xff[33]; static const GSVector8i m_xff[33];
static const GSVector8i m_x0f[33]; static const GSVector8i m_x0f[33];
@ -5133,7 +5133,7 @@ public:
#if _M_SSE >= 0x500 #if _M_SSE >= 0x500
__aligned(class, 32) GSVector8 class alignas(32) GSVector8
{ {
public: public:
union union

View File

@ -28,7 +28,7 @@
#pragma pack(push, 1) #pragma pack(push, 1)
__aligned(struct, 32) GSVertex struct alignas(32) GSVertex
{ {
union union
{ {
@ -52,7 +52,7 @@ struct GSVertexP
GSVector4 p; GSVector4 p;
}; };
__aligned(struct, 32) GSVertexPT1 struct alignas(32) GSVertexPT1
{ {
GSVector4 p; GSVector4 p;
GSVector2 t; GSVector2 t;

View File

@ -26,7 +26,7 @@
#pragma pack(push, 1) #pragma pack(push, 1)
__aligned(struct, 32) GSVertexHW9 struct alignas(32) GSVertexHW9
{ {
GSVector4 t; GSVector4 t;
GSVector4 p; GSVector4 p;

View File

@ -23,7 +23,7 @@
#include "GSVector.h" #include "GSVector.h"
__aligned(struct, 32) GSVertexSW struct alignas(32) GSVertexSW
{ {
GSVector4 p, _pad, t, c; GSVector4 p, _pad, t, c;
@ -237,7 +237,7 @@ __aligned(struct, 32) GSVertexSW
#if _M_SSE >= 0x501 #if _M_SSE >= 0x501
__aligned(struct, 32) GSVertexSW2 struct alignas(32) GSVertexSW2
{ {
GSVector4 p, _pad; GSVector4 p, _pad;
GSVector8 tc; GSVector8 tc;

View File

@ -29,7 +29,7 @@
class GSState; class GSState;
__aligned(class, 32) GSVertexTrace : public GSAlignedClass<32> class alignas(32) GSVertexTrace : public GSAlignedClass<32>
{ {
public: public:
struct Vertex {GSVector4i c; GSVector4 p, t;}; struct Vertex {GSVector4i c; GSVector4 p, t;};

View File

@ -197,17 +197,17 @@ using namespace stdext;
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER < 1900
#define __aligned(t, n) __declspec(align(n)) t #define alignas(n) __declspec(align(n))
#endif
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type __stdcall #define EXPORT_C_(type) extern "C" __declspec(dllexport) type __stdcall
#define EXPORT_C EXPORT_C_(void) #define EXPORT_C EXPORT_C_(void)
#define ALIGN_STACK(n) __aligned(int, n) __dummy; #define ALIGN_STACK(n) alignas(n) int dummy__;
#else #else
#define __aligned(t, n) t __attribute__((aligned(n)))
#define __fastcall __attribute__((fastcall)) #define __fastcall __attribute__((fastcall))
#define EXPORT_C_(type) extern "C" __attribute__((stdcall,externally_visible,visibility("default"))) type #define EXPORT_C_(type) extern "C" __attribute__((stdcall,externally_visible,visibility("default"))) type
@ -227,7 +227,7 @@ using namespace stdext;
#else #else
// TODO Check clang behavior // TODO Check clang behavior
#define ALIGN_STACK(n) __aligned(int, n) __dummy; #define ALIGN_STACK(n) alignas(n) int dummy__;
#endif #endif