From da2046e90e7cd5965e153c29896956a17d056cb1 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Thu, 12 May 2016 00:24:37 +0100 Subject: [PATCH] gsdx: Use alignas instead of __aligned __aligned is defined in FreeBSD headers and will cause compile errors. --- plugins/GSdx/GPUDrawScanlineCodeGenerator.cpp | 2 +- plugins/GSdx/GPUDrawScanlineCodeGenerator.h | 4 ++-- plugins/GSdx/GPUDrawingEnvironment.h | 2 +- plugins/GSdx/GPUScanlineEnvironment.h | 4 ++-- plugins/GSdx/GPUVertex.h | 2 +- plugins/GSdx/GS.h | 2 +- plugins/GSdx/GSBlock.h | 12 ++++++------ plugins/GSdx/GSClut.h | 6 +++--- plugins/GSdx/GSDeviceDX.h | 4 ++-- plugins/GSdx/GSDeviceOGL.h | 6 +++--- plugins/GSdx/GSDeviceSW.cpp | 2 +- plugins/GSdx/GSDrawScanlineCodeGenerator.cpp | 2 +- plugins/GSdx/GSDrawScanlineCodeGenerator.h | 2 +- plugins/GSdx/GSDrawingContext.h | 2 +- plugins/GSdx/GSDrawingEnvironment.h | 2 +- plugins/GSdx/GSLocalMemory.cpp | 4 ++-- plugins/GSdx/GSLocalMemory.h | 6 +++--- plugins/GSdx/GSRasterizer.h | 4 ++-- plugins/GSdx/GSRendererCL.h | 4 ++-- plugins/GSdx/GSRendererCS.h | 4 ++-- plugins/GSdx/GSRendererSW.h | 2 +- plugins/GSdx/GSScanlineEnvironment.h | 4 ++-- plugins/GSdx/GSVector.h | 8 ++++---- plugins/GSdx/GSVertex.h | 4 ++-- plugins/GSdx/GSVertexHW.h | 2 +- plugins/GSdx/GSVertexSW.h | 4 ++-- plugins/GSdx/GSVertexTrace.h | 2 +- plugins/GSdx/stdafx.h | 10 +++++----- 28 files changed, 56 insertions(+), 56 deletions(-) diff --git a/plugins/GSdx/GPUDrawScanlineCodeGenerator.cpp b/plugins/GSdx/GPUDrawScanlineCodeGenerator.cpp index c92e28d7c3..2ada9f269f 100644 --- a/plugins/GSdx/GPUDrawScanlineCodeGenerator.cpp +++ b/plugins/GSdx/GPUDrawScanlineCodeGenerator.cpp @@ -1022,7 +1022,7 @@ const GSVector4i GPUDrawScanlineCodeGenerator::m_test[8] = 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}, {2, 5, 3, 4, 2, 5, 3, 4, 2, 5, 3, 4, 2, 5, 3, 4}, diff --git a/plugins/GSdx/GPUDrawScanlineCodeGenerator.h b/plugins/GSdx/GPUDrawScanlineCodeGenerator.h index 00eff14c6d..9caf2c171c 100644 --- a/plugins/GSdx/GPUDrawScanlineCodeGenerator.h +++ b/plugins/GSdx/GPUDrawScanlineCodeGenerator.h @@ -56,5 +56,5 @@ public: GPUDrawScanlineCodeGenerator(void* param, uint32 key, void* code, size_t maxsize); static const GSVector4i m_test[8]; - static __aligned(const uint16, 32) m_dither[4][16]; -}; \ No newline at end of file + alignas(32) static const uint16 m_dither[4][16]; +}; diff --git a/plugins/GSdx/GPUDrawingEnvironment.h b/plugins/GSdx/GPUDrawingEnvironment.h index 674bfb2830..2d3d0b8ac3 100644 --- a/plugins/GSdx/GPUDrawingEnvironment.h +++ b/plugins/GSdx/GPUDrawingEnvironment.h @@ -23,7 +23,7 @@ #include "GPU.h" -__aligned(class, 32) GPUDrawingEnvironment +class alignas(32) GPUDrawingEnvironment { public: GPURegSTATUS STATUS; diff --git a/plugins/GSdx/GPUScanlineEnvironment.h b/plugins/GSdx/GPUScanlineEnvironment.h index ad9d7fa1fd..bd3b927f0c 100644 --- a/plugins/GSdx/GPUScanlineEnvironment.h +++ b/plugins/GSdx/GPUScanlineEnvironment.h @@ -56,7 +56,7 @@ union GPUScanlineSelector operator uint32() const {return key;} }; -__aligned(struct, 32) GPUScanlineGlobalData +struct alignas(32) GPUScanlineGlobalData { GPUScanlineSelector sel; @@ -66,7 +66,7 @@ __aligned(struct, 32) GPUScanlineGlobalData GSVector4i twin; // TWW, TWH, TWX, TWY }; -__aligned(struct, 32) GPUScanlineLocalData +struct alignas(32) GPUScanlineLocalData { const GPUScanlineGlobalData* gd; diff --git a/plugins/GSdx/GPUVertex.h b/plugins/GSdx/GPUVertex.h index 05455a4c42..3803ae81f0 100644 --- a/plugins/GSdx/GPUVertex.h +++ b/plugins/GSdx/GPUVertex.h @@ -26,7 +26,7 @@ #pragma pack(push, 1) -__aligned(struct, 32) GPUVertex +struct alignas(32) GPUVertex { union { diff --git a/plugins/GSdx/GS.h b/plugins/GSdx/GS.h index 9df86a1d98..d5d0b89cab 100644 --- a/plugins/GSdx/GS.h +++ b/plugins/GSdx/GS.h @@ -1101,7 +1101,7 @@ REG128_SET(GIFPackedReg) GIFPackedNOP NOP; REG_SET_END -__aligned(struct, 32) GIFPath +struct alignas(32) GIFPath { GIFTag tag; uint32 nloop; diff --git a/plugins/GSdx/GSBlock.h b/plugins/GSdx/GSBlock.h index a18f597299..1c38fcb529 100644 --- a/plugins/GSdx/GSBlock.h +++ b/plugins/GSdx/GSBlock.h @@ -1917,7 +1917,7 @@ public: #else - __aligned(uint16, 32) block[16 * 8]; + alignas(32) uint16 block[16 * 8]; ReadBlock16(src, (uint8*)block, sizeof(block) / 8); @@ -1976,7 +1976,7 @@ public: #else - __aligned(uint8, 32) block[16 * 16]; + alignas(32) uint8 block[16 * 16]; ReadBlock8(src, (uint8*)block, sizeof(block) / 16); @@ -2053,7 +2053,7 @@ public: #else - __aligned(uint8, 32) block[(32 / 2) * 16]; + alignas(32) uint8 block[(32 / 2) * 16]; ReadBlock4(src, (uint8*)block, sizeof(block) / 16); @@ -2096,7 +2096,7 @@ public: #else - __aligned(uint32, 32) block[8 * 8]; + alignas(32) uint32 block[8 * 8]; ReadBlock32(src, (uint8*)block, sizeof(block) / 8); @@ -2139,7 +2139,7 @@ public: #else - __aligned(uint32, 32) block[8 * 8]; + alignas(32) uint32 block[8 * 8]; ReadBlock32(src, (uint8*)block, sizeof(block) / 8); @@ -2182,7 +2182,7 @@ public: #else - __aligned(uint32, 32) block[8 * 8]; + alignas(32) uint32 block[8 * 8]; ReadBlock32(src, (uint8*)block, sizeof(block) / 8); diff --git a/plugins/GSdx/GSClut.h b/plugins/GSdx/GSClut.h index 171e5e1452..d39eb1602f 100644 --- a/plugins/GSdx/GSClut.h +++ b/plugins/GSdx/GSClut.h @@ -28,7 +28,7 @@ class GSLocalMemory; -__aligned(class, 32) GSClut : public GSAlignedClass<32> +class alignas(32) GSClut : public GSAlignedClass<32> { GSLocalMemory* m_mem; @@ -37,7 +37,7 @@ __aligned(class, 32) GSClut : public GSAlignedClass<32> uint32* m_buff32; uint64* m_buff64; - __aligned(struct, 32) WriteState + struct alignas(32) WriteState { GIFRegTEX0 TEX0; GIFRegTEXCLUT TEXCLUT; @@ -45,7 +45,7 @@ __aligned(class, 32) GSClut : public GSAlignedClass<32> bool IsDirty(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT); } m_write; - __aligned(struct, 32) ReadState + struct alignas(32) ReadState { GIFRegTEX0 TEX0; GIFRegTEXA TEXA; diff --git a/plugins/GSdx/GSDeviceDX.h b/plugins/GSdx/GSDeviceDX.h index cdf03312ad..36bb0ae13f 100644 --- a/plugins/GSdx/GSDeviceDX.h +++ b/plugins/GSdx/GSDeviceDX.h @@ -30,7 +30,7 @@ class GSDeviceDX : public GSDevice public: #pragma pack(push, 1) - __aligned(struct, 32) VSConstantBuffer + struct alignas(32) VSConstantBuffer { GSVector4 VertexScale; GSVector4 VertexOffset; @@ -86,7 +86,7 @@ public: VSSelector() : key(0) {} }; - __aligned(struct, 32) PSConstantBuffer + struct alignas(32) PSConstantBuffer { GSVector4 FogColor_AREF; GSVector4 HalfTexel; diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index 28e436e5f4..2bf30b632b 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -116,8 +116,8 @@ public: class GSDeviceOGL final : public GSDevice { - public: - __aligned(struct, 32) VSConstantBuffer +public: + struct alignas(32) VSConstantBuffer { GSVector4 Vertex_Scale_Offset; GSVector4 TextureScale; @@ -187,7 +187,7 @@ class GSDeviceOGL final : public GSDevice GSSelector(uint32 k) : key(k) {} }; - __aligned(struct, 32) PSConstantBuffer + struct alignas(32) PSConstantBuffer { GSVector4 FogColor_AREF; GSVector4 WH; diff --git a/plugins/GSdx/GSDeviceSW.cpp b/plugins/GSdx/GSDeviceSW.cpp index 5518e5eecd..dfcf63bea6 100644 --- a/plugins/GSdx/GSDeviceSW.cpp +++ b/plugins/GSdx/GSDeviceSW.cpp @@ -186,7 +186,7 @@ public: } }; -__aligned(class, 16) ShaderFactorBlend : public ShaderBase +class alignas(16) ShaderFactorBlend : public ShaderBase { GSVector4i m_f; diff --git a/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp b/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp index 3909a6e787..09a233a6ae 100644 --- a/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp +++ b/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp @@ -24,7 +24,7 @@ #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}, {0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, diff --git a/plugins/GSdx/GSDrawScanlineCodeGenerator.h b/plugins/GSdx/GSDrawScanlineCodeGenerator.h index 282285bcbd..5ff54b4d4b 100644 --- a/plugins/GSdx/GSDrawScanlineCodeGenerator.h +++ b/plugins/GSdx/GSDrawScanlineCodeGenerator.h @@ -135,7 +135,7 @@ public: GSDrawScanlineCodeGenerator(void* param, uint64 key, void* code, size_t maxsize); #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]; #else static const GSVector4i m_test[8]; diff --git a/plugins/GSdx/GSDrawingContext.h b/plugins/GSdx/GSDrawingContext.h index 9ac9f92c09..df764d9310 100644 --- a/plugins/GSdx/GSDrawingContext.h +++ b/plugins/GSdx/GSDrawingContext.h @@ -24,7 +24,7 @@ #include "GS.h" #include "GSLocalMemory.h" -__aligned(class, 32) GSDrawingContext +class alignas(32) GSDrawingContext { public: GIFRegXYOFFSET XYOFFSET; diff --git a/plugins/GSdx/GSDrawingEnvironment.h b/plugins/GSdx/GSDrawingEnvironment.h index 07c6d4eab2..4acf9d4db0 100644 --- a/plugins/GSdx/GSDrawingEnvironment.h +++ b/plugins/GSdx/GSDrawingEnvironment.h @@ -23,7 +23,7 @@ #include "GS.h" -__aligned(class, 32) GSDrawingEnvironment +class alignas(32) GSDrawingEnvironment { public: GIFRegPRIM PRIM; diff --git a/plugins/GSdx/GSLocalMemory.cpp b/plugins/GSdx/GSLocalMemory.cpp index 16ac0f62ed..c37bfaec3c 100644 --- a/plugins/GSdx/GSLocalMemory.cpp +++ b/plugins/GSdx/GSLocalMemory.cpp @@ -770,7 +770,7 @@ void GSLocalMemory::WriteImageLeftRight(int l, int r, int y, int h, const uint8* template 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 bw = BITBLTBUF.DBW; @@ -2055,7 +2055,7 @@ uint32* GSOffset::GetPages(const GSVector4i& rect, uint32* pages, GSVector4i* bb pages = new uint32[limit]; } - __aligned(uint32, 16) tmp[16]; + alignas(16) uint32 tmp[16]; ((GSVector4i*)tmp)[0] = GSVector4i::zero(); ((GSVector4i*)tmp)[1] = GSVector4i::zero(); diff --git a/plugins/GSdx/GSLocalMemory.h b/plugins/GSdx/GSLocalMemory.h index 4f0e2efe1b..f52d438fb6 100644 --- a/plugins/GSdx/GSLocalMemory.h +++ b/plugins/GSdx/GSLocalMemory.h @@ -30,13 +30,13 @@ class GSOffset : public GSAlignedClass<32> { public: - __aligned(struct, 32) Block + struct alignas(32) Block { short row[256]; // yn (n = 0 8 16 ...) 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* 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::*readTextureBlock)(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const; - __aligned(struct, 128) psm_t + struct alignas(128) psm_t { pixelAddress pa, bn; readPixel rp; diff --git a/plugins/GSdx/GSRasterizer.h b/plugins/GSdx/GSRasterizer.h index 35d42c8ff4..f4eeb04c25 100644 --- a/plugins/GSdx/GSRasterizer.h +++ b/plugins/GSdx/GSRasterizer.h @@ -28,7 +28,7 @@ #include "GSPerfMon.h" #include "GSThread_CXX11.h" -__aligned(class, 32) GSRasterizerData : public GSAlignedClass<32> +class alignas(32) GSRasterizerData : public GSAlignedClass<32> { static int s_counter; @@ -122,7 +122,7 @@ public: virtual void PrintStats() = 0; }; -__aligned(class, 32) GSRasterizer : public IRasterizer +class alignas(32) GSRasterizer : public IRasterizer { protected: GSPerfMon* m_perfmon; diff --git a/plugins/GSdx/GSRendererCL.h b/plugins/GSdx/GSRendererCL.h index 46e7f0467f..d1b849b6cd 100644 --- a/plugins/GSdx/GSRendererCL.h +++ b/plugins/GSdx/GSRendererCL.h @@ -25,7 +25,7 @@ #ifdef ENABLE_OPENCL -__aligned(struct, 32) GSVertexCL +struct alignas(32) GSVertexCL { GSVector4 p, t; }; @@ -145,7 +145,7 @@ class GSRendererCL : public GSRenderer } }; - __aligned(struct, 32) TFXParameter + struct alignas(32) TFXParameter { GSVector4i scissor; GSVector4i dimx; // 4x4 signed char diff --git a/plugins/GSdx/GSRendererCS.h b/plugins/GSdx/GSRendererCS.h index 5b1def1ff7..01f9071b18 100644 --- a/plugins/GSdx/GSRendererCS.h +++ b/plugins/GSdx/GSRendererCS.h @@ -44,7 +44,7 @@ class GSRendererCS : public GSRenderer VSSelector() : key(0) {} }; - __aligned(struct, 32) VSConstantBuffer + struct alignas(32) VSConstantBuffer { GSVector4 VertexScale; GSVector4 VertexOffset; @@ -86,7 +86,7 @@ class GSRendererCS : public GSRenderer PSSelector() : key(0) {} }; - __aligned(struct, 32) PSConstantBuffer + struct alignas(32) PSConstantBuffer { uint32 fm; uint32 zm; diff --git a/plugins/GSdx/GSRendererSW.h b/plugins/GSdx/GSRendererSW.h index badb702592..b2e1c2155b 100644 --- a/plugins/GSdx/GSRendererSW.h +++ b/plugins/GSdx/GSRendererSW.h @@ -29,7 +29,7 @@ class GSRendererSW : public GSRenderer { class SharedData : public GSDrawScanline::SharedData { - __aligned(struct, 16) TextureLevel + struct alignas(16) TextureLevel { GSVector4i r; GSTextureCacheSW::Texture* t; diff --git a/plugins/GSdx/GSScanlineEnvironment.h b/plugins/GSdx/GSScanlineEnvironment.h index cc71026b72..e9f0551e40 100644 --- a/plugins/GSdx/GSScanlineEnvironment.h +++ b/plugins/GSdx/GSScanlineEnvironment.h @@ -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; @@ -150,7 +150,7 @@ __aligned(struct, 32) GSScanlineGlobalData // per batch variables, this is like #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 diff --git a/plugins/GSdx/GSVector.h b/plugins/GSdx/GSVector.h index b8ebe1bb3a..da46a64f71 100644 --- a/plugins/GSdx/GSVector.h +++ b/plugins/GSdx/GSVector.h @@ -90,7 +90,7 @@ class GSVector8i; #endif -__aligned(class, 16) GSVector4i +class alignas(16) GSVector4i { static const GSVector4i m_xff[17]; static const GSVector4i m_x0f[17]; @@ -2421,7 +2421,7 @@ public: __forceinline static GSVector4i x0f(int n) {return m_x0f[n];} }; -__aligned(class, 16) GSVector4 +class alignas(16) GSVector4 { public: union @@ -3341,7 +3341,7 @@ GSVector.h:2973:15: error: shadows template parm 'int i' #if _M_SSE >= 0x501 -__aligned(class, 32) GSVector8i +class alignas(32) GSVector8i { static const GSVector8i m_xff[33]; static const GSVector8i m_x0f[33]; @@ -5133,7 +5133,7 @@ public: #if _M_SSE >= 0x500 -__aligned(class, 32) GSVector8 +class alignas(32) GSVector8 { public: union diff --git a/plugins/GSdx/GSVertex.h b/plugins/GSdx/GSVertex.h index 198fbb93d0..5d6b82135f 100644 --- a/plugins/GSdx/GSVertex.h +++ b/plugins/GSdx/GSVertex.h @@ -28,7 +28,7 @@ #pragma pack(push, 1) -__aligned(struct, 32) GSVertex +struct alignas(32) GSVertex { union { @@ -52,7 +52,7 @@ struct GSVertexP GSVector4 p; }; -__aligned(struct, 32) GSVertexPT1 +struct alignas(32) GSVertexPT1 { GSVector4 p; GSVector2 t; diff --git a/plugins/GSdx/GSVertexHW.h b/plugins/GSdx/GSVertexHW.h index e0fe308b62..f249f5731a 100644 --- a/plugins/GSdx/GSVertexHW.h +++ b/plugins/GSdx/GSVertexHW.h @@ -26,7 +26,7 @@ #pragma pack(push, 1) -__aligned(struct, 32) GSVertexHW9 +struct alignas(32) GSVertexHW9 { GSVector4 t; GSVector4 p; diff --git a/plugins/GSdx/GSVertexSW.h b/plugins/GSdx/GSVertexSW.h index 0d977658d7..b902fd4f41 100644 --- a/plugins/GSdx/GSVertexSW.h +++ b/plugins/GSdx/GSVertexSW.h @@ -23,7 +23,7 @@ #include "GSVector.h" -__aligned(struct, 32) GSVertexSW +struct alignas(32) GSVertexSW { GSVector4 p, _pad, t, c; @@ -237,7 +237,7 @@ __aligned(struct, 32) GSVertexSW #if _M_SSE >= 0x501 -__aligned(struct, 32) GSVertexSW2 +struct alignas(32) GSVertexSW2 { GSVector4 p, _pad; GSVector8 tc; diff --git a/plugins/GSdx/GSVertexTrace.h b/plugins/GSdx/GSVertexTrace.h index b3ee0b73e6..caaa75a18e 100644 --- a/plugins/GSdx/GSVertexTrace.h +++ b/plugins/GSdx/GSVertexTrace.h @@ -29,7 +29,7 @@ class GSState; -__aligned(class, 32) GSVertexTrace : public GSAlignedClass<32> +class alignas(32) GSVertexTrace : public GSAlignedClass<32> { public: struct Vertex {GSVector4i c; GSVector4 p, t;}; diff --git a/plugins/GSdx/stdafx.h b/plugins/GSdx/stdafx.h index 7417a262a3..851f18b6e0 100644 --- a/plugins/GSdx/stdafx.h +++ b/plugins/GSdx/stdafx.h @@ -197,17 +197,17 @@ using namespace stdext; #endif #ifdef _MSC_VER - - #define __aligned(t, n) __declspec(align(n)) t +#if _MSC_VER < 1900 + #define alignas(n) __declspec(align(n)) +#endif #define EXPORT_C_(type) extern "C" __declspec(dllexport) type __stdcall #define EXPORT_C EXPORT_C_(void) - #define ALIGN_STACK(n) __aligned(int, n) __dummy; + #define ALIGN_STACK(n) alignas(n) int dummy__; #else - #define __aligned(t, n) t __attribute__((aligned(n))) #define __fastcall __attribute__((fastcall)) #define EXPORT_C_(type) extern "C" __attribute__((stdcall,externally_visible,visibility("default"))) type @@ -227,7 +227,7 @@ using namespace stdext; #else // TODO Check clang behavior - #define ALIGN_STACK(n) __aligned(int, n) __dummy; + #define ALIGN_STACK(n) alignas(n) int dummy__; #endif