GSdx: A few minor cleanups to nudge GSdx a little closer to being cross-platform compatible,

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2405 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-01-01 05:18:32 +00:00
parent c3d2d20c47
commit 01aff16aac
21 changed files with 68 additions and 51 deletions

View File

@ -23,9 +23,13 @@
#include "GSdx.h"
#include "GSUtil.h"
#include "GPURendererSW.h"
#ifdef _WINDOWS
#include "GSDevice7.h"
#include "GSDevice9.h"
#include "GSDevice10.h"
#endif
#include "GPUSettingsDlg.h"
#define PSE_LT_GPU 2

View File

@ -1020,7 +1020,7 @@ const GSVector4i GPUDrawScanlineCodeGenerator::m_test[8] =
GSVector4i::zero(),
};
__declspec(align(16)) const uint16 GPUDrawScanlineCodeGenerator::m_dither[4][16] =
__aligned16 const uint16 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},

View File

@ -25,7 +25,7 @@
#pragma pack(push, 1)
__declspec(align(16)) class GPUDrawingEnvironment
__aligned16 class GPUDrawingEnvironment
{
public:
GPURegSTATUS STATUS;

View File

@ -56,7 +56,7 @@ union GPUScanlineSelector
operator uint32() {return key;}
};
__declspec(align(16)) struct GPUScanlineParam
__aligned16 struct GPUScanlineParam
{
GPUScanlineSelector sel;
@ -64,7 +64,7 @@ __declspec(align(16)) struct GPUScanlineParam
const uint16* clut;
};
__declspec(align(16)) struct GPUScanlineEnvironment
__aligned16 struct GPUScanlineEnvironment
{
GPUScanlineSelector sel;

View File

@ -26,7 +26,7 @@
#pragma pack(push, 1)
__declspec(align(16)) struct GPUVertex
__aligned16 struct GPUVertex
{
union
{

View File

@ -1080,7 +1080,7 @@ REG128_SET(GIFPackedReg)
GIFPackedNOP NOP;
REG_SET_END
__declspec(align(16)) struct GIFPath
__aligned16 struct GIFPath
{
GIFTag tag;
uint32 reg;

View File

@ -1201,7 +1201,7 @@ public:
#else
/*
__declspec(align(16)) uint32 block[8 * 8];
__aligned16 uint32 block[8 * 8];
UnpackBlock4HL(src, srcpitch, block);
@ -1316,7 +1316,7 @@ public:
#else
/*
__declspec(align(16)) uint32 block[8 * 8];
__aligned16 uint32 block[8 * 8];
UnpackBlock4HH(src, srcpitch, block);
@ -1467,7 +1467,7 @@ public:
#else
__declspec(align(16)) uint8 block[16 * 16];
__aligned16 uint8 block[16 * 16];
ReadBlock8<true>(src, (uint8*)block, sizeof(block) / 16);
@ -1542,7 +1542,7 @@ public:
#else
__declspec(align(16)) uint8 block[(32 / 2) * 16];
__aligned16 uint8 block[(32 / 2) * 16];
ReadBlock4<true>(src, (uint8*)block, sizeof(block) / 16);
@ -1583,7 +1583,7 @@ public:
#else
__declspec(align(16)) uint32 block[8 * 8];
__aligned16 uint32 block[8 * 8];
ReadBlock32<true>(src, (uint8*)block, sizeof(block) / 8);
@ -1624,7 +1624,7 @@ public:
#else
__declspec(align(16)) uint32 block[8 * 8];
__aligned16 uint32 block[8 * 8];
ReadBlock32<true>(src, (uint8*)block, sizeof(block) / 8);
@ -1665,7 +1665,7 @@ public:
#else
__declspec(align(16)) uint32 block[8 * 8];
__aligned16 uint32 block[8 * 8];
ReadBlock32<true>(src, (uint8*)block, sizeof(block) / 8);

View File

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

View File

@ -30,7 +30,7 @@ class GSDeviceDX : public GSDevice
public:
#pragma pack(push, 1)
__declspec(align(16)) struct VSConstantBuffer
__aligned16 struct VSConstantBuffer
{
GSVector4 VertexScale;
GSVector4 VertexOffset;
@ -85,7 +85,7 @@ public:
VSSelector() : key(0) {}
};
__declspec(align(16)) struct PSConstantBuffer
__aligned16 struct PSConstantBuffer
{
GSVector4 FogColor_AREF;
GSVector4 HalfTexel;

View File

@ -26,7 +26,7 @@
#pragma pack(push, 1)
__declspec(align(16)) class GSDrawingContext
__aligned16 class GSDrawingContext
{
public:
GIFRegXYOFFSET XYOFFSET;
@ -43,7 +43,7 @@ public:
GIFRegFRAME FRAME;
GIFRegZBUF ZBUF;
__declspec(align(16)) struct
__aligned16 struct
{
GSVector4i dx10;
GSVector4 dx9;

View File

@ -25,7 +25,7 @@
#pragma pack(push, 1)
__declspec(align(16)) class GSDrawingEnvironment
__aligned16 class GSDrawingEnvironment
{
public:
GIFRegPRIM PRIM;

View File

@ -628,7 +628,7 @@ void GSLocalMemory::WriteImageLeftRight(int l, int r, int y, int h, uint8* src,
template<int psm, int bsx, int bsy, int trbpp>
void GSLocalMemory::WriteImageTopBottom(int l, int r, int y, int h, uint8* src, int srcpitch, const GIFRegBITBLTBUF& BITBLTBUF)
{
__declspec(align(16)) uint8 buff[64]; // merge buffer for one column
__aligned16 uint8 buff[64]; // merge buffer for one column
uint32 bp = BITBLTBUF.DBP;
uint32 bw = BITBLTBUF.DBW;
@ -1438,7 +1438,7 @@ void GSLocalMemory::ReadTexture24(const GSOffset* RESTRICT o, const GSVector4i&
void GSLocalMemory::ReadTexture16(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
__declspec(align(16)) uint16 block[16 * 8];
__aligned16 uint16 block[16 * 8];
FOREACH_BLOCK_START(r, 16, 8, 32)
{
@ -1451,7 +1451,7 @@ void GSLocalMemory::ReadTexture16(const GSOffset* RESTRICT o, const GSVector4i&
void GSLocalMemory::ReadTexture16S(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
__declspec(align(16)) uint16 block[16 * 8];
__aligned16 uint16 block[16 * 8];
FOREACH_BLOCK_START(r, 16, 8, 32)
{
@ -1548,7 +1548,7 @@ void GSLocalMemory::ReadTexture24Z(const GSOffset* RESTRICT o, const GSVector4i&
void GSLocalMemory::ReadTexture16Z(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
__declspec(align(16)) uint16 block[16 * 8];
__aligned16 uint16 block[16 * 8];
FOREACH_BLOCK_START(r, 16, 8, 32)
{
@ -1561,7 +1561,7 @@ void GSLocalMemory::ReadTexture16Z(const GSOffset* RESTRICT o, const GSVector4i&
void GSLocalMemory::ReadTexture16SZ(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
__declspec(align(16)) uint16 block[16 * 8];
__aligned16 uint16 block[16 * 8];
FOREACH_BLOCK_START(r, 16, 8, 32)
{
@ -1597,7 +1597,7 @@ void GSLocalMemory::ReadTextureBlock24(uint32 bp, uint8* dst, int dstpitch, cons
void GSLocalMemory::ReadTextureBlock16(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
__declspec(align(16)) uint16 block[16 * 8];
__aligned16 uint16 block[16 * 8];
ReadBlock16<true>(BlockPtr(bp), (uint8*)block, sizeof(block) / 8);
@ -1606,7 +1606,7 @@ void GSLocalMemory::ReadTextureBlock16(uint32 bp, uint8* dst, int dstpitch, cons
void GSLocalMemory::ReadTextureBlock16S(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
__declspec(align(16)) uint16 block[16 * 8];
__aligned16 uint16 block[16 * 8];
ReadBlock16<true>(BlockPtr(bp), (uint8*)block, sizeof(block) / 8);
@ -1671,7 +1671,7 @@ void GSLocalMemory::ReadTextureBlock24Z(uint32 bp, uint8* dst, int dstpitch, con
void GSLocalMemory::ReadTextureBlock16Z(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
__declspec(align(16)) uint16 block[16 * 8];
__aligned16 uint16 block[16 * 8];
ReadBlock16<true>(BlockPtr(bp), (uint8*)block, sizeof(block) / 8);
@ -1680,7 +1680,7 @@ void GSLocalMemory::ReadTextureBlock16Z(uint32 bp, uint8* dst, int dstpitch, con
void GSLocalMemory::ReadTextureBlock16SZ(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
__declspec(align(16)) uint16 block[16 * 8];
__aligned16 uint16 block[16 * 8];
ReadBlock16<true>(BlockPtr(bp), (uint8*)block, sizeof(block) / 8);

View File

@ -30,7 +30,7 @@
#include "pthread.h"
#include "semaphore.h"
__declspec(align(16)) class GSRasterizerData
__aligned16 class GSRasterizerData
{
public:
GSVector4i scissor;

View File

@ -99,7 +99,7 @@ union GSScanlineSelector
}
};
__declspec(align(16)) struct GSScanlineParam
__aligned16 struct GSScanlineParam
{
GSScanlineSelector sel;
@ -115,7 +115,7 @@ __declspec(align(16)) struct GSScanlineParam
uint32 fm, zm;
};
__declspec(align(16)) struct GSScanlineEnvironment
__aligned16 struct GSScanlineEnvironment
{
void* vm;
const void* tex;

View File

@ -1,3 +1,6 @@
#include "stdafx.h"
#pragma once
// NOTE: x64 version of the _mm_set_* functions are terrible, first they store components into memory then reload in one piece (VS2008 SP1)
@ -40,7 +43,7 @@ typedef GSVector2T<int> GSVector2i;
class GSVector4;
__declspec(align(16)) class GSVector4i
__aligned16 class GSVector4i
{
public:
union
@ -2038,9 +2041,9 @@ public:
VECTOR4i_SHUFFLE_3(xs, xn, ys, yn, w, 3) \
#define VECTOR4i_SHUFFLE_1(xs, xn) \
GSVector4i xs##4##() const {return GSVector4i(_mm_shuffle_epi32(m, _MM_SHUFFLE(xn, xn, xn, xn)));} \
GSVector4i xs##4##l() const {return GSVector4i(_mm_shufflelo_epi16(m, _MM_SHUFFLE(xn, xn, xn, xn)));} \
GSVector4i xs##4##h() const {return GSVector4i(_mm_shufflehi_epi16(m, _MM_SHUFFLE(xn, xn, xn, xn)));} \
GSVector4i xs##4() const {return GSVector4i(_mm_shuffle_epi32(m, _MM_SHUFFLE(xn, xn, xn, xn)));} \
GSVector4i xs##4l() const {return GSVector4i(_mm_shufflelo_epi16(m, _MM_SHUFFLE(xn, xn, xn, xn)));} \
GSVector4i xs##4h() const {return GSVector4i(_mm_shufflehi_epi16(m, _MM_SHUFFLE(xn, xn, xn, xn)));} \
VECTOR4i_SHUFFLE_2(xs, xn, x, 0) \
VECTOR4i_SHUFFLE_2(xs, xn, y, 1) \
VECTOR4i_SHUFFLE_2(xs, xn, z, 2) \
@ -2250,7 +2253,7 @@ public:
static GSVector4i xfffe(const GSVector4i& v) {return xffffffff(v).sll16( 1);}
};
__declspec(align(16)) class GSVector4
__aligned16 class GSVector4
{
public:
union
@ -2860,8 +2863,8 @@ public:
VECTOR4_SHUFFLE_3(xs, xn, ys, yn, w, 3) \
#define VECTOR4_SHUFFLE_1(xs, xn) \
GSVector4 xs##4##() const {return GSVector4(_mm_shuffle_ps(m, m, _MM_SHUFFLE(xn, xn, xn, xn)));} \
GSVector4 xs##4##(const GSVector4& v) const {return GSVector4(_mm_shuffle_ps(m, v.m, _MM_SHUFFLE(xn, xn, xn, xn)));} \
GSVector4 xs##4() const {return GSVector4(_mm_shuffle_ps(m, m, _MM_SHUFFLE(xn, xn, xn, xn)));} \
GSVector4 xs##4(const GSVector4& v) const {return GSVector4(_mm_shuffle_ps(m, v.m, _MM_SHUFFLE(xn, xn, xn, xn)));} \
VECTOR4_SHUFFLE_2(xs, xn, x, 0) \
VECTOR4_SHUFFLE_2(xs, xn, y, 1) \
VECTOR4_SHUFFLE_2(xs, xn, z, 2) \

View File

@ -28,7 +28,7 @@
#pragma pack(push, 1)
__declspec(align(16)) struct GSVertex
__aligned16 struct GSVertex
{
union
{

View File

@ -26,7 +26,7 @@
#pragma pack(push, 1)
__declspec(align(16)) union GSVertexHW9
__aligned16 union GSVertexHW9
{
struct
{
@ -56,7 +56,7 @@ __declspec(align(16)) union GSVertexHW9
float GetQ() {return p.w;}
};
__declspec(align(16)) union GSVertexHW10
__aligned16 union GSVertexHW10
{
struct
{

View File

@ -23,7 +23,7 @@
#include "GSVector.h"
__declspec(align(16)) union GSVertexSW
__aligned16 union GSVertexSW
{
struct {GSVector4 c, p, t;};
struct {GSVector4 v[3];};

View File

@ -31,7 +31,7 @@
class GSState;
__declspec(align(16)) class GSVertexTrace
__aligned16 class GSVertexTrace
{
struct Vertex {GSVector4i c; GSVector4 p, t;};
struct VertexAlpha {int min, max; bool valid;};

View File

@ -29,7 +29,11 @@ class GSdxApp
public:
GSdxApp();
HMODULE GetModuleHandle();
#ifdef _WINDOWS
HMODULE GetModuleHandle();
#else
void *GetModuleHandle();
#endif
string GetConfig(const char* entry, const char* value);
void SetConfig(const char* entry, const char* value);

View File

@ -46,8 +46,8 @@
#include <math.h>
#include <time.h>
#include <intrin.h>
#include <cstring>
#include <string>
#include <vector>
#include <list>
@ -56,8 +56,14 @@
#include <hash_set>
#include <algorithm>
// Let's take advantage of the work that's already been done on making things cross-platform by bringing this in.
#include "Pcsx2Defs.h"
using namespace std;
#ifdef _WINDOWS
using namespace stdext;
#endif
extern string format(const char* fmt, ...);
@ -86,7 +92,7 @@ typedef signed long long int64;
#define EXPORT_C extern "C" __declspec(dllexport) void __stdcall
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type __stdcall
#define ALIGN_STACK(n) __declspec(align(n)) int __dummy;
#define ALIGN_STACK(n) __aligned(n) int __dummy;
#ifndef RESTRICT
#ifdef __INTEL_COMPILER
@ -135,8 +141,8 @@ typedef signed long long int64;
#include <GL/glew.h>
#include <GL/glut.h>
#include <CG/cg.h>
#include <CG/cgGL.h>
#include <Cg/cg.h>
#include <Cg/cgGL.h>
#ifdef _WINDOWS
#include <GL/wglew.h>
@ -144,7 +150,7 @@ typedef signed long long int64;
// sse
#if !defined(_M_SSE) && (defined(_M_AMD64) || defined(_M_IX86_FP) && _M_IX86_FP >= 2)
#if !defined(_M_SSE) && (!defined(_WINDOWS) || defined(_M_AMD64) || defined(_M_IX86_FP) && _M_IX86_FP >= 2)
#define _M_SSE 0x200