diff --git a/plugins/GSdx/GPU.cpp b/plugins/GSdx/GPU.cpp index 009e81e357..ce07fa8b6a 100644 --- a/plugins/GSdx/GPU.cpp +++ b/plugins/GSdx/GPU.cpp @@ -1,311 +1,311 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "GSdx.h" -#include "GSUtil.h" -#include "GPURendererSW.h" -#include "GSDeviceNull.h" - -#ifdef _WINDOWS - -#include "GPUSettingsDlg.h" -#include "GSDevice9.h" -#include "GSDevice11.h" - -static HRESULT s_hr = E_FAIL; - -#endif - -#define PSE_LT_GPU 2 - -static GPURenderer* s_gpu = NULL; - -EXPORT_C_(uint32) PSEgetLibType() -{ - return PSE_LT_GPU; -} - -EXPORT_C_(char*) PSEgetLibName() -{ - return GSUtil::GetLibName(); -} - -EXPORT_C_(uint32) PSEgetLibVersion() -{ - static const uint32 version = 1; - static const uint32 revision = 1; - - return version << 16 | revision << 8 | PLUGIN_VERSION; -} - -EXPORT_C_(int32) GPUinit() -{ - return 0; -} - -EXPORT_C_(int32) GPUshutdown() -{ - return 0; -} - -EXPORT_C_(int32) GPUclose() -{ - delete s_gpu; - - s_gpu = NULL; - -#ifdef _WINDOWS - - if(SUCCEEDED(s_hr)) - { - ::CoUninitialize(); - - s_hr = E_FAIL; - } - -#endif - - return 0; -} - -EXPORT_C_(int32) GPUopen(void* hWnd) -{ - GPUclose(); - - if(!GSUtil::CheckSSE()) - { - return -1; - } - -#ifdef _WINDOWS - - s_hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); - - if(!GSUtil::CheckDirectX()) - { - return -1; - } - -#endif - - int renderer = theApp.GetConfig("Renderer", 1); - int threads = theApp.GetConfig("swthreads", 1); - - switch(renderer) - { - default: - #ifdef _WINDOWS - case 0: s_gpu = new GPURendererSW(new GSDevice9(), threads); break; - case 1: s_gpu = new GPURendererSW(new GSDevice11(), threads); break; - #endif - case 2: s_gpu = new GPURendererSW(new GSDeviceNull(), threads); break; - //case 3: s_gpu = new GPURendererNull(new GSDeviceNull()); break; - } - - if(!s_gpu->Create(hWnd)) - { - GPUclose(); - - return -1; - } - - return 0; -} - -EXPORT_C_(int32) GPUconfigure() -{ -#ifdef _WINDOWS - - GPUSettingsDlg dlg; - - if(IDOK == dlg.DoModal()) - { - GPUshutdown(); - GPUinit(); - } - -#else - - // TODO: linux - -#endif - - return 0; -} - -EXPORT_C_(int32) GPUtest() -{ - return 0; -} - -EXPORT_C GPUabout() -{ - // TODO -} - -EXPORT_C GPUwriteDataMem(const uint8* mem, uint32 size) -{ - s_gpu->WriteData(mem, size); -} - -EXPORT_C GPUwriteData(uint32 data) -{ - s_gpu->WriteData((uint8*)&data, 1); -} - -EXPORT_C GPUreadDataMem(uint8* mem, uint32 size) -{ - s_gpu->ReadData(mem, size); -} - -EXPORT_C_(uint32) GPUreadData() -{ - uint32 data = 0; - - s_gpu->ReadData((uint8*)&data, 1); - - return data; -} - -EXPORT_C GPUwriteStatus(uint32 status) -{ - s_gpu->WriteStatus(status); -} - -EXPORT_C_(uint32) GPUreadStatus() -{ - return s_gpu->ReadStatus(); -} - -EXPORT_C_(uint32) GPUdmaChain(const uint8* mem, uint32 addr) -{ - uint32 last[3]; - - memset(last, 0xff, sizeof(last)); - - do - { - if(addr == last[1] || addr == last[2]) - { - break; - } - - (addr < last[0] ? last[1] : last[2]) = addr; - - last[0] = addr; - - uint8 size = mem[addr + 3]; - - if(size > 0) - { - s_gpu->WriteData(&mem[addr + 4], size); - } - - addr = *(uint32*)&mem[addr] & 0xffffff; - } - while(addr != 0xffffff); - - return 0; -} - -EXPORT_C_(uint32) GPUgetMode() -{ - // TODO - - return 0; -} - -EXPORT_C GPUsetMode(uint32 mode) -{ - // TODO -} - -EXPORT_C GPUupdateLace() -{ - s_gpu->VSync(); -} - -EXPORT_C GPUmakeSnapshot() -{ - s_gpu->MakeSnapshot("c:/"); // TODO -} - -EXPORT_C GPUdisplayText(char* text) -{ - // TODO -} - -EXPORT_C GPUdisplayFlags(uint32 flags) -{ - // TODO -} - -EXPORT_C_(int32) GPUfreeze(uint32 type, GPUFreezeData* data) -{ - if(!data || data->version != 1) - { - return 0; - } - - if(type == 0) - { - s_gpu->Defrost(data); - - return 1; - } - else if(type == 1) - { - s_gpu->Freeze(data); - - return 1; - } - else if(type == 2) - { - int slot = *(int*)data + 1; - - if(slot < 1 || slot > 9) - { - return 0; - } - - // TODO - - return 1; - } - - return 0; -} - -EXPORT_C GPUgetScreenPic(uint8* mem) -{ - // TODO -} - -EXPORT_C GPUshowScreenPic(uint8* mem) -{ - // TODO -} - -EXPORT_C GPUcursor(int player, int x, int y) -{ - // TODO -} +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "stdafx.h" +#include "GSdx.h" +#include "GSUtil.h" +#include "GPURendererSW.h" +#include "GSDeviceNull.h" + +#ifdef _WINDOWS + +#include "GPUSettingsDlg.h" +#include "GSDevice9.h" +#include "GSDevice11.h" + +static HRESULT s_hr = E_FAIL; + +#endif + +#define PSE_LT_GPU 2 + +static GPURenderer* s_gpu = NULL; + +EXPORT_C_(uint32) PSEgetLibType() +{ + return PSE_LT_GPU; +} + +EXPORT_C_(char*) PSEgetLibName() +{ + return GSUtil::GetLibName(); +} + +EXPORT_C_(uint32) PSEgetLibVersion() +{ + static const uint32 version = 1; + static const uint32 revision = 1; + + return version << 16 | revision << 8 | PLUGIN_VERSION; +} + +EXPORT_C_(int32) GPUinit() +{ + return 0; +} + +EXPORT_C_(int32) GPUshutdown() +{ + return 0; +} + +EXPORT_C_(int32) GPUclose() +{ + delete s_gpu; + + s_gpu = NULL; + +#ifdef _WINDOWS + + if(SUCCEEDED(s_hr)) + { + ::CoUninitialize(); + + s_hr = E_FAIL; + } + +#endif + + return 0; +} + +EXPORT_C_(int32) GPUopen(void* hWnd) +{ + GPUclose(); + + if(!GSUtil::CheckSSE()) + { + return -1; + } + +#ifdef _WINDOWS + + s_hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); + + if(!GSUtil::CheckDirectX()) + { + return -1; + } + +#endif + + int renderer = theApp.GetConfig("Renderer", 1); + int threads = theApp.GetConfig("swthreads", 1); + + switch(renderer) + { + default: + #ifdef _WINDOWS + case 0: s_gpu = new GPURendererSW(new GSDevice9(), threads); break; + case 1: s_gpu = new GPURendererSW(new GSDevice11(), threads); break; + #endif + case 2: s_gpu = new GPURendererSW(new GSDeviceNull(), threads); break; + //case 3: s_gpu = new GPURendererNull(new GSDeviceNull()); break; + } + + if(!s_gpu->Create(hWnd)) + { + GPUclose(); + + return -1; + } + + return 0; +} + +EXPORT_C_(int32) GPUconfigure() +{ +#ifdef _WINDOWS + + GPUSettingsDlg dlg; + + if(IDOK == dlg.DoModal()) + { + GPUshutdown(); + GPUinit(); + } + +#else + + // TODO: linux + +#endif + + return 0; +} + +EXPORT_C_(int32) GPUtest() +{ + return 0; +} + +EXPORT_C GPUabout() +{ + // TODO +} + +EXPORT_C GPUwriteDataMem(const uint8* mem, uint32 size) +{ + s_gpu->WriteData(mem, size); +} + +EXPORT_C GPUwriteData(uint32 data) +{ + s_gpu->WriteData((uint8*)&data, 1); +} + +EXPORT_C GPUreadDataMem(uint8* mem, uint32 size) +{ + s_gpu->ReadData(mem, size); +} + +EXPORT_C_(uint32) GPUreadData() +{ + uint32 data = 0; + + s_gpu->ReadData((uint8*)&data, 1); + + return data; +} + +EXPORT_C GPUwriteStatus(uint32 status) +{ + s_gpu->WriteStatus(status); +} + +EXPORT_C_(uint32) GPUreadStatus() +{ + return s_gpu->ReadStatus(); +} + +EXPORT_C_(uint32) GPUdmaChain(const uint8* mem, uint32 addr) +{ + uint32 last[3]; + + memset(last, 0xff, sizeof(last)); + + do + { + if(addr == last[1] || addr == last[2]) + { + break; + } + + (addr < last[0] ? last[1] : last[2]) = addr; + + last[0] = addr; + + uint8 size = mem[addr + 3]; + + if(size > 0) + { + s_gpu->WriteData(&mem[addr + 4], size); + } + + addr = *(uint32*)&mem[addr] & 0xffffff; + } + while(addr != 0xffffff); + + return 0; +} + +EXPORT_C_(uint32) GPUgetMode() +{ + // TODO + + return 0; +} + +EXPORT_C GPUsetMode(uint32 mode) +{ + // TODO +} + +EXPORT_C GPUupdateLace() +{ + s_gpu->VSync(); +} + +EXPORT_C GPUmakeSnapshot() +{ + s_gpu->MakeSnapshot("c:/"); // TODO +} + +EXPORT_C GPUdisplayText(char* text) +{ + // TODO +} + +EXPORT_C GPUdisplayFlags(uint32 flags) +{ + // TODO +} + +EXPORT_C_(int32) GPUfreeze(uint32 type, GPUFreezeData* data) +{ + if(!data || data->version != 1) + { + return 0; + } + + if(type == 0) + { + s_gpu->Defrost(data); + + return 1; + } + else if(type == 1) + { + s_gpu->Freeze(data); + + return 1; + } + else if(type == 2) + { + int slot = *(int*)data + 1; + + if(slot < 1 || slot > 9) + { + return 0; + } + + // TODO + + return 1; + } + + return 0; +} + +EXPORT_C GPUgetScreenPic(uint8* mem) +{ + // TODO +} + +EXPORT_C GPUshowScreenPic(uint8* mem) +{ + // TODO +} + +EXPORT_C GPUcursor(int player, int x, int y) +{ + // TODO +} diff --git a/plugins/GSdx/GPU.h b/plugins/GSdx/GPU.h index 457de2ba97..d1ec2d6a3e 100644 --- a/plugins/GSdx/GPU.h +++ b/plugins/GSdx/GPU.h @@ -1,276 +1,276 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#pragma pack(push, 1) - -#include "GS.h" - -enum -{ - GPU_POLYGON = 1, - GPU_LINE = 2, - GPU_SPRITE = 3, -}; - -REG32_(GPUReg, STATUS) - uint32 TX:4; - uint32 TY:1; - uint32 ABR:2; - uint32 TP:2; - uint32 DTD:1; - uint32 DFE:1; - uint32 MD:1; - uint32 ME:1; - uint32 _PAD0:3; - uint32 WIDTH1:1; - uint32 WIDTH0:2; - uint32 HEIGHT:1; - uint32 ISPAL:1; - uint32 ISRGB24:1; - uint32 ISINTER:1; - uint32 DEN:1; - uint32 _PAD1:2; - uint32 IDLE:1; - uint32 IMG:1; - uint32 COM:1; - uint32 DMA:2; - uint32 LCF:1; - /* - uint32 TX:4; - uint32 TY:1; - uint32 ABR:2; - uint32 TP:2; - uint32 DTD:1; - uint32 DFE:1; - uint32 PBW:1; - uint32 PBC:1; - uint32 _PAD0:3; - uint32 HRES2:1; - uint32 HRES1:2; - uint32 VRES:1; - uint32 ISPAL:1; - uint32 ISRGB24:1; - uint32 ISINTER:1; - uint32 ISSTOP:1; - uint32 _PAD1:1; - uint32 DMARDY:1; - uint32 IDIDLE:1; - uint32 DATARDY:1; - uint32 ISEMPTY:1; - uint32 TMODE:2; - uint32 ODE:1; - */ -REG_END - -REG32_(GPUReg, PACKET) - uint32 _PAD:24; - uint32 OPTION:5; - uint32 TYPE:3; -REG_END - -REG32_(GPUReg, PRIM) - uint32 VTX:24; - uint32 TGE:1; - uint32 ABE:1; - uint32 TME:1; - uint32 _PAD2:1; - uint32 IIP:1; - uint32 TYPE:3; -REG_END - -REG32_(GPUReg, POLYGON) - uint32 _PAD:24; - uint32 TGE:1; - uint32 ABE:1; - uint32 TME:1; - uint32 VTX:1; - uint32 IIP:1; - uint32 TYPE:3; -REG_END - -REG32_(GPUReg, LINE) - uint32 _PAD:24; - uint32 ZERO1:1; - uint32 ABE:1; - uint32 ZERO2:1; - uint32 PLL:1; - uint32 IIP:1; - uint32 TYPE:3; -REG_END - -REG32_(GPUReg, SPRITE) - uint32 _PAD:24; - uint32 ZERO:1; - uint32 ABE:1; - uint32 TME:1; - uint32 SIZE:2; - uint32 TYPE:3; -REG_END - -REG32_(GPUReg, RESET) - uint32 _PAD:32; -REG_END - -REG32_(GPUReg, DEN) - uint32 DEN:1; - uint32 _PAD:31; -REG_END - -REG32_(GPUReg, DMA) - uint32 DMA:2; - uint32 _PAD:30; -REG_END - -REG32_(GPUReg, DAREA) - uint32 X:10; - uint32 Y:9; - uint32 _PAD:13; -REG_END - -REG32_(GPUReg, DHRANGE) - uint32 X1:12; - uint32 X2:12; - uint32 _PAD:8; -REG_END - -REG32_(GPUReg, DVRANGE) - uint32 Y1:10; - uint32 Y2:11; - uint32 _PAD:11; -REG_END - -REG32_(GPUReg, DMODE) - uint32 WIDTH0:2; - uint32 HEIGHT:1; - uint32 ISPAL:1; - uint32 ISRGB24:1; - uint32 ISINTER:1; - uint32 WIDTH1:1; - uint32 REVERSE:1; - uint32 _PAD:24; -REG_END - -REG32_(GPUReg, GPUINFO) - uint32 PARAM:24; - uint32 _PAD:8; -REG_END - -REG32_(GPUReg, MODE) - uint32 TX:4; - uint32 TY:1; - uint32 ABR:2; - uint32 TP:2; - uint32 DTD:1; - uint32 DFE:1; - uint32 _PAD:21; -REG_END - -REG32_(GPUReg, MASK) - uint32 MD:1; - uint32 ME:1; - uint32 _PAD:30; -REG_END - -REG32_(GPUReg, DRAREA) - uint32 X:10; - uint32 Y:10; - uint32 _PAD:12; -REG_END - -REG32_(GPUReg, DROFF) - int32 X:11; - int32 Y:11; - int32 _PAD:10; -REG_END - -REG32_(GPUReg, RGB) - uint32 R:8; - uint32 G:8; - uint32 B:8; - uint32 _PAD:8; -REG_END - -REG32_(GPUReg, XY) - int32 X:11; - int32 _PAD1:5; - int32 Y:11; - int32 _PAD2:5; -REG_END - -REG32_(GPUReg, UV) - uint32 U:8; - uint32 V:8; - uint32 _PAD:16; -REG_END - -REG32_(GPUReg, TWIN) - uint32 TWW:5; - uint32 TWH:5; - uint32 TWX:5; - uint32 TWY:5; - uint32 _PAD:12; -REG_END - -REG32_(GPUReg, CLUT) - uint32 _PAD1:16; - uint32 X:6; - uint32 Y:9; - uint32 _PAD2:1; -REG_END - -REG32_SET(GPUReg) - GPURegSTATUS STATUS; - GPURegPACKET PACKET; - GPURegPRIM PRIM; - GPURegPOLYGON POLYGON; - GPURegLINE LINE; - GPURegSPRITE SPRITE; - GPURegRESET RESET; - GPURegDEN DEN; - GPURegDMA DMA; - GPURegDAREA DAREA; - GPURegDHRANGE DHRANGE; - GPURegDVRANGE DVRANGE; - GPURegDMODE DMODE; - GPURegGPUINFO GPUINFO; - GPURegMODE MODE; - GPURegMASK MASK; - GPURegDRAREA DRAREA; - GPURegDROFF DROFF; - GPURegRGB RGB; - GPURegXY XY; - GPURegUV UV; - GPURegTWIN TWIN; - GPURegCLUT CLUT; -REG_SET_END - -struct GPUFreezeData -{ - uint32 version; // == 1 - uint32 status; - uint32 control[256]; - uint16 vram[1024 * 1024]; -}; - -#pragma pack(pop) - +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#pragma pack(push, 1) + +#include "GS.h" + +enum +{ + GPU_POLYGON = 1, + GPU_LINE = 2, + GPU_SPRITE = 3, +}; + +REG32_(GPUReg, STATUS) + uint32 TX:4; + uint32 TY:1; + uint32 ABR:2; + uint32 TP:2; + uint32 DTD:1; + uint32 DFE:1; + uint32 MD:1; + uint32 ME:1; + uint32 _PAD0:3; + uint32 WIDTH1:1; + uint32 WIDTH0:2; + uint32 HEIGHT:1; + uint32 ISPAL:1; + uint32 ISRGB24:1; + uint32 ISINTER:1; + uint32 DEN:1; + uint32 _PAD1:2; + uint32 IDLE:1; + uint32 IMG:1; + uint32 COM:1; + uint32 DMA:2; + uint32 LCF:1; + /* + uint32 TX:4; + uint32 TY:1; + uint32 ABR:2; + uint32 TP:2; + uint32 DTD:1; + uint32 DFE:1; + uint32 PBW:1; + uint32 PBC:1; + uint32 _PAD0:3; + uint32 HRES2:1; + uint32 HRES1:2; + uint32 VRES:1; + uint32 ISPAL:1; + uint32 ISRGB24:1; + uint32 ISINTER:1; + uint32 ISSTOP:1; + uint32 _PAD1:1; + uint32 DMARDY:1; + uint32 IDIDLE:1; + uint32 DATARDY:1; + uint32 ISEMPTY:1; + uint32 TMODE:2; + uint32 ODE:1; + */ +REG_END + +REG32_(GPUReg, PACKET) + uint32 _PAD:24; + uint32 OPTION:5; + uint32 TYPE:3; +REG_END + +REG32_(GPUReg, PRIM) + uint32 VTX:24; + uint32 TGE:1; + uint32 ABE:1; + uint32 TME:1; + uint32 _PAD2:1; + uint32 IIP:1; + uint32 TYPE:3; +REG_END + +REG32_(GPUReg, POLYGON) + uint32 _PAD:24; + uint32 TGE:1; + uint32 ABE:1; + uint32 TME:1; + uint32 VTX:1; + uint32 IIP:1; + uint32 TYPE:3; +REG_END + +REG32_(GPUReg, LINE) + uint32 _PAD:24; + uint32 ZERO1:1; + uint32 ABE:1; + uint32 ZERO2:1; + uint32 PLL:1; + uint32 IIP:1; + uint32 TYPE:3; +REG_END + +REG32_(GPUReg, SPRITE) + uint32 _PAD:24; + uint32 ZERO:1; + uint32 ABE:1; + uint32 TME:1; + uint32 SIZE:2; + uint32 TYPE:3; +REG_END + +REG32_(GPUReg, RESET) + uint32 _PAD:32; +REG_END + +REG32_(GPUReg, DEN) + uint32 DEN:1; + uint32 _PAD:31; +REG_END + +REG32_(GPUReg, DMA) + uint32 DMA:2; + uint32 _PAD:30; +REG_END + +REG32_(GPUReg, DAREA) + uint32 X:10; + uint32 Y:9; + uint32 _PAD:13; +REG_END + +REG32_(GPUReg, DHRANGE) + uint32 X1:12; + uint32 X2:12; + uint32 _PAD:8; +REG_END + +REG32_(GPUReg, DVRANGE) + uint32 Y1:10; + uint32 Y2:11; + uint32 _PAD:11; +REG_END + +REG32_(GPUReg, DMODE) + uint32 WIDTH0:2; + uint32 HEIGHT:1; + uint32 ISPAL:1; + uint32 ISRGB24:1; + uint32 ISINTER:1; + uint32 WIDTH1:1; + uint32 REVERSE:1; + uint32 _PAD:24; +REG_END + +REG32_(GPUReg, GPUINFO) + uint32 PARAM:24; + uint32 _PAD:8; +REG_END + +REG32_(GPUReg, MODE) + uint32 TX:4; + uint32 TY:1; + uint32 ABR:2; + uint32 TP:2; + uint32 DTD:1; + uint32 DFE:1; + uint32 _PAD:21; +REG_END + +REG32_(GPUReg, MASK) + uint32 MD:1; + uint32 ME:1; + uint32 _PAD:30; +REG_END + +REG32_(GPUReg, DRAREA) + uint32 X:10; + uint32 Y:10; + uint32 _PAD:12; +REG_END + +REG32_(GPUReg, DROFF) + int32 X:11; + int32 Y:11; + int32 _PAD:10; +REG_END + +REG32_(GPUReg, RGB) + uint32 R:8; + uint32 G:8; + uint32 B:8; + uint32 _PAD:8; +REG_END + +REG32_(GPUReg, XY) + int32 X:11; + int32 _PAD1:5; + int32 Y:11; + int32 _PAD2:5; +REG_END + +REG32_(GPUReg, UV) + uint32 U:8; + uint32 V:8; + uint32 _PAD:16; +REG_END + +REG32_(GPUReg, TWIN) + uint32 TWW:5; + uint32 TWH:5; + uint32 TWX:5; + uint32 TWY:5; + uint32 _PAD:12; +REG_END + +REG32_(GPUReg, CLUT) + uint32 _PAD1:16; + uint32 X:6; + uint32 Y:9; + uint32 _PAD2:1; +REG_END + +REG32_SET(GPUReg) + GPURegSTATUS STATUS; + GPURegPACKET PACKET; + GPURegPRIM PRIM; + GPURegPOLYGON POLYGON; + GPURegLINE LINE; + GPURegSPRITE SPRITE; + GPURegRESET RESET; + GPURegDEN DEN; + GPURegDMA DMA; + GPURegDAREA DAREA; + GPURegDHRANGE DHRANGE; + GPURegDVRANGE DVRANGE; + GPURegDMODE DMODE; + GPURegGPUINFO GPUINFO; + GPURegMODE MODE; + GPURegMASK MASK; + GPURegDRAREA DRAREA; + GPURegDROFF DROFF; + GPURegRGB RGB; + GPURegXY XY; + GPURegUV UV; + GPURegTWIN TWIN; + GPURegCLUT CLUT; +REG_SET_END + +struct GPUFreezeData +{ + uint32 version; // == 1 + uint32 status; + uint32 control[256]; + uint16 vram[1024 * 1024]; +}; + +#pragma pack(pop) + diff --git a/plugins/GSdx/GPUDrawScanline.cpp b/plugins/GSdx/GPUDrawScanline.cpp index f25df7f1c7..fb233109cb 100644 --- a/plugins/GSdx/GPUDrawScanline.cpp +++ b/plugins/GSdx/GPUDrawScanline.cpp @@ -1,82 +1,82 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "GPUDrawScanline.h" - -GPUDrawScanline::GPUDrawScanline() - : m_sp_map("GPUSetupPrim", &m_local) - , m_ds_map("GPUDrawScanline", &m_local) -{ - memset(&m_local, 0, sizeof(m_local)); - - m_local.gd = &m_global; -} - -GPUDrawScanline::~GPUDrawScanline() -{ -} - -void GPUDrawScanline::BeginDraw(const void* param) -{ - memcpy(&m_global, param, sizeof(m_global)); - - if(m_global.sel.tme && m_global.sel.twin) - { - uint32 u, v; - - u = ~(m_global.twin.x << 3) & 0xff; // TWW - v = ~(m_global.twin.y << 3) & 0xff; // TWH - - m_local.twin[0].u = GSVector4i((u << 16) | u); - m_local.twin[0].v = GSVector4i((v << 16) | v); - - u = m_global.twin.z << 3; // TWX - v = m_global.twin.w << 3; // TWY - - m_local.twin[1].u = GSVector4i((u << 16) | u) & ~m_local.twin[0].u; - m_local.twin[1].v = GSVector4i((v << 16) | v) & ~m_local.twin[0].v; - } - - m_ds = m_ds_map[m_global.sel]; - - m_de = NULL; - - m_dr = NULL; // TODO - - // doesn't need all bits => less functions generated - - GPUScanlineSelector sel; - - sel.key = 0; - - sel.iip = m_global.sel.iip; - sel.tfx = m_global.sel.tfx; - sel.twin = m_global.sel.twin; - sel.sprite = m_global.sel.sprite; - - m_sp = m_sp_map[sel]; -} - -void GPUDrawScanline::EndDraw(const GSRasterizerStats& stats, uint64 frame) -{ - m_ds_map.UpdateStats(stats, frame); -} +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "stdafx.h" +#include "GPUDrawScanline.h" + +GPUDrawScanline::GPUDrawScanline() + : m_sp_map("GPUSetupPrim", &m_local) + , m_ds_map("GPUDrawScanline", &m_local) +{ + memset(&m_local, 0, sizeof(m_local)); + + m_local.gd = &m_global; +} + +GPUDrawScanline::~GPUDrawScanline() +{ +} + +void GPUDrawScanline::BeginDraw(const void* param) +{ + memcpy(&m_global, param, sizeof(m_global)); + + if(m_global.sel.tme && m_global.sel.twin) + { + uint32 u, v; + + u = ~(m_global.twin.x << 3) & 0xff; // TWW + v = ~(m_global.twin.y << 3) & 0xff; // TWH + + m_local.twin[0].u = GSVector4i((u << 16) | u); + m_local.twin[0].v = GSVector4i((v << 16) | v); + + u = m_global.twin.z << 3; // TWX + v = m_global.twin.w << 3; // TWY + + m_local.twin[1].u = GSVector4i((u << 16) | u) & ~m_local.twin[0].u; + m_local.twin[1].v = GSVector4i((v << 16) | v) & ~m_local.twin[0].v; + } + + m_ds = m_ds_map[m_global.sel]; + + m_de = NULL; + + m_dr = NULL; // TODO + + // doesn't need all bits => less functions generated + + GPUScanlineSelector sel; + + sel.key = 0; + + sel.iip = m_global.sel.iip; + sel.tfx = m_global.sel.tfx; + sel.twin = m_global.sel.twin; + sel.sprite = m_global.sel.sprite; + + m_sp = m_sp_map[sel]; +} + +void GPUDrawScanline::EndDraw(const GSRasterizerStats& stats, uint64 frame) +{ + m_ds_map.UpdateStats(stats, frame); +} diff --git a/plugins/GSdx/GPUDrawScanline.h b/plugins/GSdx/GPUDrawScanline.h index 3a6b743fcd..7c21a04cc8 100644 --- a/plugins/GSdx/GPUDrawScanline.h +++ b/plugins/GSdx/GPUDrawScanline.h @@ -1,47 +1,47 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "GPUState.h" -#include "GSRasterizer.h" -#include "GPUScanlineEnvironment.h" -#include "GPUSetupPrimCodeGenerator.h" -#include "GPUDrawScanlineCodeGenerator.h" - -class GPUDrawScanline : public IDrawScanline -{ - GPUScanlineGlobalData m_global; - GPUScanlineLocalData m_local; - - GSCodeGeneratorFunctionMap m_sp_map; - GSCodeGeneratorFunctionMap m_ds_map; - -public: - GPUDrawScanline(); - virtual ~GPUDrawScanline(); - - // IDrawScanline - - void BeginDraw(const void* param); - void EndDraw(const GSRasterizerStats& stats, uint64 frame); - void PrintStats() {m_ds_map.PrintStats();} -}; +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#include "GPUState.h" +#include "GSRasterizer.h" +#include "GPUScanlineEnvironment.h" +#include "GPUSetupPrimCodeGenerator.h" +#include "GPUDrawScanlineCodeGenerator.h" + +class GPUDrawScanline : public IDrawScanline +{ + GPUScanlineGlobalData m_global; + GPUScanlineLocalData m_local; + + GSCodeGeneratorFunctionMap m_sp_map; + GSCodeGeneratorFunctionMap m_ds_map; + +public: + GPUDrawScanline(); + virtual ~GPUDrawScanline(); + + // IDrawScanline + + void BeginDraw(const void* param); + void EndDraw(const GSRasterizerStats& stats, uint64 frame); + void PrintStats() {m_ds_map.PrintStats();} +}; diff --git a/plugins/GSdx/GPUDrawScanlineCodeGenerator.cpp b/plugins/GSdx/GPUDrawScanlineCodeGenerator.cpp index 79a72318b8..4bb5956a76 100644 --- a/plugins/GSdx/GPUDrawScanlineCodeGenerator.cpp +++ b/plugins/GSdx/GPUDrawScanlineCodeGenerator.cpp @@ -1,1030 +1,1030 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// TODO: x64 - -#include "stdafx.h" -#include "GPUDrawScanlineCodeGenerator.h" - -static const int _args = 8; -static const int _top = _args + 4; -static const int _v = _args + 8; - -GPUDrawScanlineCodeGenerator::GPUDrawScanlineCodeGenerator(void* param, uint32 key, void* code, size_t maxsize) - : GSCodeGenerator(code, maxsize) - , m_local(*(GPUScanlineLocalData*)param) -{ - #if _M_AMD64 - #error TODO - #endif - - m_sel.key = key; - - Generate(); -} - -void GPUDrawScanlineCodeGenerator::Generate() -{ - push(esi); - push(edi); - - Init(); - - align(16); - -L("loop"); - - // GSVector4i test = m_test[7 + (steps & (steps >> 31))]; - - mov(edx, ecx); - sar(edx, 31); - and(edx, ecx); - shl(edx, 4); - - movdqa(xmm7, ptr[edx + (size_t)&m_test[7]]); - - // movdqu(xmm1, ptr[edi]); - - movq(xmm1, qword[edi]); - movhps(xmm1, qword[edi + 8]); - - // ecx = steps - // esi = tex (tme) - // edi = fb - // xmm1 = fd - // xmm2 = s - // xmm3 = t - // xmm4 = r - // xmm5 = g - // xmm6 = b - // xmm7 = test - - TestMask(); - - SampleTexture(); - - // xmm1 = fd - // xmm3 = a - // xmm4 = r - // xmm5 = g - // xmm6 = b - // xmm7 = test - // xmm0, xmm2 = free - - ColorTFX(); - - AlphaBlend(); - - Dither(); - - WriteFrame(); - -L("step"); - - // if(steps <= 0) break; - - test(ecx, ecx); - jle("exit", T_NEAR); - - Step(); - - jmp("loop", T_NEAR); - -L("exit"); - - pop(edi); - pop(esi); - - ret(8); -} - -void GPUDrawScanlineCodeGenerator::Init() -{ - mov(eax, dword[esp + _top]); - - // uint16* fb = &m_local.vm[(top << (10 + m_sel.scalex)) + left]; - - mov(edi, eax); - shl(edi, 10 + m_sel.scalex); - add(edi, edx); - lea(edi, ptr[edi * 2 + (size_t)m_local.gd->vm]); - - // int steps = right - left - 8; - - sub(ecx, edx); - sub(ecx, 8); - - if(m_sel.dtd) - { - // dither = GSVector4i::load(&s_dither[top & 3][left & 3]); - - and(eax, 3); - shl(eax, 5); - and(edx, 3); - shl(edx, 1); - movdqu(xmm0, ptr[eax + edx + (size_t)m_dither]); - movdqa(ptr[&m_local.temp.dither], xmm0); - } - - mov(edx, dword[esp + _v]); - - if(m_sel.tme) - { - mov(esi, dword[&m_local.gd->tex]); - - // GSVector4i vt = GSVector4i(v.t).xxzzl(); - - cvttps2dq(xmm4, ptr[edx + 32]); - pshuflw(xmm4, xmm4, _MM_SHUFFLE(2, 2, 0, 0)); - - // s = vt.xxxx().add16(m_local.d.s); - // t = vt.yyyy().add16(m_local.d.t); - - pshufd(xmm2, xmm4, _MM_SHUFFLE(0, 0, 0, 0)); - pshufd(xmm3, xmm4, _MM_SHUFFLE(1, 1, 1, 1)); - - paddw(xmm2, ptr[&m_local.d.s]); - - if(!m_sel.sprite) - { - paddw(xmm3, ptr[&m_local.d.t]); - } - else - { - if(m_sel.ltf) - { - movdqa(xmm0, xmm3); - psllw(xmm0, 8); - psrlw(xmm0, 1); - movdqa(ptr[&m_local.temp.vf], xmm0); - } - } - - movdqa(ptr[&m_local.temp.s], xmm2); - movdqa(ptr[&m_local.temp.t], xmm3); - } - - if(m_sel.tfx != 3) // != decal - { - // GSVector4i vc = GSVector4i(v.c).xxzzlh(); - - cvttps2dq(xmm6, ptr[edx]); - pshuflw(xmm6, xmm6, _MM_SHUFFLE(2, 2, 0, 0)); - pshufhw(xmm6, xmm6, _MM_SHUFFLE(2, 2, 0, 0)); - - // r = vc.xxxx(); - // g = vc.yyyy(); - // b = vc.zzzz(); - - pshufd(xmm4, xmm6, _MM_SHUFFLE(0, 0, 0, 0)); - pshufd(xmm5, xmm6, _MM_SHUFFLE(1, 1, 1, 1)); - pshufd(xmm6, xmm6, _MM_SHUFFLE(2, 2, 2, 2)); - - if(m_sel.iip) - { - // r = r.add16(m_local.d.r); - // g = g.add16(m_local.d.g); - // b = b.add16(m_local.d.b); - - paddw(xmm4, ptr[&m_local.d.r]); - paddw(xmm5, ptr[&m_local.d.g]); - paddw(xmm6, ptr[&m_local.d.b]); - } - - movdqa(ptr[&m_local.temp.r], xmm4); - movdqa(ptr[&m_local.temp.g], xmm5); - movdqa(ptr[&m_local.temp.b], xmm6); - } -} - -void GPUDrawScanlineCodeGenerator::Step() -{ - // steps -= 8; - - sub(ecx, 8); - - // fb += 8; - - add(edi, 8 * sizeof(uint16)); - - if(m_sel.tme) - { - // GSVector4i st = m_local.d8.st; - - movdqa(xmm4, ptr[&m_local.d8.st]); - - // s = s.add16(st.xxxx()); - // t = t.add16(st.yyyy()); - - pshufd(xmm2, xmm4, _MM_SHUFFLE(0, 0, 0, 0)); - paddw(xmm2, ptr[&m_local.temp.s]); - movdqa(ptr[&m_local.temp.s], xmm2); - - // TODO: if(!sprite) ... else reload t - - pshufd(xmm3, xmm4, _MM_SHUFFLE(1, 1, 1, 1)); - paddw(xmm3, ptr[&m_local.temp.t]); - movdqa(ptr[&m_local.temp.t], xmm3); - } - - if(m_sel.tfx != 3) // != decal - { - if(m_sel.iip) - { - // GSVector4i c = m_local.d8.c; - - // r = r.add16(c.xxxx()); - // g = g.add16(c.yyyy()); - // b = b.add16(c.zzzz()); - - movdqa(xmm6, ptr[&m_local.d8.c]); - - pshufd(xmm4, xmm6, _MM_SHUFFLE(0, 0, 0, 0)); - pshufd(xmm5, xmm6, _MM_SHUFFLE(1, 1, 1, 1)); - pshufd(xmm6, xmm6, _MM_SHUFFLE(2, 2, 2, 2)); - - paddw(xmm4, ptr[&m_local.temp.r]); - paddw(xmm5, ptr[&m_local.temp.g]); - paddw(xmm6, ptr[&m_local.temp.b]); - - movdqa(ptr[&m_local.temp.r], xmm4); - movdqa(ptr[&m_local.temp.g], xmm5); - movdqa(ptr[&m_local.temp.b], xmm6); - } - else - { - movdqa(xmm4, ptr[&m_local.temp.r]); - movdqa(xmm5, ptr[&m_local.temp.g]); - movdqa(xmm6, ptr[&m_local.temp.b]); - } - } -} - -void GPUDrawScanlineCodeGenerator::TestMask() -{ - if(!m_sel.me) - { - return; - } - - // test |= fd.sra16(15); - - movdqa(xmm0, xmm1); - psraw(xmm0, 15); - por(xmm7, xmm0); - - alltrue(); -} - -void GPUDrawScanlineCodeGenerator::SampleTexture() -{ - if(!m_sel.tme) - { - return; - } - - // xmm2 = s - // xmm3 = t - // xmm7 = test - // xmm0, xmm4, xmm5, xmm6 = free - // xmm1 = used - - if(m_sel.ltf) - { - // GSVector4i u = s.sub16(GSVector4i(0x00200020)); // - 0.125f - // GSVector4i v = t.sub16(GSVector4i(0x00200020)); // - 0.125f - - mov(eax, 0x00200020); - movd(xmm0, eax); - pshufd(xmm0, xmm0, _MM_SHUFFLE(0, 0, 0, 0)); - - psubw(xmm2, xmm0); - psubw(xmm3, xmm0); - - // GSVector4i uf = (u & GSVector4i::x00ff()) << 7; - // GSVector4i vf = (v & GSVector4i::x00ff()) << 7; - - movdqa(xmm0, xmm2); - psllw(xmm0, 8); - psrlw(xmm0, 1); - movdqa(ptr[&m_local.temp.uf], xmm0); - - if(!m_sel.sprite) - { - movdqa(xmm0, xmm3); - psllw(xmm0, 8); - psrlw(xmm0, 1); - movdqa(ptr[&m_local.temp.vf], xmm0); - } - } - - // GSVector4i u0 = s.srl16(8); - // GSVector4i v0 = t.srl16(8); - - psrlw(xmm2, 8); - psrlw(xmm3, 8); - - // xmm2 = u - // xmm3 = v - // xmm7 = test - // xmm0, xmm4, xmm5, xmm6 = free - // xmm1 = used - - if(m_sel.ltf) - { - // GSVector4i u1 = u0.add16(GSVector4i::x0001()); - // GSVector4i v1 = v0.add16(GSVector4i::x0001()); - - movdqa(xmm4, xmm2); - movdqa(xmm5, xmm3); - - pcmpeqd(xmm0, xmm0); - psrlw(xmm0, 15); - paddw(xmm4, xmm0); - paddw(xmm5, xmm0); - - if(m_sel.twin) - { - // u0 = (u0 & m_local.twin[0].u).add16(m_local.twin[1].u); - // v0 = (v0 & m_local.twin[0].v).add16(m_local.twin[1].v); - // u1 = (u1 & m_local.twin[0].u).add16(m_local.twin[1].u); - // v1 = (v1 & m_local.twin[0].v).add16(m_local.twin[1].v); - - movdqa(xmm0, ptr[&m_local.twin[0].u]); - movdqa(xmm6, ptr[&m_local.twin[1].u]); - - pand(xmm2, xmm0); - paddw(xmm2, xmm6); - pand(xmm4, xmm0); - paddw(xmm4, xmm6); - - movdqa(xmm0, ptr[&m_local.twin[0].v]); - movdqa(xmm6, ptr[&m_local.twin[1].v]); - - pand(xmm3, xmm0); - paddw(xmm3, xmm6); - pand(xmm5, xmm0); - paddw(xmm5, xmm6); - } - else - { - // u0 = u0.min_i16(m_local.twin[2].u); - // v0 = v0.min_i16(m_local.twin[2].v); - // u1 = u1.min_i16(m_local.twin[2].u); - // v1 = v1.min_i16(m_local.twin[2].v); - - // TODO: if(!sprite) clamp16 else: - - movdqa(xmm0, ptr[&m_local.twin[2].u]); - movdqa(xmm6, ptr[&m_local.twin[2].v]); - - pminsw(xmm2, xmm0); - pminsw(xmm3, xmm6); - pminsw(xmm4, xmm0); - pminsw(xmm5, xmm6); - } - - // xmm2 = u0 - // xmm3 = v0 - // xmm4 = u1 - // xmm5 = v1 - // xmm7 = test - // xmm0, xmm6 = free - // xmm1 = used - - // GSVector4i addr00 = v0.sll16(8) | u0; - // GSVector4i addr01 = v0.sll16(8) | u1; - // GSVector4i addr10 = v1.sll16(8) | u0; - // GSVector4i addr11 = v1.sll16(8) | u1; - - psllw(xmm3, 8); - movdqa(xmm0, xmm3); - por(xmm3, xmm2); - por(xmm0, xmm4); - - psllw(xmm5, 8); - movdqa(xmm6, xmm5); - por(xmm5, xmm2); - por(xmm6, xmm4); - - // xmm3 = addr00 - // xmm0 = addr01 - // xmm5 = addr10 - // xmm6 = addr11 - // xmm7 = test - // xmm2, xmm4 = free - // xmm1 = used - - ReadTexel(xmm2, xmm3); - ReadTexel(xmm4, xmm0); - ReadTexel(xmm3, xmm5); - ReadTexel(xmm5, xmm6); - - // xmm2 = c00 - // xmm4 = c01 - // xmm3 = c10 - // xmm5 = c11 - // xmm7 = test - // xmm0, xmm6 = free - // xmm1 = used - - // spill (TODO) - - movdqa(ptr[&m_local.temp.fd], xmm1); - movdqa(ptr[&m_local.temp.test], xmm7); - - // xmm2 = c00 - // xmm4 = c01 - // xmm3 = c10 - // xmm5 = c11 - // xmm0, xmm1, xmm6, xmm7 = free - - movdqa(xmm1, xmm2); - psllw(xmm1, 11); - psrlw(xmm1, 8); - - movdqa(xmm0, xmm4); - psllw(xmm0, 11); - psrlw(xmm0, 8); - - lerp16<0>(xmm0, xmm1, ptr[&m_local.temp.uf]); - - movdqa(xmm6, xmm2); - psllw(xmm6, 6); - psrlw(xmm6, 11); - psllw(xmm6, 3); - - movdqa(xmm1, xmm4); - psllw(xmm1, 6); - psrlw(xmm1, 11); - psllw(xmm1, 3); - - lerp16<0>(xmm1, xmm6, ptr[&m_local.temp.uf]); - - movdqa(xmm7, xmm2); - psllw(xmm7, 1); - psrlw(xmm7, 11); - psllw(xmm7, 3); - - movdqa(xmm6, xmm4); - psllw(xmm6, 1); - psrlw(xmm6, 11); - psllw(xmm6, 3); - - lerp16<0>(xmm6, xmm7, ptr[&m_local.temp.uf]); - - psraw(xmm2, 15); - psrlw(xmm2, 8); - psraw(xmm4, 15); - psrlw(xmm4, 8); - - lerp16<0>(xmm4, xmm2, ptr[&m_local.temp.uf]); - - // xmm0 = r00 - // xmm1 = g00 - // xmm6 = b00 - // xmm4 = a00 - // xmm3 = c10 - // xmm5 = c11 - // xmm2, xmm7 = free - - movdqa(xmm7, xmm3); - psllw(xmm7, 11); - psrlw(xmm7, 8); - - movdqa(xmm2, xmm5); - psllw(xmm2, 11); - psrlw(xmm2, 8); - - lerp16<0>(xmm2, xmm7, ptr[&m_local.temp.uf]); - lerp16<0>(xmm2, xmm0, ptr[&m_local.temp.vf]); - - // xmm2 = r - // xmm1 = g00 - // xmm6 = b00 - // xmm4 = a00 - // xmm3 = c10 - // xmm5 = c11 - // xmm0, xmm7 = free - - movdqa(xmm7, xmm3); - psllw(xmm7, 6); - psrlw(xmm7, 11); - psllw(xmm7, 3); - - movdqa(xmm0, xmm5); - psllw(xmm0, 6); - psrlw(xmm0, 11); - psllw(xmm0, 3); - - lerp16<0>(xmm0, xmm7, ptr[&m_local.temp.uf]); - lerp16<0>(xmm0, xmm1, ptr[&m_local.temp.vf]); - - // xmm2 = r - // xmm0 = g - // xmm6 = b00 - // xmm4 = a00 - // xmm3 = c10 - // xmm5 = c11 - // xmm1, xmm7 = free - - movdqa(xmm7, xmm3); - psllw(xmm7, 1); - psrlw(xmm7, 11); - psllw(xmm7, 3); - - movdqa(xmm1, xmm5); - psllw(xmm1, 1); - psrlw(xmm1, 11); - psllw(xmm1, 3); - - lerp16<0>(xmm1, xmm7, ptr[&m_local.temp.uf]); - lerp16<0>(xmm1, xmm6, ptr[&m_local.temp.vf]); - - // xmm2 = r - // xmm0 = g - // xmm1 = b - // xmm4 = a00 - // xmm3 = c10 - // xmm5 = c11 - // xmm6, xmm7 = free - - psraw(xmm3, 15); - psrlw(xmm3, 8); - psraw(xmm5, 15); - psrlw(xmm5, 8); - - lerp16<0>(xmm5, xmm3, ptr[&m_local.temp.uf]); - lerp16<0>(xmm5, xmm4, ptr[&m_local.temp.vf]); - - // xmm2 = r - // xmm0 = g - // xmm1 = b - // xmm5 = a - // xmm3, xmm4, xmm6, xmm7 = free - - // TODO - movdqa(xmm3, xmm5); // a - movdqa(xmm4, xmm2); // r - movdqa(xmm6, xmm1); // b - movdqa(xmm5, xmm0); // g - - // reload test - - movdqa(xmm7, ptr[&m_local.temp.test]); - - // xmm4 = r - // xmm5 = g - // xmm6 = b - // xmm3 = a - // xmm7 = test - // xmm0, xmm1, xmm2 = free - - // test |= (c[0] | c[1] | c[2] | c[3]).eq16(GSVector4i::zero()); // mask out blank pixels (not perfect) - - movdqa(xmm1, xmm3); - por(xmm1, xmm4); - movdqa(xmm2, xmm5); - por(xmm2, xmm6); - por(xmm1, xmm2); - - pxor(xmm0, xmm0); - pcmpeqw(xmm1, xmm0); - por(xmm7, xmm1); - - // a = a.gt16(GSVector4i::zero()); - - pcmpgtw(xmm3, xmm0); - - // reload fd - - movdqa(xmm1, ptr[&m_local.temp.fd]); - } - else - { - if(m_sel.twin) - { - // u = (u & m_local.twin[0].u).add16(m_local.twin[1].u); - // v = (v & m_local.twin[0].v).add16(m_local.twin[1].v); - - pand(xmm2, ptr[&m_local.twin[0].u]); - paddw(xmm2, ptr[&m_local.twin[1].u]); - pand(xmm3, ptr[&m_local.twin[0].v]); - paddw(xmm3, ptr[&m_local.twin[1].v]); - } - else - { - // u = u.min_i16(m_local.twin[2].u); - // v = v.min_i16(m_local.twin[2].v); - - // TODO: if(!sprite) clamp16 else: - - pminsw(xmm2, ptr[&m_local.twin[2].u]); - pminsw(xmm3, ptr[&m_local.twin[2].v]); - } - - // xmm2 = u - // xmm3 = v - // xmm7 = test - // xmm0, xmm4, xmm5, xmm6 = free - // xmm1 = used - - // GSVector4i addr = v.sll16(8) | u; - - psllw(xmm3, 8); - por(xmm3, xmm2); - - // xmm3 = addr - // xmm7 = test - // xmm0, xmm2, xmm4, xmm5, xmm6 = free - // xmm1 = used - - ReadTexel(xmm6, xmm3); - - // xmm3 = c00 - // xmm7 = test - // xmm0, xmm2, xmm4, xmm5, xmm6 = free - // xmm1 = used - - // test |= c00.eq16(GSVector4i::zero()); // mask out blank pixels - - pxor(xmm0, xmm0); - pcmpeqw(xmm0, xmm6); - por(xmm7, xmm0); - - // c[0] = (c00 << 3) & 0x00f800f8; - // c[1] = (c00 >> 2) & 0x00f800f8; - // c[2] = (c00 >> 7) & 0x00f800f8; - // c[3] = c00.sra16(15); - - movdqa(xmm3, xmm6); - psraw(xmm3, 15); // a - - pcmpeqd(xmm0, xmm0); - psrlw(xmm0, 11); - psllw(xmm0, 3); // 0x00f8 - - movdqa(xmm4, xmm6); - psllw(xmm4, 3); - pand(xmm4, xmm0); // r - - movdqa(xmm5, xmm6); - psrlw(xmm5, 2); - pand(xmm5, xmm0); // g - - psrlw(xmm6, 7); - pand(xmm6, xmm0); // b - } -} - -void GPUDrawScanlineCodeGenerator::ColorTFX() -{ - switch(m_sel.tfx) - { - case 0: // none (tfx = 0) - case 1: // none (tfx = tge) - // c[0] = r.srl16(7); - // c[1] = g.srl16(7); - // c[2] = b.srl16(7); - psrlw(xmm4, 7); - psrlw(xmm5, 7); - psrlw(xmm6, 7); - break; - case 2: // modulate (tfx = tme | tge) - // c[0] = c[0].modulate16<1>(r).clamp8(); - // c[1] = c[1].modulate16<1>(g).clamp8(); - // c[2] = c[2].modulate16<1>(b).clamp8(); - pcmpeqd(xmm0, xmm0); - psrlw(xmm0, 8); - modulate16<1>(xmm4, ptr[&m_local.temp.r]); - pminsw(xmm4, xmm0); - modulate16<1>(xmm5, ptr[&m_local.temp.g]); - pminsw(xmm5, xmm0); - modulate16<1>(xmm6, ptr[&m_local.temp.b]); - pminsw(xmm6, xmm0); - break; - case 3: // decal (tfx = tme) - break; - } -} - -void GPUDrawScanlineCodeGenerator::AlphaBlend() -{ - if(!m_sel.abe) - { - return; - } - - // xmm1 = fd - // xmm3 = a - // xmm4 = r - // xmm5 = g - // xmm6 = b - // xmm7 = test - // xmm0, xmm2 = free - - // GSVector4i r = (d & 0x001f001f) << 3; - - pcmpeqd(xmm0, xmm0); - psrlw(xmm0, 11); // 0x001f - movdqa(xmm2, xmm1); - pand(xmm2, xmm0); - psllw(xmm2, 3); - - switch(m_sel.abr) - { - case 0: - // r = r.avg8(c[0]); - pavgb(xmm2, xmm4); - break; - case 1: - // r = r.addus8(c[0]); - paddusb(xmm2, xmm4); - break; - case 2: - // r = r.subus8(c[0]); - psubusb(xmm2, xmm4); - break; - case 3: - // r = r.addus8(c[0].srl16(2)); - movdqa(xmm0, xmm4); - psrlw(xmm0, 2); - paddusb(xmm2, xmm0); - break; - } - - if(m_sel.tme) - { - movdqa(xmm0, xmm3); - blend8(xmm4, xmm2); - } - else - { - movdqa(xmm4, xmm2); - } - - // GSVector4i g = (d & 0x03e003e0) >> 2; - - pcmpeqd(xmm0, xmm0); - psrlw(xmm0, 11); - psllw(xmm0, 5); // 0x03e0 - movdqa(xmm2, xmm1); - pand(xmm2, xmm0); - psrlw(xmm2, 2); - - switch(m_sel.abr) - { - case 0: - // g = g.avg8(c[2]); - pavgb(xmm2, xmm5); - break; - case 1: - // g = g.addus8(c[2]); - paddusb(xmm2, xmm5); - break; - case 2: - // g = g.subus8(c[2]); - psubusb(xmm2, xmm5); - break; - case 3: - // g = g.addus8(c[2].srl16(2)); - movdqa(xmm0, xmm5); - psrlw(xmm0, 2); - paddusb(xmm2, xmm0); - break; - } - - if(m_sel.tme) - { - movdqa(xmm0, xmm3); - blend8(xmm5, xmm2); - } - else - { - movdqa(xmm5, xmm2); - } - - // GSVector4i b = (d & 0x7c007c00) >> 7; - - pcmpeqd(xmm0, xmm0); - psrlw(xmm0, 11); - psllw(xmm0, 10); // 0x7c00 - movdqa(xmm2, xmm1); - pand(xmm2, xmm0); - psrlw(xmm2, 7); - - switch(m_sel.abr) - { - case 0: - // b = b.avg8(c[2]); - pavgb(xmm2, xmm6); - break; - case 1: - // b = b.addus8(c[2]); - paddusb(xmm2, xmm6); - break; - case 2: - // b = b.subus8(c[2]); - psubusb(xmm2, xmm6); - break; - case 3: - // b = b.addus8(c[2].srl16(2)); - movdqa(xmm0, xmm6); - psrlw(xmm0, 2); - paddusb(xmm2, xmm0); - break; - } - - if(m_sel.tme) - { - movdqa(xmm0, xmm3); - blend8(xmm6, xmm2); - } - else - { - movdqa(xmm6, xmm2); - } -} - -void GPUDrawScanlineCodeGenerator::Dither() -{ - if(!m_sel.dtd) - { - return; - } - - // c[0] = c[0].addus8(dither); - // c[1] = c[1].addus8(dither); - // c[2] = c[2].addus8(dither); - - movdqa(xmm0, ptr[&m_local.temp.dither]); - - paddusb(xmm4, xmm0); - paddusb(xmm5, xmm0); - paddusb(xmm6, xmm0); -} - -void GPUDrawScanlineCodeGenerator::WriteFrame() -{ - // GSVector4i fs = r | g | b | (m_sel.md ? GSVector4i(0x80008000) : m_sel.tme ? a : 0); - - pcmpeqd(xmm0, xmm0); - - if(m_sel.md || m_sel.tme) - { - movdqa(xmm2, xmm0); - psllw(xmm2, 15); - } - - psrlw(xmm0, 11); - psllw(xmm0, 3); - - // xmm0 = 0x00f8 - // xmm2 = 0x8000 (md) - - // GSVector4i r = (c[0] & 0x00f800f8) >> 3; - - pand(xmm4, xmm0); - psrlw(xmm4, 3); - - // GSVector4i g = (c[1] & 0x00f800f8) << 2; - - pand(xmm5, xmm0); - psllw(xmm5, 2); - por(xmm4, xmm5); - - // GSVector4i b = (c[2] & 0x00f800f8) << 7; - - pand(xmm6, xmm0); - psllw(xmm6, 7); - por(xmm4, xmm6); - - if(m_sel.md) - { - // GSVector4i a = GSVector4i(0x80008000); - - por(xmm4, xmm2); - } - else if(m_sel.tme) - { - // GSVector4i a = (c[3] << 8) & 0x80008000; - - psllw(xmm3, 8); - pand(xmm3, xmm2); - por(xmm4, xmm3); - } - - // fs = fs.blend8(fd, test); - - movdqa(xmm0, xmm7); - blend8(xmm4, xmm1); - - // GSVector4i::store(fb, fs); - - // movdqu(ptr[edi], xmm4); - - movq(qword[edi], xmm4); - movhps(qword[edi + 8], xmm4); -} - -void GPUDrawScanlineCodeGenerator::ReadTexel(const Xmm& dst, const Xmm& addr) -{ - for(int i = 0; i < 8; i++) - { - pextrw(eax, addr, (uint8)i); - - if(m_sel.tlu) movzx(eax, byte[esi + eax]); - - const Address& src = m_sel.tlu ? ptr[eax * 2 + (size_t)m_local.gd->clut] : ptr[esi + eax * 2]; - - if(i == 0) movd(dst, src); - else pinsrw(dst, src, (uint8)i); - } -} - -template -void GPUDrawScanlineCodeGenerator::modulate16(const Xmm& a, const Operand& f) -{ - if(shift == 0 && m_cpu.has(util::Cpu::tSSSE3)) - { - pmulhrsw(a, f); - } - else - { - psllw(a, shift + 1); - pmulhw(a, f); - } -} - -template -void GPUDrawScanlineCodeGenerator::lerp16(const Xmm& a, const Xmm& b, const Operand& f) -{ - psubw(a, b); - modulate16(a, f); - paddw(a, b); -} - -void GPUDrawScanlineCodeGenerator::alltrue() -{ - pmovmskb(eax, xmm7); - cmp(eax, 0xffff); - je("step", T_NEAR); -} - -void GPUDrawScanlineCodeGenerator::blend8(const Xmm& a, const Xmm& b) -{ - if(m_cpu.has(util::Cpu::tSSE41)) - { - pblendvb(a, b); - } - else - { - blend(a, b, xmm0); - } -} - -void GPUDrawScanlineCodeGenerator::blend(const Xmm& a, const Xmm& b, const Xmm& mask) -{ - pand(b, mask); - pandn(mask, a); - por(b, mask); - movdqa(a, b); -} - -const GSVector4i GPUDrawScanlineCodeGenerator::m_test[8] = -{ - GSVector4i(0xffff0000, 0xffffffff, 0xffffffff, 0xffffffff), - GSVector4i(0x00000000, 0xffffffff, 0xffffffff, 0xffffffff), - GSVector4i(0x00000000, 0xffff0000, 0xffffffff, 0xffffffff), - GSVector4i(0x00000000, 0x00000000, 0xffffffff, 0xffffffff), - GSVector4i(0x00000000, 0x00000000, 0xffff0000, 0xffffffff), - GSVector4i(0x00000000, 0x00000000, 0x00000000, 0xffffffff), - GSVector4i(0x00000000, 0x00000000, 0x00000000, 0xffff0000), - GSVector4i::zero(), -}; - -__aligned(const uint16, 32) 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}, - {1, 6, 0, 7, 1, 6, 0, 7, 1, 6, 0, 7, 1, 6, 0, 7}, - {4, 3, 5, 2, 4, 3, 5, 2, 4, 3, 5, 2, 4, 3, 5, 2}, -}; +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +// TODO: x64 + +#include "stdafx.h" +#include "GPUDrawScanlineCodeGenerator.h" + +static const int _args = 8; +static const int _top = _args + 4; +static const int _v = _args + 8; + +GPUDrawScanlineCodeGenerator::GPUDrawScanlineCodeGenerator(void* param, uint32 key, void* code, size_t maxsize) + : GSCodeGenerator(code, maxsize) + , m_local(*(GPUScanlineLocalData*)param) +{ + #if _M_AMD64 + #error TODO + #endif + + m_sel.key = key; + + Generate(); +} + +void GPUDrawScanlineCodeGenerator::Generate() +{ + push(esi); + push(edi); + + Init(); + + align(16); + +L("loop"); + + // GSVector4i test = m_test[7 + (steps & (steps >> 31))]; + + mov(edx, ecx); + sar(edx, 31); + and(edx, ecx); + shl(edx, 4); + + movdqa(xmm7, ptr[edx + (size_t)&m_test[7]]); + + // movdqu(xmm1, ptr[edi]); + + movq(xmm1, qword[edi]); + movhps(xmm1, qword[edi + 8]); + + // ecx = steps + // esi = tex (tme) + // edi = fb + // xmm1 = fd + // xmm2 = s + // xmm3 = t + // xmm4 = r + // xmm5 = g + // xmm6 = b + // xmm7 = test + + TestMask(); + + SampleTexture(); + + // xmm1 = fd + // xmm3 = a + // xmm4 = r + // xmm5 = g + // xmm6 = b + // xmm7 = test + // xmm0, xmm2 = free + + ColorTFX(); + + AlphaBlend(); + + Dither(); + + WriteFrame(); + +L("step"); + + // if(steps <= 0) break; + + test(ecx, ecx); + jle("exit", T_NEAR); + + Step(); + + jmp("loop", T_NEAR); + +L("exit"); + + pop(edi); + pop(esi); + + ret(8); +} + +void GPUDrawScanlineCodeGenerator::Init() +{ + mov(eax, dword[esp + _top]); + + // uint16* fb = &m_local.vm[(top << (10 + m_sel.scalex)) + left]; + + mov(edi, eax); + shl(edi, 10 + m_sel.scalex); + add(edi, edx); + lea(edi, ptr[edi * 2 + (size_t)m_local.gd->vm]); + + // int steps = right - left - 8; + + sub(ecx, edx); + sub(ecx, 8); + + if(m_sel.dtd) + { + // dither = GSVector4i::load(&s_dither[top & 3][left & 3]); + + and(eax, 3); + shl(eax, 5); + and(edx, 3); + shl(edx, 1); + movdqu(xmm0, ptr[eax + edx + (size_t)m_dither]); + movdqa(ptr[&m_local.temp.dither], xmm0); + } + + mov(edx, dword[esp + _v]); + + if(m_sel.tme) + { + mov(esi, dword[&m_local.gd->tex]); + + // GSVector4i vt = GSVector4i(v.t).xxzzl(); + + cvttps2dq(xmm4, ptr[edx + 32]); + pshuflw(xmm4, xmm4, _MM_SHUFFLE(2, 2, 0, 0)); + + // s = vt.xxxx().add16(m_local.d.s); + // t = vt.yyyy().add16(m_local.d.t); + + pshufd(xmm2, xmm4, _MM_SHUFFLE(0, 0, 0, 0)); + pshufd(xmm3, xmm4, _MM_SHUFFLE(1, 1, 1, 1)); + + paddw(xmm2, ptr[&m_local.d.s]); + + if(!m_sel.sprite) + { + paddw(xmm3, ptr[&m_local.d.t]); + } + else + { + if(m_sel.ltf) + { + movdqa(xmm0, xmm3); + psllw(xmm0, 8); + psrlw(xmm0, 1); + movdqa(ptr[&m_local.temp.vf], xmm0); + } + } + + movdqa(ptr[&m_local.temp.s], xmm2); + movdqa(ptr[&m_local.temp.t], xmm3); + } + + if(m_sel.tfx != 3) // != decal + { + // GSVector4i vc = GSVector4i(v.c).xxzzlh(); + + cvttps2dq(xmm6, ptr[edx]); + pshuflw(xmm6, xmm6, _MM_SHUFFLE(2, 2, 0, 0)); + pshufhw(xmm6, xmm6, _MM_SHUFFLE(2, 2, 0, 0)); + + // r = vc.xxxx(); + // g = vc.yyyy(); + // b = vc.zzzz(); + + pshufd(xmm4, xmm6, _MM_SHUFFLE(0, 0, 0, 0)); + pshufd(xmm5, xmm6, _MM_SHUFFLE(1, 1, 1, 1)); + pshufd(xmm6, xmm6, _MM_SHUFFLE(2, 2, 2, 2)); + + if(m_sel.iip) + { + // r = r.add16(m_local.d.r); + // g = g.add16(m_local.d.g); + // b = b.add16(m_local.d.b); + + paddw(xmm4, ptr[&m_local.d.r]); + paddw(xmm5, ptr[&m_local.d.g]); + paddw(xmm6, ptr[&m_local.d.b]); + } + + movdqa(ptr[&m_local.temp.r], xmm4); + movdqa(ptr[&m_local.temp.g], xmm5); + movdqa(ptr[&m_local.temp.b], xmm6); + } +} + +void GPUDrawScanlineCodeGenerator::Step() +{ + // steps -= 8; + + sub(ecx, 8); + + // fb += 8; + + add(edi, 8 * sizeof(uint16)); + + if(m_sel.tme) + { + // GSVector4i st = m_local.d8.st; + + movdqa(xmm4, ptr[&m_local.d8.st]); + + // s = s.add16(st.xxxx()); + // t = t.add16(st.yyyy()); + + pshufd(xmm2, xmm4, _MM_SHUFFLE(0, 0, 0, 0)); + paddw(xmm2, ptr[&m_local.temp.s]); + movdqa(ptr[&m_local.temp.s], xmm2); + + // TODO: if(!sprite) ... else reload t + + pshufd(xmm3, xmm4, _MM_SHUFFLE(1, 1, 1, 1)); + paddw(xmm3, ptr[&m_local.temp.t]); + movdqa(ptr[&m_local.temp.t], xmm3); + } + + if(m_sel.tfx != 3) // != decal + { + if(m_sel.iip) + { + // GSVector4i c = m_local.d8.c; + + // r = r.add16(c.xxxx()); + // g = g.add16(c.yyyy()); + // b = b.add16(c.zzzz()); + + movdqa(xmm6, ptr[&m_local.d8.c]); + + pshufd(xmm4, xmm6, _MM_SHUFFLE(0, 0, 0, 0)); + pshufd(xmm5, xmm6, _MM_SHUFFLE(1, 1, 1, 1)); + pshufd(xmm6, xmm6, _MM_SHUFFLE(2, 2, 2, 2)); + + paddw(xmm4, ptr[&m_local.temp.r]); + paddw(xmm5, ptr[&m_local.temp.g]); + paddw(xmm6, ptr[&m_local.temp.b]); + + movdqa(ptr[&m_local.temp.r], xmm4); + movdqa(ptr[&m_local.temp.g], xmm5); + movdqa(ptr[&m_local.temp.b], xmm6); + } + else + { + movdqa(xmm4, ptr[&m_local.temp.r]); + movdqa(xmm5, ptr[&m_local.temp.g]); + movdqa(xmm6, ptr[&m_local.temp.b]); + } + } +} + +void GPUDrawScanlineCodeGenerator::TestMask() +{ + if(!m_sel.me) + { + return; + } + + // test |= fd.sra16(15); + + movdqa(xmm0, xmm1); + psraw(xmm0, 15); + por(xmm7, xmm0); + + alltrue(); +} + +void GPUDrawScanlineCodeGenerator::SampleTexture() +{ + if(!m_sel.tme) + { + return; + } + + // xmm2 = s + // xmm3 = t + // xmm7 = test + // xmm0, xmm4, xmm5, xmm6 = free + // xmm1 = used + + if(m_sel.ltf) + { + // GSVector4i u = s.sub16(GSVector4i(0x00200020)); // - 0.125f + // GSVector4i v = t.sub16(GSVector4i(0x00200020)); // - 0.125f + + mov(eax, 0x00200020); + movd(xmm0, eax); + pshufd(xmm0, xmm0, _MM_SHUFFLE(0, 0, 0, 0)); + + psubw(xmm2, xmm0); + psubw(xmm3, xmm0); + + // GSVector4i uf = (u & GSVector4i::x00ff()) << 7; + // GSVector4i vf = (v & GSVector4i::x00ff()) << 7; + + movdqa(xmm0, xmm2); + psllw(xmm0, 8); + psrlw(xmm0, 1); + movdqa(ptr[&m_local.temp.uf], xmm0); + + if(!m_sel.sprite) + { + movdqa(xmm0, xmm3); + psllw(xmm0, 8); + psrlw(xmm0, 1); + movdqa(ptr[&m_local.temp.vf], xmm0); + } + } + + // GSVector4i u0 = s.srl16(8); + // GSVector4i v0 = t.srl16(8); + + psrlw(xmm2, 8); + psrlw(xmm3, 8); + + // xmm2 = u + // xmm3 = v + // xmm7 = test + // xmm0, xmm4, xmm5, xmm6 = free + // xmm1 = used + + if(m_sel.ltf) + { + // GSVector4i u1 = u0.add16(GSVector4i::x0001()); + // GSVector4i v1 = v0.add16(GSVector4i::x0001()); + + movdqa(xmm4, xmm2); + movdqa(xmm5, xmm3); + + pcmpeqd(xmm0, xmm0); + psrlw(xmm0, 15); + paddw(xmm4, xmm0); + paddw(xmm5, xmm0); + + if(m_sel.twin) + { + // u0 = (u0 & m_local.twin[0].u).add16(m_local.twin[1].u); + // v0 = (v0 & m_local.twin[0].v).add16(m_local.twin[1].v); + // u1 = (u1 & m_local.twin[0].u).add16(m_local.twin[1].u); + // v1 = (v1 & m_local.twin[0].v).add16(m_local.twin[1].v); + + movdqa(xmm0, ptr[&m_local.twin[0].u]); + movdqa(xmm6, ptr[&m_local.twin[1].u]); + + pand(xmm2, xmm0); + paddw(xmm2, xmm6); + pand(xmm4, xmm0); + paddw(xmm4, xmm6); + + movdqa(xmm0, ptr[&m_local.twin[0].v]); + movdqa(xmm6, ptr[&m_local.twin[1].v]); + + pand(xmm3, xmm0); + paddw(xmm3, xmm6); + pand(xmm5, xmm0); + paddw(xmm5, xmm6); + } + else + { + // u0 = u0.min_i16(m_local.twin[2].u); + // v0 = v0.min_i16(m_local.twin[2].v); + // u1 = u1.min_i16(m_local.twin[2].u); + // v1 = v1.min_i16(m_local.twin[2].v); + + // TODO: if(!sprite) clamp16 else: + + movdqa(xmm0, ptr[&m_local.twin[2].u]); + movdqa(xmm6, ptr[&m_local.twin[2].v]); + + pminsw(xmm2, xmm0); + pminsw(xmm3, xmm6); + pminsw(xmm4, xmm0); + pminsw(xmm5, xmm6); + } + + // xmm2 = u0 + // xmm3 = v0 + // xmm4 = u1 + // xmm5 = v1 + // xmm7 = test + // xmm0, xmm6 = free + // xmm1 = used + + // GSVector4i addr00 = v0.sll16(8) | u0; + // GSVector4i addr01 = v0.sll16(8) | u1; + // GSVector4i addr10 = v1.sll16(8) | u0; + // GSVector4i addr11 = v1.sll16(8) | u1; + + psllw(xmm3, 8); + movdqa(xmm0, xmm3); + por(xmm3, xmm2); + por(xmm0, xmm4); + + psllw(xmm5, 8); + movdqa(xmm6, xmm5); + por(xmm5, xmm2); + por(xmm6, xmm4); + + // xmm3 = addr00 + // xmm0 = addr01 + // xmm5 = addr10 + // xmm6 = addr11 + // xmm7 = test + // xmm2, xmm4 = free + // xmm1 = used + + ReadTexel(xmm2, xmm3); + ReadTexel(xmm4, xmm0); + ReadTexel(xmm3, xmm5); + ReadTexel(xmm5, xmm6); + + // xmm2 = c00 + // xmm4 = c01 + // xmm3 = c10 + // xmm5 = c11 + // xmm7 = test + // xmm0, xmm6 = free + // xmm1 = used + + // spill (TODO) + + movdqa(ptr[&m_local.temp.fd], xmm1); + movdqa(ptr[&m_local.temp.test], xmm7); + + // xmm2 = c00 + // xmm4 = c01 + // xmm3 = c10 + // xmm5 = c11 + // xmm0, xmm1, xmm6, xmm7 = free + + movdqa(xmm1, xmm2); + psllw(xmm1, 11); + psrlw(xmm1, 8); + + movdqa(xmm0, xmm4); + psllw(xmm0, 11); + psrlw(xmm0, 8); + + lerp16<0>(xmm0, xmm1, ptr[&m_local.temp.uf]); + + movdqa(xmm6, xmm2); + psllw(xmm6, 6); + psrlw(xmm6, 11); + psllw(xmm6, 3); + + movdqa(xmm1, xmm4); + psllw(xmm1, 6); + psrlw(xmm1, 11); + psllw(xmm1, 3); + + lerp16<0>(xmm1, xmm6, ptr[&m_local.temp.uf]); + + movdqa(xmm7, xmm2); + psllw(xmm7, 1); + psrlw(xmm7, 11); + psllw(xmm7, 3); + + movdqa(xmm6, xmm4); + psllw(xmm6, 1); + psrlw(xmm6, 11); + psllw(xmm6, 3); + + lerp16<0>(xmm6, xmm7, ptr[&m_local.temp.uf]); + + psraw(xmm2, 15); + psrlw(xmm2, 8); + psraw(xmm4, 15); + psrlw(xmm4, 8); + + lerp16<0>(xmm4, xmm2, ptr[&m_local.temp.uf]); + + // xmm0 = r00 + // xmm1 = g00 + // xmm6 = b00 + // xmm4 = a00 + // xmm3 = c10 + // xmm5 = c11 + // xmm2, xmm7 = free + + movdqa(xmm7, xmm3); + psllw(xmm7, 11); + psrlw(xmm7, 8); + + movdqa(xmm2, xmm5); + psllw(xmm2, 11); + psrlw(xmm2, 8); + + lerp16<0>(xmm2, xmm7, ptr[&m_local.temp.uf]); + lerp16<0>(xmm2, xmm0, ptr[&m_local.temp.vf]); + + // xmm2 = r + // xmm1 = g00 + // xmm6 = b00 + // xmm4 = a00 + // xmm3 = c10 + // xmm5 = c11 + // xmm0, xmm7 = free + + movdqa(xmm7, xmm3); + psllw(xmm7, 6); + psrlw(xmm7, 11); + psllw(xmm7, 3); + + movdqa(xmm0, xmm5); + psllw(xmm0, 6); + psrlw(xmm0, 11); + psllw(xmm0, 3); + + lerp16<0>(xmm0, xmm7, ptr[&m_local.temp.uf]); + lerp16<0>(xmm0, xmm1, ptr[&m_local.temp.vf]); + + // xmm2 = r + // xmm0 = g + // xmm6 = b00 + // xmm4 = a00 + // xmm3 = c10 + // xmm5 = c11 + // xmm1, xmm7 = free + + movdqa(xmm7, xmm3); + psllw(xmm7, 1); + psrlw(xmm7, 11); + psllw(xmm7, 3); + + movdqa(xmm1, xmm5); + psllw(xmm1, 1); + psrlw(xmm1, 11); + psllw(xmm1, 3); + + lerp16<0>(xmm1, xmm7, ptr[&m_local.temp.uf]); + lerp16<0>(xmm1, xmm6, ptr[&m_local.temp.vf]); + + // xmm2 = r + // xmm0 = g + // xmm1 = b + // xmm4 = a00 + // xmm3 = c10 + // xmm5 = c11 + // xmm6, xmm7 = free + + psraw(xmm3, 15); + psrlw(xmm3, 8); + psraw(xmm5, 15); + psrlw(xmm5, 8); + + lerp16<0>(xmm5, xmm3, ptr[&m_local.temp.uf]); + lerp16<0>(xmm5, xmm4, ptr[&m_local.temp.vf]); + + // xmm2 = r + // xmm0 = g + // xmm1 = b + // xmm5 = a + // xmm3, xmm4, xmm6, xmm7 = free + + // TODO + movdqa(xmm3, xmm5); // a + movdqa(xmm4, xmm2); // r + movdqa(xmm6, xmm1); // b + movdqa(xmm5, xmm0); // g + + // reload test + + movdqa(xmm7, ptr[&m_local.temp.test]); + + // xmm4 = r + // xmm5 = g + // xmm6 = b + // xmm3 = a + // xmm7 = test + // xmm0, xmm1, xmm2 = free + + // test |= (c[0] | c[1] | c[2] | c[3]).eq16(GSVector4i::zero()); // mask out blank pixels (not perfect) + + movdqa(xmm1, xmm3); + por(xmm1, xmm4); + movdqa(xmm2, xmm5); + por(xmm2, xmm6); + por(xmm1, xmm2); + + pxor(xmm0, xmm0); + pcmpeqw(xmm1, xmm0); + por(xmm7, xmm1); + + // a = a.gt16(GSVector4i::zero()); + + pcmpgtw(xmm3, xmm0); + + // reload fd + + movdqa(xmm1, ptr[&m_local.temp.fd]); + } + else + { + if(m_sel.twin) + { + // u = (u & m_local.twin[0].u).add16(m_local.twin[1].u); + // v = (v & m_local.twin[0].v).add16(m_local.twin[1].v); + + pand(xmm2, ptr[&m_local.twin[0].u]); + paddw(xmm2, ptr[&m_local.twin[1].u]); + pand(xmm3, ptr[&m_local.twin[0].v]); + paddw(xmm3, ptr[&m_local.twin[1].v]); + } + else + { + // u = u.min_i16(m_local.twin[2].u); + // v = v.min_i16(m_local.twin[2].v); + + // TODO: if(!sprite) clamp16 else: + + pminsw(xmm2, ptr[&m_local.twin[2].u]); + pminsw(xmm3, ptr[&m_local.twin[2].v]); + } + + // xmm2 = u + // xmm3 = v + // xmm7 = test + // xmm0, xmm4, xmm5, xmm6 = free + // xmm1 = used + + // GSVector4i addr = v.sll16(8) | u; + + psllw(xmm3, 8); + por(xmm3, xmm2); + + // xmm3 = addr + // xmm7 = test + // xmm0, xmm2, xmm4, xmm5, xmm6 = free + // xmm1 = used + + ReadTexel(xmm6, xmm3); + + // xmm3 = c00 + // xmm7 = test + // xmm0, xmm2, xmm4, xmm5, xmm6 = free + // xmm1 = used + + // test |= c00.eq16(GSVector4i::zero()); // mask out blank pixels + + pxor(xmm0, xmm0); + pcmpeqw(xmm0, xmm6); + por(xmm7, xmm0); + + // c[0] = (c00 << 3) & 0x00f800f8; + // c[1] = (c00 >> 2) & 0x00f800f8; + // c[2] = (c00 >> 7) & 0x00f800f8; + // c[3] = c00.sra16(15); + + movdqa(xmm3, xmm6); + psraw(xmm3, 15); // a + + pcmpeqd(xmm0, xmm0); + psrlw(xmm0, 11); + psllw(xmm0, 3); // 0x00f8 + + movdqa(xmm4, xmm6); + psllw(xmm4, 3); + pand(xmm4, xmm0); // r + + movdqa(xmm5, xmm6); + psrlw(xmm5, 2); + pand(xmm5, xmm0); // g + + psrlw(xmm6, 7); + pand(xmm6, xmm0); // b + } +} + +void GPUDrawScanlineCodeGenerator::ColorTFX() +{ + switch(m_sel.tfx) + { + case 0: // none (tfx = 0) + case 1: // none (tfx = tge) + // c[0] = r.srl16(7); + // c[1] = g.srl16(7); + // c[2] = b.srl16(7); + psrlw(xmm4, 7); + psrlw(xmm5, 7); + psrlw(xmm6, 7); + break; + case 2: // modulate (tfx = tme | tge) + // c[0] = c[0].modulate16<1>(r).clamp8(); + // c[1] = c[1].modulate16<1>(g).clamp8(); + // c[2] = c[2].modulate16<1>(b).clamp8(); + pcmpeqd(xmm0, xmm0); + psrlw(xmm0, 8); + modulate16<1>(xmm4, ptr[&m_local.temp.r]); + pminsw(xmm4, xmm0); + modulate16<1>(xmm5, ptr[&m_local.temp.g]); + pminsw(xmm5, xmm0); + modulate16<1>(xmm6, ptr[&m_local.temp.b]); + pminsw(xmm6, xmm0); + break; + case 3: // decal (tfx = tme) + break; + } +} + +void GPUDrawScanlineCodeGenerator::AlphaBlend() +{ + if(!m_sel.abe) + { + return; + } + + // xmm1 = fd + // xmm3 = a + // xmm4 = r + // xmm5 = g + // xmm6 = b + // xmm7 = test + // xmm0, xmm2 = free + + // GSVector4i r = (d & 0x001f001f) << 3; + + pcmpeqd(xmm0, xmm0); + psrlw(xmm0, 11); // 0x001f + movdqa(xmm2, xmm1); + pand(xmm2, xmm0); + psllw(xmm2, 3); + + switch(m_sel.abr) + { + case 0: + // r = r.avg8(c[0]); + pavgb(xmm2, xmm4); + break; + case 1: + // r = r.addus8(c[0]); + paddusb(xmm2, xmm4); + break; + case 2: + // r = r.subus8(c[0]); + psubusb(xmm2, xmm4); + break; + case 3: + // r = r.addus8(c[0].srl16(2)); + movdqa(xmm0, xmm4); + psrlw(xmm0, 2); + paddusb(xmm2, xmm0); + break; + } + + if(m_sel.tme) + { + movdqa(xmm0, xmm3); + blend8(xmm4, xmm2); + } + else + { + movdqa(xmm4, xmm2); + } + + // GSVector4i g = (d & 0x03e003e0) >> 2; + + pcmpeqd(xmm0, xmm0); + psrlw(xmm0, 11); + psllw(xmm0, 5); // 0x03e0 + movdqa(xmm2, xmm1); + pand(xmm2, xmm0); + psrlw(xmm2, 2); + + switch(m_sel.abr) + { + case 0: + // g = g.avg8(c[2]); + pavgb(xmm2, xmm5); + break; + case 1: + // g = g.addus8(c[2]); + paddusb(xmm2, xmm5); + break; + case 2: + // g = g.subus8(c[2]); + psubusb(xmm2, xmm5); + break; + case 3: + // g = g.addus8(c[2].srl16(2)); + movdqa(xmm0, xmm5); + psrlw(xmm0, 2); + paddusb(xmm2, xmm0); + break; + } + + if(m_sel.tme) + { + movdqa(xmm0, xmm3); + blend8(xmm5, xmm2); + } + else + { + movdqa(xmm5, xmm2); + } + + // GSVector4i b = (d & 0x7c007c00) >> 7; + + pcmpeqd(xmm0, xmm0); + psrlw(xmm0, 11); + psllw(xmm0, 10); // 0x7c00 + movdqa(xmm2, xmm1); + pand(xmm2, xmm0); + psrlw(xmm2, 7); + + switch(m_sel.abr) + { + case 0: + // b = b.avg8(c[2]); + pavgb(xmm2, xmm6); + break; + case 1: + // b = b.addus8(c[2]); + paddusb(xmm2, xmm6); + break; + case 2: + // b = b.subus8(c[2]); + psubusb(xmm2, xmm6); + break; + case 3: + // b = b.addus8(c[2].srl16(2)); + movdqa(xmm0, xmm6); + psrlw(xmm0, 2); + paddusb(xmm2, xmm0); + break; + } + + if(m_sel.tme) + { + movdqa(xmm0, xmm3); + blend8(xmm6, xmm2); + } + else + { + movdqa(xmm6, xmm2); + } +} + +void GPUDrawScanlineCodeGenerator::Dither() +{ + if(!m_sel.dtd) + { + return; + } + + // c[0] = c[0].addus8(dither); + // c[1] = c[1].addus8(dither); + // c[2] = c[2].addus8(dither); + + movdqa(xmm0, ptr[&m_local.temp.dither]); + + paddusb(xmm4, xmm0); + paddusb(xmm5, xmm0); + paddusb(xmm6, xmm0); +} + +void GPUDrawScanlineCodeGenerator::WriteFrame() +{ + // GSVector4i fs = r | g | b | (m_sel.md ? GSVector4i(0x80008000) : m_sel.tme ? a : 0); + + pcmpeqd(xmm0, xmm0); + + if(m_sel.md || m_sel.tme) + { + movdqa(xmm2, xmm0); + psllw(xmm2, 15); + } + + psrlw(xmm0, 11); + psllw(xmm0, 3); + + // xmm0 = 0x00f8 + // xmm2 = 0x8000 (md) + + // GSVector4i r = (c[0] & 0x00f800f8) >> 3; + + pand(xmm4, xmm0); + psrlw(xmm4, 3); + + // GSVector4i g = (c[1] & 0x00f800f8) << 2; + + pand(xmm5, xmm0); + psllw(xmm5, 2); + por(xmm4, xmm5); + + // GSVector4i b = (c[2] & 0x00f800f8) << 7; + + pand(xmm6, xmm0); + psllw(xmm6, 7); + por(xmm4, xmm6); + + if(m_sel.md) + { + // GSVector4i a = GSVector4i(0x80008000); + + por(xmm4, xmm2); + } + else if(m_sel.tme) + { + // GSVector4i a = (c[3] << 8) & 0x80008000; + + psllw(xmm3, 8); + pand(xmm3, xmm2); + por(xmm4, xmm3); + } + + // fs = fs.blend8(fd, test); + + movdqa(xmm0, xmm7); + blend8(xmm4, xmm1); + + // GSVector4i::store(fb, fs); + + // movdqu(ptr[edi], xmm4); + + movq(qword[edi], xmm4); + movhps(qword[edi + 8], xmm4); +} + +void GPUDrawScanlineCodeGenerator::ReadTexel(const Xmm& dst, const Xmm& addr) +{ + for(int i = 0; i < 8; i++) + { + pextrw(eax, addr, (uint8)i); + + if(m_sel.tlu) movzx(eax, byte[esi + eax]); + + const Address& src = m_sel.tlu ? ptr[eax * 2 + (size_t)m_local.gd->clut] : ptr[esi + eax * 2]; + + if(i == 0) movd(dst, src); + else pinsrw(dst, src, (uint8)i); + } +} + +template +void GPUDrawScanlineCodeGenerator::modulate16(const Xmm& a, const Operand& f) +{ + if(shift == 0 && m_cpu.has(util::Cpu::tSSSE3)) + { + pmulhrsw(a, f); + } + else + { + psllw(a, shift + 1); + pmulhw(a, f); + } +} + +template +void GPUDrawScanlineCodeGenerator::lerp16(const Xmm& a, const Xmm& b, const Operand& f) +{ + psubw(a, b); + modulate16(a, f); + paddw(a, b); +} + +void GPUDrawScanlineCodeGenerator::alltrue() +{ + pmovmskb(eax, xmm7); + cmp(eax, 0xffff); + je("step", T_NEAR); +} + +void GPUDrawScanlineCodeGenerator::blend8(const Xmm& a, const Xmm& b) +{ + if(m_cpu.has(util::Cpu::tSSE41)) + { + pblendvb(a, b); + } + else + { + blend(a, b, xmm0); + } +} + +void GPUDrawScanlineCodeGenerator::blend(const Xmm& a, const Xmm& b, const Xmm& mask) +{ + pand(b, mask); + pandn(mask, a); + por(b, mask); + movdqa(a, b); +} + +const GSVector4i GPUDrawScanlineCodeGenerator::m_test[8] = +{ + GSVector4i(0xffff0000, 0xffffffff, 0xffffffff, 0xffffffff), + GSVector4i(0x00000000, 0xffffffff, 0xffffffff, 0xffffffff), + GSVector4i(0x00000000, 0xffff0000, 0xffffffff, 0xffffffff), + GSVector4i(0x00000000, 0x00000000, 0xffffffff, 0xffffffff), + GSVector4i(0x00000000, 0x00000000, 0xffff0000, 0xffffffff), + GSVector4i(0x00000000, 0x00000000, 0x00000000, 0xffffffff), + GSVector4i(0x00000000, 0x00000000, 0x00000000, 0xffff0000), + GSVector4i::zero(), +}; + +__aligned(const uint16, 32) 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}, + {1, 6, 0, 7, 1, 6, 0, 7, 1, 6, 0, 7, 1, 6, 0, 7}, + {4, 3, 5, 2, 4, 3, 5, 2, 4, 3, 5, 2, 4, 3, 5, 2}, +}; diff --git a/plugins/GSdx/GPUDrawScanlineCodeGenerator.h b/plugins/GSdx/GPUDrawScanlineCodeGenerator.h index 2cc38de374..8705d5057d 100644 --- a/plugins/GSdx/GPUDrawScanlineCodeGenerator.h +++ b/plugins/GSdx/GPUDrawScanlineCodeGenerator.h @@ -1,60 +1,60 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "GPUScanlineEnvironment.h" -#include "GSFunctionMap.h" - -using namespace Xbyak; - -class GPUDrawScanlineCodeGenerator : public GSCodeGenerator -{ - void operator = (const GPUDrawScanlineCodeGenerator&); - - static const GSVector4i m_test[8]; - static const uint16 m_dither[4][16]; - - GPUScanlineSelector m_sel; - GPUScanlineLocalData& m_local; - - void Generate(); - - void Init(); - void Step(); - void TestMask(); - void SampleTexture(); - void ColorTFX(); - void AlphaBlend(); - void Dither(); - void WriteFrame(); - - void ReadTexel(const Xmm& dst, const Xmm& addr); - - template void modulate16(const Xmm& a, const Operand& f); - template void lerp16(const Xmm& a, const Xmm& b, const Operand& f); - void alltrue(); - void blend8(const Xmm& a, const Xmm& b); - void blend(const Xmm& a, const Xmm& b, const Xmm& mask); - -public: - GPUDrawScanlineCodeGenerator(void* param, uint32 key, void* code, size_t maxsize); +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#include "GPUScanlineEnvironment.h" +#include "GSFunctionMap.h" + +using namespace Xbyak; + +class GPUDrawScanlineCodeGenerator : public GSCodeGenerator +{ + void operator = (const GPUDrawScanlineCodeGenerator&); + + static const GSVector4i m_test[8]; + static const uint16 m_dither[4][16]; + + GPUScanlineSelector m_sel; + GPUScanlineLocalData& m_local; + + void Generate(); + + void Init(); + void Step(); + void TestMask(); + void SampleTexture(); + void ColorTFX(); + void AlphaBlend(); + void Dither(); + void WriteFrame(); + + void ReadTexel(const Xmm& dst, const Xmm& addr); + + template void modulate16(const Xmm& a, const Operand& f); + template void lerp16(const Xmm& a, const Xmm& b, const Operand& f); + void alltrue(); + void blend8(const Xmm& a, const Xmm& b); + void blend(const Xmm& a, const Xmm& b, const Xmm& mask); + +public: + GPUDrawScanlineCodeGenerator(void* param, uint32 key, void* code, size_t maxsize); }; \ No newline at end of file diff --git a/plugins/GSdx/GPUDrawingEnvironment.h b/plugins/GSdx/GPUDrawingEnvironment.h index 5fb852040b..0f14bc6441 100644 --- a/plugins/GSdx/GPUDrawingEnvironment.h +++ b/plugins/GSdx/GPUDrawingEnvironment.h @@ -1,79 +1,79 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "GPU.h" - -#pragma pack(push, 1) - -__aligned(class, 32) GPUDrawingEnvironment -{ -public: - GPURegSTATUS STATUS; - GPURegPRIM PRIM; - GPURegDAREA DAREA; - GPURegDHRANGE DHRANGE; - GPURegDVRANGE DVRANGE; - GPURegDRAREA DRAREATL; - GPURegDRAREA DRAREABR; - GPURegDROFF DROFF; - GPURegTWIN TWIN; - GPURegCLUT CLUT; - - GPUDrawingEnvironment() - { - Reset(); - } - - void Reset() - { - memset(this, 0, sizeof(*this)); - - STATUS.IDLE = 1; - STATUS.COM = 1; - STATUS.WIDTH0 = 1; - DVRANGE.Y1 = 16; - DVRANGE.Y2 = 256; - } - - GSVector4i GetDisplayRect() - { - static int s_width[] = {256, 320, 512, 640, 368, 384, 512, 640}; - static int s_height[] = {240, 480}; - - GSVector4i r; - - r.left = DAREA.X & ~7; // FIXME - r.top = DAREA.Y; - r.right = r.left + s_width[(STATUS.WIDTH1 << 2) | STATUS.WIDTH0]; - r.bottom = r.top + (DVRANGE.Y2 - DVRANGE.Y1) * s_height[STATUS.HEIGHT] / 240; - - return r.rintersect(GSVector4i(0, 0, 1024, 512)); - } - - int GetFPS() - { - return STATUS.ISPAL ? 50 : 60; - } -}; - -#pragma pack(pop) +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#include "GPU.h" + +#pragma pack(push, 1) + +__aligned(class, 32) GPUDrawingEnvironment +{ +public: + GPURegSTATUS STATUS; + GPURegPRIM PRIM; + GPURegDAREA DAREA; + GPURegDHRANGE DHRANGE; + GPURegDVRANGE DVRANGE; + GPURegDRAREA DRAREATL; + GPURegDRAREA DRAREABR; + GPURegDROFF DROFF; + GPURegTWIN TWIN; + GPURegCLUT CLUT; + + GPUDrawingEnvironment() + { + Reset(); + } + + void Reset() + { + memset(this, 0, sizeof(*this)); + + STATUS.IDLE = 1; + STATUS.COM = 1; + STATUS.WIDTH0 = 1; + DVRANGE.Y1 = 16; + DVRANGE.Y2 = 256; + } + + GSVector4i GetDisplayRect() + { + static int s_width[] = {256, 320, 512, 640, 368, 384, 512, 640}; + static int s_height[] = {240, 480}; + + GSVector4i r; + + r.left = DAREA.X & ~7; // FIXME + r.top = DAREA.Y; + r.right = r.left + s_width[(STATUS.WIDTH1 << 2) | STATUS.WIDTH0]; + r.bottom = r.top + (DVRANGE.Y2 - DVRANGE.Y1) * s_height[STATUS.HEIGHT] / 240; + + return r.rintersect(GSVector4i(0, 0, 1024, 512)); + } + + int GetFPS() + { + return STATUS.ISPAL ? 50 : 60; + } +}; + +#pragma pack(pop) diff --git a/plugins/GSdx/GPULocalMemory.h b/plugins/GSdx/GPULocalMemory.h index 4a6c3ee684..450d8c5792 100644 --- a/plugins/GSdx/GPULocalMemory.h +++ b/plugins/GSdx/GPULocalMemory.h @@ -1,84 +1,84 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "GPU.h" -#include "GSVector.h" - -class GPULocalMemory -{ - static const GSVector4i m_xxxa; - static const GSVector4i m_xxbx; - static const GSVector4i m_xgxx; - static const GSVector4i m_rxxx; - - uint16* m_vm; - - struct - { - uint16* buff; - int tp, cx, cy; - bool dirty; - } m_clut; - - struct - { - uint8* buff[3]; - void* page[3][2][16]; - uint16 valid[3][2]; - } m_texture; - - GSVector2i m_scale; - -public: - GPULocalMemory(); - virtual ~GPULocalMemory(); - - GSVector2i GetScale() {return m_scale;} - - int GetWidth() {return 1 << (10 + m_scale.x);} - int GetHeight() {return 1 << (9 + m_scale.y);} - - uint16* GetPixelAddress(int x, int y) const {return &m_vm[(y << (10 + m_scale.x)) + x];} - uint16* GetPixelAddressScaled(int x, int y) const {return &m_vm[((y << m_scale.y) << (10 + m_scale.x)) + (x << m_scale.x)];} - - const uint16* GetCLUT(int tp, int cx, int cy); - const void* GetTexture(int tp, int tx, int ty); - - void Invalidate(const GSVector4i& r); - - void FillRect(const GSVector4i& r, uint16 c); - void WriteRect(const GSVector4i& r, const uint16* RESTRICT src); - void ReadRect(const GSVector4i& r, uint16* RESTRICT dst); - void MoveRect(int sx, int sy, int dx, int dy, int w, int h); - - void ReadPage4(int tx, int ty, uint8* RESTRICT dst); - void ReadPage8(int tx, int ty, uint8* RESTRICT dst); - void ReadPage16(int tx, int ty, uint16* RESTRICT dst); - - void ReadFrame32(const GSVector4i& r, uint32* RESTRICT dst, bool rgb24); - - void Expand16(const uint16* RESTRICT src, uint32* RESTRICT dst, int pixels); - void Expand24(const uint16* RESTRICT src, uint32* RESTRICT dst, int pixels); - - void SaveBMP(const string& path, const GSVector4i& r, int tp, int cx, int cy); -}; +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#include "GPU.h" +#include "GSVector.h" + +class GPULocalMemory +{ + static const GSVector4i m_xxxa; + static const GSVector4i m_xxbx; + static const GSVector4i m_xgxx; + static const GSVector4i m_rxxx; + + uint16* m_vm; + + struct + { + uint16* buff; + int tp, cx, cy; + bool dirty; + } m_clut; + + struct + { + uint8* buff[3]; + void* page[3][2][16]; + uint16 valid[3][2]; + } m_texture; + + GSVector2i m_scale; + +public: + GPULocalMemory(); + virtual ~GPULocalMemory(); + + GSVector2i GetScale() {return m_scale;} + + int GetWidth() {return 1 << (10 + m_scale.x);} + int GetHeight() {return 1 << (9 + m_scale.y);} + + uint16* GetPixelAddress(int x, int y) const {return &m_vm[(y << (10 + m_scale.x)) + x];} + uint16* GetPixelAddressScaled(int x, int y) const {return &m_vm[((y << m_scale.y) << (10 + m_scale.x)) + (x << m_scale.x)];} + + const uint16* GetCLUT(int tp, int cx, int cy); + const void* GetTexture(int tp, int tx, int ty); + + void Invalidate(const GSVector4i& r); + + void FillRect(const GSVector4i& r, uint16 c); + void WriteRect(const GSVector4i& r, const uint16* RESTRICT src); + void ReadRect(const GSVector4i& r, uint16* RESTRICT dst); + void MoveRect(int sx, int sy, int dx, int dy, int w, int h); + + void ReadPage4(int tx, int ty, uint8* RESTRICT dst); + void ReadPage8(int tx, int ty, uint8* RESTRICT dst); + void ReadPage16(int tx, int ty, uint16* RESTRICT dst); + + void ReadFrame32(const GSVector4i& r, uint32* RESTRICT dst, bool rgb24); + + void Expand16(const uint16* RESTRICT src, uint32* RESTRICT dst, int pixels); + void Expand24(const uint16* RESTRICT src, uint32* RESTRICT dst, int pixels); + + void SaveBMP(const string& path, const GSVector4i& r, int tp, int cx, int cy); +}; diff --git a/plugins/GSdx/GPURenderer.cpp b/plugins/GSdx/GPURenderer.cpp index f1d3a69ad6..bc4520bba0 100644 --- a/plugins/GSdx/GPURenderer.cpp +++ b/plugins/GSdx/GPURenderer.cpp @@ -1,244 +1,244 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "GPURenderer.h" -#include "GSdx.h" - -#ifdef _WINDOWS - -map GPURenderer::m_wnd2gpu; - -#endif - -GPURenderer::GPURenderer(GSDevice* dev) - : m_dev(dev) -{ - m_filter = theApp.GetConfig("filter", 0); - m_dither = theApp.GetConfig("dithering", 1); - m_aspectratio = theApp.GetConfig("AspectRatio", 1); - m_vsync = !!theApp.GetConfig("vsync", 0); - m_scale = m_mem.GetScale(); - - #ifdef _WINDOWS - - m_hWnd = NULL; - m_wndproc = NULL; - - #endif -} - -GPURenderer::~GPURenderer() -{ - #ifdef _WINDOWS - - if(m_wndproc) - { - SetWindowLongPtr(m_hWnd, GWLP_WNDPROC, (LONG_PTR)m_wndproc); - - m_wnd2gpu.erase(m_hWnd); - } - - #endif -} - -bool GPURenderer::Create(void* hWnd) -{ - #ifdef _WINDOWS - - // TODO: move subclassing inside GSWnd::Attach - - m_hWnd = (HWND)hWnd; - - m_wndproc = (WNDPROC)GetWindowLongPtr(m_hWnd, GWLP_WNDPROC); - - SetWindowLongPtr(m_hWnd, GWLP_WNDPROC, (LONG_PTR)WndProc); - - if(!m_wnd.Attach(m_hWnd)) - { - return false; - } - - m_wnd2gpu[m_hWnd] = this; - - SetWindowLong(m_hWnd, GWL_STYLE, GetWindowLong(m_hWnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW); - - #endif - - m_wnd.Show(); - - if(!m_dev->Create(&m_wnd)) - { - return false; - } - - m_dev->SetVSync(m_vsync); - - Reset(); - - return true; -} - -bool GPURenderer::Merge() -{ - GSTexture* st[2] = {GetOutput(), NULL}; - - if(!st[0]) - { - return false; - } - - GSVector2i s = st[0]->GetSize(); - - GSVector4 sr[2]; - GSVector4 dr[2]; - - sr[0] = GSVector4(0, 0, 1, 1); - dr[0] = GSVector4(0, 0, s.x, s.y); - - m_dev->Merge(st, sr, dr, s, 1, 1, GSVector4(0, 0, 0, 1)); - - return true; -} - -void GPURenderer::VSync() -{ - GSPerfMonAutoTimer pmat(m_perfmon); - - m_perfmon.Put(GSPerfMon::Frame); - - // m_env.STATUS.LCF = ~m_env.STATUS.LCF; // ? - - #ifdef _WINDOWS - - if(!IsWindow(m_hWnd)) return; - - #endif - - Flush(); - - if(!m_dev->IsLost(true)) - { - if(!Merge()) - { - return; - } - } - else - { - ResetDevice(); - } - - // osd - - if((m_perfmon.GetFrame() & 0x1f) == 0) - { - m_perfmon.Update(); - - double fps = 1000.0f / m_perfmon.Get(GSPerfMon::Frame); - - GSVector4i r = m_env.GetDisplayRect(); - - int w = r.width() << m_scale.x; - int h = r.height() << m_scale.y; - - string s = format( - "%lld | %d x %d | %.2f fps (%d%%) | %d/%d | %d%% CPU | %.2f | %.2f", - m_perfmon.GetFrame(), w, h, fps, (int)(100.0 * fps / m_env.GetFPS()), - (int)m_perfmon.Get(GSPerfMon::Prim), - (int)m_perfmon.Get(GSPerfMon::Draw), - m_perfmon.CPU(), - m_perfmon.Get(GSPerfMon::Swizzle) / 1024, - m_perfmon.Get(GSPerfMon::Unswizzle) / 1024 - ); - - double fillrate = m_perfmon.Get(GSPerfMon::Fillrate); - - if(fillrate > 0) - { - s = format("%s | %.2f mpps", s.c_str(), fps * fillrate / (1024 * 1024)); - } - - m_wnd.SetWindowText(s.c_str()); - } - - GSVector4i r = m_wnd.GetClientRect(); - - m_dev->Present(r.fit(m_aspectratio), 0); -} - -bool GPURenderer::MakeSnapshot(const string& path) -{ - time_t t = time(NULL); - - char buff[16]; - - if(!strftime(buff, sizeof(buff), "%Y%m%d%H%M%S", localtime(&t))) - { - return false; - } - - if(GSTexture* t = m_dev->GetCurrent()) - { - return t->Save(format("%s_%s.bmp", path.c_str(), buff)); - } - - return false; -} - -#ifdef _WINDOWS - -LRESULT CALLBACK GPURenderer::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - map::iterator i = m_wnd2gpu.find(hWnd); - - if(i != m_wnd2gpu.end()) - { - return i->second->OnMessage(message, wParam, lParam); - } - - ASSERT(0); - - return 0; -} - -LRESULT GPURenderer::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) -{ - if(message == WM_KEYUP) - { - switch(wParam) - { - case VK_DELETE: - m_filter = (m_filter + 1) % 3; - return 0; - case VK_END: - m_dither = m_dither ? 0 : 1; - return 0; - case VK_NEXT: - m_aspectratio = (m_aspectratio + 1) % 3; - return 0; - } - } - - return CallWindowProc(m_wndproc, m_hWnd, message, wParam, lParam); -} - -#endif +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "stdafx.h" +#include "GPURenderer.h" +#include "GSdx.h" + +#ifdef _WINDOWS + +map GPURenderer::m_wnd2gpu; + +#endif + +GPURenderer::GPURenderer(GSDevice* dev) + : m_dev(dev) +{ + m_filter = theApp.GetConfig("filter", 0); + m_dither = theApp.GetConfig("dithering", 1); + m_aspectratio = theApp.GetConfig("AspectRatio", 1); + m_vsync = !!theApp.GetConfig("vsync", 0); + m_scale = m_mem.GetScale(); + + #ifdef _WINDOWS + + m_hWnd = NULL; + m_wndproc = NULL; + + #endif +} + +GPURenderer::~GPURenderer() +{ + #ifdef _WINDOWS + + if(m_wndproc) + { + SetWindowLongPtr(m_hWnd, GWLP_WNDPROC, (LONG_PTR)m_wndproc); + + m_wnd2gpu.erase(m_hWnd); + } + + #endif +} + +bool GPURenderer::Create(void* hWnd) +{ + #ifdef _WINDOWS + + // TODO: move subclassing inside GSWnd::Attach + + m_hWnd = (HWND)hWnd; + + m_wndproc = (WNDPROC)GetWindowLongPtr(m_hWnd, GWLP_WNDPROC); + + SetWindowLongPtr(m_hWnd, GWLP_WNDPROC, (LONG_PTR)WndProc); + + if(!m_wnd.Attach(m_hWnd)) + { + return false; + } + + m_wnd2gpu[m_hWnd] = this; + + SetWindowLong(m_hWnd, GWL_STYLE, GetWindowLong(m_hWnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW); + + #endif + + m_wnd.Show(); + + if(!m_dev->Create(&m_wnd)) + { + return false; + } + + m_dev->SetVSync(m_vsync); + + Reset(); + + return true; +} + +bool GPURenderer::Merge() +{ + GSTexture* st[2] = {GetOutput(), NULL}; + + if(!st[0]) + { + return false; + } + + GSVector2i s = st[0]->GetSize(); + + GSVector4 sr[2]; + GSVector4 dr[2]; + + sr[0] = GSVector4(0, 0, 1, 1); + dr[0] = GSVector4(0, 0, s.x, s.y); + + m_dev->Merge(st, sr, dr, s, 1, 1, GSVector4(0, 0, 0, 1)); + + return true; +} + +void GPURenderer::VSync() +{ + GSPerfMonAutoTimer pmat(m_perfmon); + + m_perfmon.Put(GSPerfMon::Frame); + + // m_env.STATUS.LCF = ~m_env.STATUS.LCF; // ? + + #ifdef _WINDOWS + + if(!IsWindow(m_hWnd)) return; + + #endif + + Flush(); + + if(!m_dev->IsLost(true)) + { + if(!Merge()) + { + return; + } + } + else + { + ResetDevice(); + } + + // osd + + if((m_perfmon.GetFrame() & 0x1f) == 0) + { + m_perfmon.Update(); + + double fps = 1000.0f / m_perfmon.Get(GSPerfMon::Frame); + + GSVector4i r = m_env.GetDisplayRect(); + + int w = r.width() << m_scale.x; + int h = r.height() << m_scale.y; + + string s = format( + "%lld | %d x %d | %.2f fps (%d%%) | %d/%d | %d%% CPU | %.2f | %.2f", + m_perfmon.GetFrame(), w, h, fps, (int)(100.0 * fps / m_env.GetFPS()), + (int)m_perfmon.Get(GSPerfMon::Prim), + (int)m_perfmon.Get(GSPerfMon::Draw), + m_perfmon.CPU(), + m_perfmon.Get(GSPerfMon::Swizzle) / 1024, + m_perfmon.Get(GSPerfMon::Unswizzle) / 1024 + ); + + double fillrate = m_perfmon.Get(GSPerfMon::Fillrate); + + if(fillrate > 0) + { + s = format("%s | %.2f mpps", s.c_str(), fps * fillrate / (1024 * 1024)); + } + + m_wnd.SetWindowText(s.c_str()); + } + + GSVector4i r = m_wnd.GetClientRect(); + + m_dev->Present(r.fit(m_aspectratio), 0); +} + +bool GPURenderer::MakeSnapshot(const string& path) +{ + time_t t = time(NULL); + + char buff[16]; + + if(!strftime(buff, sizeof(buff), "%Y%m%d%H%M%S", localtime(&t))) + { + return false; + } + + if(GSTexture* t = m_dev->GetCurrent()) + { + return t->Save(format("%s_%s.bmp", path.c_str(), buff)); + } + + return false; +} + +#ifdef _WINDOWS + +LRESULT CALLBACK GPURenderer::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + map::iterator i = m_wnd2gpu.find(hWnd); + + if(i != m_wnd2gpu.end()) + { + return i->second->OnMessage(message, wParam, lParam); + } + + ASSERT(0); + + return 0; +} + +LRESULT GPURenderer::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) +{ + if(message == WM_KEYUP) + { + switch(wParam) + { + case VK_DELETE: + m_filter = (m_filter + 1) % 3; + return 0; + case VK_END: + m_dither = m_dither ? 0 : 1; + return 0; + case VK_NEXT: + m_aspectratio = (m_aspectratio + 1) % 3; + return 0; + } + } + + return CallWindowProc(m_wndproc, m_hWnd, message, wParam, lParam); +} + +#endif diff --git a/plugins/GSdx/GPURenderer.h b/plugins/GSdx/GPURenderer.h index e8047fe86a..688af6e62c 100644 --- a/plugins/GSdx/GPURenderer.h +++ b/plugins/GSdx/GPURenderer.h @@ -1,184 +1,184 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "GPUState.h" -#include "GSVertexList.h" -#include "GSDevice.h" - -class GPURenderer : public GPUState -{ - bool Merge(); - -protected: - GSDevice* m_dev; - int m_filter; - int m_dither; - int m_aspectratio; - bool m_vsync; - GSVector2i m_scale; - - virtual void ResetDevice() {} - virtual GSTexture* GetOutput() = 0; - - #ifdef _WINDOWS - - HWND m_hWnd; - WNDPROC m_wndproc; - static map m_wnd2gpu; - - static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam); - - #endif - - GSWnd m_wnd; - -public: - GPURenderer(GSDevice* dev); - virtual ~GPURenderer(); - - virtual bool Create(void* hWnd); - virtual void VSync(); - virtual bool MakeSnapshot(const string& path); -}; - -template -class GPURendererT : public GPURenderer -{ -protected: - Vertex* m_vertices; - int m_count; - int m_maxcount; - GSVertexList m_vl; - - void Reset() - { - m_count = 0; - m_vl.RemoveAll(); - - GPURenderer::Reset(); - } - - void ResetPrim() - { - m_vl.RemoveAll(); - } - - void FlushPrim() - { - if(m_count > 0) - { - /* - Dump("db"); - - if(m_env.PRIM.TME) - { - GSVector4i r; - - r.left = m_env.STATUS.TX << 6; - r.top = m_env.STATUS.TY << 8; - r.right = r.left + 256; - r.bottom = r.top + 256; - - Dump(format("da_%d_%d_%d_%d_%d", m_env.STATUS.TP, r).c_str(), m_env.STATUS.TP, r, false); - } - */ - - Draw(); - - m_count = 0; - - //Dump("dc", false); - } - } - - void GrowVertexBuffer() - { - if(m_vertices != NULL) _aligned_free(m_vertices); - - m_maxcount = max(10000, m_maxcount * 3/2); - m_vertices = (Vertex*)_aligned_malloc(sizeof(Vertex) * m_maxcount, 16); - m_maxcount -= 100; - } - - __forceinline Vertex* DrawingKick(int& count) - { - count = (int)m_env.PRIM.VTX; - - if(m_vl.GetCount() < count) - { - return NULL; - } - - if(m_count >= m_maxcount) - { - GrowVertexBuffer(); - } - - Vertex* v = &m_vertices[m_count]; - - switch(m_env.PRIM.TYPE) - { - case GPU_POLYGON: - m_vl.GetAt(0, v[0]); - m_vl.GetAt(1, v[1]); - m_vl.GetAt(2, v[2]); - m_vl.RemoveAll(); - break; - case GPU_LINE: - m_vl.GetAt(0, v[0]); - m_vl.GetAt(1, v[1]); - m_vl.RemoveAll(); - break; - case GPU_SPRITE: - m_vl.GetAt(0, v[0]); - m_vl.GetAt(1, v[1]); - m_vl.RemoveAll(); - break; - default: - ASSERT(0); - m_vl.RemoveAll(); - return NULL; - } - - return v; - } - - virtual void VertexKick() = 0; - - virtual void Draw() = 0; - -public: - GPURendererT(GSDevice* dev) - : GPURenderer(dev) - , m_count(0) - , m_maxcount(0) - , m_vertices(NULL) - { - } - - virtual ~GPURendererT() - { - if(m_vertices) _aligned_free(m_vertices); - } -}; +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#include "GPUState.h" +#include "GSVertexList.h" +#include "GSDevice.h" + +class GPURenderer : public GPUState +{ + bool Merge(); + +protected: + GSDevice* m_dev; + int m_filter; + int m_dither; + int m_aspectratio; + bool m_vsync; + GSVector2i m_scale; + + virtual void ResetDevice() {} + virtual GSTexture* GetOutput() = 0; + + #ifdef _WINDOWS + + HWND m_hWnd; + WNDPROC m_wndproc; + static map m_wnd2gpu; + + static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam); + + #endif + + GSWnd m_wnd; + +public: + GPURenderer(GSDevice* dev); + virtual ~GPURenderer(); + + virtual bool Create(void* hWnd); + virtual void VSync(); + virtual bool MakeSnapshot(const string& path); +}; + +template +class GPURendererT : public GPURenderer +{ +protected: + Vertex* m_vertices; + int m_count; + int m_maxcount; + GSVertexList m_vl; + + void Reset() + { + m_count = 0; + m_vl.RemoveAll(); + + GPURenderer::Reset(); + } + + void ResetPrim() + { + m_vl.RemoveAll(); + } + + void FlushPrim() + { + if(m_count > 0) + { + /* + Dump("db"); + + if(m_env.PRIM.TME) + { + GSVector4i r; + + r.left = m_env.STATUS.TX << 6; + r.top = m_env.STATUS.TY << 8; + r.right = r.left + 256; + r.bottom = r.top + 256; + + Dump(format("da_%d_%d_%d_%d_%d", m_env.STATUS.TP, r).c_str(), m_env.STATUS.TP, r, false); + } + */ + + Draw(); + + m_count = 0; + + //Dump("dc", false); + } + } + + void GrowVertexBuffer() + { + if(m_vertices != NULL) _aligned_free(m_vertices); + + m_maxcount = max(10000, m_maxcount * 3/2); + m_vertices = (Vertex*)_aligned_malloc(sizeof(Vertex) * m_maxcount, 16); + m_maxcount -= 100; + } + + __forceinline Vertex* DrawingKick(int& count) + { + count = (int)m_env.PRIM.VTX; + + if(m_vl.GetCount() < count) + { + return NULL; + } + + if(m_count >= m_maxcount) + { + GrowVertexBuffer(); + } + + Vertex* v = &m_vertices[m_count]; + + switch(m_env.PRIM.TYPE) + { + case GPU_POLYGON: + m_vl.GetAt(0, v[0]); + m_vl.GetAt(1, v[1]); + m_vl.GetAt(2, v[2]); + m_vl.RemoveAll(); + break; + case GPU_LINE: + m_vl.GetAt(0, v[0]); + m_vl.GetAt(1, v[1]); + m_vl.RemoveAll(); + break; + case GPU_SPRITE: + m_vl.GetAt(0, v[0]); + m_vl.GetAt(1, v[1]); + m_vl.RemoveAll(); + break; + default: + ASSERT(0); + m_vl.RemoveAll(); + return NULL; + } + + return v; + } + + virtual void VertexKick() = 0; + + virtual void Draw() = 0; + +public: + GPURendererT(GSDevice* dev) + : GPURenderer(dev) + , m_count(0) + , m_maxcount(0) + , m_vertices(NULL) + { + } + + virtual ~GPURendererT() + { + if(m_vertices) _aligned_free(m_vertices); + } +}; diff --git a/plugins/GSdx/GPURendererSW.cpp b/plugins/GSdx/GPURendererSW.cpp index f7f78aebb5..f13d2e611d 100644 --- a/plugins/GSdx/GPURendererSW.cpp +++ b/plugins/GSdx/GPURendererSW.cpp @@ -1,196 +1,196 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "GPURendererSW.h" -//#include "GSdx.h" - -GPURendererSW::GPURendererSW(GSDevice* dev, int threads) - : GPURendererT(dev) - , m_texture(NULL) -{ - m_output = (uint32*)_aligned_malloc(m_mem.GetWidth() * m_mem.GetHeight() * sizeof(uint32), 16); - - m_rl.Create(threads); -} - -GPURendererSW::~GPURendererSW() -{ - delete m_texture; - - _aligned_free(m_output); -} - -void GPURendererSW::ResetDevice() -{ - delete m_texture; - - m_texture = NULL; -} - -GSTexture* GPURendererSW::GetOutput() -{ - GSVector4i r = m_env.GetDisplayRect(); - - r.left <<= m_scale.x; - r.top <<= m_scale.y; - r.right <<= m_scale.x; - r.bottom <<= m_scale.y; - - if(m_dev->ResizeTexture(&m_texture, r.width(), r.height())) - { - m_mem.ReadFrame32(r, m_output, !!m_env.STATUS.ISRGB24); - - m_texture->Update(r.rsize(), m_output, m_mem.GetWidth() * sizeof(uint32)); - } - - return m_texture; -} - -void GPURendererSW::Draw() -{ - const GPUDrawingEnvironment& env = m_env; - - // - - GPUScanlineGlobalData gd; - - gd.sel.key = 0; - gd.sel.iip = env.PRIM.IIP; - gd.sel.me = env.STATUS.ME; - - if(env.PRIM.ABE) - { - gd.sel.abe = env.PRIM.ABE; - gd.sel.abr = env.STATUS.ABR; - } - - gd.sel.tge = env.PRIM.TGE; - - if(env.PRIM.TME) - { - gd.sel.tme = env.PRIM.TME; - gd.sel.tlu = env.STATUS.TP < 2; - gd.sel.twin = (env.TWIN.u32 & 0xfffff) != 0; - gd.sel.ltf = m_filter == 1 && env.PRIM.TYPE == GPU_POLYGON || m_filter == 2 ? 1 : 0; - - const void* t = m_mem.GetTexture(env.STATUS.TP, env.STATUS.TX, env.STATUS.TY); - - if(!t) {ASSERT(0); return;} - - gd.tex = t; - gd.clut = m_mem.GetCLUT(env.STATUS.TP, env.CLUT.X, env.CLUT.Y); - gd.twin = GSVector4i(env.TWIN.TWW, env.TWIN.TWH, env.TWIN.TWX, env.TWIN.TWY); - } - - gd.sel.dtd = m_dither ? env.STATUS.DTD : 0; - gd.sel.md = env.STATUS.MD; - gd.sel.sprite = env.PRIM.TYPE == GPU_SPRITE; - gd.sel.scalex = m_mem.GetScale().x; - - gd.vm = m_mem.GetPixelAddress(0, 0); - - // - - GSRasterizerData data; - - data.vertices = m_vertices; - data.count = m_count; - data.frame = m_perfmon.GetFrame(); - data.param = &gd; - - data.scissor.left = (int)m_env.DRAREATL.X << m_scale.x; - data.scissor.top = (int)m_env.DRAREATL.Y << m_scale.y; - data.scissor.right = min((int)(m_env.DRAREABR.X + 1) << m_scale.x, m_mem.GetWidth()); - data.scissor.bottom = min((int)(m_env.DRAREABR.Y + 1) << m_scale.y, m_mem.GetHeight()); - - switch(env.PRIM.TYPE) - { - case GPU_POLYGON: data.primclass = GS_TRIANGLE_CLASS; break; - case GPU_LINE: data.primclass = GS_LINE_CLASS; break; - case GPU_SPRITE: data.primclass = GS_SPRITE_CLASS; break; - default: __assume(0); - } - - // TODO: VertexTrace - - GSVector4 tl(+1e10f); - GSVector4 br(-1e10f); - - for(int i = 0, j = m_count; i < j; i++) - { - GSVector4 p = m_vertices[i].p; - - tl = tl.min(p); - br = br.max(p); - } - - GSVector4i r = GSVector4i(tl.xyxy(br)).rintersect(data.scissor); - - r.left >>= m_scale.x; - r.top >>= m_scale.y; - r.right >>= m_scale.x; - r.bottom >>= m_scale.y; - - m_rl.Draw(&data, r.width(), r.height()); - - Invalidate(r); - - m_rl.Sync(); - - GSRasterizerStats stats; - - m_rl.GetStats(stats); - - m_perfmon.Put(GSPerfMon::Draw, 1); - m_perfmon.Put(GSPerfMon::Prim, stats.prims); - m_perfmon.Put(GSPerfMon::Fillrate, stats.pixels); -} - -void GPURendererSW::VertexKick() -{ - GSVertexSW& dst = m_vl.AddTail(); - - // TODO: x/y + off.x/y should wrap around at +/-1024 - - int x = (int)(m_v.XY.X + m_env.DROFF.X) << m_scale.x; - int y = (int)(m_v.XY.Y + m_env.DROFF.Y) << m_scale.y; - - int s = m_v.UV.X; - int t = m_v.UV.Y; - - GSVector4 pt(x, y, s, t); - - dst.p = pt.xyxy(GSVector4::zero()); - dst.t = (pt.zwzw(GSVector4::zero()) + GSVector4(0.125f)) * 256.0f; - // dst.c = GSVector4(m_v.RGB.u32) * 128.0f; - dst.c = GSVector4(GSVector4i::load((int)m_v.RGB.u32).u8to32() << 7); - - int count = 0; - - if(GSVertexSW* v = DrawingKick(count)) - { - // TODO - - m_count += count; - } -} - +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "stdafx.h" +#include "GPURendererSW.h" +//#include "GSdx.h" + +GPURendererSW::GPURendererSW(GSDevice* dev, int threads) + : GPURendererT(dev) + , m_texture(NULL) +{ + m_output = (uint32*)_aligned_malloc(m_mem.GetWidth() * m_mem.GetHeight() * sizeof(uint32), 16); + + m_rl.Create(threads); +} + +GPURendererSW::~GPURendererSW() +{ + delete m_texture; + + _aligned_free(m_output); +} + +void GPURendererSW::ResetDevice() +{ + delete m_texture; + + m_texture = NULL; +} + +GSTexture* GPURendererSW::GetOutput() +{ + GSVector4i r = m_env.GetDisplayRect(); + + r.left <<= m_scale.x; + r.top <<= m_scale.y; + r.right <<= m_scale.x; + r.bottom <<= m_scale.y; + + if(m_dev->ResizeTexture(&m_texture, r.width(), r.height())) + { + m_mem.ReadFrame32(r, m_output, !!m_env.STATUS.ISRGB24); + + m_texture->Update(r.rsize(), m_output, m_mem.GetWidth() * sizeof(uint32)); + } + + return m_texture; +} + +void GPURendererSW::Draw() +{ + const GPUDrawingEnvironment& env = m_env; + + // + + GPUScanlineGlobalData gd; + + gd.sel.key = 0; + gd.sel.iip = env.PRIM.IIP; + gd.sel.me = env.STATUS.ME; + + if(env.PRIM.ABE) + { + gd.sel.abe = env.PRIM.ABE; + gd.sel.abr = env.STATUS.ABR; + } + + gd.sel.tge = env.PRIM.TGE; + + if(env.PRIM.TME) + { + gd.sel.tme = env.PRIM.TME; + gd.sel.tlu = env.STATUS.TP < 2; + gd.sel.twin = (env.TWIN.u32 & 0xfffff) != 0; + gd.sel.ltf = m_filter == 1 && env.PRIM.TYPE == GPU_POLYGON || m_filter == 2 ? 1 : 0; + + const void* t = m_mem.GetTexture(env.STATUS.TP, env.STATUS.TX, env.STATUS.TY); + + if(!t) {ASSERT(0); return;} + + gd.tex = t; + gd.clut = m_mem.GetCLUT(env.STATUS.TP, env.CLUT.X, env.CLUT.Y); + gd.twin = GSVector4i(env.TWIN.TWW, env.TWIN.TWH, env.TWIN.TWX, env.TWIN.TWY); + } + + gd.sel.dtd = m_dither ? env.STATUS.DTD : 0; + gd.sel.md = env.STATUS.MD; + gd.sel.sprite = env.PRIM.TYPE == GPU_SPRITE; + gd.sel.scalex = m_mem.GetScale().x; + + gd.vm = m_mem.GetPixelAddress(0, 0); + + // + + GSRasterizerData data; + + data.vertices = m_vertices; + data.count = m_count; + data.frame = m_perfmon.GetFrame(); + data.param = &gd; + + data.scissor.left = (int)m_env.DRAREATL.X << m_scale.x; + data.scissor.top = (int)m_env.DRAREATL.Y << m_scale.y; + data.scissor.right = min((int)(m_env.DRAREABR.X + 1) << m_scale.x, m_mem.GetWidth()); + data.scissor.bottom = min((int)(m_env.DRAREABR.Y + 1) << m_scale.y, m_mem.GetHeight()); + + switch(env.PRIM.TYPE) + { + case GPU_POLYGON: data.primclass = GS_TRIANGLE_CLASS; break; + case GPU_LINE: data.primclass = GS_LINE_CLASS; break; + case GPU_SPRITE: data.primclass = GS_SPRITE_CLASS; break; + default: __assume(0); + } + + // TODO: VertexTrace + + GSVector4 tl(+1e10f); + GSVector4 br(-1e10f); + + for(int i = 0, j = m_count; i < j; i++) + { + GSVector4 p = m_vertices[i].p; + + tl = tl.min(p); + br = br.max(p); + } + + GSVector4i r = GSVector4i(tl.xyxy(br)).rintersect(data.scissor); + + r.left >>= m_scale.x; + r.top >>= m_scale.y; + r.right >>= m_scale.x; + r.bottom >>= m_scale.y; + + m_rl.Draw(&data, r.width(), r.height()); + + Invalidate(r); + + m_rl.Sync(); + + GSRasterizerStats stats; + + m_rl.GetStats(stats); + + m_perfmon.Put(GSPerfMon::Draw, 1); + m_perfmon.Put(GSPerfMon::Prim, stats.prims); + m_perfmon.Put(GSPerfMon::Fillrate, stats.pixels); +} + +void GPURendererSW::VertexKick() +{ + GSVertexSW& dst = m_vl.AddTail(); + + // TODO: x/y + off.x/y should wrap around at +/-1024 + + int x = (int)(m_v.XY.X + m_env.DROFF.X) << m_scale.x; + int y = (int)(m_v.XY.Y + m_env.DROFF.Y) << m_scale.y; + + int s = m_v.UV.X; + int t = m_v.UV.Y; + + GSVector4 pt(x, y, s, t); + + dst.p = pt.xyxy(GSVector4::zero()); + dst.t = (pt.zwzw(GSVector4::zero()) + GSVector4(0.125f)) * 256.0f; + // dst.c = GSVector4(m_v.RGB.u32) * 128.0f; + dst.c = GSVector4(GSVector4i::load((int)m_v.RGB.u32).u8to32() << 7); + + int count = 0; + + if(GSVertexSW* v = DrawingKick(count)) + { + // TODO + + m_count += count; + } +} + diff --git a/plugins/GSdx/GPURendererSW.h b/plugins/GSdx/GPURendererSW.h index cf2a22806c..169499a826 100644 --- a/plugins/GSdx/GPURendererSW.h +++ b/plugins/GSdx/GPURendererSW.h @@ -1,42 +1,42 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "GPURenderer.h" -#include "GPUDrawScanline.h" - -class GPURendererSW : public GPURendererT -{ -protected: - GSRasterizerList m_rl; - GSTexture* m_texture; - uint32* m_output; - - void ResetDevice(); - GSTexture* GetOutput(); - void VertexKick(); - void Draw(); - -public: - GPURendererSW(GSDevice* dev, int threads); - virtual ~GPURendererSW(); -}; +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#include "GPURenderer.h" +#include "GPUDrawScanline.h" + +class GPURendererSW : public GPURendererT +{ +protected: + GSRasterizerList m_rl; + GSTexture* m_texture; + uint32* m_output; + + void ResetDevice(); + GSTexture* GetOutput(); + void VertexKick(); + void Draw(); + +public: + GPURendererSW(GSDevice* dev, int threads); + virtual ~GPURendererSW(); +}; diff --git a/plugins/GSdx/GPUScanlineEnvironment.h b/plugins/GSdx/GPUScanlineEnvironment.h index ec2f2bd886..1b80dd6767 100644 --- a/plugins/GSdx/GPUScanlineEnvironment.h +++ b/plugins/GSdx/GPUScanlineEnvironment.h @@ -1,78 +1,78 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "GSVector.h" -#include "GPULocalMemory.h" - -union GPUScanlineSelector -{ - struct - { - uint32 iip:1; // 0 - uint32 me:1; // 1 - uint32 abe:1; // 2 - uint32 abr:2; // 3 - uint32 tge:1; // 5 - uint32 tme:1; // 6 - uint32 twin:1; // 7 - uint32 tlu:1; // 8 - uint32 dtd:1; // 9 - uint32 ltf:1; // 10 - uint32 md:1; // 11 - uint32 sprite:1; // 12 - uint32 scalex:2; // 13 - }; - - struct - { - uint32 _pad1:1; // 0 - uint32 rfb:2; // 1 - uint32 _pad2:2; // 3 - uint32 tfx:2; // 5 - }; - - uint32 key; - - operator uint32() const {return key;} -}; - -__aligned(struct, 32) GPUScanlineGlobalData -{ - GPUScanlineSelector sel; - - void* vm; - const void* tex; - const uint16* clut; - GSVector4i twin; // TWW, TWH, TWX, TWY -}; - -__aligned(struct, 32) GPUScanlineLocalData -{ - const GPUScanlineGlobalData* gd; - - struct {GSVector4i u, v;} twin[3]; - struct {GSVector4i s, t, r, g, b, _pad[3];} d; - struct {GSVector4i st, c;} d8; - - struct {GSVector4i s, t, r, b, g, uf, vf, dither, fd, test;} temp; -}; +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#include "GSVector.h" +#include "GPULocalMemory.h" + +union GPUScanlineSelector +{ + struct + { + uint32 iip:1; // 0 + uint32 me:1; // 1 + uint32 abe:1; // 2 + uint32 abr:2; // 3 + uint32 tge:1; // 5 + uint32 tme:1; // 6 + uint32 twin:1; // 7 + uint32 tlu:1; // 8 + uint32 dtd:1; // 9 + uint32 ltf:1; // 10 + uint32 md:1; // 11 + uint32 sprite:1; // 12 + uint32 scalex:2; // 13 + }; + + struct + { + uint32 _pad1:1; // 0 + uint32 rfb:2; // 1 + uint32 _pad2:2; // 3 + uint32 tfx:2; // 5 + }; + + uint32 key; + + operator uint32() const {return key;} +}; + +__aligned(struct, 32) GPUScanlineGlobalData +{ + GPUScanlineSelector sel; + + void* vm; + const void* tex; + const uint16* clut; + GSVector4i twin; // TWW, TWH, TWX, TWY +}; + +__aligned(struct, 32) GPUScanlineLocalData +{ + const GPUScanlineGlobalData* gd; + + struct {GSVector4i u, v;} twin[3]; + struct {GSVector4i s, t, r, g, b, _pad[3];} d; + struct {GSVector4i st, c;} d8; + + struct {GSVector4i s, t, r, b, g, uf, vf, dither, fd, test;} temp; +}; diff --git a/plugins/GSdx/GPUSettingsDlg.cpp b/plugins/GSdx/GPUSettingsDlg.cpp index 330f88c30a..8e513dab73 100644 --- a/plugins/GSdx/GPUSettingsDlg.cpp +++ b/plugins/GSdx/GPUSettingsDlg.cpp @@ -1,151 +1,151 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "GSdx.h" -#include "GSUtil.h" -#include "GPUSettingsDlg.h" -#include "resource.h" - -GPUSettingsDlg::GPUSettingsDlg() - : GSDialog(IDD_GPUCONFIG) -{ -} - -void GPUSettingsDlg::OnInit() -{ - __super::OnInit(); - - m_modes.clear(); - - { - D3DDISPLAYMODE mode; - memset(&mode, 0, sizeof(mode)); - m_modes.push_back(mode); - - ComboBoxAppend(IDC_RESOLUTION, "Please select...", (LPARAM)&m_modes.back(), true); - - if(CComPtr d3d = Direct3DCreate9(D3D_SDK_VERSION)) - { - uint32 w = theApp.GetConfig("ModeWidth", 0); - uint32 h = theApp.GetConfig("ModeHeight", 0); - uint32 hz = theApp.GetConfig("ModeRefreshRate", 0); - - uint32 n = d3d->GetAdapterModeCount(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8); - - for(uint32 i = 0; i < n; i++) - { - if(S_OK == d3d->EnumAdapterModes(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &mode)) - { - m_modes.push_back(mode); - - string str = format("%dx%d %dHz", mode.Width, mode.Height, mode.RefreshRate); - - ComboBoxAppend(IDC_RESOLUTION, str.c_str(), (LPARAM)&m_modes.back(), w == mode.Width && h == mode.Height && hz == mode.RefreshRate); - } - } - } - } - - ComboBoxInit(IDC_RENDERER, theApp.m_gpu_renderers, theApp.GetConfig("Renderer", 0)); - ComboBoxInit(IDC_FILTER, theApp.m_gpu_filter, theApp.GetConfig("filter", 0)); - ComboBoxInit(IDC_DITHERING, theApp.m_gpu_dithering, theApp.GetConfig("dithering", 1)); - ComboBoxInit(IDC_ASPECTRATIO, theApp.m_gpu_aspectratio, theApp.GetConfig("AspectRatio", 1)); - ComboBoxInit(IDC_SCALE, theApp.m_gpu_scale, theApp.GetConfig("scale_x", 0) | (theApp.GetConfig("scale_y", 0) << 2)); - - CheckDlgButton(m_hWnd, IDC_WINDOWED, theApp.GetConfig("windowed", 1)); - - SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETRANGE, 0, MAKELPARAM(16, 1)); - SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("swthreads", 1), 0)); - - UpdateControls(); -} - -bool GPUSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) -{ - if(id == IDC_RENDERER && code == CBN_SELCHANGE) - { - UpdateControls(); - } - else if(id == IDOK) - { - INT_PTR data; - - if(ComboBoxGetSelData(IDC_RESOLUTION, data)) - { - const D3DDISPLAYMODE* mode = (D3DDISPLAYMODE*)data; - - theApp.SetConfig("ModeWidth", (int)mode->Width); - theApp.SetConfig("ModeHeight", (int)mode->Height); - theApp.SetConfig("ModeRefreshRate", (int)mode->RefreshRate); - } - - if(ComboBoxGetSelData(IDC_RENDERER, data)) - { - theApp.SetConfig("Renderer", (int)data); - } - - if(ComboBoxGetSelData(IDC_FILTER, data)) - { - theApp.SetConfig("filter", (int)data); - } - - if(ComboBoxGetSelData(IDC_DITHERING, data)) - { - theApp.SetConfig("dithering", (int)data); - } - - if(ComboBoxGetSelData(IDC_ASPECTRATIO, data)) - { - theApp.SetConfig("AspectRatio", (int)data); - } - - if(ComboBoxGetSelData(IDC_SCALE, data)) - { - theApp.SetConfig("scale_x", data & 3); - theApp.SetConfig("scale_y", (data >> 2) & 3); - } - - theApp.SetConfig("swthreads", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0)); - theApp.SetConfig("windowed", (int)IsDlgButtonChecked(m_hWnd, IDC_WINDOWED)); - } - - return __super::OnCommand(hWnd, id, code); -} - -void GPUSettingsDlg::UpdateControls() -{ - INT_PTR i; - - if(ComboBoxGetSelData(IDC_RENDERER, i)) - { - bool dx9 = i == 0; - bool dx11 = i == 1; - bool sw = i >= 0 && i <= 1; - - ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), dx9 ? SW_SHOW : SW_HIDE); - ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO11), dx11 ? SW_SHOW : SW_HIDE); - - EnableWindow(GetDlgItem(m_hWnd, IDC_SCALE), sw); - EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_EDIT), sw); - EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS), sw); - } +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "stdafx.h" +#include "GSdx.h" +#include "GSUtil.h" +#include "GPUSettingsDlg.h" +#include "resource.h" + +GPUSettingsDlg::GPUSettingsDlg() + : GSDialog(IDD_GPUCONFIG) +{ +} + +void GPUSettingsDlg::OnInit() +{ + __super::OnInit(); + + m_modes.clear(); + + { + D3DDISPLAYMODE mode; + memset(&mode, 0, sizeof(mode)); + m_modes.push_back(mode); + + ComboBoxAppend(IDC_RESOLUTION, "Please select...", (LPARAM)&m_modes.back(), true); + + if(CComPtr d3d = Direct3DCreate9(D3D_SDK_VERSION)) + { + uint32 w = theApp.GetConfig("ModeWidth", 0); + uint32 h = theApp.GetConfig("ModeHeight", 0); + uint32 hz = theApp.GetConfig("ModeRefreshRate", 0); + + uint32 n = d3d->GetAdapterModeCount(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8); + + for(uint32 i = 0; i < n; i++) + { + if(S_OK == d3d->EnumAdapterModes(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &mode)) + { + m_modes.push_back(mode); + + string str = format("%dx%d %dHz", mode.Width, mode.Height, mode.RefreshRate); + + ComboBoxAppend(IDC_RESOLUTION, str.c_str(), (LPARAM)&m_modes.back(), w == mode.Width && h == mode.Height && hz == mode.RefreshRate); + } + } + } + } + + ComboBoxInit(IDC_RENDERER, theApp.m_gpu_renderers, theApp.GetConfig("Renderer", 0)); + ComboBoxInit(IDC_FILTER, theApp.m_gpu_filter, theApp.GetConfig("filter", 0)); + ComboBoxInit(IDC_DITHERING, theApp.m_gpu_dithering, theApp.GetConfig("dithering", 1)); + ComboBoxInit(IDC_ASPECTRATIO, theApp.m_gpu_aspectratio, theApp.GetConfig("AspectRatio", 1)); + ComboBoxInit(IDC_SCALE, theApp.m_gpu_scale, theApp.GetConfig("scale_x", 0) | (theApp.GetConfig("scale_y", 0) << 2)); + + CheckDlgButton(m_hWnd, IDC_WINDOWED, theApp.GetConfig("windowed", 1)); + + SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETRANGE, 0, MAKELPARAM(16, 1)); + SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("swthreads", 1), 0)); + + UpdateControls(); +} + +bool GPUSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) +{ + if(id == IDC_RENDERER && code == CBN_SELCHANGE) + { + UpdateControls(); + } + else if(id == IDOK) + { + INT_PTR data; + + if(ComboBoxGetSelData(IDC_RESOLUTION, data)) + { + const D3DDISPLAYMODE* mode = (D3DDISPLAYMODE*)data; + + theApp.SetConfig("ModeWidth", (int)mode->Width); + theApp.SetConfig("ModeHeight", (int)mode->Height); + theApp.SetConfig("ModeRefreshRate", (int)mode->RefreshRate); + } + + if(ComboBoxGetSelData(IDC_RENDERER, data)) + { + theApp.SetConfig("Renderer", (int)data); + } + + if(ComboBoxGetSelData(IDC_FILTER, data)) + { + theApp.SetConfig("filter", (int)data); + } + + if(ComboBoxGetSelData(IDC_DITHERING, data)) + { + theApp.SetConfig("dithering", (int)data); + } + + if(ComboBoxGetSelData(IDC_ASPECTRATIO, data)) + { + theApp.SetConfig("AspectRatio", (int)data); + } + + if(ComboBoxGetSelData(IDC_SCALE, data)) + { + theApp.SetConfig("scale_x", data & 3); + theApp.SetConfig("scale_y", (data >> 2) & 3); + } + + theApp.SetConfig("swthreads", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0)); + theApp.SetConfig("windowed", (int)IsDlgButtonChecked(m_hWnd, IDC_WINDOWED)); + } + + return __super::OnCommand(hWnd, id, code); +} + +void GPUSettingsDlg::UpdateControls() +{ + INT_PTR i; + + if(ComboBoxGetSelData(IDC_RENDERER, i)) + { + bool dx9 = i == 0; + bool dx11 = i == 1; + bool sw = i >= 0 && i <= 1; + + ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), dx9 ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO11), dx11 ? SW_SHOW : SW_HIDE); + + EnableWindow(GetDlgItem(m_hWnd, IDC_SCALE), sw); + EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_EDIT), sw); + EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS), sw); + } } \ No newline at end of file diff --git a/plugins/GSdx/GPUSettingsDlg.h b/plugins/GSdx/GPUSettingsDlg.h index 85064b3cd9..687fb31edf 100644 --- a/plugins/GSdx/GPUSettingsDlg.h +++ b/plugins/GSdx/GPUSettingsDlg.h @@ -1,39 +1,39 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "GSDialog.h" -#include "GSSetting.h" - -class GPUSettingsDlg : public GSDialog -{ - list m_modes; - - void UpdateControls(); - -protected: - void OnInit(); - bool OnCommand(HWND hWnd, UINT id, UINT code); - -public: - GPUSettingsDlg(); -}; +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#include "GSDialog.h" +#include "GSSetting.h" + +class GPUSettingsDlg : public GSDialog +{ + list m_modes; + + void UpdateControls(); + +protected: + void OnInit(); + bool OnCommand(HWND hWnd, UINT id, UINT code); + +public: + GPUSettingsDlg(); +}; diff --git a/plugins/GSdx/GPUSetupPrimCodeGenerator.cpp b/plugins/GSdx/GPUSetupPrimCodeGenerator.cpp index a926d52d6a..f3c4de37d5 100644 --- a/plugins/GSdx/GPUSetupPrimCodeGenerator.cpp +++ b/plugins/GSdx/GPUSetupPrimCodeGenerator.cpp @@ -1,220 +1,220 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -// TODO: x64 - -#include "stdafx.h" -#include "GSVertexSW.h" -#include "GPUSetupPrimCodeGenerator.h" - -using namespace Xbyak; - -GPUSetupPrimCodeGenerator::GPUSetupPrimCodeGenerator(void* param, uint32 key, void* code, size_t maxsize) - : GSCodeGenerator(code, maxsize) - , m_local(*(GPUScanlineLocalData*)param) -{ - #if _M_AMD64 - #error TODO - #endif - - m_sel.key = key; - - Generate(); -} - -void GPUSetupPrimCodeGenerator::Generate() -{ - if(m_sel.tme && !m_sel.twin) - { - pcmpeqd(xmm0, xmm0); - - if(m_sel.sprite) - { - // t = (GSVector4i(vertices[1].t) >> 8) - GSVector4i::x00000001(); - - cvttps2dq(xmm1, ptr[ecx + sizeof(GSVertexSW) * 1 + 32]); - psrld(xmm1, 8); - psrld(xmm0, 31); - psubd(xmm1, xmm0); - - // t = t.ps32(t); - // t = t.upl16(t); - - packssdw(xmm1, xmm1); - punpcklwd(xmm1, xmm1); - - // m_local.twin[2].u = t.xxxx(); - // m_local.twin[2].v = t.yyyy(); - - pshufd(xmm2, xmm1, _MM_SHUFFLE(0, 0, 0, 0)); - pshufd(xmm3, xmm1, _MM_SHUFFLE(1, 1, 1, 1)); - - movdqa(ptr[&m_local.twin[2].u], xmm2); - movdqa(ptr[&m_local.twin[2].v], xmm3); - } - else - { - // TODO: not really needed - - // m_local.twin[2].u = GSVector4i::x00ff(); - // m_local.twin[2].v = GSVector4i::x00ff(); - - psrlw(xmm0, 8); - - movdqa(ptr[&m_local.twin[2].u], xmm0); - movdqa(ptr[&m_local.twin[2].v], xmm0); - } - } - - if(m_sel.tme || m_sel.iip && m_sel.tfx != 3) - { - for(int i = 0; i < 3; i++) - { - movaps(Xmm(5 + i), ptr[&m_shift[i]]); - } - - // GSVector4 dt = dscan.t; - // GSVector4 dc = dscan.c; - - movaps(xmm4, ptr[edx]); - movaps(xmm3, ptr[edx + 32]); - - // GSVector4i dtc8 = GSVector4i(dt * 8.0f).ps32(GSVector4i(dc * 8.0f)); - - movaps(xmm1, xmm3); - mulps(xmm1, xmm5); - cvttps2dq(xmm1, xmm1); - movaps(xmm2, xmm4); - mulps(xmm2, xmm5); - cvttps2dq(xmm2, xmm2); - packssdw(xmm1, xmm2); - - if(m_sel.tme) - { - // m_local.d8.st = dtc8.upl16(dtc8); - - movdqa(xmm0, xmm1); - punpcklwd(xmm0, xmm0); - movdqa(ptr[&m_local.d8.st], xmm0); - } - - if(m_sel.iip && m_sel.tfx != 3) - { - // m_local.d8.c = dtc8.uph16(dtc8); - - punpckhwd(xmm1, xmm1); - movdqa(ptr[&m_local.d8.c], xmm1); - } - - // xmm3 = dt - // xmm4 = dc - // xmm6 = ps0123 - // xmm7 = ps4567 - // xmm0, xmm1, xmm2, xmm5 = free - - if(m_sel.tme) - { - // GSVector4 dtx = dt.xxxx(); - // GSVector4 dty = dt.yyyy(); - - movaps(xmm0, xmm3); - shufps(xmm3, xmm3, _MM_SHUFFLE(0, 0, 0, 0)); - shufps(xmm0, xmm0, _MM_SHUFFLE(1, 1, 1, 1)); - - // m_local.d.s = GSVector4i(dtx * ps0123).ps32(GSVector4i(dtx * ps4567)); - - movaps(xmm1, xmm3); - mulps(xmm3, xmm6); - mulps(xmm1, xmm7); - cvttps2dq(xmm3, xmm3); - cvttps2dq(xmm1, xmm1); - packssdw(xmm3, xmm1); - movdqa(ptr[&m_local.d.s], xmm3); - - // m_local.d.t = GSVector4i(dty * ps0123).ps32(GSVector4i(dty * ps4567)); - - movaps(xmm1, xmm0); - mulps(xmm0, xmm6); - mulps(xmm1, xmm7); - cvttps2dq(xmm0, xmm0); - cvttps2dq(xmm1, xmm1); - packssdw(xmm0, xmm1); - movdqa(ptr[&m_local.d.t], xmm0); - } - - // xmm4 = dc - // xmm6 = ps0123 - // xmm7 = ps4567 - // xmm0, xmm1, zmm2, xmm3, xmm5 = free - - if(m_sel.iip && m_sel.tfx != 3) - { - // GSVector4 dcx = dc.xxxx(); - // GSVector4 dcy = dc.yyyy(); - // GSVector4 dcz = dc.zzzz(); - - movaps(xmm0, xmm4); - movaps(xmm1, xmm4); - shufps(xmm4, xmm4, _MM_SHUFFLE(0, 0, 0, 0)); - shufps(xmm0, xmm0, _MM_SHUFFLE(1, 1, 1, 1)); - shufps(xmm1, xmm1, _MM_SHUFFLE(2, 2, 2, 2)); - - // m_local.d.r = GSVector4i(dcx * ps0123).ps32(GSVector4i(dcx * ps4567)); - - movaps(xmm2, xmm4); - mulps(xmm4, xmm6); - mulps(xmm2, xmm7); - cvttps2dq(xmm4, xmm4); - cvttps2dq(xmm2, xmm2); - packssdw(xmm4, xmm2); - movdqa(ptr[&m_local.d.r], xmm4); - - // m_local.d.g = GSVector4i(dcy * ps0123).ps32(GSVector4i(dcy * ps4567)); - - movaps(xmm2, xmm0); - mulps(xmm0, xmm6); - mulps(xmm2, xmm7); - cvttps2dq(xmm0, xmm0); - cvttps2dq(xmm2, xmm2); - packssdw(xmm0, xmm2); - movdqa(ptr[&m_local.d.g], xmm0); - - // m_local.d.b = GSVector4i(dcz * ps0123).ps32(GSVector4i(dcz * ps4567)); - - movaps(xmm2, xmm1); - mulps(xmm1, xmm6); - mulps(xmm2, xmm7); - cvttps2dq(xmm1, xmm1); - cvttps2dq(xmm2, xmm2); - packssdw(xmm1, xmm2); - movdqa(ptr[&m_local.d.b], xmm1); - } - } - - ret(); -} - -const GSVector4 GPUSetupPrimCodeGenerator::m_shift[3] = -{ - GSVector4(8.0f, 8.0f, 8.0f, 8.0f), - GSVector4(0.0f, 1.0f, 2.0f, 3.0f), - GSVector4(4.0f, 5.0f, 6.0f, 7.0f), -}; +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +// TODO: x64 + +#include "stdafx.h" +#include "GSVertexSW.h" +#include "GPUSetupPrimCodeGenerator.h" + +using namespace Xbyak; + +GPUSetupPrimCodeGenerator::GPUSetupPrimCodeGenerator(void* param, uint32 key, void* code, size_t maxsize) + : GSCodeGenerator(code, maxsize) + , m_local(*(GPUScanlineLocalData*)param) +{ + #if _M_AMD64 + #error TODO + #endif + + m_sel.key = key; + + Generate(); +} + +void GPUSetupPrimCodeGenerator::Generate() +{ + if(m_sel.tme && !m_sel.twin) + { + pcmpeqd(xmm0, xmm0); + + if(m_sel.sprite) + { + // t = (GSVector4i(vertices[1].t) >> 8) - GSVector4i::x00000001(); + + cvttps2dq(xmm1, ptr[ecx + sizeof(GSVertexSW) * 1 + 32]); + psrld(xmm1, 8); + psrld(xmm0, 31); + psubd(xmm1, xmm0); + + // t = t.ps32(t); + // t = t.upl16(t); + + packssdw(xmm1, xmm1); + punpcklwd(xmm1, xmm1); + + // m_local.twin[2].u = t.xxxx(); + // m_local.twin[2].v = t.yyyy(); + + pshufd(xmm2, xmm1, _MM_SHUFFLE(0, 0, 0, 0)); + pshufd(xmm3, xmm1, _MM_SHUFFLE(1, 1, 1, 1)); + + movdqa(ptr[&m_local.twin[2].u], xmm2); + movdqa(ptr[&m_local.twin[2].v], xmm3); + } + else + { + // TODO: not really needed + + // m_local.twin[2].u = GSVector4i::x00ff(); + // m_local.twin[2].v = GSVector4i::x00ff(); + + psrlw(xmm0, 8); + + movdqa(ptr[&m_local.twin[2].u], xmm0); + movdqa(ptr[&m_local.twin[2].v], xmm0); + } + } + + if(m_sel.tme || m_sel.iip && m_sel.tfx != 3) + { + for(int i = 0; i < 3; i++) + { + movaps(Xmm(5 + i), ptr[&m_shift[i]]); + } + + // GSVector4 dt = dscan.t; + // GSVector4 dc = dscan.c; + + movaps(xmm4, ptr[edx]); + movaps(xmm3, ptr[edx + 32]); + + // GSVector4i dtc8 = GSVector4i(dt * 8.0f).ps32(GSVector4i(dc * 8.0f)); + + movaps(xmm1, xmm3); + mulps(xmm1, xmm5); + cvttps2dq(xmm1, xmm1); + movaps(xmm2, xmm4); + mulps(xmm2, xmm5); + cvttps2dq(xmm2, xmm2); + packssdw(xmm1, xmm2); + + if(m_sel.tme) + { + // m_local.d8.st = dtc8.upl16(dtc8); + + movdqa(xmm0, xmm1); + punpcklwd(xmm0, xmm0); + movdqa(ptr[&m_local.d8.st], xmm0); + } + + if(m_sel.iip && m_sel.tfx != 3) + { + // m_local.d8.c = dtc8.uph16(dtc8); + + punpckhwd(xmm1, xmm1); + movdqa(ptr[&m_local.d8.c], xmm1); + } + + // xmm3 = dt + // xmm4 = dc + // xmm6 = ps0123 + // xmm7 = ps4567 + // xmm0, xmm1, xmm2, xmm5 = free + + if(m_sel.tme) + { + // GSVector4 dtx = dt.xxxx(); + // GSVector4 dty = dt.yyyy(); + + movaps(xmm0, xmm3); + shufps(xmm3, xmm3, _MM_SHUFFLE(0, 0, 0, 0)); + shufps(xmm0, xmm0, _MM_SHUFFLE(1, 1, 1, 1)); + + // m_local.d.s = GSVector4i(dtx * ps0123).ps32(GSVector4i(dtx * ps4567)); + + movaps(xmm1, xmm3); + mulps(xmm3, xmm6); + mulps(xmm1, xmm7); + cvttps2dq(xmm3, xmm3); + cvttps2dq(xmm1, xmm1); + packssdw(xmm3, xmm1); + movdqa(ptr[&m_local.d.s], xmm3); + + // m_local.d.t = GSVector4i(dty * ps0123).ps32(GSVector4i(dty * ps4567)); + + movaps(xmm1, xmm0); + mulps(xmm0, xmm6); + mulps(xmm1, xmm7); + cvttps2dq(xmm0, xmm0); + cvttps2dq(xmm1, xmm1); + packssdw(xmm0, xmm1); + movdqa(ptr[&m_local.d.t], xmm0); + } + + // xmm4 = dc + // xmm6 = ps0123 + // xmm7 = ps4567 + // xmm0, xmm1, zmm2, xmm3, xmm5 = free + + if(m_sel.iip && m_sel.tfx != 3) + { + // GSVector4 dcx = dc.xxxx(); + // GSVector4 dcy = dc.yyyy(); + // GSVector4 dcz = dc.zzzz(); + + movaps(xmm0, xmm4); + movaps(xmm1, xmm4); + shufps(xmm4, xmm4, _MM_SHUFFLE(0, 0, 0, 0)); + shufps(xmm0, xmm0, _MM_SHUFFLE(1, 1, 1, 1)); + shufps(xmm1, xmm1, _MM_SHUFFLE(2, 2, 2, 2)); + + // m_local.d.r = GSVector4i(dcx * ps0123).ps32(GSVector4i(dcx * ps4567)); + + movaps(xmm2, xmm4); + mulps(xmm4, xmm6); + mulps(xmm2, xmm7); + cvttps2dq(xmm4, xmm4); + cvttps2dq(xmm2, xmm2); + packssdw(xmm4, xmm2); + movdqa(ptr[&m_local.d.r], xmm4); + + // m_local.d.g = GSVector4i(dcy * ps0123).ps32(GSVector4i(dcy * ps4567)); + + movaps(xmm2, xmm0); + mulps(xmm0, xmm6); + mulps(xmm2, xmm7); + cvttps2dq(xmm0, xmm0); + cvttps2dq(xmm2, xmm2); + packssdw(xmm0, xmm2); + movdqa(ptr[&m_local.d.g], xmm0); + + // m_local.d.b = GSVector4i(dcz * ps0123).ps32(GSVector4i(dcz * ps4567)); + + movaps(xmm2, xmm1); + mulps(xmm1, xmm6); + mulps(xmm2, xmm7); + cvttps2dq(xmm1, xmm1); + cvttps2dq(xmm2, xmm2); + packssdw(xmm1, xmm2); + movdqa(ptr[&m_local.d.b], xmm1); + } + } + + ret(); +} + +const GSVector4 GPUSetupPrimCodeGenerator::m_shift[3] = +{ + GSVector4(8.0f, 8.0f, 8.0f, 8.0f), + GSVector4(0.0f, 1.0f, 2.0f, 3.0f), + GSVector4(4.0f, 5.0f, 6.0f, 7.0f), +}; diff --git a/plugins/GSdx/GPUSetupPrimCodeGenerator.h b/plugins/GSdx/GPUSetupPrimCodeGenerator.h index 2d0010bb87..1dacffaab8 100644 --- a/plugins/GSdx/GPUSetupPrimCodeGenerator.h +++ b/plugins/GSdx/GPUSetupPrimCodeGenerator.h @@ -1,40 +1,40 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "GPUScanlineEnvironment.h" -#include "GSFunctionMap.h" - -class GPUSetupPrimCodeGenerator : public GSCodeGenerator -{ - void operator = (const GPUSetupPrimCodeGenerator&); - - static const GSVector4 m_shift[3]; - - GPUScanlineSelector m_sel; - GPUScanlineLocalData& m_local; - - void Generate(); - -public: - GPUSetupPrimCodeGenerator(void* param, uint32 key, void* code, size_t maxsize); +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#include "GPUScanlineEnvironment.h" +#include "GSFunctionMap.h" + +class GPUSetupPrimCodeGenerator : public GSCodeGenerator +{ + void operator = (const GPUSetupPrimCodeGenerator&); + + static const GSVector4 m_shift[3]; + + GPUScanlineSelector m_sel; + GPUScanlineLocalData& m_local; + + void Generate(); + +public: + GPUSetupPrimCodeGenerator(void* param, uint32 key, void* code, size_t maxsize); }; \ No newline at end of file diff --git a/plugins/GSdx/GPUState.cpp b/plugins/GSdx/GPUState.cpp index ed500c89a4..354e9fe20a 100644 --- a/plugins/GSdx/GPUState.cpp +++ b/plugins/GSdx/GPUState.cpp @@ -1,746 +1,746 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "GPUState.h" - -GPUState::GPUState() - : s_n(0) -{ - memset(m_status, 0, sizeof(m_status)); - - for(int i = 0; i < countof(m_fpGPUStatusCommandHandlers); i++) - { - m_fpGPUStatusCommandHandlers[i] = &GPUState::SCH_Null; - } - - m_fpGPUStatusCommandHandlers[0x00] = &GPUState::SCH_ResetGPU; - m_fpGPUStatusCommandHandlers[0x01] = &GPUState::SCH_ResetCommandBuffer; - m_fpGPUStatusCommandHandlers[0x02] = &GPUState::SCH_ResetIRQ; - m_fpGPUStatusCommandHandlers[0x03] = &GPUState::SCH_DisplayEnable; - m_fpGPUStatusCommandHandlers[0x04] = &GPUState::SCH_DMASetup; - m_fpGPUStatusCommandHandlers[0x05] = &GPUState::SCH_StartOfDisplayArea; - m_fpGPUStatusCommandHandlers[0x06] = &GPUState::SCH_HorizontalDisplayRange; - m_fpGPUStatusCommandHandlers[0x07] = &GPUState::SCH_VerticalDisplayRange; - m_fpGPUStatusCommandHandlers[0x08] = &GPUState::SCH_DisplayMode; - m_fpGPUStatusCommandHandlers[0x10] = &GPUState::SCH_GPUInfo; - - m_fpGPUPacketHandler[0] = &GPUState::PH_Command; - m_fpGPUPacketHandler[1] = &GPUState::PH_Polygon; - m_fpGPUPacketHandler[2] = &GPUState::PH_Line; - m_fpGPUPacketHandler[3] = &GPUState::PH_Sprite; - m_fpGPUPacketHandler[4] = &GPUState::PH_Move; - m_fpGPUPacketHandler[5] = &GPUState::PH_Write; - m_fpGPUPacketHandler[6] = &GPUState::PH_Read; - m_fpGPUPacketHandler[7] = &GPUState::PH_Environment; - - Reset(); -} - -GPUState::~GPUState() -{ -} - -void GPUState::Reset() -{ - m_env.Reset(); - - m_mem.Invalidate(GSVector4i(0, 0, 1024, 512)); - - memset(&m_v, 0, sizeof(m_v)); -} - -void GPUState::Flush() -{ - FlushPrim(); -} - -void GPUState::SetPrim(GPUReg* r) -{ - if(m_env.PRIM.TYPE != r->PRIM.TYPE) - { - ResetPrim(); - } - - GPURegPRIM PRIM = r->PRIM; - - PRIM.VTX = 0; - - switch(r->PRIM.TYPE) - { - case GPU_POLYGON: - PRIM.u32 = (r->PRIM.u32 & 0xF7000000) | 3; // TYPE IIP TME ABE TGE - break; - case GPU_LINE: - PRIM.u32 = (r->PRIM.u32 & 0xF2000000) | 2; // TYPE IIP ABE - PRIM.TGE = 1; // ? - break; - case GPU_SPRITE: - PRIM.u32 = (r->PRIM.u32 & 0xE7000000) | 2; // TYPE TME ABE TGE - break; - } - - if(m_env.PRIM.u32 != PRIM.u32) - { - Flush(); - - m_env.PRIM = PRIM; - } -} - -void GPUState::SetCLUT(GPUReg* r) -{ - uint32 mask = 0xFFFF0000; // X Y - - uint32 value = (m_env.CLUT.u32 & ~mask) | (r->u32 & mask); - - if(m_env.CLUT.u32 != value) - { - Flush(); - - m_env.CLUT.u32 = value; - } -} - -void GPUState::SetTPAGE(GPUReg* r) -{ - uint32 mask = 0x000001FF; // TP ABR TY TX - - uint32 value = (m_env.STATUS.u32 & ~mask) | ((r->u32 >> 16) & mask); - - if(m_env.STATUS.u32 != value) - { - Flush(); - - m_env.STATUS.u32 = value; - } -} - -void GPUState::Invalidate(const GSVector4i& r) -{ - m_mem.Invalidate(r); -} - -void GPUState::WriteData(const uint8* mem, uint32 size) -{ - GSPerfMonAutoTimer pmat(m_perfmon); - - size <<= 2; - - m_write.Append(mem, size); - - int i = 0; - - while(i < m_write.bytes) - { - GPUReg* r = (GPUReg*)&m_write.buff[i]; - - int ret = (this->*m_fpGPUPacketHandler[r->PACKET.TYPE])(r, (m_write.bytes - i) >> 2); - - if(ret == 0) return; // need more data - - i += ret << 2; - } - - m_write.Remove(i); -} - -void GPUState::ReadData(uint8* mem, uint32 size) -{ - GSPerfMonAutoTimer pmat(m_perfmon); - - int remaining = m_read.bytes - m_read.cur; - - int bytes = (int)size << 2; - - if(bytes > remaining) - { - // ASSERT(0); - - // printf"WARNING: ReadData\n"); - - // memset(&mem[remaining], 0, bytes - remaining); - - bytes = remaining; - } - - memcpy(mem, &m_read.buff[m_read.cur], bytes); - - m_read.cur += bytes; - - if(m_read.cur >= m_read.bytes) - { - m_env.STATUS.IMG = 0; - } -} - -void GPUState::WriteStatus(uint32 status) -{ - GSPerfMonAutoTimer pmat(m_perfmon); - - uint32 b = status >> 24; - - m_status[b] = status; - - (this->*m_fpGPUStatusCommandHandlers[b])((GPUReg*)&status); -} - -uint32 GPUState::ReadStatus() -{ - GSPerfMonAutoTimer pmat(m_perfmon); - - m_env.STATUS.LCF = ~m_env.STATUS.LCF; // ? - - return m_env.STATUS.u32; -} - -void GPUState::Freeze(GPUFreezeData* data) -{ - data->status = m_env.STATUS.u32; - memcpy(data->control, m_status, 256 * 4); - m_mem.ReadRect(GSVector4i(0, 0, 1024, 512), data->vram); -} - -void GPUState::Defrost(const GPUFreezeData* data) -{ - m_env.STATUS.u32 = data->status; - memcpy(m_status, data->control, 256 * 4); - m_mem.WriteRect(GSVector4i(0, 0, 1024, 512), data->vram); - - for(int i = 0; i <= 8; i++) - { - WriteStatus(m_status[i]); - } -} - -void GPUState::SCH_Null(GPUReg* r) -{ - ASSERT(0); -} - -void GPUState::SCH_ResetGPU(GPUReg* r) -{ - Reset(); -} - -void GPUState::SCH_ResetCommandBuffer(GPUReg* r) -{ - // ? -} - -void GPUState::SCH_ResetIRQ(GPUReg* r) -{ - // ? -} - -void GPUState::SCH_DisplayEnable(GPUReg* r) -{ - m_env.STATUS.DEN = r->DEN.DEN; -} - -void GPUState::SCH_DMASetup(GPUReg* r) -{ - m_env.STATUS.DMA = r->DMA.DMA; -} - -void GPUState::SCH_StartOfDisplayArea(GPUReg* r) -{ - m_env.DAREA = r->DAREA; -} - -void GPUState::SCH_HorizontalDisplayRange(GPUReg* r) -{ - m_env.DHRANGE = r->DHRANGE; -} - -void GPUState::SCH_VerticalDisplayRange(GPUReg* r) -{ - m_env.DVRANGE = r->DVRANGE; -} - -void GPUState::SCH_DisplayMode(GPUReg* r) -{ - m_env.STATUS.WIDTH0 = r->DMODE.WIDTH0; - m_env.STATUS.HEIGHT = r->DMODE.HEIGHT; - m_env.STATUS.ISPAL = r->DMODE.ISPAL; - m_env.STATUS.ISRGB24 = r->DMODE.ISRGB24; - m_env.STATUS.ISINTER = r->DMODE.ISINTER; - m_env.STATUS.WIDTH1 = r->DMODE.WIDTH1; -} - -void GPUState::SCH_GPUInfo(GPUReg* r) -{ - uint32 value = 0; - - switch(r->GPUINFO.PARAM) - { - case 0x2: - value = m_env.TWIN.u32; - break; - case 0x0: - case 0x1: - case 0x3: - value = m_env.DRAREATL.u32; - break; - case 0x4: - value = m_env.DRAREABR.u32; - break; - case 0x5: - case 0x6: - value = m_env.DROFF.u32; - break; - case 0x7: - value = 2; - break; - case 0x8: - case 0xf: - value = 0xBFC03720; // ? - break; - default: - ASSERT(0); - break; - } - - m_read.RemoveAll(); - m_read.Append((uint8*)&value, 4); - m_read.cur = 0; -} - -int GPUState::PH_Command(GPUReg* r, int size) -{ - switch(r->PACKET.OPTION) - { - case 0: // ??? - - return 1; - - case 1: // clear cache - - return 1; - - case 2: // fillrect - - if(size < 3) return 0; - - Flush(); - - GSVector4i r2; - - r2.left = r[1].XY.X; - r2.top = r[1].XY.Y; - r2.right = r2.left + r[2].XY.X; - r2.bottom = r2.top + r[2].XY.Y; - - uint16 c = (uint16)(((r[0].RGB.R >> 3) << 10) | ((r[0].RGB.R >> 3) << 5) | (r[0].RGB.R >> 3)); - - m_mem.FillRect(r2, c); - - Invalidate(r2); - - Dump("f"); - - return 3; - } - - ASSERT(0); - - return 1; -} - -int GPUState::PH_Polygon(GPUReg* r, int size) -{ - int required = 1; - - int vertices = r[0].POLYGON.VTX ? 4 : 3; - - required += vertices; - - if(r[0].POLYGON.TME) required += vertices; - - if(r[0].POLYGON.IIP) required += vertices - 1; - - if(size < required) return 0; - - // - - SetPrim(r); - - if(r[0].POLYGON.TME) - { - SetCLUT(&r[2]); - - SetTPAGE(&r[r[0].POLYGON.IIP ? 5 : 4]); - } - - // - - GPUVertex v[4]; - - for(int i = 0, j = 0; j < vertices; j++) - { - v[j].RGB = r[r[0].POLYGON.IIP ? i : 0].RGB; - - if(j == 0 || r[0].POLYGON.IIP) i++; - - v[j].XY = r[i++].XY; - - if(r[0].POLYGON.TME) - { - v[j].UV.X = r[i].UV.U; - v[j].UV.Y = r[i].UV.V; - - i++; - } - } - - for(int i = 0; i <= vertices - 3; i++) - { - for(int j = 0; j < 3; j++) - { - m_v = v[i + j]; - - VertexKick(); - } - } - - // - - return required; -} - -int GPUState::PH_Line(GPUReg* r, int size) -{ - int required = 1; - - int vertices = 0; - - if(r->LINE.PLL) - { - required++; - - for(int i = 1; i < size; i++) - { - if(r[i].u32 == 0x55555555) - { - vertices = i - 1; - } - } - - if(vertices < 2) - { - return 0; - } - } - else - { - vertices = 2; - } - - required += vertices; - - if(r->LINE.IIP) required += vertices - 1; - - // - - SetPrim(r); - - // - - for(int i = 0, j = 0; j < vertices; j++) - { - if(j >= 2) VertexKick(); - - m_v.RGB = r[r[0].LINE.IIP ? i : 0].RGB; - - if(j == 0 || r[0].LINE.IIP) i++; - - m_v.XY = r[i++].XY; - - VertexKick(); - } - - // - - return required; -} - -int GPUState::PH_Sprite(GPUReg* r, int size) -{ - int required = 2; - - if(r[0].SPRITE.TME) required++; - if(r[0].SPRITE.SIZE == 0) required++; - - if(size < required) return 0; - - // - - SetPrim(r); - - if(r[0].SPRITE.TME) - { - SetCLUT(&r[2]); - } - - // - - int i = 0; - - m_v.RGB = r[i++].RGB; - - m_v.XY = r[i++].XY; - - if(r[0].SPRITE.TME) - { - m_v.UV.X = r[i].UV.U; - m_v.UV.Y = r[i].UV.V; - - i++; - } - - VertexKick(); - - int w = 0; - int h = 0; - - switch(r[0].SPRITE.SIZE) - { - case 0: w = r[i].XY.X; h = r[i].XY.Y; i++; break; - case 1: w = h = 1; break; - case 2: w = h = 8; break; - case 3: w = h = 16; break; - default: __assume(0); - } - - m_v.XY.X += w; - m_v.XY.Y += h; - - if(r[0].SPRITE.TME) - { - m_v.UV.X += w; - m_v.UV.Y += h; - } - - VertexKick(); - - // - - return required; -} - -int GPUState::PH_Move(GPUReg* r, int size) -{ - if(size < 4) return 0; - - Flush(); - - int sx = r[1].XY.X; - int sy = r[1].XY.Y; - - int dx = r[2].XY.X; - int dy = r[2].XY.Y; - - int w = r[3].XY.X; - int h = r[3].XY.Y; - - m_mem.MoveRect(sx, sy, dx, dy, w, h); - - Invalidate(GSVector4i(dx, dy, dx + w, dy + h)); - - // Dump("m"); - - return 4; -} - -int GPUState::PH_Write(GPUReg* r, int size) -{ - if(size < 3) return 0; - - int w = r[2].XY.X; - int h = r[2].XY.Y; - - int required = 3 + ((w * h + 1) >> 1); - - if(size < required) return 0; - - Flush(); - - GSVector4i r2; - - r2.left = r[1].XY.X; - r2.top = r[1].XY.Y; - r2.right = r2.left + w; - r2.bottom = r2.top + h; - - m_mem.WriteRect(r2, (const uint16*)&r[3]); - - Invalidate(r2); - - Dump("w"); - - m_perfmon.Put(GSPerfMon::Swizzle, w * h * 2); - - return required; -} - -int GPUState::PH_Read(GPUReg* r, int size) -{ - if(size < 3) return 0; - - Flush(); - - int w = r[2].XY.X; - int h = r[2].XY.Y; - - GSVector4i r2; - - r2.left = r[1].XY.X; - r2.top = r[1].XY.Y; - r2.right = r2.left + w; - r2.bottom = r2.top + h; - - m_read.bytes = ((w * h + 1) & ~1) * 2; - m_read.cur = 0; - m_read.Reserve(m_read.bytes); - - m_mem.ReadRect(r2, (uint16*)m_read.buff); - - Dump("r"); - - m_env.STATUS.IMG = 1; - - return 3; -} - -int GPUState::PH_Environment(GPUReg* r, int size) -{ - Flush(); // TODO: only call when something really changes - - switch(r->PACKET.OPTION) - { - case 1: // draw mode setting - - m_env.STATUS.TX = r->MODE.TX; - m_env.STATUS.TY = r->MODE.TY; - m_env.STATUS.ABR = r->MODE.ABR; - m_env.STATUS.TP = r->MODE.TP; - m_env.STATUS.DTD = r->MODE.DTD; - m_env.STATUS.DFE = r->MODE.DFE; - - return 1; - - case 2: // texture window setting - - m_env.TWIN = r->TWIN; - - return 1; - - case 3: // set drawing area top left - - m_env.DRAREATL = r->DRAREA; - - return 1; - - case 4: // set drawing area bottom right - - m_env.DRAREABR = r->DRAREA; - - return 1; - - case 5: // drawing offset - - m_env.DROFF = r->DROFF; - - return 1; - - case 6: // mask setting - - m_env.STATUS.MD = r->MASK.MD; - m_env.STATUS.ME = r->MASK.ME; - - return 1; - } - - ASSERT(0); - - return 1; -} - -// - -GPUState::Buffer::Buffer() -{ - bytes = 0; - maxbytes = 4096; - buff = (uint8*)_aligned_malloc(maxbytes, 16); - cur = 0; -} - -GPUState::Buffer::~Buffer() -{ - _aligned_free(buff); -} - -void GPUState::Buffer::Reserve(int size) -{ - if(size > maxbytes) - { - maxbytes = (maxbytes + size + 1023) & ~1023; - - if(buff != NULL) _aligned_free(buff); - - buff = (uint8*)_aligned_malloc(maxbytes, 16); - } -} - -void GPUState::Buffer::Append(const uint8* src, int size) -{ - Reserve(bytes + (int)size); - - memcpy(&buff[bytes], src, size); - - bytes += size; -} - -void GPUState::Buffer::Remove(int size) -{ - ASSERT(size <= bytes); - - if(size < bytes) - { - memmove(&buff[0], &buff[size], bytes - size); - - bytes -= size; - } - else - { - bytes = 0; - } - - #ifdef DEBUG - memset(&buff[bytes], 0xff, maxbytes - bytes); - #endif -} - -void GPUState::Buffer::RemoveAll() -{ - bytes = 0; -} +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "stdafx.h" +#include "GPUState.h" + +GPUState::GPUState() + : s_n(0) +{ + memset(m_status, 0, sizeof(m_status)); + + for(int i = 0; i < countof(m_fpGPUStatusCommandHandlers); i++) + { + m_fpGPUStatusCommandHandlers[i] = &GPUState::SCH_Null; + } + + m_fpGPUStatusCommandHandlers[0x00] = &GPUState::SCH_ResetGPU; + m_fpGPUStatusCommandHandlers[0x01] = &GPUState::SCH_ResetCommandBuffer; + m_fpGPUStatusCommandHandlers[0x02] = &GPUState::SCH_ResetIRQ; + m_fpGPUStatusCommandHandlers[0x03] = &GPUState::SCH_DisplayEnable; + m_fpGPUStatusCommandHandlers[0x04] = &GPUState::SCH_DMASetup; + m_fpGPUStatusCommandHandlers[0x05] = &GPUState::SCH_StartOfDisplayArea; + m_fpGPUStatusCommandHandlers[0x06] = &GPUState::SCH_HorizontalDisplayRange; + m_fpGPUStatusCommandHandlers[0x07] = &GPUState::SCH_VerticalDisplayRange; + m_fpGPUStatusCommandHandlers[0x08] = &GPUState::SCH_DisplayMode; + m_fpGPUStatusCommandHandlers[0x10] = &GPUState::SCH_GPUInfo; + + m_fpGPUPacketHandler[0] = &GPUState::PH_Command; + m_fpGPUPacketHandler[1] = &GPUState::PH_Polygon; + m_fpGPUPacketHandler[2] = &GPUState::PH_Line; + m_fpGPUPacketHandler[3] = &GPUState::PH_Sprite; + m_fpGPUPacketHandler[4] = &GPUState::PH_Move; + m_fpGPUPacketHandler[5] = &GPUState::PH_Write; + m_fpGPUPacketHandler[6] = &GPUState::PH_Read; + m_fpGPUPacketHandler[7] = &GPUState::PH_Environment; + + Reset(); +} + +GPUState::~GPUState() +{ +} + +void GPUState::Reset() +{ + m_env.Reset(); + + m_mem.Invalidate(GSVector4i(0, 0, 1024, 512)); + + memset(&m_v, 0, sizeof(m_v)); +} + +void GPUState::Flush() +{ + FlushPrim(); +} + +void GPUState::SetPrim(GPUReg* r) +{ + if(m_env.PRIM.TYPE != r->PRIM.TYPE) + { + ResetPrim(); + } + + GPURegPRIM PRIM = r->PRIM; + + PRIM.VTX = 0; + + switch(r->PRIM.TYPE) + { + case GPU_POLYGON: + PRIM.u32 = (r->PRIM.u32 & 0xF7000000) | 3; // TYPE IIP TME ABE TGE + break; + case GPU_LINE: + PRIM.u32 = (r->PRIM.u32 & 0xF2000000) | 2; // TYPE IIP ABE + PRIM.TGE = 1; // ? + break; + case GPU_SPRITE: + PRIM.u32 = (r->PRIM.u32 & 0xE7000000) | 2; // TYPE TME ABE TGE + break; + } + + if(m_env.PRIM.u32 != PRIM.u32) + { + Flush(); + + m_env.PRIM = PRIM; + } +} + +void GPUState::SetCLUT(GPUReg* r) +{ + uint32 mask = 0xFFFF0000; // X Y + + uint32 value = (m_env.CLUT.u32 & ~mask) | (r->u32 & mask); + + if(m_env.CLUT.u32 != value) + { + Flush(); + + m_env.CLUT.u32 = value; + } +} + +void GPUState::SetTPAGE(GPUReg* r) +{ + uint32 mask = 0x000001FF; // TP ABR TY TX + + uint32 value = (m_env.STATUS.u32 & ~mask) | ((r->u32 >> 16) & mask); + + if(m_env.STATUS.u32 != value) + { + Flush(); + + m_env.STATUS.u32 = value; + } +} + +void GPUState::Invalidate(const GSVector4i& r) +{ + m_mem.Invalidate(r); +} + +void GPUState::WriteData(const uint8* mem, uint32 size) +{ + GSPerfMonAutoTimer pmat(m_perfmon); + + size <<= 2; + + m_write.Append(mem, size); + + int i = 0; + + while(i < m_write.bytes) + { + GPUReg* r = (GPUReg*)&m_write.buff[i]; + + int ret = (this->*m_fpGPUPacketHandler[r->PACKET.TYPE])(r, (m_write.bytes - i) >> 2); + + if(ret == 0) return; // need more data + + i += ret << 2; + } + + m_write.Remove(i); +} + +void GPUState::ReadData(uint8* mem, uint32 size) +{ + GSPerfMonAutoTimer pmat(m_perfmon); + + int remaining = m_read.bytes - m_read.cur; + + int bytes = (int)size << 2; + + if(bytes > remaining) + { + // ASSERT(0); + + // printf"WARNING: ReadData\n"); + + // memset(&mem[remaining], 0, bytes - remaining); + + bytes = remaining; + } + + memcpy(mem, &m_read.buff[m_read.cur], bytes); + + m_read.cur += bytes; + + if(m_read.cur >= m_read.bytes) + { + m_env.STATUS.IMG = 0; + } +} + +void GPUState::WriteStatus(uint32 status) +{ + GSPerfMonAutoTimer pmat(m_perfmon); + + uint32 b = status >> 24; + + m_status[b] = status; + + (this->*m_fpGPUStatusCommandHandlers[b])((GPUReg*)&status); +} + +uint32 GPUState::ReadStatus() +{ + GSPerfMonAutoTimer pmat(m_perfmon); + + m_env.STATUS.LCF = ~m_env.STATUS.LCF; // ? + + return m_env.STATUS.u32; +} + +void GPUState::Freeze(GPUFreezeData* data) +{ + data->status = m_env.STATUS.u32; + memcpy(data->control, m_status, 256 * 4); + m_mem.ReadRect(GSVector4i(0, 0, 1024, 512), data->vram); +} + +void GPUState::Defrost(const GPUFreezeData* data) +{ + m_env.STATUS.u32 = data->status; + memcpy(m_status, data->control, 256 * 4); + m_mem.WriteRect(GSVector4i(0, 0, 1024, 512), data->vram); + + for(int i = 0; i <= 8; i++) + { + WriteStatus(m_status[i]); + } +} + +void GPUState::SCH_Null(GPUReg* r) +{ + ASSERT(0); +} + +void GPUState::SCH_ResetGPU(GPUReg* r) +{ + Reset(); +} + +void GPUState::SCH_ResetCommandBuffer(GPUReg* r) +{ + // ? +} + +void GPUState::SCH_ResetIRQ(GPUReg* r) +{ + // ? +} + +void GPUState::SCH_DisplayEnable(GPUReg* r) +{ + m_env.STATUS.DEN = r->DEN.DEN; +} + +void GPUState::SCH_DMASetup(GPUReg* r) +{ + m_env.STATUS.DMA = r->DMA.DMA; +} + +void GPUState::SCH_StartOfDisplayArea(GPUReg* r) +{ + m_env.DAREA = r->DAREA; +} + +void GPUState::SCH_HorizontalDisplayRange(GPUReg* r) +{ + m_env.DHRANGE = r->DHRANGE; +} + +void GPUState::SCH_VerticalDisplayRange(GPUReg* r) +{ + m_env.DVRANGE = r->DVRANGE; +} + +void GPUState::SCH_DisplayMode(GPUReg* r) +{ + m_env.STATUS.WIDTH0 = r->DMODE.WIDTH0; + m_env.STATUS.HEIGHT = r->DMODE.HEIGHT; + m_env.STATUS.ISPAL = r->DMODE.ISPAL; + m_env.STATUS.ISRGB24 = r->DMODE.ISRGB24; + m_env.STATUS.ISINTER = r->DMODE.ISINTER; + m_env.STATUS.WIDTH1 = r->DMODE.WIDTH1; +} + +void GPUState::SCH_GPUInfo(GPUReg* r) +{ + uint32 value = 0; + + switch(r->GPUINFO.PARAM) + { + case 0x2: + value = m_env.TWIN.u32; + break; + case 0x0: + case 0x1: + case 0x3: + value = m_env.DRAREATL.u32; + break; + case 0x4: + value = m_env.DRAREABR.u32; + break; + case 0x5: + case 0x6: + value = m_env.DROFF.u32; + break; + case 0x7: + value = 2; + break; + case 0x8: + case 0xf: + value = 0xBFC03720; // ? + break; + default: + ASSERT(0); + break; + } + + m_read.RemoveAll(); + m_read.Append((uint8*)&value, 4); + m_read.cur = 0; +} + +int GPUState::PH_Command(GPUReg* r, int size) +{ + switch(r->PACKET.OPTION) + { + case 0: // ??? + + return 1; + + case 1: // clear cache + + return 1; + + case 2: // fillrect + + if(size < 3) return 0; + + Flush(); + + GSVector4i r2; + + r2.left = r[1].XY.X; + r2.top = r[1].XY.Y; + r2.right = r2.left + r[2].XY.X; + r2.bottom = r2.top + r[2].XY.Y; + + uint16 c = (uint16)(((r[0].RGB.R >> 3) << 10) | ((r[0].RGB.R >> 3) << 5) | (r[0].RGB.R >> 3)); + + m_mem.FillRect(r2, c); + + Invalidate(r2); + + Dump("f"); + + return 3; + } + + ASSERT(0); + + return 1; +} + +int GPUState::PH_Polygon(GPUReg* r, int size) +{ + int required = 1; + + int vertices = r[0].POLYGON.VTX ? 4 : 3; + + required += vertices; + + if(r[0].POLYGON.TME) required += vertices; + + if(r[0].POLYGON.IIP) required += vertices - 1; + + if(size < required) return 0; + + // + + SetPrim(r); + + if(r[0].POLYGON.TME) + { + SetCLUT(&r[2]); + + SetTPAGE(&r[r[0].POLYGON.IIP ? 5 : 4]); + } + + // + + GPUVertex v[4]; + + for(int i = 0, j = 0; j < vertices; j++) + { + v[j].RGB = r[r[0].POLYGON.IIP ? i : 0].RGB; + + if(j == 0 || r[0].POLYGON.IIP) i++; + + v[j].XY = r[i++].XY; + + if(r[0].POLYGON.TME) + { + v[j].UV.X = r[i].UV.U; + v[j].UV.Y = r[i].UV.V; + + i++; + } + } + + for(int i = 0; i <= vertices - 3; i++) + { + for(int j = 0; j < 3; j++) + { + m_v = v[i + j]; + + VertexKick(); + } + } + + // + + return required; +} + +int GPUState::PH_Line(GPUReg* r, int size) +{ + int required = 1; + + int vertices = 0; + + if(r->LINE.PLL) + { + required++; + + for(int i = 1; i < size; i++) + { + if(r[i].u32 == 0x55555555) + { + vertices = i - 1; + } + } + + if(vertices < 2) + { + return 0; + } + } + else + { + vertices = 2; + } + + required += vertices; + + if(r->LINE.IIP) required += vertices - 1; + + // + + SetPrim(r); + + // + + for(int i = 0, j = 0; j < vertices; j++) + { + if(j >= 2) VertexKick(); + + m_v.RGB = r[r[0].LINE.IIP ? i : 0].RGB; + + if(j == 0 || r[0].LINE.IIP) i++; + + m_v.XY = r[i++].XY; + + VertexKick(); + } + + // + + return required; +} + +int GPUState::PH_Sprite(GPUReg* r, int size) +{ + int required = 2; + + if(r[0].SPRITE.TME) required++; + if(r[0].SPRITE.SIZE == 0) required++; + + if(size < required) return 0; + + // + + SetPrim(r); + + if(r[0].SPRITE.TME) + { + SetCLUT(&r[2]); + } + + // + + int i = 0; + + m_v.RGB = r[i++].RGB; + + m_v.XY = r[i++].XY; + + if(r[0].SPRITE.TME) + { + m_v.UV.X = r[i].UV.U; + m_v.UV.Y = r[i].UV.V; + + i++; + } + + VertexKick(); + + int w = 0; + int h = 0; + + switch(r[0].SPRITE.SIZE) + { + case 0: w = r[i].XY.X; h = r[i].XY.Y; i++; break; + case 1: w = h = 1; break; + case 2: w = h = 8; break; + case 3: w = h = 16; break; + default: __assume(0); + } + + m_v.XY.X += w; + m_v.XY.Y += h; + + if(r[0].SPRITE.TME) + { + m_v.UV.X += w; + m_v.UV.Y += h; + } + + VertexKick(); + + // + + return required; +} + +int GPUState::PH_Move(GPUReg* r, int size) +{ + if(size < 4) return 0; + + Flush(); + + int sx = r[1].XY.X; + int sy = r[1].XY.Y; + + int dx = r[2].XY.X; + int dy = r[2].XY.Y; + + int w = r[3].XY.X; + int h = r[3].XY.Y; + + m_mem.MoveRect(sx, sy, dx, dy, w, h); + + Invalidate(GSVector4i(dx, dy, dx + w, dy + h)); + + // Dump("m"); + + return 4; +} + +int GPUState::PH_Write(GPUReg* r, int size) +{ + if(size < 3) return 0; + + int w = r[2].XY.X; + int h = r[2].XY.Y; + + int required = 3 + ((w * h + 1) >> 1); + + if(size < required) return 0; + + Flush(); + + GSVector4i r2; + + r2.left = r[1].XY.X; + r2.top = r[1].XY.Y; + r2.right = r2.left + w; + r2.bottom = r2.top + h; + + m_mem.WriteRect(r2, (const uint16*)&r[3]); + + Invalidate(r2); + + Dump("w"); + + m_perfmon.Put(GSPerfMon::Swizzle, w * h * 2); + + return required; +} + +int GPUState::PH_Read(GPUReg* r, int size) +{ + if(size < 3) return 0; + + Flush(); + + int w = r[2].XY.X; + int h = r[2].XY.Y; + + GSVector4i r2; + + r2.left = r[1].XY.X; + r2.top = r[1].XY.Y; + r2.right = r2.left + w; + r2.bottom = r2.top + h; + + m_read.bytes = ((w * h + 1) & ~1) * 2; + m_read.cur = 0; + m_read.Reserve(m_read.bytes); + + m_mem.ReadRect(r2, (uint16*)m_read.buff); + + Dump("r"); + + m_env.STATUS.IMG = 1; + + return 3; +} + +int GPUState::PH_Environment(GPUReg* r, int size) +{ + Flush(); // TODO: only call when something really changes + + switch(r->PACKET.OPTION) + { + case 1: // draw mode setting + + m_env.STATUS.TX = r->MODE.TX; + m_env.STATUS.TY = r->MODE.TY; + m_env.STATUS.ABR = r->MODE.ABR; + m_env.STATUS.TP = r->MODE.TP; + m_env.STATUS.DTD = r->MODE.DTD; + m_env.STATUS.DFE = r->MODE.DFE; + + return 1; + + case 2: // texture window setting + + m_env.TWIN = r->TWIN; + + return 1; + + case 3: // set drawing area top left + + m_env.DRAREATL = r->DRAREA; + + return 1; + + case 4: // set drawing area bottom right + + m_env.DRAREABR = r->DRAREA; + + return 1; + + case 5: // drawing offset + + m_env.DROFF = r->DROFF; + + return 1; + + case 6: // mask setting + + m_env.STATUS.MD = r->MASK.MD; + m_env.STATUS.ME = r->MASK.ME; + + return 1; + } + + ASSERT(0); + + return 1; +} + +// + +GPUState::Buffer::Buffer() +{ + bytes = 0; + maxbytes = 4096; + buff = (uint8*)_aligned_malloc(maxbytes, 16); + cur = 0; +} + +GPUState::Buffer::~Buffer() +{ + _aligned_free(buff); +} + +void GPUState::Buffer::Reserve(int size) +{ + if(size > maxbytes) + { + maxbytes = (maxbytes + size + 1023) & ~1023; + + if(buff != NULL) _aligned_free(buff); + + buff = (uint8*)_aligned_malloc(maxbytes, 16); + } +} + +void GPUState::Buffer::Append(const uint8* src, int size) +{ + Reserve(bytes + (int)size); + + memcpy(&buff[bytes], src, size); + + bytes += size; +} + +void GPUState::Buffer::Remove(int size) +{ + ASSERT(size <= bytes); + + if(size < bytes) + { + memmove(&buff[0], &buff[size], bytes - size); + + bytes -= size; + } + else + { + bytes = 0; + } + + #ifdef DEBUG + memset(&buff[bytes], 0xff, maxbytes - bytes); + #endif +} + +void GPUState::Buffer::RemoveAll() +{ + bytes = 0; +} diff --git a/plugins/GSdx/GPUState.h b/plugins/GSdx/GPUState.h index c0c70b595b..7455433498 100644 --- a/plugins/GSdx/GPUState.h +++ b/plugins/GSdx/GPUState.h @@ -1,143 +1,143 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "GPU.h" -#include "GPUDrawingEnvironment.h" -#include "GPULocalMemory.h" -#include "GPUVertex.h" -#include "GSAlignedClass.h" -#include "GSUtil.h" -#include "GSPerfMon.h" - -class GPUState : public GSAlignedClass<32> -{ - typedef void (GPUState::*GPUStatusCommandHandler)(GPUReg* r); - - GPUStatusCommandHandler m_fpGPUStatusCommandHandlers[256]; - - void SCH_Null(GPUReg* r); - void SCH_ResetGPU(GPUReg* r); - void SCH_ResetCommandBuffer(GPUReg* r); - void SCH_ResetIRQ(GPUReg* r); - void SCH_DisplayEnable(GPUReg* r); - void SCH_DMASetup(GPUReg* r); - void SCH_StartOfDisplayArea(GPUReg* r); - void SCH_HorizontalDisplayRange(GPUReg* r); - void SCH_VerticalDisplayRange(GPUReg* r); - void SCH_DisplayMode(GPUReg* r); - void SCH_GPUInfo(GPUReg* r); - - typedef int (GPUState::*GPUPacketHandler)(GPUReg* r, int size); - - GPUPacketHandler m_fpGPUPacketHandler[8]; - - int PH_Command(GPUReg* r, int size); - int PH_Polygon(GPUReg* r, int size); - int PH_Line(GPUReg* r, int size); - int PH_Sprite(GPUReg* r, int size); - int PH_Move(GPUReg* r, int size); - int PH_Write(GPUReg* r, int size); - int PH_Read(GPUReg* r, int size); - int PH_Environment(GPUReg* r, int size); - - class Buffer - { - public: - int bytes; - int maxbytes; - uint8* buff; - int cur; - - public: - Buffer(); - ~Buffer(); - void Reserve(int size); - void Append(const uint8* src, int size); - void Remove(int size); - void RemoveAll(); - }; - - Buffer m_write; - Buffer m_read; - - void SetPrim(GPUReg* r); - void SetCLUT(GPUReg* r); - void SetTPAGE(GPUReg* r); - -protected: - - int s_n; - - void Dump(const string& s, uint32 TP, const GSVector4i& r, int inc = true) - { - //if(m_perfmon.GetFrame() < 1000) - //if((m_env.TWIN.u32 & 0xfffff) == 0) - //if(!m_env.STATUS.ME && !m_env.STATUS.MD) - return; - - if(inc) s_n++; - - //if(s_n < 86) return; - - int dir = 1; -#ifdef DEBUG - dir = 2; -#endif - string path = format("c:\\temp%d\\%04d_%s.bmp", dir, s_n, s.c_str()); - - m_mem.SaveBMP(path, r, TP, m_env.CLUT.X, m_env.CLUT.Y); - } - - void Dump(const string& s, int inc = true) - { - Dump(s, 2, GSVector4i(0, 0, 1024, 512), inc); - } - -public: - GPUDrawingEnvironment m_env; - GPULocalMemory m_mem; - GPUVertex m_v; - GSPerfMon m_perfmon; - uint32 m_status[256]; - -public: - GPUState(); - virtual ~GPUState(); - - virtual void Reset(); - virtual void Flush(); - virtual void FlushPrim() = 0; - virtual void ResetPrim() = 0; - virtual void VertexKick() = 0; - virtual void Invalidate(const GSVector4i& r); - - void WriteData(const uint8* mem, uint32 size); - void ReadData(uint8* mem, uint32 size); - - void WriteStatus(uint32 status); - uint32 ReadStatus(); - - void Freeze(GPUFreezeData* data); - void Defrost(const GPUFreezeData* data); -}; - +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#include "GPU.h" +#include "GPUDrawingEnvironment.h" +#include "GPULocalMemory.h" +#include "GPUVertex.h" +#include "GSAlignedClass.h" +#include "GSUtil.h" +#include "GSPerfMon.h" + +class GPUState : public GSAlignedClass<32> +{ + typedef void (GPUState::*GPUStatusCommandHandler)(GPUReg* r); + + GPUStatusCommandHandler m_fpGPUStatusCommandHandlers[256]; + + void SCH_Null(GPUReg* r); + void SCH_ResetGPU(GPUReg* r); + void SCH_ResetCommandBuffer(GPUReg* r); + void SCH_ResetIRQ(GPUReg* r); + void SCH_DisplayEnable(GPUReg* r); + void SCH_DMASetup(GPUReg* r); + void SCH_StartOfDisplayArea(GPUReg* r); + void SCH_HorizontalDisplayRange(GPUReg* r); + void SCH_VerticalDisplayRange(GPUReg* r); + void SCH_DisplayMode(GPUReg* r); + void SCH_GPUInfo(GPUReg* r); + + typedef int (GPUState::*GPUPacketHandler)(GPUReg* r, int size); + + GPUPacketHandler m_fpGPUPacketHandler[8]; + + int PH_Command(GPUReg* r, int size); + int PH_Polygon(GPUReg* r, int size); + int PH_Line(GPUReg* r, int size); + int PH_Sprite(GPUReg* r, int size); + int PH_Move(GPUReg* r, int size); + int PH_Write(GPUReg* r, int size); + int PH_Read(GPUReg* r, int size); + int PH_Environment(GPUReg* r, int size); + + class Buffer + { + public: + int bytes; + int maxbytes; + uint8* buff; + int cur; + + public: + Buffer(); + ~Buffer(); + void Reserve(int size); + void Append(const uint8* src, int size); + void Remove(int size); + void RemoveAll(); + }; + + Buffer m_write; + Buffer m_read; + + void SetPrim(GPUReg* r); + void SetCLUT(GPUReg* r); + void SetTPAGE(GPUReg* r); + +protected: + + int s_n; + + void Dump(const string& s, uint32 TP, const GSVector4i& r, int inc = true) + { + //if(m_perfmon.GetFrame() < 1000) + //if((m_env.TWIN.u32 & 0xfffff) == 0) + //if(!m_env.STATUS.ME && !m_env.STATUS.MD) + return; + + if(inc) s_n++; + + //if(s_n < 86) return; + + int dir = 1; +#ifdef DEBUG + dir = 2; +#endif + string path = format("c:\\temp%d\\%04d_%s.bmp", dir, s_n, s.c_str()); + + m_mem.SaveBMP(path, r, TP, m_env.CLUT.X, m_env.CLUT.Y); + } + + void Dump(const string& s, int inc = true) + { + Dump(s, 2, GSVector4i(0, 0, 1024, 512), inc); + } + +public: + GPUDrawingEnvironment m_env; + GPULocalMemory m_mem; + GPUVertex m_v; + GSPerfMon m_perfmon; + uint32 m_status[256]; + +public: + GPUState(); + virtual ~GPUState(); + + virtual void Reset(); + virtual void Flush(); + virtual void FlushPrim() = 0; + virtual void ResetPrim() = 0; + virtual void VertexKick() = 0; + virtual void Invalidate(const GSVector4i& r); + + void WriteData(const uint8* mem, uint32 size); + void ReadData(uint8* mem, uint32 size); + + void WriteStatus(uint32 status); + uint32 ReadStatus(); + + void Freeze(GPUFreezeData* data); + void Defrost(const GPUFreezeData* data); +}; + diff --git a/plugins/GSdx/GPUVertex.h b/plugins/GSdx/GPUVertex.h index 74047ae2ed..fecd371a6e 100644 --- a/plugins/GSdx/GPUVertex.h +++ b/plugins/GSdx/GPUVertex.h @@ -1,51 +1,51 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma once - -#include "GPU.h" -#include "GSVector.h" - -#pragma pack(push, 1) - -__aligned(struct, 32) GPUVertex -{ - union - { - struct - { - GPURegRGB RGB; - GPURegXY XY; - GPURegXY UV; - }; - - struct {__m128i m128i;}; - struct {__m128 m128;}; - }; - - GPUVertex() {memset(this, 0, sizeof(*this));} -}; - -struct GPUVertexNull -{ -}; - -#pragma pack(pop) +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#pragma once + +#include "GPU.h" +#include "GSVector.h" + +#pragma pack(push, 1) + +__aligned(struct, 32) GPUVertex +{ + union + { + struct + { + GPURegRGB RGB; + GPURegXY XY; + GPURegXY UV; + }; + + struct {__m128i m128i;}; + struct {__m128 m128;}; + }; + + GPUVertex() {memset(this, 0, sizeof(*this));} +}; + +struct GPUVertexNull +{ +}; + +#pragma pack(pop) diff --git a/plugins/GSdx/GSDeviceDX.cpp b/plugins/GSdx/GSDeviceDX.cpp index 5d4e6327fd..79fbd61c29 100644 --- a/plugins/GSdx/GSDeviceDX.cpp +++ b/plugins/GSdx/GSDeviceDX.cpp @@ -1,188 +1,188 @@ -/* - * Copyright (C) 2007-2009 Gabest - * http://www.gabest.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "stdafx.h" -#include "GSdx.h" -#include "GSDeviceDX.h" - -GSDeviceDX::GSDeviceDX() -{ - m_msaa = theApp.GetConfig("msaa", 0); - - m_msaa_desc.Count = 1; - m_msaa_desc.Quality = 0; -} - -GSDeviceDX::~GSDeviceDX() -{ -} - -GSTexture* GSDeviceDX::Fetch(int type, int w, int h, bool msaa, int format) -{ - if(m_msaa < 2) - { - msaa = false; - } - - return __super::Fetch(type, w, h, msaa, format); -} - -bool GSDeviceDX::SetFeatureLevel(D3D_FEATURE_LEVEL level, bool compat_mode) -{ - m_shader.level = level; - - switch(level) - { - case D3D_FEATURE_LEVEL_9_1: - case D3D_FEATURE_LEVEL_9_2: - m_shader.model = "0x200"; - m_shader.vs = compat_mode ? "vs_4_0_level_9_1" : "vs_2_0"; - m_shader.ps = compat_mode ? "ps_4_0_level_9_1" : "ps_2_0"; - break; - case D3D_FEATURE_LEVEL_9_3: - m_shader.model = "0x300"; - m_shader.vs = compat_mode ? "vs_4_0_level_9_3" : "vs_3_0"; - m_shader.ps = compat_mode ? "ps_4_0_level_9_3" : "ps_3_0"; - break; - case D3D_FEATURE_LEVEL_10_0: - m_shader.model = "0x400"; - m_shader.vs = "vs_4_0"; - m_shader.gs = "gs_4_0"; - m_shader.ps = "ps_4_0"; - break; - case D3D_FEATURE_LEVEL_10_1: - m_shader.model = "0x401"; - m_shader.vs = "vs_4_1"; - m_shader.gs = "gs_4_1"; - m_shader.ps = "ps_4_1"; - break; - case D3D_FEATURE_LEVEL_11_0: - m_shader.model = "0x500"; - m_shader.vs = "vs_5_0"; - m_shader.gs = "gs_5_0"; - m_shader.ps = "ps_5_0"; - break; - default: - ASSERT(0); - return false; - } - - return true; -} - -// (A - B) * C + D -// A: Cs/Cd/0 -// B: Cs/Cd/0 -// C: As/Ad/FIX -// D: Cs/Cd/0 - -// bogus: 0100, 0110, 0120, 0200, 0210, 0220, 1001, 1011, 1021 -// tricky: 1201, 1211, 1221 - -// Source.rgb = float3(1, 1, 1); -// 1201 Cd*(1 + As) => Source * Dest color + Dest * Source alpha -// 1211 Cd*(1 + Ad) => Source * Dest color + Dest * Dest alpha -// 1221 Cd*(1 + F) => Source * Dest color + Dest * Factor - -const GSDeviceDX::D3D9Blend GSDeviceDX::m_blendMapD3D9[3*3*3*3] = -{ - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 0000: (Cs - Cs)*As + Cs ==> Cs - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 0001: (Cs - Cs)*As + Cd ==> Cd - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 0002: (Cs - Cs)*As + 0 ==> 0 - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 0010: (Cs - Cs)*Ad + Cs ==> Cs - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 0011: (Cs - Cs)*Ad + Cd ==> Cd - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 0012: (Cs - Cs)*Ad + 0 ==> 0 - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 0020: (Cs - Cs)*F + Cs ==> Cs - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 0021: (Cs - Cs)*F + Cd ==> Cd - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 0022: (Cs - Cs)*F + 0 ==> 0 - {1, D3DBLENDOP_SUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_SRCALPHA}, //*0100: (Cs - Cd)*As + Cs ==> Cs*(As + 1) - Cd*As - {0, D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA}, // 0101: (Cs - Cd)*As + Cd ==> Cs*As + Cd*(1 - As) - {0, D3DBLENDOP_SUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_SRCALPHA}, // 0102: (Cs - Cd)*As + 0 ==> Cs*As - Cd*As - {1, D3DBLENDOP_SUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_DESTALPHA}, //*0110: (Cs - Cd)*Ad + Cs ==> Cs*(Ad + 1) - Cd*Ad - {0, D3DBLENDOP_ADD, D3DBLEND_DESTALPHA, D3DBLEND_INVDESTALPHA}, // 0111: (Cs - Cd)*Ad + Cd ==> Cs*Ad + Cd*(1 - Ad) - {0, D3DBLENDOP_SUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_DESTALPHA}, // 0112: (Cs - Cd)*Ad + 0 ==> Cs*Ad - Cd*Ad - {1, D3DBLENDOP_SUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_BLENDFACTOR}, //*0120: (Cs - Cd)*F + Cs ==> Cs*(F + 1) - Cd*F - {0, D3DBLENDOP_ADD, D3DBLEND_BLENDFACTOR, D3DBLEND_INVBLENDFACTOR}, // 0121: (Cs - Cd)*F + Cd ==> Cs*F + Cd*(1 - F) - {0, D3DBLENDOP_SUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_BLENDFACTOR}, // 0122: (Cs - Cd)*F + 0 ==> Cs*F - Cd*F - {1, D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_ZERO}, //*0200: (Cs - 0)*As + Cs ==> Cs*(As + 1) - {0, D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_ONE}, // 0201: (Cs - 0)*As + Cd ==> Cs*As + Cd - {0, D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_ZERO}, // 0202: (Cs - 0)*As + 0 ==> Cs*As - {1, D3DBLENDOP_ADD, D3DBLEND_DESTALPHA, D3DBLEND_ZERO}, //*0210: (Cs - 0)*Ad + Cs ==> Cs*(Ad + 1) - {0, D3DBLENDOP_ADD, D3DBLEND_DESTALPHA, D3DBLEND_ONE}, // 0211: (Cs - 0)*Ad + Cd ==> Cs*Ad + Cd - {0, D3DBLENDOP_ADD, D3DBLEND_DESTALPHA, D3DBLEND_ZERO}, // 0212: (Cs - 0)*Ad + 0 ==> Cs*Ad - {1, D3DBLENDOP_ADD, D3DBLEND_BLENDFACTOR, D3DBLEND_ZERO}, //*0220: (Cs - 0)*F + Cs ==> Cs*(F + 1) - {0, D3DBLENDOP_ADD, D3DBLEND_BLENDFACTOR, D3DBLEND_ONE}, // 0221: (Cs - 0)*F + Cd ==> Cs*F + Cd - {0, D3DBLENDOP_ADD, D3DBLEND_BLENDFACTOR, D3DBLEND_ZERO}, // 0222: (Cs - 0)*F + 0 ==> Cs*F - {0, D3DBLENDOP_ADD, D3DBLEND_INVSRCALPHA, D3DBLEND_SRCALPHA}, // 1000: (Cd - Cs)*As + Cs ==> Cd*As + Cs*(1 - As) - {1, D3DBLENDOP_REVSUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_SRCALPHA}, //*1001: (Cd - Cs)*As + Cd ==> Cd*(As + 1) - Cs*As - {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_SRCALPHA}, // 1002: (Cd - Cs)*As + 0 ==> Cd*As - Cs*As - {0, D3DBLENDOP_ADD, D3DBLEND_INVDESTALPHA, D3DBLEND_DESTALPHA}, // 1010: (Cd - Cs)*Ad + Cs ==> Cd*Ad + Cs*(1 - Ad) - {1, D3DBLENDOP_REVSUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_DESTALPHA}, //*1011: (Cd - Cs)*Ad + Cd ==> Cd*(Ad + 1) - Cs*Ad - {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_DESTALPHA}, // 1012: (Cd - Cs)*Ad + 0 ==> Cd*Ad - Cs*Ad - {0, D3DBLENDOP_ADD, D3DBLEND_INVBLENDFACTOR, D3DBLEND_BLENDFACTOR}, // 1020: (Cd - Cs)*F + Cs ==> Cd*F + Cs*(1 - F) - {1, D3DBLENDOP_REVSUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_BLENDFACTOR},//*1021: (Cd - Cs)*F + Cd ==> Cd*(F + 1) - Cs*F - {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_BLENDFACTOR},// 1022: (Cd - Cs)*F + 0 ==> Cd*F - Cs*F - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 1100: (Cd - Cd)*As + Cs ==> Cs - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 1101: (Cd - Cd)*As + Cd ==> Cd - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 1102: (Cd - Cd)*As + 0 ==> 0 - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 1110: (Cd - Cd)*Ad + Cs ==> Cs - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 1111: (Cd - Cd)*Ad + Cd ==> Cd - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 1112: (Cd - Cd)*Ad + 0 ==> 0 - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 1120: (Cd - Cd)*F + Cs ==> Cs - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 1121: (Cd - Cd)*F + Cd ==> Cd - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 1122: (Cd - Cd)*F + 0 ==> 0 - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_SRCALPHA}, // 1200: (Cd - 0)*As + Cs ==> Cs + Cd*As - {2, D3DBLENDOP_ADD, D3DBLEND_DESTCOLOR, D3DBLEND_SRCALPHA}, //#1201: (Cd - 0)*As + Cd ==> Cd*(1 + As) // ffxii main menu background glow effect - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_SRCALPHA}, // 1202: (Cd - 0)*As + 0 ==> Cd*As - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_DESTALPHA}, // 1210: (Cd - 0)*Ad + Cs ==> Cs + Cd*Ad - {2, D3DBLENDOP_ADD, D3DBLEND_DESTCOLOR, D3DBLEND_DESTALPHA}, //#1211: (Cd - 0)*Ad + Cd ==> Cd*(1 + Ad) - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_DESTALPHA}, // 1212: (Cd - 0)*Ad + 0 ==> Cd*Ad - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_BLENDFACTOR}, // 1220: (Cd - 0)*F + Cs ==> Cs + Cd*F - {2, D3DBLENDOP_ADD, D3DBLEND_DESTCOLOR, D3DBLEND_BLENDFACTOR}, //#1221: (Cd - 0)*F + Cd ==> Cd*(1 + F) - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_BLENDFACTOR}, // 1222: (Cd - 0)*F + 0 ==> Cd*F - {0, D3DBLENDOP_ADD, D3DBLEND_INVSRCALPHA, D3DBLEND_ZERO}, // 2000: (0 - Cs)*As + Cs ==> Cs*(1 - As) - {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_ONE}, // 2001: (0 - Cs)*As + Cd ==> Cd - Cs*As - {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_ZERO}, // 2002: (0 - Cs)*As + 0 ==> 0 - Cs*As - {0, D3DBLENDOP_ADD, D3DBLEND_INVDESTALPHA, D3DBLEND_ZERO}, // 2010: (0 - Cs)*Ad + Cs ==> Cs*(1 - Ad) - {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_ONE}, // 2011: (0 - Cs)*Ad + Cd ==> Cd - Cs*Ad - {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_ZERO}, // 2012: (0 - Cs)*Ad + 0 ==> 0 - Cs*Ad - {0, D3DBLENDOP_ADD, D3DBLEND_INVBLENDFACTOR, D3DBLEND_ZERO}, // 2020: (0 - Cs)*F + Cs ==> Cs*(1 - F) - {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_ONE}, // 2021: (0 - Cs)*F + Cd ==> Cd - Cs*F - {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_ZERO}, // 2022: (0 - Cs)*F + 0 ==> 0 - Cs*F - {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ONE, D3DBLEND_SRCALPHA}, // 2100: (0 - Cd)*As + Cs ==> Cs - Cd*As - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_INVSRCALPHA}, // 2101: (0 - Cd)*As + Cd ==> Cd*(1 - As) - {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ZERO, D3DBLEND_SRCALPHA}, // 2102: (0 - Cd)*As + 0 ==> 0 - Cd*As - {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ONE, D3DBLEND_DESTALPHA}, // 2110: (0 - Cd)*Ad + Cs ==> Cs - Cd*Ad - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_INVDESTALPHA}, // 2111: (0 - Cd)*Ad + Cd ==> Cd*(1 - Ad) - {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ONE, D3DBLEND_DESTALPHA}, // 2112: (0 - Cd)*Ad + 0 ==> 0 - Cd*Ad - {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ONE, D3DBLEND_BLENDFACTOR}, // 2120: (0 - Cd)*F + Cs ==> Cs - Cd*F - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_INVBLENDFACTOR}, // 2121: (0 - Cd)*F + Cd ==> Cd*(1 - F) - {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ONE, D3DBLEND_BLENDFACTOR}, // 2122: (0 - Cd)*F + 0 ==> 0 - Cd*F - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 2200: (0 - 0)*As + Cs ==> Cs - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 2201: (0 - 0)*As + Cd ==> Cd - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 2202: (0 - 0)*As + 0 ==> 0 - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 2210: (0 - 0)*Ad + Cs ==> Cs - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 2211: (0 - 0)*Ad + Cd ==> Cd - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 2212: (0 - 0)*Ad + 0 ==> 0 - {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 2220: (0 - 0)*F + Cs ==> Cs - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 2221: (0 - 0)*F + Cd ==> Cd - {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 2222: (0 - 0)*F + 0 ==> 0 -}; +/* + * Copyright (C) 2007-2009 Gabest + * http://www.gabest.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "stdafx.h" +#include "GSdx.h" +#include "GSDeviceDX.h" + +GSDeviceDX::GSDeviceDX() +{ + m_msaa = theApp.GetConfig("msaa", 0); + + m_msaa_desc.Count = 1; + m_msaa_desc.Quality = 0; +} + +GSDeviceDX::~GSDeviceDX() +{ +} + +GSTexture* GSDeviceDX::Fetch(int type, int w, int h, bool msaa, int format) +{ + if(m_msaa < 2) + { + msaa = false; + } + + return __super::Fetch(type, w, h, msaa, format); +} + +bool GSDeviceDX::SetFeatureLevel(D3D_FEATURE_LEVEL level, bool compat_mode) +{ + m_shader.level = level; + + switch(level) + { + case D3D_FEATURE_LEVEL_9_1: + case D3D_FEATURE_LEVEL_9_2: + m_shader.model = "0x200"; + m_shader.vs = compat_mode ? "vs_4_0_level_9_1" : "vs_2_0"; + m_shader.ps = compat_mode ? "ps_4_0_level_9_1" : "ps_2_0"; + break; + case D3D_FEATURE_LEVEL_9_3: + m_shader.model = "0x300"; + m_shader.vs = compat_mode ? "vs_4_0_level_9_3" : "vs_3_0"; + m_shader.ps = compat_mode ? "ps_4_0_level_9_3" : "ps_3_0"; + break; + case D3D_FEATURE_LEVEL_10_0: + m_shader.model = "0x400"; + m_shader.vs = "vs_4_0"; + m_shader.gs = "gs_4_0"; + m_shader.ps = "ps_4_0"; + break; + case D3D_FEATURE_LEVEL_10_1: + m_shader.model = "0x401"; + m_shader.vs = "vs_4_1"; + m_shader.gs = "gs_4_1"; + m_shader.ps = "ps_4_1"; + break; + case D3D_FEATURE_LEVEL_11_0: + m_shader.model = "0x500"; + m_shader.vs = "vs_5_0"; + m_shader.gs = "gs_5_0"; + m_shader.ps = "ps_5_0"; + break; + default: + ASSERT(0); + return false; + } + + return true; +} + +// (A - B) * C + D +// A: Cs/Cd/0 +// B: Cs/Cd/0 +// C: As/Ad/FIX +// D: Cs/Cd/0 + +// bogus: 0100, 0110, 0120, 0200, 0210, 0220, 1001, 1011, 1021 +// tricky: 1201, 1211, 1221 + +// Source.rgb = float3(1, 1, 1); +// 1201 Cd*(1 + As) => Source * Dest color + Dest * Source alpha +// 1211 Cd*(1 + Ad) => Source * Dest color + Dest * Dest alpha +// 1221 Cd*(1 + F) => Source * Dest color + Dest * Factor + +const GSDeviceDX::D3D9Blend GSDeviceDX::m_blendMapD3D9[3*3*3*3] = +{ + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 0000: (Cs - Cs)*As + Cs ==> Cs + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 0001: (Cs - Cs)*As + Cd ==> Cd + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 0002: (Cs - Cs)*As + 0 ==> 0 + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 0010: (Cs - Cs)*Ad + Cs ==> Cs + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 0011: (Cs - Cs)*Ad + Cd ==> Cd + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 0012: (Cs - Cs)*Ad + 0 ==> 0 + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 0020: (Cs - Cs)*F + Cs ==> Cs + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 0021: (Cs - Cs)*F + Cd ==> Cd + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 0022: (Cs - Cs)*F + 0 ==> 0 + {1, D3DBLENDOP_SUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_SRCALPHA}, //*0100: (Cs - Cd)*As + Cs ==> Cs*(As + 1) - Cd*As + {0, D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA}, // 0101: (Cs - Cd)*As + Cd ==> Cs*As + Cd*(1 - As) + {0, D3DBLENDOP_SUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_SRCALPHA}, // 0102: (Cs - Cd)*As + 0 ==> Cs*As - Cd*As + {1, D3DBLENDOP_SUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_DESTALPHA}, //*0110: (Cs - Cd)*Ad + Cs ==> Cs*(Ad + 1) - Cd*Ad + {0, D3DBLENDOP_ADD, D3DBLEND_DESTALPHA, D3DBLEND_INVDESTALPHA}, // 0111: (Cs - Cd)*Ad + Cd ==> Cs*Ad + Cd*(1 - Ad) + {0, D3DBLENDOP_SUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_DESTALPHA}, // 0112: (Cs - Cd)*Ad + 0 ==> Cs*Ad - Cd*Ad + {1, D3DBLENDOP_SUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_BLENDFACTOR}, //*0120: (Cs - Cd)*F + Cs ==> Cs*(F + 1) - Cd*F + {0, D3DBLENDOP_ADD, D3DBLEND_BLENDFACTOR, D3DBLEND_INVBLENDFACTOR}, // 0121: (Cs - Cd)*F + Cd ==> Cs*F + Cd*(1 - F) + {0, D3DBLENDOP_SUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_BLENDFACTOR}, // 0122: (Cs - Cd)*F + 0 ==> Cs*F - Cd*F + {1, D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_ZERO}, //*0200: (Cs - 0)*As + Cs ==> Cs*(As + 1) + {0, D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_ONE}, // 0201: (Cs - 0)*As + Cd ==> Cs*As + Cd + {0, D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_ZERO}, // 0202: (Cs - 0)*As + 0 ==> Cs*As + {1, D3DBLENDOP_ADD, D3DBLEND_DESTALPHA, D3DBLEND_ZERO}, //*0210: (Cs - 0)*Ad + Cs ==> Cs*(Ad + 1) + {0, D3DBLENDOP_ADD, D3DBLEND_DESTALPHA, D3DBLEND_ONE}, // 0211: (Cs - 0)*Ad + Cd ==> Cs*Ad + Cd + {0, D3DBLENDOP_ADD, D3DBLEND_DESTALPHA, D3DBLEND_ZERO}, // 0212: (Cs - 0)*Ad + 0 ==> Cs*Ad + {1, D3DBLENDOP_ADD, D3DBLEND_BLENDFACTOR, D3DBLEND_ZERO}, //*0220: (Cs - 0)*F + Cs ==> Cs*(F + 1) + {0, D3DBLENDOP_ADD, D3DBLEND_BLENDFACTOR, D3DBLEND_ONE}, // 0221: (Cs - 0)*F + Cd ==> Cs*F + Cd + {0, D3DBLENDOP_ADD, D3DBLEND_BLENDFACTOR, D3DBLEND_ZERO}, // 0222: (Cs - 0)*F + 0 ==> Cs*F + {0, D3DBLENDOP_ADD, D3DBLEND_INVSRCALPHA, D3DBLEND_SRCALPHA}, // 1000: (Cd - Cs)*As + Cs ==> Cd*As + Cs*(1 - As) + {1, D3DBLENDOP_REVSUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_SRCALPHA}, //*1001: (Cd - Cs)*As + Cd ==> Cd*(As + 1) - Cs*As + {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_SRCALPHA}, // 1002: (Cd - Cs)*As + 0 ==> Cd*As - Cs*As + {0, D3DBLENDOP_ADD, D3DBLEND_INVDESTALPHA, D3DBLEND_DESTALPHA}, // 1010: (Cd - Cs)*Ad + Cs ==> Cd*Ad + Cs*(1 - Ad) + {1, D3DBLENDOP_REVSUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_DESTALPHA}, //*1011: (Cd - Cs)*Ad + Cd ==> Cd*(Ad + 1) - Cs*Ad + {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_DESTALPHA}, // 1012: (Cd - Cs)*Ad + 0 ==> Cd*Ad - Cs*Ad + {0, D3DBLENDOP_ADD, D3DBLEND_INVBLENDFACTOR, D3DBLEND_BLENDFACTOR}, // 1020: (Cd - Cs)*F + Cs ==> Cd*F + Cs*(1 - F) + {1, D3DBLENDOP_REVSUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_BLENDFACTOR},//*1021: (Cd - Cs)*F + Cd ==> Cd*(F + 1) - Cs*F + {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_BLENDFACTOR},// 1022: (Cd - Cs)*F + 0 ==> Cd*F - Cs*F + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 1100: (Cd - Cd)*As + Cs ==> Cs + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 1101: (Cd - Cd)*As + Cd ==> Cd + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 1102: (Cd - Cd)*As + 0 ==> 0 + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 1110: (Cd - Cd)*Ad + Cs ==> Cs + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 1111: (Cd - Cd)*Ad + Cd ==> Cd + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 1112: (Cd - Cd)*Ad + 0 ==> 0 + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 1120: (Cd - Cd)*F + Cs ==> Cs + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 1121: (Cd - Cd)*F + Cd ==> Cd + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 1122: (Cd - Cd)*F + 0 ==> 0 + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_SRCALPHA}, // 1200: (Cd - 0)*As + Cs ==> Cs + Cd*As + {2, D3DBLENDOP_ADD, D3DBLEND_DESTCOLOR, D3DBLEND_SRCALPHA}, //#1201: (Cd - 0)*As + Cd ==> Cd*(1 + As) // ffxii main menu background glow effect + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_SRCALPHA}, // 1202: (Cd - 0)*As + 0 ==> Cd*As + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_DESTALPHA}, // 1210: (Cd - 0)*Ad + Cs ==> Cs + Cd*Ad + {2, D3DBLENDOP_ADD, D3DBLEND_DESTCOLOR, D3DBLEND_DESTALPHA}, //#1211: (Cd - 0)*Ad + Cd ==> Cd*(1 + Ad) + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_DESTALPHA}, // 1212: (Cd - 0)*Ad + 0 ==> Cd*Ad + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_BLENDFACTOR}, // 1220: (Cd - 0)*F + Cs ==> Cs + Cd*F + {2, D3DBLENDOP_ADD, D3DBLEND_DESTCOLOR, D3DBLEND_BLENDFACTOR}, //#1221: (Cd - 0)*F + Cd ==> Cd*(1 + F) + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_BLENDFACTOR}, // 1222: (Cd - 0)*F + 0 ==> Cd*F + {0, D3DBLENDOP_ADD, D3DBLEND_INVSRCALPHA, D3DBLEND_ZERO}, // 2000: (0 - Cs)*As + Cs ==> Cs*(1 - As) + {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_ONE}, // 2001: (0 - Cs)*As + Cd ==> Cd - Cs*As + {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_SRCALPHA, D3DBLEND_ZERO}, // 2002: (0 - Cs)*As + 0 ==> 0 - Cs*As + {0, D3DBLENDOP_ADD, D3DBLEND_INVDESTALPHA, D3DBLEND_ZERO}, // 2010: (0 - Cs)*Ad + Cs ==> Cs*(1 - Ad) + {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_ONE}, // 2011: (0 - Cs)*Ad + Cd ==> Cd - Cs*Ad + {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_DESTALPHA, D3DBLEND_ZERO}, // 2012: (0 - Cs)*Ad + 0 ==> 0 - Cs*Ad + {0, D3DBLENDOP_ADD, D3DBLEND_INVBLENDFACTOR, D3DBLEND_ZERO}, // 2020: (0 - Cs)*F + Cs ==> Cs*(1 - F) + {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_ONE}, // 2021: (0 - Cs)*F + Cd ==> Cd - Cs*F + {0, D3DBLENDOP_REVSUBTRACT, D3DBLEND_BLENDFACTOR, D3DBLEND_ZERO}, // 2022: (0 - Cs)*F + 0 ==> 0 - Cs*F + {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ONE, D3DBLEND_SRCALPHA}, // 2100: (0 - Cd)*As + Cs ==> Cs - Cd*As + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_INVSRCALPHA}, // 2101: (0 - Cd)*As + Cd ==> Cd*(1 - As) + {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ZERO, D3DBLEND_SRCALPHA}, // 2102: (0 - Cd)*As + 0 ==> 0 - Cd*As + {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ONE, D3DBLEND_DESTALPHA}, // 2110: (0 - Cd)*Ad + Cs ==> Cs - Cd*Ad + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_INVDESTALPHA}, // 2111: (0 - Cd)*Ad + Cd ==> Cd*(1 - Ad) + {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ONE, D3DBLEND_DESTALPHA}, // 2112: (0 - Cd)*Ad + 0 ==> 0 - Cd*Ad + {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ONE, D3DBLEND_BLENDFACTOR}, // 2120: (0 - Cd)*F + Cs ==> Cs - Cd*F + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_INVBLENDFACTOR}, // 2121: (0 - Cd)*F + Cd ==> Cd*(1 - F) + {0, D3DBLENDOP_SUBTRACT, D3DBLEND_ONE, D3DBLEND_BLENDFACTOR}, // 2122: (0 - Cd)*F + 0 ==> 0 - Cd*F + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 2200: (0 - 0)*As + Cs ==> Cs + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 2201: (0 - 0)*As + Cd ==> Cd + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 2202: (0 - 0)*As + 0 ==> 0 + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 2210: (0 - 0)*Ad + Cs ==> Cs + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 2211: (0 - 0)*Ad + Cd ==> Cd + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 2212: (0 - 0)*Ad + 0 ==> 0 + {0, D3DBLENDOP_ADD, D3DBLEND_ONE, D3DBLEND_ZERO}, // 2220: (0 - 0)*F + Cs ==> Cs + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ONE}, // 2221: (0 - 0)*F + Cd ==> Cd + {0, D3DBLENDOP_ADD, D3DBLEND_ZERO, D3DBLEND_ZERO}, // 2222: (0 - 0)*F + 0 ==> 0 +}; diff --git a/plugins/GSdx/GSdx.def b/plugins/GSdx/GSdx.def index 8f80c6cec5..2de7fecd48 100644 --- a/plugins/GSdx/GSdx.def +++ b/plugins/GSdx/GSdx.def @@ -1,70 +1,70 @@ -; GSdx.def : Declares the module parameters for the DLL. - -EXPORTS - ; Explicit exports can go here - PS2EgetLibType - PS2EgetLibName - PS2EgetLibVersion2 - PS2EgetCpuPlatform - PS2EsetEmuVersion - GSsetBaseMem - GSinit - GSshutdown - GSopen - GSopen2 - GSclose - GSreset - GSwriteCSR - GSgifSoftReset - GSgifTransfer - GSgifTransfer1 - GSgifTransfer2 - GSgifTransfer3 - GSvsync - GSmakeSnapshot - GSkeyEvent - GSfreeze - GSconfigure - GStest - GSabout - GSreadFIFO - GSreadFIFO2 - GSirqCallback - GSsetupRecording - GSsetGameCRC - GSsetFrameSkip - GSsetFrameLimit - GSsetVsync - GSsetExclusive - GSsetSettingsDir - GSgetLastTag - GSReplay - GSBenchmark - GSgetTitleInfo2 - PSEgetLibType - PSEgetLibName - PSEgetLibVersion - GPUinit - GPUshutdown - GPUopen - GPUclose - GPUconfigure - GPUabout - GPUtest - GPUwriteData - GPUwriteStatus - GPUreadData - GPUreadStatus - GPUdmaChain - GPUgetMode - GPUsetMode - GPUupdateLace - GPUmakeSnapshot - GPUwriteDataMem - GPUreadDataMem - GPUdisplayText - GPUdisplayFlags - GPUfreeze - GPUshowScreenPic - GPUgetScreenPic +; GSdx.def : Declares the module parameters for the DLL. + +EXPORTS + ; Explicit exports can go here + PS2EgetLibType + PS2EgetLibName + PS2EgetLibVersion2 + PS2EgetCpuPlatform + PS2EsetEmuVersion + GSsetBaseMem + GSinit + GSshutdown + GSopen + GSopen2 + GSclose + GSreset + GSwriteCSR + GSgifSoftReset + GSgifTransfer + GSgifTransfer1 + GSgifTransfer2 + GSgifTransfer3 + GSvsync + GSmakeSnapshot + GSkeyEvent + GSfreeze + GSconfigure + GStest + GSabout + GSreadFIFO + GSreadFIFO2 + GSirqCallback + GSsetupRecording + GSsetGameCRC + GSsetFrameSkip + GSsetFrameLimit + GSsetVsync + GSsetExclusive + GSsetSettingsDir + GSgetLastTag + GSReplay + GSBenchmark + GSgetTitleInfo2 + PSEgetLibType + PSEgetLibName + PSEgetLibVersion + GPUinit + GPUshutdown + GPUopen + GPUclose + GPUconfigure + GPUabout + GPUtest + GPUwriteData + GPUwriteStatus + GPUreadData + GPUreadStatus + GPUdmaChain + GPUgetMode + GPUsetMode + GPUupdateLace + GPUmakeSnapshot + GPUwriteDataMem + GPUreadDataMem + GPUdisplayText + GPUdisplayFlags + GPUfreeze + GPUshowScreenPic + GPUgetScreenPic GPUcursor \ No newline at end of file diff --git a/plugins/GSdx/GSdx.props b/plugins/GSdx/GSdx.props index a7b35f3c7f..3a5504edf2 100644 --- a/plugins/GSdx/GSdx.props +++ b/plugins/GSdx/GSdx.props @@ -1,24 +1,24 @@ - - - <_PropertySheetDisplayName>GSdx - $(ProjectName)-$(SSEtype) - - - - Level4 - 4995;4324;%(DisableSpecificWarnings) - - - JITProfiling.lib;d3d11_beta.lib;d3dx11.lib;d3d10.lib;d3d10_1.lib;d3dx10.lib;d3d9.lib;d3dx9.lib;ddraw.lib;dxguid.lib;winmm.lib;strmiids.lib;xinput.lib;cg.lib;cgGL.lib;glut32.lib;glew32.lib;%(AdditionalDependencies) - ./vtune;%(AdditionalLibraryDirectories) - d3d9.dll;d3dx9_41.dll;d3d10.dll;d3d10_1.dll;d3dx10_41.dll;d3d11.dll;d3d11_beta.dll;d3dx11_41.dll;%(DelayLoadDLLs) - - - - - - - "$(SolutionDir)common\vsprops\preBuild.cmd" "$(ProjectDir)." - - + + + <_PropertySheetDisplayName>GSdx + $(ProjectName)-$(SSEtype) + + + + Level4 + 4995;4324;%(DisableSpecificWarnings) + + + JITProfiling.lib;d3d11_beta.lib;d3dx11.lib;d3d10.lib;d3d10_1.lib;d3dx10.lib;d3d9.lib;d3dx9.lib;ddraw.lib;dxguid.lib;winmm.lib;strmiids.lib;xinput.lib;cg.lib;cgGL.lib;glut32.lib;glew32.lib;%(AdditionalDependencies) + ./vtune;%(AdditionalLibraryDirectories) + d3d9.dll;d3dx9_41.dll;d3d10.dll;d3d10_1.dll;d3dx10_41.dll;d3d11.dll;d3d11_beta.dll;d3dx11_41.dll;%(DelayLoadDLLs) + + + + + + + "$(SolutionDir)common\vsprops\preBuild.cmd" "$(ProjectDir)." + + \ No newline at end of file diff --git a/plugins/GSdx/GSdx.rc b/plugins/GSdx/GSdx.rc index ebee0a82f2..36d34e52a1 100644 --- a/plugins/GSdx/GSdx.rc +++ b/plugins/GSdx/GSdx.rc @@ -1,315 +1,315 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\0" -END - -3 TEXTINCLUDE -BEGIN - "#include ""res/tfx.fx""\r\n" - "#include ""res/convert.fx""\r\n" - "#include ""res/interlace.fx""\r\n" - "#include ""res/merge.fx""\r\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// RCDATA -// - -IDR_CONVERT_FX RCDATA "res\\convert.fx" -IDR_TFX_FX RCDATA "res\\tfx.fx" -IDR_MERGE_FX RCDATA "res\\merge.fx" -IDR_INTERLACE_FX RCDATA "res\\interlace.fx" - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_LOGO9 BITMAP "res\\logo9.bmp" -IDB_LOGO10 BITMAP "res\\logo10.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_CONFIG DIALOGEX 0, 0, 189, 351 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Settings..." -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CONTROL 2022,IDC_LOGO11,"Static",SS_BITMAP,7,7,175,42 - CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,7,7,175,44 - LTEXT "Resolution:",IDC_STATIC,7,58,37,8 - COMBOBOX IDC_RESOLUTION,71,56,111,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Renderer:",IDC_STATIC,7,73,34,8 - COMBOBOX IDC_RENDERER,71,71,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Interlacing (F5):",IDC_STATIC,7,89,53,8 - COMBOBOX IDC_INTERLACE,71,86,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Aspect Ratio (F6):",IDC_STATIC,7,104,60,8 - COMBOBOX IDC_ASPECTRATIO,71,101,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "OK",IDOK,43,323,50,14 - PUSHBUTTON "Cancel",IDCANCEL,96,323,50,14 - CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,231,93,10 - LTEXT "D3D internal res:",IDC_STATIC,18,135,55,8 - EDITTEXT IDC_RESX_EDIT,82,132,35,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,110,135,11,14 - EDITTEXT IDC_RESY_EDIT,120,132,35,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,144,135,11,14 - CONTROL "Native",IDC_NATIVERES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,123,165,33,10 - COMBOBOX IDC_UPSCALE_MULTIPLIER,82,147,74,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Or use Scaling:",IDC_STATIC,18,150,49,8 - LTEXT "Or use original PS2 resolution :",IDC_STATIC,18,165,99,8 - EDITTEXT IDC_MSAAEDIT,75,258,35,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_MSAA,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,109,261,11,14 - LTEXT "HW Anti Aliasing",IDC_STATIC_TEXT_HWAA,18,261,53,8 - GROUPBOX "D3D Enhancements (can cause glitches)",IDC_STATIC,7,117,175,66 - LTEXT "SW rend. threads:",IDC_STATIC,7,189,60,8 - EDITTEXT IDC_SWTHREADS_EDIT,71,187,35,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,190,11,14 - CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,7,203,67,10 - CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,204,58,10 - CONTROL "Allow 8-bit textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,217,82,10 - CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,217,93,10 - CONTROL "Edge anti-aliasing",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,231,72,10 - CONTROL "Alpha Hack",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,279,51,10 - CONTROL "Offset Hack",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,85,279,51,10 - GROUPBOX "Hacks",IDC_USERHACKS,13,244,161,71,BS_CENTER - EDITTEXT IDC_SKIPDRAWHACKEDIT,55,291,40,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,94,293,11,14 - LTEXT "SkipDraw:",IDC_STATIC_TEXT_SKIPDRAW,20,293,33,8 -END - -IDD_CAPTURE DIALOGEX 0, 0, 279, 71 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Capture settings" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - EDITTEXT IDC_FILENAME,7,7,207,14,ES_AUTOHSCROLL - PUSHBUTTON "Browse...",IDC_BROWSE,222,7,50,14 - COMBOBOX IDC_CODECS,7,27,207,122,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Config...",IDC_CONFIGURE,222,26,50,14 - LTEXT "Size:",IDC_STATIC,6,50,16,8 - EDITTEXT IDC_WIDTH,30,47,31,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - EDITTEXT IDC_HEIGHT,64,47,31,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - PUSHBUTTON "Cancel",IDCANCEL,169,47,50,14 - DEFPUSHBUTTON "OK",IDOK,221,47,50,14 -END - -IDD_GPUCONFIG DIALOGEX 0, 0, 189, 199 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Settings..." -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,7,7,175,44 - LTEXT "Resolution:",IDC_STATIC,7,59,37,8 - COMBOBOX IDC_RESOLUTION,78,57,104,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Renderer:",IDC_STATIC,7,74,34,8 - COMBOBOX IDC_RENDERER,78,72,104,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Texture Filter (Del):",IDC_STATIC,7,90,64,8 - COMBOBOX IDC_FILTER,78,87,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Dithering (End):",IDC_STATIC,7,105,52,8 - COMBOBOX IDC_DITHERING,78,102,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Aspect Ratio (PgDn):",IDC_STATIC,7,120,68,8 - COMBOBOX IDC_ASPECTRATIO,78,117,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Rendering Threads:",IDC_STATIC,7,157,64,8 - EDITTEXT IDC_SWTHREADS_EDIT,78,155,35,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,161,11,14 - DEFPUSHBUTTON "OK",IDOK,43,178,50,14 - PUSHBUTTON "Cancel",IDCANCEL,96,178,50,14 - CONTROL 2022,IDC_LOGO11,"Static",SS_BITMAP,7,7,173,42 - LTEXT "Internal Resolution:",IDC_STATIC,7,135,64,8 - COMBOBOX IDC_SCALE,78,132,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,129,157,49,10 -END - -IDD_CONFIG2 DIALOGEX 0, 0, 187, 341 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Settings..." -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - CONTROL 2022,IDC_LOGO11,"Static",SS_BITMAP,6,6,173,42 - DEFPUSHBUTTON "OK",IDOK,41,312,50,14 - LTEXT "Renderer:",IDC_STATIC,6,57,34,8 - COMBOBOX IDC_RENDERER,70,55,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Interlacing (F5):",IDC_STATIC,6,73,81,8 - COMBOBOX IDC_INTERLACE,70,70,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Custom resolution:",IDC_STATIC,26,135,65,8 - EDITTEXT IDC_RESX_EDIT,92,132,35,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,120,135,11,14 - EDITTEXT IDC_RESY_EDIT,130,132,35,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,154,130,11,14 - CONTROL "Native",IDC_NATIVERES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,105,33,10 - LTEXT "Rendering threads:",IDC_STATIC,19,214,63,8 - EDITTEXT IDC_SWTHREADS_EDIT,87,212,35,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,115,215,11,14 - COMBOBOX IDC_UPSCALE_MULTIPLIER,92,117,74,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Or use Scaling:",IDC_STATIC,38,120,49,8 - LTEXT "Original PS2 resolution :",IDC_STATIC,10,105,80,8 - CONTROL "Edge anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,230,93,10 - PUSHBUTTON "Cancel",IDCANCEL,95,312,50,14 - CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,6,6,175,44 - CONTROL "Alpha Hack",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,275,51,10 - CONTROL "Offset Hack",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,87,275,51,10 - GROUPBOX "Hacks",IDC_USERHACKS,6,250,175,55,BS_CENTER - EDITTEXT IDC_SKIPDRAWHACKEDIT,65,286,40,14,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,104,288,11,14 - LTEXT "Skipdraw Hack:",IDC_STATIC_TEXT_SKIPDRAW,11,289,50,8 - EDITTEXT IDC_MSAAEDIT,69,260,35,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_MSAA,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,103,263,11,14 - GROUPBOX "D3D Internal resolution (can cause glitches)",IDC_STATIC,6,87,175,64,BS_CENTER - GROUPBOX "Software Mode Settings",IDC_STATIC,6,198,175,50,BS_CENTER - GROUPBOX "Hardware Mode Settings",IDC_STATIC,6,152,175,45,BS_CENTER - CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,88,166,58,10 - CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,88,179,87,10 - CONTROL "Allow 8-bit textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,179,82,10 - CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,6,165,67,10 - LTEXT "HW Anti Aliasing",IDC_STATIC_TEXT_HWAA,11,263,53,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_CONFIG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 182 - VERTGUIDE, 71 - VERTGUIDE, 89 - VERTGUIDE, 182 - TOPMARGIN, 7 - BOTTOMMARGIN, 344 - HORZGUIDE, 49 - END - - IDD_CAPTURE, DIALOG - BEGIN - VERTGUIDE, 6 - VERTGUIDE, 30 - VERTGUIDE, 271 - HORZGUIDE, 54 - END - - IDD_GPUCONFIG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 182 - VERTGUIDE, 78 - VERTGUIDE, 182 - TOPMARGIN, 7 - BOTTOMMARGIN, 192 - END - - IDD_CONFIG2, DIALOG - BEGIN - LEFTMARGIN, 6 - RIGHTMARGIN, 181 - VERTGUIDE, 87 - TOPMARGIN, 6 - BOTTOMMARGIN, 334 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,1,9 - PRODUCTVERSION 1,0,1,9 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "Comments", "http://guliverkli.sf.net/" - VALUE "CompanyName", "Gabest" - VALUE "FileDescription", "GS plugin for ps2 emulators" - VALUE "FileVersion", "1, 0, 1, 9" - VALUE "InternalName", "GSdx.dll" - VALUE "LegalCopyright", "Copyright (c) 2007-2008 Gabest. All rights reserved." - VALUE "OriginalFilename", "GSdx.dll" - VALUE "ProductName", "GSdx" - VALUE "ProductVersion", "1, 0, 1, 9" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#include "res/tfx.fx" -#include "res/convert.fx" -#include "res/interlace.fx" -#include "res/merge.fx" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""res/tfx.fx""\r\n" + "#include ""res/convert.fx""\r\n" + "#include ""res/interlace.fx""\r\n" + "#include ""res/merge.fx""\r\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// RCDATA +// + +IDR_CONVERT_FX RCDATA "res\\convert.fx" +IDR_TFX_FX RCDATA "res\\tfx.fx" +IDR_MERGE_FX RCDATA "res\\merge.fx" +IDR_INTERLACE_FX RCDATA "res\\interlace.fx" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_LOGO9 BITMAP "res\\logo9.bmp" +IDB_LOGO10 BITMAP "res\\logo10.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_CONFIG DIALOGEX 0, 0, 189, 351 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Settings..." +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL 2022,IDC_LOGO11,"Static",SS_BITMAP,7,7,175,42 + CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,7,7,175,44 + LTEXT "Resolution:",IDC_STATIC,7,58,37,8 + COMBOBOX IDC_RESOLUTION,71,56,111,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Renderer:",IDC_STATIC,7,73,34,8 + COMBOBOX IDC_RENDERER,71,71,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Interlacing (F5):",IDC_STATIC,7,89,53,8 + COMBOBOX IDC_INTERLACE,71,86,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Aspect Ratio (F6):",IDC_STATIC,7,104,60,8 + COMBOBOX IDC_ASPECTRATIO,71,101,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,43,323,50,14 + PUSHBUTTON "Cancel",IDCANCEL,96,323,50,14 + CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,231,93,10 + LTEXT "D3D internal res:",IDC_STATIC,18,135,55,8 + EDITTEXT IDC_RESX_EDIT,82,132,35,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,110,135,11,14 + EDITTEXT IDC_RESY_EDIT,120,132,35,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,144,135,11,14 + CONTROL "Native",IDC_NATIVERES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,123,165,33,10 + COMBOBOX IDC_UPSCALE_MULTIPLIER,82,147,74,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Or use Scaling:",IDC_STATIC,18,150,49,8 + LTEXT "Or use original PS2 resolution :",IDC_STATIC,18,165,99,8 + EDITTEXT IDC_MSAAEDIT,75,258,35,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_MSAA,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,109,261,11,14 + LTEXT "HW Anti Aliasing",IDC_STATIC_TEXT_HWAA,18,261,53,8 + GROUPBOX "D3D Enhancements (can cause glitches)",IDC_STATIC,7,117,175,66 + LTEXT "SW rend. threads:",IDC_STATIC,7,189,60,8 + EDITTEXT IDC_SWTHREADS_EDIT,71,187,35,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,190,11,14 + CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,7,203,67,10 + CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,204,58,10 + CONTROL "Allow 8-bit textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,217,82,10 + CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,217,93,10 + CONTROL "Edge anti-aliasing",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,231,72,10 + CONTROL "Alpha Hack",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,279,51,10 + CONTROL "Offset Hack",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,85,279,51,10 + GROUPBOX "Hacks",IDC_USERHACKS,13,244,161,71,BS_CENTER + EDITTEXT IDC_SKIPDRAWHACKEDIT,55,291,40,14,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,94,293,11,14 + LTEXT "SkipDraw:",IDC_STATIC_TEXT_SKIPDRAW,20,293,33,8 +END + +IDD_CAPTURE DIALOGEX 0, 0, 279, 71 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Capture settings" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + EDITTEXT IDC_FILENAME,7,7,207,14,ES_AUTOHSCROLL + PUSHBUTTON "Browse...",IDC_BROWSE,222,7,50,14 + COMBOBOX IDC_CODECS,7,27,207,122,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Config...",IDC_CONFIGURE,222,26,50,14 + LTEXT "Size:",IDC_STATIC,6,50,16,8 + EDITTEXT IDC_WIDTH,30,47,31,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_HEIGHT,64,47,31,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + PUSHBUTTON "Cancel",IDCANCEL,169,47,50,14 + DEFPUSHBUTTON "OK",IDOK,221,47,50,14 +END + +IDD_GPUCONFIG DIALOGEX 0, 0, 189, 199 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Settings..." +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,7,7,175,44 + LTEXT "Resolution:",IDC_STATIC,7,59,37,8 + COMBOBOX IDC_RESOLUTION,78,57,104,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Renderer:",IDC_STATIC,7,74,34,8 + COMBOBOX IDC_RENDERER,78,72,104,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Texture Filter (Del):",IDC_STATIC,7,90,64,8 + COMBOBOX IDC_FILTER,78,87,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Dithering (End):",IDC_STATIC,7,105,52,8 + COMBOBOX IDC_DITHERING,78,102,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Aspect Ratio (PgDn):",IDC_STATIC,7,120,68,8 + COMBOBOX IDC_ASPECTRATIO,78,117,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Rendering Threads:",IDC_STATIC,7,157,64,8 + EDITTEXT IDC_SWTHREADS_EDIT,78,155,35,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,161,11,14 + DEFPUSHBUTTON "OK",IDOK,43,178,50,14 + PUSHBUTTON "Cancel",IDCANCEL,96,178,50,14 + CONTROL 2022,IDC_LOGO11,"Static",SS_BITMAP,7,7,173,42 + LTEXT "Internal Resolution:",IDC_STATIC,7,135,64,8 + COMBOBOX IDC_SCALE,78,132,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,129,157,49,10 +END + +IDD_CONFIG2 DIALOGEX 0, 0, 187, 341 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Settings..." +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + CONTROL 2022,IDC_LOGO11,"Static",SS_BITMAP,6,6,173,42 + DEFPUSHBUTTON "OK",IDOK,41,312,50,14 + LTEXT "Renderer:",IDC_STATIC,6,57,34,8 + COMBOBOX IDC_RENDERER,70,55,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Interlacing (F5):",IDC_STATIC,6,73,81,8 + COMBOBOX IDC_INTERLACE,70,70,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Custom resolution:",IDC_STATIC,26,135,65,8 + EDITTEXT IDC_RESX_EDIT,92,132,35,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,120,135,11,14 + EDITTEXT IDC_RESY_EDIT,130,132,35,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,154,130,11,14 + CONTROL "Native",IDC_NATIVERES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,105,33,10 + LTEXT "Rendering threads:",IDC_STATIC,19,214,63,8 + EDITTEXT IDC_SWTHREADS_EDIT,87,212,35,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,115,215,11,14 + COMBOBOX IDC_UPSCALE_MULTIPLIER,92,117,74,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Or use Scaling:",IDC_STATIC,38,120,49,8 + LTEXT "Original PS2 resolution :",IDC_STATIC,10,105,80,8 + CONTROL "Edge anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,230,93,10 + PUSHBUTTON "Cancel",IDCANCEL,95,312,50,14 + CONTROL 2021,IDC_LOGO9,"Static",SS_BITMAP,6,6,175,44 + CONTROL "Alpha Hack",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,275,51,10 + CONTROL "Offset Hack",IDC_OFFSETHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,87,275,51,10 + GROUPBOX "Hacks",IDC_USERHACKS,6,250,175,55,BS_CENTER + EDITTEXT IDC_SKIPDRAWHACKEDIT,65,286,40,14,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SKIPDRAWHACK,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,104,288,11,14 + LTEXT "Skipdraw Hack:",IDC_STATIC_TEXT_SKIPDRAW,11,289,50,8 + EDITTEXT IDC_MSAAEDIT,69,260,35,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_MSAA,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,103,263,11,14 + GROUPBOX "D3D Internal resolution (can cause glitches)",IDC_STATIC,6,87,175,64,BS_CENTER + GROUPBOX "Software Mode Settings",IDC_STATIC,6,198,175,50,BS_CENTER + GROUPBOX "Hardware Mode Settings",IDC_STATIC,6,152,175,45,BS_CENTER + CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,88,166,58,10 + CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,88,179,87,10 + CONTROL "Allow 8-bit textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,179,82,10 + CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,6,165,67,10 + LTEXT "HW Anti Aliasing",IDC_STATIC_TEXT_HWAA,11,263,53,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_CONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 182 + VERTGUIDE, 71 + VERTGUIDE, 89 + VERTGUIDE, 182 + TOPMARGIN, 7 + BOTTOMMARGIN, 344 + HORZGUIDE, 49 + END + + IDD_CAPTURE, DIALOG + BEGIN + VERTGUIDE, 6 + VERTGUIDE, 30 + VERTGUIDE, 271 + HORZGUIDE, 54 + END + + IDD_GPUCONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 182 + VERTGUIDE, 78 + VERTGUIDE, 182 + TOPMARGIN, 7 + BOTTOMMARGIN, 192 + END + + IDD_CONFIG2, DIALOG + BEGIN + LEFTMARGIN, 6 + RIGHTMARGIN, 181 + VERTGUIDE, 87 + TOPMARGIN, 6 + BOTTOMMARGIN, 334 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,1,9 + PRODUCTVERSION 1,0,1,9 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "Comments", "http://guliverkli.sf.net/" + VALUE "CompanyName", "Gabest" + VALUE "FileDescription", "GS plugin for ps2 emulators" + VALUE "FileVersion", "1, 0, 1, 9" + VALUE "InternalName", "GSdx.dll" + VALUE "LegalCopyright", "Copyright (c) 2007-2008 Gabest. All rights reserved." + VALUE "OriginalFilename", "GSdx.dll" + VALUE "ProductName", "GSdx" + VALUE "ProductVersion", "1, 0, 1, 9" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "res/tfx.fx" +#include "res/convert.fx" +#include "res/interlace.fx" +#include "res/merge.fx" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/GSdx/GSdx.vcxproj b/plugins/GSdx/GSdx.vcxproj index 639bf26444..08b1d981dc 100644 --- a/plugins/GSdx/GSdx.vcxproj +++ b/plugins/GSdx/GSdx.vcxproj @@ -1,1875 +1,1875 @@ - - - - - Debug AVX - Win32 - - - Debug AVX - x64 - - - Debug SSE2 - Win32 - - - Debug SSE2 - x64 - - - Debug SSE4 - Win32 - - - Debug SSE4 - x64 - - - Debug SSSE3 - Win32 - - - Debug SSSE3 - x64 - - - Debug - Win32 - - - Debug - x64 - - - Devel - Win32 - - - Release AVX - Win32 - - - Release AVX - x64 - - - Release SSE2 - Win32 - - - Release SSE2 - x64 - - - Release SSE4 - Win32 - - - Release SSE4 - x64 - - - Release SSSE3 - Win32 - - - Release SSSE3 - x64 - - - Release - Win32 - - - Release - x64 - - - Template - Win32 - - - Template - x64 - - - - GSdx - {18E42F6F-3A62-41EE-B42F-79366C4F1E95} - GSdx - Win32Proj - - - - Application - - - Application - - - DynamicLibrary - MultiByte - true - - - DynamicLibrary - MultiByte - true - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - true - - - DynamicLibrary - MultiByte - true - - - DynamicLibrary - MultiByte - true - - - DynamicLibrary - MultiByte - - - Application - - - DynamicLibrary - Static - MultiByte - true - - - DynamicLibrary - Static - MultiByte - - - DynamicLibrary - Static - MultiByte - true - - - DynamicLibrary - Static - MultiByte - true - - - DynamicLibrary - Static - MultiByte - - - DynamicLibrary - Static - MultiByte - - - DynamicLibrary - Static - MultiByte - - - DynamicLibrary - Static - MultiByte - true - - - DynamicLibrary - Static - MultiByte - true - - - DynamicLibrary - Static - MultiByte - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Use - - - $(OutDir)$(TargetName)$(TargetExt) - $(SvnRootDir)\deps\$(Platform)\Debug;%(AdditionalLibraryDirectories) - .\GSdx.def - MachineX86 - - - - - Use - - - - - MachineX64 - - - - - Use - - - $(SvnRootDir)\deps\$(Platform)\Devel;%(AdditionalLibraryDirectories) - .\GSdx.def - MachineX86 - $(OutDir)$(TargetName)$(TargetExt) - - - - - Use - - - $(SvnRootDir)\deps\$(Platform)\Release;%(AdditionalLibraryDirectories) - .\GSdx.def - MachineX86 - $(OutDir)$(TargetName)$(TargetExt) - - - - - Use - - - - - MachineX64 - - - - - Use - - - $(SvnRootDir)\deps\$(Platform)\Release;%(AdditionalLibraryDirectories) - .\GSdx.def - MachineX86 - $(OutDir)$(TargetName)$(TargetExt) - - - - - Use - - - - - MachineX86 - - - - - Use - - - $(OutDir)$(TargetName)$(TargetExt) - $(SvnRootDir)\deps\$(Platform)\Debug;%(AdditionalLibraryDirectories) - .\GSdx.def - MachineX86 - - - - - Use - - - - - MachineX64 - - - - - Use - - - $(OutDir)$(TargetName)$(TargetExt) - $(SvnRootDir)\deps\$(Platform)\Debug;%(AdditionalLibraryDirectories) - .\GSdx.def - MachineX86 - - - - - Use - - - $(OutDir)$(TargetName)$(TargetExt) - $(SvnRootDir)\deps\$(Platform)\Debug;%(AdditionalLibraryDirectories) - .\GSdx.def - MachineX86 - - - - - X64 - - - Use - - - - - MachineX64 - - - - - X64 - - - Use - - - - - MachineX64 - - - - - Use - - - $(SvnRootDir)\deps\$(Platform)\Release;%(AdditionalLibraryDirectories) - .\GSdx.def - MachineX86 - $(OutDir)$(TargetName)$(TargetExt) - - - - - Use - - - $(SvnRootDir)\deps\$(Platform)\Release;%(AdditionalLibraryDirectories) - .\GSdx.def - MachineX86 - $(OutDir)$(TargetName)$(TargetExt) - - - - - X64 - - - Use - - - - - MachineX64 - - - - - X64 - - - Use - - - - - MachineX64 - - - - - $(SvnRootDir)\deps\$(Platform)\Debug;%(AdditionalLibraryDirectories) - - - - - X64 - - - Use - - - - - - - MachineX64 - - - - - $(SvnRootDir)\deps\$(Platform)\Release;%(AdditionalLibraryDirectories) - - - - - X64 - - - Use - - - - - - - MachineX64 - - - - - - - - - - - - - - AssemblyAndSourceCode - AssemblyAndSourceCode - - - - AssemblyAndSourceCode - AssemblyAndSourceCode - - - AssemblyAndSourceCode - AssemblyAndSourceCode - - - - - - - - - - - - - - AssemblyAndSourceCode - - - - - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - - - - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - - - - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - - - - - - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - - - - - AssemblyAndSourceCode - - - - - - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - AssemblyAndSourceCode - - - - - - - AssemblyAndSourceCode - AssemblyAndSourceCode - - - - - AssemblyAndSourceCode - AssemblyAndSourceCode - - - - - - - AssemblyAndSourceCode - AssemblyAndSourceCode - - - - - - - - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug AVX + Win32 + + + Debug AVX + x64 + + + Debug SSE2 + Win32 + + + Debug SSE2 + x64 + + + Debug SSE4 + Win32 + + + Debug SSE4 + x64 + + + Debug SSSE3 + Win32 + + + Debug SSSE3 + x64 + + + Debug + Win32 + + + Debug + x64 + + + Devel + Win32 + + + Release AVX + Win32 + + + Release AVX + x64 + + + Release SSE2 + Win32 + + + Release SSE2 + x64 + + + Release SSE4 + Win32 + + + Release SSE4 + x64 + + + Release SSSE3 + Win32 + + + Release SSSE3 + x64 + + + Release + Win32 + + + Release + x64 + + + Template + Win32 + + + Template + x64 + + + + GSdx + {18E42F6F-3A62-41EE-B42F-79366C4F1E95} + GSdx + Win32Proj + + + + Application + + + Application + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + + + Application + + + DynamicLibrary + Static + MultiByte + true + + + DynamicLibrary + Static + MultiByte + + + DynamicLibrary + Static + MultiByte + true + + + DynamicLibrary + Static + MultiByte + true + + + DynamicLibrary + Static + MultiByte + + + DynamicLibrary + Static + MultiByte + + + DynamicLibrary + Static + MultiByte + + + DynamicLibrary + Static + MultiByte + true + + + DynamicLibrary + Static + MultiByte + true + + + DynamicLibrary + Static + MultiByte + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Use + + + $(OutDir)$(TargetName)$(TargetExt) + $(SvnRootDir)\deps\$(Platform)\Debug;%(AdditionalLibraryDirectories) + .\GSdx.def + MachineX86 + + + + + Use + + + + + MachineX64 + + + + + Use + + + $(SvnRootDir)\deps\$(Platform)\Devel;%(AdditionalLibraryDirectories) + .\GSdx.def + MachineX86 + $(OutDir)$(TargetName)$(TargetExt) + + + + + Use + + + $(SvnRootDir)\deps\$(Platform)\Release;%(AdditionalLibraryDirectories) + .\GSdx.def + MachineX86 + $(OutDir)$(TargetName)$(TargetExt) + + + + + Use + + + + + MachineX64 + + + + + Use + + + $(SvnRootDir)\deps\$(Platform)\Release;%(AdditionalLibraryDirectories) + .\GSdx.def + MachineX86 + $(OutDir)$(TargetName)$(TargetExt) + + + + + Use + + + + + MachineX86 + + + + + Use + + + $(OutDir)$(TargetName)$(TargetExt) + $(SvnRootDir)\deps\$(Platform)\Debug;%(AdditionalLibraryDirectories) + .\GSdx.def + MachineX86 + + + + + Use + + + + + MachineX64 + + + + + Use + + + $(OutDir)$(TargetName)$(TargetExt) + $(SvnRootDir)\deps\$(Platform)\Debug;%(AdditionalLibraryDirectories) + .\GSdx.def + MachineX86 + + + + + Use + + + $(OutDir)$(TargetName)$(TargetExt) + $(SvnRootDir)\deps\$(Platform)\Debug;%(AdditionalLibraryDirectories) + .\GSdx.def + MachineX86 + + + + + X64 + + + Use + + + + + MachineX64 + + + + + X64 + + + Use + + + + + MachineX64 + + + + + Use + + + $(SvnRootDir)\deps\$(Platform)\Release;%(AdditionalLibraryDirectories) + .\GSdx.def + MachineX86 + $(OutDir)$(TargetName)$(TargetExt) + + + + + Use + + + $(SvnRootDir)\deps\$(Platform)\Release;%(AdditionalLibraryDirectories) + .\GSdx.def + MachineX86 + $(OutDir)$(TargetName)$(TargetExt) + + + + + X64 + + + Use + + + + + MachineX64 + + + + + X64 + + + Use + + + + + MachineX64 + + + + + $(SvnRootDir)\deps\$(Platform)\Debug;%(AdditionalLibraryDirectories) + + + + + X64 + + + Use + + + + + + + MachineX64 + + + + + $(SvnRootDir)\deps\$(Platform)\Release;%(AdditionalLibraryDirectories) + + + + + X64 + + + Use + + + + + + + MachineX64 + + + + + + + + + + + + + + AssemblyAndSourceCode + AssemblyAndSourceCode + + + + AssemblyAndSourceCode + AssemblyAndSourceCode + + + AssemblyAndSourceCode + AssemblyAndSourceCode + + + + + + + + + + + + + + AssemblyAndSourceCode + + + + + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + + + + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + + + + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + + + + + + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + + + + + AssemblyAndSourceCode + + + + + + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + AssemblyAndSourceCode + + + + + + + AssemblyAndSourceCode + AssemblyAndSourceCode + + + + + AssemblyAndSourceCode + AssemblyAndSourceCode + + + + + + + AssemblyAndSourceCode + AssemblyAndSourceCode + + + + + + + + Create + Create + Create + Create + Create + Create + Create + Create + Create + Create + Create + Create + Create + Create + Create + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/GSdx/GSdx.vcxproj.filters b/plugins/GSdx/GSdx.vcxproj.filters index 71a5406543..7b0dae2e1f 100644 --- a/plugins/GSdx/GSdx.vcxproj.filters +++ b/plugins/GSdx/GSdx.vcxproj.filters @@ -1,626 +1,626 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - {6d029896-e5fd-4b46-8576-52d7d90125e6} - - - {3c2d6a4a-ff5a-420d-a0f7-4c17cc5c19df} - - - {d6fcc23b-bc82-4390-8a9a-928910bc4123} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Resource Files - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Baseclasses - - - Xbyak - - - Xbyak - - - Xbyak - - - Xbyak - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - - Resource Files - - - Shaders - - - Shaders - - - Shaders - - - Shaders - - - Baseclasses - - - Baseclasses - - - - - - Resource Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {6d029896-e5fd-4b46-8576-52d7d90125e6} + + + {3c2d6a4a-ff5a-420d-a0f7-4c17cc5c19df} + + + {d6fcc23b-bc82-4390-8a9a-928910bc4123} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Resource Files + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Baseclasses + + + Xbyak + + + Xbyak + + + Xbyak + + + Xbyak + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + Resource Files + + + Shaders + + + Shaders + + + Shaders + + + Shaders + + + Baseclasses + + + Baseclasses + + + + + + Resource Files + + \ No newline at end of file diff --git a/plugins/GSdx/GSdx_vs2008.vcproj b/plugins/GSdx/GSdx_vs2008.vcproj index 0d95c2ebff..61dd29c2b6 100644 --- a/plugins/GSdx/GSdx_vs2008.vcproj +++ b/plugins/GSdx/GSdx_vs2008.vcproj @@ -1,4630 +1,4630 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/GSdx/baseclasses/activex.rcv b/plugins/GSdx/baseclasses/activex.rcv index 8aef99bfa5..3894f65096 100644 --- a/plugins/GSdx/baseclasses/activex.rcv +++ b/plugins/GSdx/baseclasses/activex.rcv @@ -1,142 +1,142 @@ -//------------------------------------------------------------------------------ -// File: Activex.rcv -// -// Desc: DirectShow base classes - this file defines the version resource -// used for the application. -// -// NOTE: All strings MUST have an explicit \0 for termination! -// -// For a complete description of the Version Resource, search the -// Microsoft Developer's Network (MSDN) CD-ROM for 'version resource'.. -// -// Copyright (c) 1992 - 2002, Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef _ACTIVEX_RCV_ -#define _ACTIVEX_RCV_ - -#ifndef WIN32 -#define WIN32 -#endif -#include - -#ifndef _ACTIVEX_VER_ -#include -#endif - -// -// Version flags. -// -// OFFICIAL and FINAL should be defined when appropriate. -// - -#ifndef OFFICIAL -#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD -#else -#define VER_PRIVATEBUILD 0 -#endif - -#ifndef FINAL -#define VER_PRERELEASE VS_FF_PRERELEASE -#else -#define VER_PRERELEASE 0 -#endif - -#ifdef DEBUG -#define VER_DEBUG VS_FF_DEBUG -#else -#define VER_DEBUG 0 -#endif - -// -// Version definitions -// - -#define VERSION_RES_FLAGSMASK 0x0030003FL -#define VERSION_RES_FLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG) - -#ifndef VERSION_RES_OS -#define VERSION_RES_OS VOS__WINDOWS32 -#endif - -#ifndef VERSION_RES_TYPE -#define VERSION_RES_TYPE VFT_DLL -#endif - -#ifndef VERSION_RES_SUBTYPE -#define VERSION_RES_SUBTYPE VFT2_UNKNOWN -#endif - -#define VERSION_RES_LANGUAGE 0x409 - -#ifndef VERSION_RES_CHARSET -#ifdef UNICODE -#define VERSION_RES_CHARSET 1200 -#else -#define VERSION_RES_CHARSET 1252 -#endif -#endif - -#ifndef VERSION_RES_ACTIVEX -#define VERSION_RES_ACTIVEX "Filter dll\0" -#endif - -#ifdef AMOVIE_SELF_REGISTER -#ifndef OLE_SELF_REGISTER -#define OLE_SELF_REGISTER -#endif -#endif - -#ifdef OLE_SELF_REGISTER -#ifdef AMOVIE_SELF_REGISTER -#define VERSION_RES_SELFREGISTER "AM20\0" -#else -#define VERSION_RES_SELFREGISTER "\0" -#endif -#endif - -// -// Version resource -// - -VS_VERSION_INFO VERSIONINFO -FILEVERSION VERSION_RES_MAJOR_VER, VERSION_RES_MINOR_VER, 0, VERSION_RES_BUILD -PRODUCTVERSION VERSION_RES_MAJOR_VER, VERSION_RES_MINOR_VER, 0, VERSION_RES_BUILD -FILEFLAGSMASK VERSION_RES_FLAGSMASK -FILEFLAGS VERSION_RES_FLAGS -FILEOS VERSION_RES_OS -FILETYPE VERSION_RES_TYPE -FILESUBTYPE VERSION_RES_SUBTYPE -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - BEGIN - VALUE "CompanyName", VERSION_RES_COMPANY_NAME - VALUE "Comment", VERSION_RES_COMMENT - VALUE "FileDescription", VERSION_RES_BIN_DESCRIPTION - VALUE "FileVersion", VERSION_RES_STRING - VALUE "InternalName", VERSION_RES_BIN_NAME - VALUE "LegalCopyright", VERSION_RES_COPYRIGHT - VALUE "OriginalFilename", VERSION_RES_BIN_NAME - VALUE "ProductName", VERSION_RES_PRODUCT_NAME -#ifdef DEBUG - VALUE "ProductVersion", VERSION_RES_STRING_D -#else - VALUE "ProductVersion", VERSION_RES_STRING -#endif - VALUE "ActiveMovie", VERSION_RES_ACTIVEX -#ifdef OLE_SELF_REGISTER - VALUE "OLESelfRegister", VERSION_RES_SELFREGISTER -#endif - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", VERSION_RES_LANGUAGE, VERSION_RES_CHARSET - END -END - -#endif -// _ACTIVEX_RCV_ +//------------------------------------------------------------------------------ +// File: Activex.rcv +// +// Desc: DirectShow base classes - this file defines the version resource +// used for the application. +// +// NOTE: All strings MUST have an explicit \0 for termination! +// +// For a complete description of the Version Resource, search the +// Microsoft Developer's Network (MSDN) CD-ROM for 'version resource'.. +// +// Copyright (c) 1992 - 2002, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef _ACTIVEX_RCV_ +#define _ACTIVEX_RCV_ + +#ifndef WIN32 +#define WIN32 +#endif +#include + +#ifndef _ACTIVEX_VER_ +#include +#endif + +// +// Version flags. +// +// OFFICIAL and FINAL should be defined when appropriate. +// + +#ifndef OFFICIAL +#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD +#else +#define VER_PRIVATEBUILD 0 +#endif + +#ifndef FINAL +#define VER_PRERELEASE VS_FF_PRERELEASE +#else +#define VER_PRERELEASE 0 +#endif + +#ifdef DEBUG +#define VER_DEBUG VS_FF_DEBUG +#else +#define VER_DEBUG 0 +#endif + +// +// Version definitions +// + +#define VERSION_RES_FLAGSMASK 0x0030003FL +#define VERSION_RES_FLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG) + +#ifndef VERSION_RES_OS +#define VERSION_RES_OS VOS__WINDOWS32 +#endif + +#ifndef VERSION_RES_TYPE +#define VERSION_RES_TYPE VFT_DLL +#endif + +#ifndef VERSION_RES_SUBTYPE +#define VERSION_RES_SUBTYPE VFT2_UNKNOWN +#endif + +#define VERSION_RES_LANGUAGE 0x409 + +#ifndef VERSION_RES_CHARSET +#ifdef UNICODE +#define VERSION_RES_CHARSET 1200 +#else +#define VERSION_RES_CHARSET 1252 +#endif +#endif + +#ifndef VERSION_RES_ACTIVEX +#define VERSION_RES_ACTIVEX "Filter dll\0" +#endif + +#ifdef AMOVIE_SELF_REGISTER +#ifndef OLE_SELF_REGISTER +#define OLE_SELF_REGISTER +#endif +#endif + +#ifdef OLE_SELF_REGISTER +#ifdef AMOVIE_SELF_REGISTER +#define VERSION_RES_SELFREGISTER "AM20\0" +#else +#define VERSION_RES_SELFREGISTER "\0" +#endif +#endif + +// +// Version resource +// + +VS_VERSION_INFO VERSIONINFO +FILEVERSION VERSION_RES_MAJOR_VER, VERSION_RES_MINOR_VER, 0, VERSION_RES_BUILD +PRODUCTVERSION VERSION_RES_MAJOR_VER, VERSION_RES_MINOR_VER, 0, VERSION_RES_BUILD +FILEFLAGSMASK VERSION_RES_FLAGSMASK +FILEFLAGS VERSION_RES_FLAGS +FILEOS VERSION_RES_OS +FILETYPE VERSION_RES_TYPE +FILESUBTYPE VERSION_RES_SUBTYPE +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", VERSION_RES_COMPANY_NAME + VALUE "Comment", VERSION_RES_COMMENT + VALUE "FileDescription", VERSION_RES_BIN_DESCRIPTION + VALUE "FileVersion", VERSION_RES_STRING + VALUE "InternalName", VERSION_RES_BIN_NAME + VALUE "LegalCopyright", VERSION_RES_COPYRIGHT + VALUE "OriginalFilename", VERSION_RES_BIN_NAME + VALUE "ProductName", VERSION_RES_PRODUCT_NAME +#ifdef DEBUG + VALUE "ProductVersion", VERSION_RES_STRING_D +#else + VALUE "ProductVersion", VERSION_RES_STRING +#endif + VALUE "ActiveMovie", VERSION_RES_ACTIVEX +#ifdef OLE_SELF_REGISTER + VALUE "OLESelfRegister", VERSION_RES_SELFREGISTER +#endif + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", VERSION_RES_LANGUAGE, VERSION_RES_CHARSET + END +END + +#endif +// _ACTIVEX_RCV_ diff --git a/plugins/GSdx/baseclasses/activex.ver b/plugins/GSdx/baseclasses/activex.ver index 4786f68eea..f948934679 100644 --- a/plugins/GSdx/baseclasses/activex.ver +++ b/plugins/GSdx/baseclasses/activex.ver @@ -1,56 +1,56 @@ -//------------------------------------------------------------------------------ -// File: Activex.ver -// -// Desc: DirectShow base classes - common versioning information for -// ACTIVEX binaries. -// -// Copyright (c) 1996-2002, Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -#ifndef _ACTIVEX_VER_ -#define _ACTIVEX_VER_ - -// NOTE: all string resources that will be used in ACTIVEX.RCV for the -// version resource information *MUST* have an explicit \0 terminator! - -#define VERSION_RES_MAJOR_VER 9 -#define VERSION_RES_MINOR_VER 0 -#define VERSION_RES_BUILD 0 - -#define VERSION_RES_STRING_D "9.00 (Debug)\0" -#define VERSION_RES_STRING "9.00\0" - -#define VERSION_RES_PRODUCT_NAME "DirectX 9.0 Sample\0" -#define VERSION_RES_COMMENT "DirectShow Sample\0" -#define VERSION_RES_COMPANY_NAME "Microsoft Corporation\0" -#define VERSION_RES_COPYRIGHT "Copyright (C) 1992-2002 Microsoft Corporation\0" - -// The following defines are required on a file-by-file basis -// -// #define VERSION_RES_BIN_NAME "sample.ax\0" -// #define VERSION_RES_BIN_DESCRIPTION "Sample Filter\0" -// -// Also required, if you don't want the defaults, are -// -// #define VERSION_RES_ACTIVEX "Filter dll\0" (the default value) -// -// A string defining the type of component. -// -// #define VERSION_RES_TYPE VFT_DLL (default) -// VFT_APP -// VFT_VXD -// VFT_DRV -// VFT_FONT -// VFT_STATIC_LIB -// VFT_UNKNOWN -// -// #define VERSION_RES_SUBTYPE VFT2_UNKNOWN (default) -// VFT2_DRV_INSTALLABLE -// VFT2_DRV_SOUND -// -// -// See winver.h for further details - -#endif - +//------------------------------------------------------------------------------ +// File: Activex.ver +// +// Desc: DirectShow base classes - common versioning information for +// ACTIVEX binaries. +// +// Copyright (c) 1996-2002, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +#ifndef _ACTIVEX_VER_ +#define _ACTIVEX_VER_ + +// NOTE: all string resources that will be used in ACTIVEX.RCV for the +// version resource information *MUST* have an explicit \0 terminator! + +#define VERSION_RES_MAJOR_VER 9 +#define VERSION_RES_MINOR_VER 0 +#define VERSION_RES_BUILD 0 + +#define VERSION_RES_STRING_D "9.00 (Debug)\0" +#define VERSION_RES_STRING "9.00\0" + +#define VERSION_RES_PRODUCT_NAME "DirectX 9.0 Sample\0" +#define VERSION_RES_COMMENT "DirectShow Sample\0" +#define VERSION_RES_COMPANY_NAME "Microsoft Corporation\0" +#define VERSION_RES_COPYRIGHT "Copyright (C) 1992-2002 Microsoft Corporation\0" + +// The following defines are required on a file-by-file basis +// +// #define VERSION_RES_BIN_NAME "sample.ax\0" +// #define VERSION_RES_BIN_DESCRIPTION "Sample Filter\0" +// +// Also required, if you don't want the defaults, are +// +// #define VERSION_RES_ACTIVEX "Filter dll\0" (the default value) +// +// A string defining the type of component. +// +// #define VERSION_RES_TYPE VFT_DLL (default) +// VFT_APP +// VFT_VXD +// VFT_DRV +// VFT_FONT +// VFT_STATIC_LIB +// VFT_UNKNOWN +// +// #define VERSION_RES_SUBTYPE VFT2_UNKNOWN (default) +// VFT2_DRV_INSTALLABLE +// VFT2_DRV_SOUND +// +// +// See winver.h for further details + +#endif + diff --git a/plugins/GSdx/baseclasses/ddmm.cpp b/plugins/GSdx/baseclasses/ddmm.cpp index 652e6893a7..3cf6fc1490 100644 --- a/plugins/GSdx/baseclasses/ddmm.cpp +++ b/plugins/GSdx/baseclasses/ddmm.cpp @@ -1,130 +1,130 @@ -//------------------------------------------------------------------------------ -// File: DDMM.cpp -// -// Desc: DirectShow base classes - implements routines for using DirectDraw -// on a multimonitor system. -// -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------------------------ - - -//#include -#include -#include -#include "ddmm.h" - -/* - * FindDeviceCallback - */ -typedef struct { - LPSTR szDevice; - GUID* lpGUID; - GUID GUID; - BOOL fFound; -} FindDeviceData; - -BOOL CALLBACK FindDeviceCallback(GUID* lpGUID, LPSTR szName, LPSTR szDevice, LPVOID lParam) -{ - FindDeviceData *p = (FindDeviceData*)lParam; - - if (lstrcmpiA(p->szDevice, szDevice) == 0) { - if (lpGUID) { - p->GUID = *lpGUID; - p->lpGUID = &p->GUID; - } else { - p->lpGUID = NULL; - } - p->fFound = TRUE; - return FALSE; - } - return TRUE; -} - - -BOOL CALLBACK FindDeviceCallbackEx(GUID* lpGUID, LPSTR szName, LPSTR szDevice, LPVOID lParam, HMONITOR hMonitor) -{ - FindDeviceData *p = (FindDeviceData*)lParam; - - if (lstrcmpiA(p->szDevice, szDevice) == 0) { - if (lpGUID) { - p->GUID = *lpGUID; - p->lpGUID = &p->GUID; - } else { - p->lpGUID = NULL; - } - p->fFound = TRUE; - return FALSE; - } - return TRUE; -} - - -/* - * DirectDrawCreateFromDevice - * - * create a DirectDraw object for a particular device - */ -IDirectDraw * DirectDrawCreateFromDevice(LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, PDRAWENUM DirectDrawEnumerateP) -{ - IDirectDraw* pdd = NULL; - FindDeviceData find; - - if (szDevice == NULL) { - DirectDrawCreateP(NULL, &pdd, NULL); - return pdd; - } - - find.szDevice = szDevice; - find.fFound = FALSE; - DirectDrawEnumerateP(FindDeviceCallback, (LPVOID)&find); - - if (find.fFound) - { - // - // In 4bpp mode the following DDraw call causes a message box to be popped - // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we - // make sure it doesn't happen. - // - UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); - DirectDrawCreateP(find.lpGUID, &pdd, NULL); - SetErrorMode(ErrorMode); - } - - return pdd; -} - - -/* - * DirectDrawCreateFromDeviceEx - * - * create a DirectDraw object for a particular device - */ -IDirectDraw * DirectDrawCreateFromDeviceEx(LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, LPDIRECTDRAWENUMERATEEXA DirectDrawEnumerateExP) -{ - IDirectDraw* pdd = NULL; - FindDeviceData find; - - if (szDevice == NULL) { - DirectDrawCreateP(NULL, &pdd, NULL); - return pdd; - } - - find.szDevice = szDevice; - find.fFound = FALSE; - DirectDrawEnumerateExP(FindDeviceCallbackEx, (LPVOID)&find, - DDENUM_ATTACHEDSECONDARYDEVICES); - - if (find.fFound) - { - // - // In 4bpp mode the following DDraw call causes a message box to be popped - // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we - // make sure it doesn't happen. - // - UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); - DirectDrawCreateP(find.lpGUID, &pdd, NULL); - SetErrorMode(ErrorMode); - } - - return pdd; -} +//------------------------------------------------------------------------------ +// File: DDMM.cpp +// +// Desc: DirectShow base classes - implements routines for using DirectDraw +// on a multimonitor system. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +//#include +#include +#include +#include "ddmm.h" + +/* + * FindDeviceCallback + */ +typedef struct { + LPSTR szDevice; + GUID* lpGUID; + GUID GUID; + BOOL fFound; +} FindDeviceData; + +BOOL CALLBACK FindDeviceCallback(GUID* lpGUID, LPSTR szName, LPSTR szDevice, LPVOID lParam) +{ + FindDeviceData *p = (FindDeviceData*)lParam; + + if (lstrcmpiA(p->szDevice, szDevice) == 0) { + if (lpGUID) { + p->GUID = *lpGUID; + p->lpGUID = &p->GUID; + } else { + p->lpGUID = NULL; + } + p->fFound = TRUE; + return FALSE; + } + return TRUE; +} + + +BOOL CALLBACK FindDeviceCallbackEx(GUID* lpGUID, LPSTR szName, LPSTR szDevice, LPVOID lParam, HMONITOR hMonitor) +{ + FindDeviceData *p = (FindDeviceData*)lParam; + + if (lstrcmpiA(p->szDevice, szDevice) == 0) { + if (lpGUID) { + p->GUID = *lpGUID; + p->lpGUID = &p->GUID; + } else { + p->lpGUID = NULL; + } + p->fFound = TRUE; + return FALSE; + } + return TRUE; +} + + +/* + * DirectDrawCreateFromDevice + * + * create a DirectDraw object for a particular device + */ +IDirectDraw * DirectDrawCreateFromDevice(LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, PDRAWENUM DirectDrawEnumerateP) +{ + IDirectDraw* pdd = NULL; + FindDeviceData find; + + if (szDevice == NULL) { + DirectDrawCreateP(NULL, &pdd, NULL); + return pdd; + } + + find.szDevice = szDevice; + find.fFound = FALSE; + DirectDrawEnumerateP(FindDeviceCallback, (LPVOID)&find); + + if (find.fFound) + { + // + // In 4bpp mode the following DDraw call causes a message box to be popped + // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we + // make sure it doesn't happen. + // + UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); + DirectDrawCreateP(find.lpGUID, &pdd, NULL); + SetErrorMode(ErrorMode); + } + + return pdd; +} + + +/* + * DirectDrawCreateFromDeviceEx + * + * create a DirectDraw object for a particular device + */ +IDirectDraw * DirectDrawCreateFromDeviceEx(LPSTR szDevice, PDRAWCREATE DirectDrawCreateP, LPDIRECTDRAWENUMERATEEXA DirectDrawEnumerateExP) +{ + IDirectDraw* pdd = NULL; + FindDeviceData find; + + if (szDevice == NULL) { + DirectDrawCreateP(NULL, &pdd, NULL); + return pdd; + } + + find.szDevice = szDevice; + find.fFound = FALSE; + DirectDrawEnumerateExP(FindDeviceCallbackEx, (LPVOID)&find, + DDENUM_ATTACHEDSECONDARYDEVICES); + + if (find.fFound) + { + // + // In 4bpp mode the following DDraw call causes a message box to be popped + // up by DDraw (!?!). It's DDraw's fault, but we don't like it. So we + // make sure it doesn't happen. + // + UINT ErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); + DirectDrawCreateP(find.lpGUID, &pdd, NULL); + SetErrorMode(ErrorMode); + } + + return pdd; +} diff --git a/plugins/GSdx/res/convert.fx b/plugins/GSdx/res/convert.fx index 0aec085cc8..c2c50b60df 100644 --- a/plugins/GSdx/res/convert.fx +++ b/plugins/GSdx/res/convert.fx @@ -1,242 +1,242 @@ -#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency -#if SHADER_MODEL >= 0x400 - -struct VS_INPUT -{ - float4 p : POSITION; - float2 t : TEXCOORD0; -}; - -struct VS_OUTPUT -{ - float4 p : SV_Position; - float2 t : TEXCOORD0; -}; - -Texture2D Texture; -SamplerState TextureSampler; - -float4 sample_c(float2 uv) -{ - return Texture.Sample(TextureSampler, uv); -} - -struct PS_INPUT -{ - float4 p : SV_Position; - float2 t : TEXCOORD0; -}; - -struct PS_OUTPUT -{ - float4 c : SV_Target0; -}; - -#elif SHADER_MODEL <= 0x300 - -struct VS_INPUT -{ - float4 p : POSITION; - float2 t : TEXCOORD0; -}; - -struct VS_OUTPUT -{ - float4 p : POSITION; - float2 t : TEXCOORD0; -}; - -struct PS_INPUT -{ -#if SHADER_MODEL < 0x300 - float4 p : TEXCOORD1; -#else - float4 p : VPOS; -#endif - float2 t : TEXCOORD0; -}; - -struct PS_OUTPUT -{ - float4 c : COLOR; -}; - -sampler Texture : register(s0); - -float4 sample_c(float2 uv) -{ - return tex2D(Texture, uv); -} - -#endif - -VS_OUTPUT vs_main(VS_INPUT input) -{ - VS_OUTPUT output; - - output.p = input.p; - output.t = input.t; - - return output; -} - -PS_OUTPUT ps_main0(PS_INPUT input) -{ - PS_OUTPUT output; - - output.c = sample_c(input.t); - - return output; -} - -float4 ps_crt(PS_INPUT input, int i) -{ - float4 mask[4] = - { - float4(1, 0, 0, 0), - float4(0, 1, 0, 0), - float4(0, 0, 1, 0), - float4(1, 1, 1, 0) - }; - - return sample_c(input.t) * saturate(mask[i] + 0.5f); -} - -#if SHADER_MODEL >= 0x400 - -uint ps_main1(PS_INPUT input) : SV_Target0 -{ - float4 c = sample_c(input.t); - - c.a *= 256.0f / 127; // hm, 0.5 won't give us 1.0 if we just multiply with 2 - - uint4 i = c * float4(0x001f, 0x03e0, 0x7c00, 0x8000); - - return (i.x & 0x001f) | (i.y & 0x03e0) | (i.z & 0x7c00) | (i.w & 0x8000); -} - -PS_OUTPUT ps_main2(PS_INPUT input) -{ - PS_OUTPUT output; - - clip(sample_c(input.t).a - 128.0f / 255); // >= 0x80 pass - - output.c = 0; - - return output; -} - -PS_OUTPUT ps_main3(PS_INPUT input) -{ - PS_OUTPUT output; - - clip(127.95f / 255 - sample_c(input.t).a); // < 0x80 pass (== 0x80 should not pass) - - output.c = 0; - - return output; -} - -PS_OUTPUT ps_main4(PS_INPUT input) -{ - PS_OUTPUT output; - - output.c = fmod(sample_c(input.t) * 255 + 0.5f, 256) / 255; - - return output; -} - -PS_OUTPUT ps_main5(PS_INPUT input) // triangular -{ - PS_OUTPUT output; - - uint4 p = (uint4)input.p; - - // output.c = ps_crt(input, ((p.x + (p.y & 1) * 3) >> 1) % 3); - output.c = ps_crt(input, ((p.x + ((p.y >> 1) & 1) * 3) >> 1) % 3); - - return output; -} - -PS_OUTPUT ps_main6(PS_INPUT input) // diagonal -{ - PS_OUTPUT output; - - uint4 p = (uint4)input.p; - - output.c = ps_crt(input, (p.x + (p.y % 3)) % 3); - - return output; -} - -#elif SHADER_MODEL <= 0x300 - -PS_OUTPUT ps_main1(PS_INPUT input) -{ - PS_OUTPUT output; - - float4 c = sample_c(input.t); - - c.a *= 128.0f / 255; // *= 0.5f is no good here, need to do this in order to get 0x80 for 1.0f (instead of 0x7f) - - output.c = c; - - return output; -} - -PS_OUTPUT ps_main2(PS_INPUT input) -{ - PS_OUTPUT output; - - clip(sample_c(input.t).a - 255.0f / 255); // >= 0x80 pass - - output.c = 0; - - return output; -} - -PS_OUTPUT ps_main3(PS_INPUT input) -{ - PS_OUTPUT output; - - clip(254.95f / 255 - sample_c(input.t).a); // < 0x80 pass (== 0x80 should not pass) - - output.c = 0; - - return output; -} - -PS_OUTPUT ps_main4(PS_INPUT input) -{ - PS_OUTPUT output; - - output.c = 1; - - return output; -} - -PS_OUTPUT ps_main5(PS_INPUT input) // triangular -{ - PS_OUTPUT output; - - int4 p = (int4)input.p; - - // output.c = ps_crt(input, ((p.x + (p.y % 2) * 3) / 2) % 3); - output.c = ps_crt(input, ((p.x + ((p.y / 2) % 2) * 3) / 2) % 3); - - return output; -} - -PS_OUTPUT ps_main6(PS_INPUT input) // diagonal -{ - PS_OUTPUT output; - - int4 p = (int4)input.p; - - output.c = ps_crt(input, (p.x + (p.y % 3)) % 3); - - return output; -} - -#endif -#endif +#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency +#if SHADER_MODEL >= 0x400 + +struct VS_INPUT +{ + float4 p : POSITION; + float2 t : TEXCOORD0; +}; + +struct VS_OUTPUT +{ + float4 p : SV_Position; + float2 t : TEXCOORD0; +}; + +Texture2D Texture; +SamplerState TextureSampler; + +float4 sample_c(float2 uv) +{ + return Texture.Sample(TextureSampler, uv); +} + +struct PS_INPUT +{ + float4 p : SV_Position; + float2 t : TEXCOORD0; +}; + +struct PS_OUTPUT +{ + float4 c : SV_Target0; +}; + +#elif SHADER_MODEL <= 0x300 + +struct VS_INPUT +{ + float4 p : POSITION; + float2 t : TEXCOORD0; +}; + +struct VS_OUTPUT +{ + float4 p : POSITION; + float2 t : TEXCOORD0; +}; + +struct PS_INPUT +{ +#if SHADER_MODEL < 0x300 + float4 p : TEXCOORD1; +#else + float4 p : VPOS; +#endif + float2 t : TEXCOORD0; +}; + +struct PS_OUTPUT +{ + float4 c : COLOR; +}; + +sampler Texture : register(s0); + +float4 sample_c(float2 uv) +{ + return tex2D(Texture, uv); +} + +#endif + +VS_OUTPUT vs_main(VS_INPUT input) +{ + VS_OUTPUT output; + + output.p = input.p; + output.t = input.t; + + return output; +} + +PS_OUTPUT ps_main0(PS_INPUT input) +{ + PS_OUTPUT output; + + output.c = sample_c(input.t); + + return output; +} + +float4 ps_crt(PS_INPUT input, int i) +{ + float4 mask[4] = + { + float4(1, 0, 0, 0), + float4(0, 1, 0, 0), + float4(0, 0, 1, 0), + float4(1, 1, 1, 0) + }; + + return sample_c(input.t) * saturate(mask[i] + 0.5f); +} + +#if SHADER_MODEL >= 0x400 + +uint ps_main1(PS_INPUT input) : SV_Target0 +{ + float4 c = sample_c(input.t); + + c.a *= 256.0f / 127; // hm, 0.5 won't give us 1.0 if we just multiply with 2 + + uint4 i = c * float4(0x001f, 0x03e0, 0x7c00, 0x8000); + + return (i.x & 0x001f) | (i.y & 0x03e0) | (i.z & 0x7c00) | (i.w & 0x8000); +} + +PS_OUTPUT ps_main2(PS_INPUT input) +{ + PS_OUTPUT output; + + clip(sample_c(input.t).a - 128.0f / 255); // >= 0x80 pass + + output.c = 0; + + return output; +} + +PS_OUTPUT ps_main3(PS_INPUT input) +{ + PS_OUTPUT output; + + clip(127.95f / 255 - sample_c(input.t).a); // < 0x80 pass (== 0x80 should not pass) + + output.c = 0; + + return output; +} + +PS_OUTPUT ps_main4(PS_INPUT input) +{ + PS_OUTPUT output; + + output.c = fmod(sample_c(input.t) * 255 + 0.5f, 256) / 255; + + return output; +} + +PS_OUTPUT ps_main5(PS_INPUT input) // triangular +{ + PS_OUTPUT output; + + uint4 p = (uint4)input.p; + + // output.c = ps_crt(input, ((p.x + (p.y & 1) * 3) >> 1) % 3); + output.c = ps_crt(input, ((p.x + ((p.y >> 1) & 1) * 3) >> 1) % 3); + + return output; +} + +PS_OUTPUT ps_main6(PS_INPUT input) // diagonal +{ + PS_OUTPUT output; + + uint4 p = (uint4)input.p; + + output.c = ps_crt(input, (p.x + (p.y % 3)) % 3); + + return output; +} + +#elif SHADER_MODEL <= 0x300 + +PS_OUTPUT ps_main1(PS_INPUT input) +{ + PS_OUTPUT output; + + float4 c = sample_c(input.t); + + c.a *= 128.0f / 255; // *= 0.5f is no good here, need to do this in order to get 0x80 for 1.0f (instead of 0x7f) + + output.c = c; + + return output; +} + +PS_OUTPUT ps_main2(PS_INPUT input) +{ + PS_OUTPUT output; + + clip(sample_c(input.t).a - 255.0f / 255); // >= 0x80 pass + + output.c = 0; + + return output; +} + +PS_OUTPUT ps_main3(PS_INPUT input) +{ + PS_OUTPUT output; + + clip(254.95f / 255 - sample_c(input.t).a); // < 0x80 pass (== 0x80 should not pass) + + output.c = 0; + + return output; +} + +PS_OUTPUT ps_main4(PS_INPUT input) +{ + PS_OUTPUT output; + + output.c = 1; + + return output; +} + +PS_OUTPUT ps_main5(PS_INPUT input) // triangular +{ + PS_OUTPUT output; + + int4 p = (int4)input.p; + + // output.c = ps_crt(input, ((p.x + (p.y % 2) * 3) / 2) % 3); + output.c = ps_crt(input, ((p.x + ((p.y / 2) % 2) * 3) / 2) % 3); + + return output; +} + +PS_OUTPUT ps_main6(PS_INPUT input) // diagonal +{ + PS_OUTPUT output; + + int4 p = (int4)input.p; + + output.c = ps_crt(input, (p.x + (p.y % 3)) % 3); + + return output; +} + +#endif +#endif diff --git a/plugins/GSdx/res/interlace.fx b/plugins/GSdx/res/interlace.fx index 9f60713d93..c1b81e5f23 100644 --- a/plugins/GSdx/res/interlace.fx +++ b/plugins/GSdx/res/interlace.fx @@ -1,85 +1,85 @@ -#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency -#if SHADER_MODEL >= 0x400 - -Texture2D Texture; -SamplerState Sampler; - -cbuffer cb0 -{ - float2 ZrH; - float hH; -}; - -struct PS_INPUT -{ - float4 p : SV_Position; - float2 t : TEXCOORD0; -}; - -float4 ps_main0(PS_INPUT input) : SV_Target0 -{ - clip(frac(input.t.y * hH) - 0.5); - - return Texture.Sample(Sampler, input.t); -} - -float4 ps_main1(PS_INPUT input) : SV_Target0 -{ - clip(0.5 - frac(input.t.y * hH)); - - return Texture.Sample(Sampler, input.t); -} - -float4 ps_main2(PS_INPUT input) : SV_Target0 -{ - float4 c0 = Texture.Sample(Sampler, input.t - ZrH); - float4 c1 = Texture.Sample(Sampler, input.t); - float4 c2 = Texture.Sample(Sampler, input.t + ZrH); - - return (c0 + c1 * 2 + c2) / 4; -} - -float4 ps_main3(PS_INPUT input) : SV_Target0 -{ - return Texture.Sample(Sampler, input.t); -} - -#elif SHADER_MODEL <= 0x300 - -sampler s0 : register(s0); - -float4 Params1 : register(c0); - -#define ZrH (Params1.xy) -#define hH (Params1.z) - -float4 ps_main0(float2 tex : TEXCOORD0) : COLOR -{ - clip(frac(tex.y * hH) - 0.5); - - return tex2D(s0, tex); -} - -float4 ps_main1(float2 tex : TEXCOORD0) : COLOR -{ - clip(0.5 - frac(tex.y * hH)); - - return tex2D(s0, tex); -} - -float4 ps_main2(float2 tex : TEXCOORD0) : COLOR -{ - float4 c0 = tex2D(s0, tex - ZrH); - float4 c1 = tex2D(s0, tex); - float4 c2 = tex2D(s0, tex + ZrH); - - return (c0 + c1 * 2 + c2) / 4; -} - -float4 ps_main3(float2 tex : TEXCOORD0) : COLOR -{ - return tex2D(s0, tex); -} - -#endif -#endif +#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency +#if SHADER_MODEL >= 0x400 + +Texture2D Texture; +SamplerState Sampler; + +cbuffer cb0 +{ + float2 ZrH; + float hH; +}; + +struct PS_INPUT +{ + float4 p : SV_Position; + float2 t : TEXCOORD0; +}; + +float4 ps_main0(PS_INPUT input) : SV_Target0 +{ + clip(frac(input.t.y * hH) - 0.5); + + return Texture.Sample(Sampler, input.t); +} + +float4 ps_main1(PS_INPUT input) : SV_Target0 +{ + clip(0.5 - frac(input.t.y * hH)); + + return Texture.Sample(Sampler, input.t); +} + +float4 ps_main2(PS_INPUT input) : SV_Target0 +{ + float4 c0 = Texture.Sample(Sampler, input.t - ZrH); + float4 c1 = Texture.Sample(Sampler, input.t); + float4 c2 = Texture.Sample(Sampler, input.t + ZrH); + + return (c0 + c1 * 2 + c2) / 4; +} + +float4 ps_main3(PS_INPUT input) : SV_Target0 +{ + return Texture.Sample(Sampler, input.t); +} + +#elif SHADER_MODEL <= 0x300 + +sampler s0 : register(s0); + +float4 Params1 : register(c0); + +#define ZrH (Params1.xy) +#define hH (Params1.z) + +float4 ps_main0(float2 tex : TEXCOORD0) : COLOR +{ + clip(frac(tex.y * hH) - 0.5); + + return tex2D(s0, tex); +} + +float4 ps_main1(float2 tex : TEXCOORD0) : COLOR +{ + clip(0.5 - frac(tex.y * hH)); + + return tex2D(s0, tex); +} + +float4 ps_main2(float2 tex : TEXCOORD0) : COLOR +{ + float4 c0 = tex2D(s0, tex - ZrH); + float4 c1 = tex2D(s0, tex); + float4 c2 = tex2D(s0, tex + ZrH); + + return (c0 + c1 * 2 + c2) / 4; +} + +float4 ps_main3(float2 tex : TEXCOORD0) : COLOR +{ + return tex2D(s0, tex); +} + +#endif +#endif diff --git a/plugins/GSdx/res/merge.fx b/plugins/GSdx/res/merge.fx index 1c68a552a1..4d8236b11c 100644 --- a/plugins/GSdx/res/merge.fx +++ b/plugins/GSdx/res/merge.fx @@ -1,60 +1,60 @@ -#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency -#if SHADER_MODEL >= 0x400 - -Texture2D Texture; -SamplerState Sampler; - -cbuffer cb0 -{ - float4 BGColor; -}; - -struct PS_INPUT -{ - float4 p : SV_Position; - float2 t : TEXCOORD0; -}; - -float4 ps_main0(PS_INPUT input) : SV_Target0 -{ - float4 c = Texture.Sample(Sampler, input.t); - c.a = min(c.a * 2, 1); - return c; -} - -float4 ps_main1(PS_INPUT input) : SV_Target0 -{ - float4 c = Texture.Sample(Sampler, input.t); - c.a = BGColor.a; - return c; -} - -#elif SHADER_MODEL <= 0x300 - -sampler Texture : register(s0); - -float4 g_params[1]; - -#define BGColor (g_params[0]) - -struct PS_INPUT -{ - float2 t : TEXCOORD0; -}; - -float4 ps_main0(PS_INPUT input) : COLOR -{ - float4 c = tex2D(Texture, input.t); - // a = ; - return c.bgra; -} - -float4 ps_main1(PS_INPUT input) : COLOR -{ - float4 c = tex2D(Texture, input.t); - c.a = BGColor.a; - return c.bgra; -} - -#endif -#endif +#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency +#if SHADER_MODEL >= 0x400 + +Texture2D Texture; +SamplerState Sampler; + +cbuffer cb0 +{ + float4 BGColor; +}; + +struct PS_INPUT +{ + float4 p : SV_Position; + float2 t : TEXCOORD0; +}; + +float4 ps_main0(PS_INPUT input) : SV_Target0 +{ + float4 c = Texture.Sample(Sampler, input.t); + c.a = min(c.a * 2, 1); + return c; +} + +float4 ps_main1(PS_INPUT input) : SV_Target0 +{ + float4 c = Texture.Sample(Sampler, input.t); + c.a = BGColor.a; + return c; +} + +#elif SHADER_MODEL <= 0x300 + +sampler Texture : register(s0); + +float4 g_params[1]; + +#define BGColor (g_params[0]) + +struct PS_INPUT +{ + float2 t : TEXCOORD0; +}; + +float4 ps_main0(PS_INPUT input) : COLOR +{ + float4 c = tex2D(Texture, input.t); + // a = ; + return c.bgra; +} + +float4 ps_main1(PS_INPUT input) : COLOR +{ + float4 c = tex2D(Texture, input.t); + c.a = BGColor.a; + return c.bgra; +} + +#endif +#endif diff --git a/plugins/GSdx/res/tfx.fx b/plugins/GSdx/res/tfx.fx index 1d6458ec73..1efa4221d6 100644 --- a/plugins/GSdx/res/tfx.fx +++ b/plugins/GSdx/res/tfx.fx @@ -1,783 +1,783 @@ -#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency -#define FMT_32 0 -#define FMT_24 1 -#define FMT_16 2 -#define FMT_8H 3 -#define FMT_4HL 4 -#define FMT_4HH 5 -#define FMT_8 6 - -#if SHADER_MODEL >= 0x400 - -#ifndef VS_BPPZ -#define VS_BPPZ 0 -#define VS_TME 1 -#define VS_FST 1 -#endif - -#ifndef GS_IIP -#define GS_IIP 0 -#define GS_PRIM 3 -#endif - -#ifndef PS_FST -#define PS_FST 0 -#define PS_WMS 0 -#define PS_WMT 0 -#define PS_FMT FMT_8 -#define PS_AEM 0 -#define PS_TFX 0 -#define PS_TCC 1 -#define PS_ATST 1 -#define PS_FOG 0 -#define PS_CLR1 0 -#define PS_FBA 0 -#define PS_AOUT 0 -#define PS_LTF 1 -#define PS_COLCLIP 0 -#define PS_DATE 0 -#endif - -struct VS_INPUT -{ - uint2 p : POSITION0; - uint z : POSITION1; - float2 t : TEXCOORD0; - float q : TEXCOORD1; - float4 c : COLOR0; - float4 f : COLOR1; -}; - -struct VS_OUTPUT -{ - float4 p : SV_Position; - float4 t : TEXCOORD0; -#if VS_RTCOPY - float4 tp : TEXCOORD1; -#endif - float4 c : COLOR0; -}; - -struct PS_INPUT -{ - float4 p : SV_Position; - float4 t : TEXCOORD0; -#if PS_DATE > 0 - float4 tp : TEXCOORD1; -#endif - float4 c : COLOR0; -}; - -struct PS_OUTPUT -{ - float4 c0 : SV_Target0; - float4 c1 : SV_Target1; -}; - -Texture2D Texture : register(t0); -Texture2D Palette : register(t1); -Texture2D RTCopy : register(t2); -SamplerState TextureSampler : register(s0); -SamplerState PaletteSampler : register(s1); -SamplerState RTCopySampler : register(s2); - -cbuffer cb0 -{ - float4 VertexScale; - float4 VertexOffset; - float2 TextureScale; -}; - -cbuffer cb1 -{ - float3 FogColor; - float AREF; - float4 HalfTexel; - float4 WH; - float4 MinMax; - float2 MinF; - float2 TA; - uint4 MskFix; -}; - -float4 sample_c(float2 uv) -{ - return Texture.Sample(TextureSampler, uv); -} - -float4 sample_p(float u) -{ - return Palette.Sample(PaletteSampler, u); -} - -float4 sample_rt(float2 uv) -{ - return RTCopy.Sample(RTCopySampler, uv); -} - -#elif SHADER_MODEL <= 0x300 - -#ifndef VS_BPPZ -#define VS_BPPZ 0 -#define VS_TME 1 -#define VS_FST 1 -#define VS_LOGZ 1 -#endif - -#ifndef PS_FST -#define PS_FST 0 -#define PS_WMS 0 -#define PS_WMT 0 -#define PS_FMT FMT_8 -#define PS_AEM 0 -#define PS_TFX 0 -#define PS_TCC 0 -#define PS_ATST 4 -#define PS_FOG 0 -#define PS_CLR1 0 -#define PS_RT 0 -#define PS_LTF 0 -#define PS_COLCLIP 0 -#define PS_DATE 0 -#endif - -struct VS_INPUT -{ - float4 p : POSITION0; - float2 t : TEXCOORD0; - float4 c : COLOR0; - float4 f : COLOR1; -}; - -struct VS_OUTPUT -{ - float4 p : POSITION; - float4 t : TEXCOORD0; -#if VS_RTCOPY - float4 tp : TEXCOORD1; -#endif - float4 c : COLOR0; -}; - -struct PS_INPUT -{ - float4 t : TEXCOORD0; -#if PS_DATE > 0 - float4 tp : TEXCOORD1; -#endif - float4 c : COLOR0; -}; - -sampler Texture : register(s0); -sampler Palette : register(s1); -sampler RTCopy : register(s2); -sampler1D UMSKFIX : register(s3); -sampler1D VMSKFIX : register(s4); - -float4 vs_params[3]; - -#define VertexScale vs_params[0] -#define VertexOffset vs_params[1] -#define TextureScale vs_params[2].xy - -float4 ps_params[7]; - -#define FogColor ps_params[0].bgr -#define AREF ps_params[0].a -#define HalfTexel ps_params[1] -#define WH ps_params[2] -#define MinMax ps_params[3] -#define MinF ps_params[4].xy -#define TA ps_params[4].zw - -float4 sample_c(float2 uv) -{ - return tex2D(Texture, uv); -} - -float4 sample_p(float u) -{ - return tex2D(Palette, u); -} - -float4 sample_rt(float2 uv) -{ - return tex2D(RTCopy, uv); -} - -#endif - -float4 wrapuv(float4 uv) -{ - if(PS_WMS == PS_WMT) - { -/* - if(PS_WMS == 0) - { - uv = frac(uv); - } - else if(PS_WMS == 1) - { - uv = saturate(uv); - } - else -*/ - if(PS_WMS == 2) - { - uv = clamp(uv, MinMax.xyxy, MinMax.zwzw); - } - else if(PS_WMS == 3) - { - #if SHADER_MODEL >= 0x400 - uv = (float4)(((int4)(uv * WH.xyxy) & MskFix.xyxy) | MskFix.zwzw) / WH.xyxy; - #elif SHADER_MODEL <= 0x300 - uv.x = tex1D(UMSKFIX, uv.x); - uv.y = tex1D(VMSKFIX, uv.y); - uv.z = tex1D(UMSKFIX, uv.z); - uv.w = tex1D(VMSKFIX, uv.w); - #endif - } - } - else - { -/* - if(PS_WMS == 0) - { - uv.xz = frac(uv.xz); - } - else if(PS_WMS == 1) - { - uv.xz = saturate(uv.xz); - } - else -*/ - if(PS_WMS == 2) - { - uv.xz = clamp(uv.xz, MinMax.xx, MinMax.zz); - } - else if(PS_WMS == 3) - { - #if SHADER_MODEL >= 0x400 - uv.xz = (float2)(((int2)(uv.xz * WH.xx) & MskFix.xx) | MskFix.zz) / WH.xx; - #elif SHADER_MODEL <= 0x300 - uv.x = tex1D(UMSKFIX, uv.x); - uv.z = tex1D(UMSKFIX, uv.z); - #endif - } -/* - if(PS_WMT == 0) - { - uv.yw = frac(uv.yw); - } - else if(PS_WMT == 1) - { - uv.yw = saturate(uv.yw); - } - else -*/ - if(PS_WMT == 2) - { - uv.yw = clamp(uv.yw, MinMax.yy, MinMax.ww); - } - else if(PS_WMT == 3) - { - #if SHADER_MODEL >= 0x400 - uv.yw = (float2)(((int2)(uv.yw * WH.yy) & MskFix.yy) | MskFix.ww) / WH.yy; - #elif SHADER_MODEL <= 0x300 - uv.y = tex1D(VMSKFIX, uv.y); - uv.w = tex1D(VMSKFIX, uv.w); - #endif - } - } - - return uv; -} - -float2 clampuv(float2 uv) -{ - if(PS_WMS == 2 && PS_WMT == 2) - { - uv = clamp(uv, MinF, MinMax.zw); - } - else if(PS_WMS == 2) - { - uv.x = clamp(uv.x, MinF.x, MinMax.z); - } - else if(PS_WMT == 2) - { - uv.y = clamp(uv.y, MinF.y, MinMax.w); - } - - return uv; -} - -float4x4 sample_4c(float4 uv) -{ - float4x4 c; - - c[0] = sample_c(uv.xy); - c[1] = sample_c(uv.zy); - c[2] = sample_c(uv.xw); - c[3] = sample_c(uv.zw); - - return c; -} - -float4 sample_4a(float4 uv) -{ - float4 c; - - c.x = sample_c(uv.xy).a; - c.y = sample_c(uv.zy).a; - c.z = sample_c(uv.xw).a; - c.w = sample_c(uv.zw).a; - - #if SHADER_MODEL <= 0x300 - if(PS_RT) c *= 128.0f / 255; - #endif - - return c; -} - -float4x4 sample_4p(float4 u) -{ - float4x4 c; - - c[0] = sample_p(u.x); - c[1] = sample_p(u.y); - c[2] = sample_p(u.z); - c[3] = sample_p(u.w); - - return c; -} - -float4 sample(float2 st, float q) -{ - if(!PS_FST) - { - st /= q; - } - - float4 t; -/* - if(PS_FMT <= FMT_16 && PS_WMS < 2 && PS_WMT < 2) - { - t = sample_c(st); - } -*/ - if(PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3) - { - t = sample_c(clampuv(st)); - } - else - { - float4 uv; - float2 dd; - - if(PS_LTF) - { - uv = st.xyxy + HalfTexel; - dd = frac(uv.xy * WH.zw); - } - else - { - uv = st.xyxy; - } - - uv = wrapuv(uv); - - float4x4 c; - - if(PS_FMT == FMT_8H) - { - c = sample_4p(sample_4a(uv)); - } - else if(PS_FMT == FMT_4HL) - { - c = sample_4p(fmod(sample_4a(uv), 1.0f / 16)); - } - else if(PS_FMT == FMT_4HH) - { - c = sample_4p(fmod(sample_4a(uv) * 16, 1.0f / 16)); - } - else if(PS_FMT == FMT_8) - { - c = sample_4p(sample_4a(uv)); - } - else - { - c = sample_4c(uv); - } - - if(PS_LTF) - { - t = lerp(lerp(c[0], c[1], dd.x), lerp(c[2], c[3], dd.x), dd.y); - } - else - { - t = c[0]; - } - } - - if(PS_FMT == FMT_32) - { - #if SHADER_MODEL <= 0x300 - if(PS_RT) t.a *= 128.0f / 255; - #endif - } - else if(PS_FMT == FMT_24) - { - t.a = !PS_AEM || any(t.rgb) ? TA.x : 0; - } - else if(PS_FMT == FMT_16) - { - // a bit incompatible with up-scaling because the 1 bit alpha is interpolated - - t.a = t.a >= 0.5 ? TA.y : !PS_AEM || any(t.rgb) ? TA.x : 0; - } - - return t; -} - -float4 tfx(float4 t, float4 c) -{ - if(PS_TFX == 0) - { - if(PS_TCC) - { - c = c * t * 255.0f / 128; - } - else - { - c.rgb = c.rgb * t.rgb * 255.0f / 128; - } - } - else if(PS_TFX == 1) - { - if(PS_TCC) - { - c = t; - } - else - { - c.rgb = t.rgb; - } - } - else if(PS_TFX == 2) - { - c.rgb = c.rgb * t.rgb * 255.0f / 128 + c.a; - - if(PS_TCC) - { - c.a += t.a; - } - } - else if(PS_TFX == 3) - { - c.rgb = c.rgb * t.rgb * 255.0f / 128 + c.a; - - if(PS_TCC) - { - c.a = t.a; - } - } - - return saturate(c); -} - -void datst(PS_INPUT input) -{ -#if PS_DATE > 0 - float alpha = sample_rt(input.tp.xy).a; -#if SHADER_MODEL >= 0x400 - float alpha0x80 = 128. / 255; -#else - float alpha0x80 = 1; -#endif - - if (PS_DATE == 1 && alpha >= alpha0x80) - discard; - else if (PS_DATE == 2 && alpha < alpha0x80) - discard; -#endif -} - -void atst(float4 c) -{ - float a = trunc(c.a * 255); - - if(PS_ATST == 0) // never - { - discard; - } - else if(PS_ATST == 1) // always - { - // nothing to do - } - else if(PS_ATST == 2 || PS_ATST == 3) // l, le - { - clip(AREF - a); - } - else if(PS_ATST == 4) // e - { - clip(0.5f - abs(a - AREF)); - } - else if(PS_ATST == 5 || PS_ATST == 6) // ge, g - { - clip(a - AREF); - } - else if(PS_ATST == 7) // ne - { - clip(abs(a - AREF) - 0.5f); - } -} - -float4 fog(float4 c, float f) -{ - if(PS_FOG) - { - c.rgb = lerp(FogColor, c.rgb, f); - } - - return c; -} - -float4 ps_color(PS_INPUT input) -{ - datst(input); - - float4 t = sample(input.t.xy, input.t.w); - - float4 c = tfx(t, input.c); - - atst(c); - - c = fog(c, input.t.z); - - if (PS_COLCLIP == 2) - { - c.rgb = 256./255. - c.rgb; - } - if (PS_COLCLIP > 0) - { - c.rgb *= c.rgb < 128./255; - } - - if(PS_CLR1) // needed for Cd * (As/Ad/F + 1) blending modes - { - c.rgb = 1; - } - - return c; -} - -#if SHADER_MODEL >= 0x400 - -VS_OUTPUT vs_main(VS_INPUT input) -{ - if(VS_BPPZ == 1) // 24 - { - input.z = input.z & 0xffffff; - } - else if(VS_BPPZ == 2) // 16 - { - input.z = input.z & 0xffff; - } - - VS_OUTPUT output; - - // pos -= 0.05 (1/320 pixel) helps avoiding rounding problems (integral part of pos is usually 5 digits, 0.05 is about as low as we can go) - // example: ceil(afterseveralvertextransformations(y = 133)) => 134 => line 133 stays empty - // input granularity is 1/16 pixel, anything smaller than that won't step drawing up/left by one pixel - // example: 133.0625 (133 + 1/16) should start from line 134, ceil(133.0625 - 0.05) still above 133 - - float4 p = float4(input.p, input.z, 0) - float4(0.05f, 0.05f, 0, 0); - - output.p = p * VertexScale - VertexOffset; -#if VS_RTCOPY - output.tp = (p * VertexScale - VertexOffset) * float4(0.5, -0.5, 0, 0) + 0.5; -#endif - - if(VS_TME) - { - if(VS_FST) - { - output.t.xy = input.t * TextureScale; - output.t.w = 1.0f; - } - else - { - output.t.xy = input.t; - output.t.w = input.q; - } - } - else - { - output.t.xy = 0; - output.t.w = 1.0f; - } - - output.c = input.c; - output.t.z = input.f.a; - - return output; -} - -#if GS_PRIM == 0 - -[maxvertexcount(1)] -void gs_main(point VS_OUTPUT input[1], inout PointStream stream) -{ - stream.Append(input[0]); -} - -#elif GS_PRIM == 1 - -[maxvertexcount(2)] -void gs_main(line VS_OUTPUT input[2], inout LineStream stream) -{ - #if GS_IIP == 0 - input[0].c = input[1].c; - #endif - - stream.Append(input[0]); - stream.Append(input[1]); -} - -#elif GS_PRIM == 2 - -[maxvertexcount(3)] -void gs_main(triangle VS_OUTPUT input[3], inout TriangleStream stream) -{ - #if GS_IIP == 0 - input[0].c = input[2].c; - input[1].c = input[2].c; - #endif - - stream.Append(input[0]); - stream.Append(input[1]); - stream.Append(input[2]); -} - -#elif GS_PRIM == 3 - -[maxvertexcount(4)] -void gs_main(line VS_OUTPUT input[2], inout TriangleStream stream) -{ - input[0].p.z = input[1].p.z; - input[0].t.zw = input[1].t.zw; - - #if GS_IIP == 0 - input[0].c = input[1].c; - #endif - - VS_OUTPUT lb = input[1]; - - lb.p.x = input[0].p.x; - lb.t.x = input[0].t.x; - - VS_OUTPUT rt = input[1]; - - rt.p.y = input[0].p.y; - rt.t.y = input[0].t.y; - - stream.Append(input[0]); - stream.Append(lb); - stream.Append(rt); - stream.Append(input[1]); -} - -#endif - -PS_OUTPUT ps_main(PS_INPUT input) -{ - float4 c = ps_color(input); - - PS_OUTPUT output; - - output.c1 = c.a * 2; // used for alpha blending - - if(PS_AOUT) // 16 bit output - { - float a = 128.0f / 255; // alpha output will be 0x80 - - c.a = PS_FBA ? a : step(0.5, c.a) * a; - } - else if(PS_FBA) - { - if(c.a < 0.5) c.a += 0.5; - } - - output.c0 = c; - - return output; -} - -#elif SHADER_MODEL <= 0x300 - -VS_OUTPUT vs_main(VS_INPUT input) -{ - if(VS_BPPZ == 1) // 24 - { - input.p.z = fmod(input.p.z, 0x1000000); - } - else if(VS_BPPZ == 2) // 16 - { - input.p.z = fmod(input.p.z, 0x10000); - } - - VS_OUTPUT output; - - // pos -= 0.05 (1/320 pixel) helps avoiding rounding problems (integral part of pos is usually 5 digits, 0.05 is about as low as we can go) - // example: ceil(afterseveralvertextransformations(y = 133)) => 134 => line 133 stays empty - // input granularity is 1/16 pixel, anything smaller than that won't step drawing up/left by one pixel - // example: 133.0625 (133 + 1/16) should start from line 134, ceil(133.0625 - 0.05) still above 133 - - float4 p = input.p - float4(0.05f, 0.05f, 0, 0); - - output.p = p * VertexScale - VertexOffset; -#if VS_RTCOPY - output.tp = (p * VertexScale - VertexOffset) * float4(0.5, -0.5, 0, 0) + 0.5; -#endif - - if(VS_LOGZ) - { - output.p.z = log2(1.0f + input.p.z) / 32; - } - - if(VS_TME) - { - if(VS_FST) - { - output.t.xy = input.t * TextureScale; - output.t.w = 1.0f; - } - else - { - output.t.xy = input.t; - output.t.w = input.p.w; - } - } - else - { - output.t.xy = 0; - output.t.w = 1.0f; - } - - output.c = input.c; - output.t.z = input.f.a; - - return output; -} - -float4 ps_main(PS_INPUT input) : COLOR -{ - float4 c = ps_color(input); - - c.a *= 2; - - return c; -} - -#endif -#endif +#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency +#define FMT_32 0 +#define FMT_24 1 +#define FMT_16 2 +#define FMT_8H 3 +#define FMT_4HL 4 +#define FMT_4HH 5 +#define FMT_8 6 + +#if SHADER_MODEL >= 0x400 + +#ifndef VS_BPPZ +#define VS_BPPZ 0 +#define VS_TME 1 +#define VS_FST 1 +#endif + +#ifndef GS_IIP +#define GS_IIP 0 +#define GS_PRIM 3 +#endif + +#ifndef PS_FST +#define PS_FST 0 +#define PS_WMS 0 +#define PS_WMT 0 +#define PS_FMT FMT_8 +#define PS_AEM 0 +#define PS_TFX 0 +#define PS_TCC 1 +#define PS_ATST 1 +#define PS_FOG 0 +#define PS_CLR1 0 +#define PS_FBA 0 +#define PS_AOUT 0 +#define PS_LTF 1 +#define PS_COLCLIP 0 +#define PS_DATE 0 +#endif + +struct VS_INPUT +{ + uint2 p : POSITION0; + uint z : POSITION1; + float2 t : TEXCOORD0; + float q : TEXCOORD1; + float4 c : COLOR0; + float4 f : COLOR1; +}; + +struct VS_OUTPUT +{ + float4 p : SV_Position; + float4 t : TEXCOORD0; +#if VS_RTCOPY + float4 tp : TEXCOORD1; +#endif + float4 c : COLOR0; +}; + +struct PS_INPUT +{ + float4 p : SV_Position; + float4 t : TEXCOORD0; +#if PS_DATE > 0 + float4 tp : TEXCOORD1; +#endif + float4 c : COLOR0; +}; + +struct PS_OUTPUT +{ + float4 c0 : SV_Target0; + float4 c1 : SV_Target1; +}; + +Texture2D Texture : register(t0); +Texture2D Palette : register(t1); +Texture2D RTCopy : register(t2); +SamplerState TextureSampler : register(s0); +SamplerState PaletteSampler : register(s1); +SamplerState RTCopySampler : register(s2); + +cbuffer cb0 +{ + float4 VertexScale; + float4 VertexOffset; + float2 TextureScale; +}; + +cbuffer cb1 +{ + float3 FogColor; + float AREF; + float4 HalfTexel; + float4 WH; + float4 MinMax; + float2 MinF; + float2 TA; + uint4 MskFix; +}; + +float4 sample_c(float2 uv) +{ + return Texture.Sample(TextureSampler, uv); +} + +float4 sample_p(float u) +{ + return Palette.Sample(PaletteSampler, u); +} + +float4 sample_rt(float2 uv) +{ + return RTCopy.Sample(RTCopySampler, uv); +} + +#elif SHADER_MODEL <= 0x300 + +#ifndef VS_BPPZ +#define VS_BPPZ 0 +#define VS_TME 1 +#define VS_FST 1 +#define VS_LOGZ 1 +#endif + +#ifndef PS_FST +#define PS_FST 0 +#define PS_WMS 0 +#define PS_WMT 0 +#define PS_FMT FMT_8 +#define PS_AEM 0 +#define PS_TFX 0 +#define PS_TCC 0 +#define PS_ATST 4 +#define PS_FOG 0 +#define PS_CLR1 0 +#define PS_RT 0 +#define PS_LTF 0 +#define PS_COLCLIP 0 +#define PS_DATE 0 +#endif + +struct VS_INPUT +{ + float4 p : POSITION0; + float2 t : TEXCOORD0; + float4 c : COLOR0; + float4 f : COLOR1; +}; + +struct VS_OUTPUT +{ + float4 p : POSITION; + float4 t : TEXCOORD0; +#if VS_RTCOPY + float4 tp : TEXCOORD1; +#endif + float4 c : COLOR0; +}; + +struct PS_INPUT +{ + float4 t : TEXCOORD0; +#if PS_DATE > 0 + float4 tp : TEXCOORD1; +#endif + float4 c : COLOR0; +}; + +sampler Texture : register(s0); +sampler Palette : register(s1); +sampler RTCopy : register(s2); +sampler1D UMSKFIX : register(s3); +sampler1D VMSKFIX : register(s4); + +float4 vs_params[3]; + +#define VertexScale vs_params[0] +#define VertexOffset vs_params[1] +#define TextureScale vs_params[2].xy + +float4 ps_params[7]; + +#define FogColor ps_params[0].bgr +#define AREF ps_params[0].a +#define HalfTexel ps_params[1] +#define WH ps_params[2] +#define MinMax ps_params[3] +#define MinF ps_params[4].xy +#define TA ps_params[4].zw + +float4 sample_c(float2 uv) +{ + return tex2D(Texture, uv); +} + +float4 sample_p(float u) +{ + return tex2D(Palette, u); +} + +float4 sample_rt(float2 uv) +{ + return tex2D(RTCopy, uv); +} + +#endif + +float4 wrapuv(float4 uv) +{ + if(PS_WMS == PS_WMT) + { +/* + if(PS_WMS == 0) + { + uv = frac(uv); + } + else if(PS_WMS == 1) + { + uv = saturate(uv); + } + else +*/ + if(PS_WMS == 2) + { + uv = clamp(uv, MinMax.xyxy, MinMax.zwzw); + } + else if(PS_WMS == 3) + { + #if SHADER_MODEL >= 0x400 + uv = (float4)(((int4)(uv * WH.xyxy) & MskFix.xyxy) | MskFix.zwzw) / WH.xyxy; + #elif SHADER_MODEL <= 0x300 + uv.x = tex1D(UMSKFIX, uv.x); + uv.y = tex1D(VMSKFIX, uv.y); + uv.z = tex1D(UMSKFIX, uv.z); + uv.w = tex1D(VMSKFIX, uv.w); + #endif + } + } + else + { +/* + if(PS_WMS == 0) + { + uv.xz = frac(uv.xz); + } + else if(PS_WMS == 1) + { + uv.xz = saturate(uv.xz); + } + else +*/ + if(PS_WMS == 2) + { + uv.xz = clamp(uv.xz, MinMax.xx, MinMax.zz); + } + else if(PS_WMS == 3) + { + #if SHADER_MODEL >= 0x400 + uv.xz = (float2)(((int2)(uv.xz * WH.xx) & MskFix.xx) | MskFix.zz) / WH.xx; + #elif SHADER_MODEL <= 0x300 + uv.x = tex1D(UMSKFIX, uv.x); + uv.z = tex1D(UMSKFIX, uv.z); + #endif + } +/* + if(PS_WMT == 0) + { + uv.yw = frac(uv.yw); + } + else if(PS_WMT == 1) + { + uv.yw = saturate(uv.yw); + } + else +*/ + if(PS_WMT == 2) + { + uv.yw = clamp(uv.yw, MinMax.yy, MinMax.ww); + } + else if(PS_WMT == 3) + { + #if SHADER_MODEL >= 0x400 + uv.yw = (float2)(((int2)(uv.yw * WH.yy) & MskFix.yy) | MskFix.ww) / WH.yy; + #elif SHADER_MODEL <= 0x300 + uv.y = tex1D(VMSKFIX, uv.y); + uv.w = tex1D(VMSKFIX, uv.w); + #endif + } + } + + return uv; +} + +float2 clampuv(float2 uv) +{ + if(PS_WMS == 2 && PS_WMT == 2) + { + uv = clamp(uv, MinF, MinMax.zw); + } + else if(PS_WMS == 2) + { + uv.x = clamp(uv.x, MinF.x, MinMax.z); + } + else if(PS_WMT == 2) + { + uv.y = clamp(uv.y, MinF.y, MinMax.w); + } + + return uv; +} + +float4x4 sample_4c(float4 uv) +{ + float4x4 c; + + c[0] = sample_c(uv.xy); + c[1] = sample_c(uv.zy); + c[2] = sample_c(uv.xw); + c[3] = sample_c(uv.zw); + + return c; +} + +float4 sample_4a(float4 uv) +{ + float4 c; + + c.x = sample_c(uv.xy).a; + c.y = sample_c(uv.zy).a; + c.z = sample_c(uv.xw).a; + c.w = sample_c(uv.zw).a; + + #if SHADER_MODEL <= 0x300 + if(PS_RT) c *= 128.0f / 255; + #endif + + return c; +} + +float4x4 sample_4p(float4 u) +{ + float4x4 c; + + c[0] = sample_p(u.x); + c[1] = sample_p(u.y); + c[2] = sample_p(u.z); + c[3] = sample_p(u.w); + + return c; +} + +float4 sample(float2 st, float q) +{ + if(!PS_FST) + { + st /= q; + } + + float4 t; +/* + if(PS_FMT <= FMT_16 && PS_WMS < 2 && PS_WMT < 2) + { + t = sample_c(st); + } +*/ + if(PS_FMT <= FMT_16 && PS_WMS < 3 && PS_WMT < 3) + { + t = sample_c(clampuv(st)); + } + else + { + float4 uv; + float2 dd; + + if(PS_LTF) + { + uv = st.xyxy + HalfTexel; + dd = frac(uv.xy * WH.zw); + } + else + { + uv = st.xyxy; + } + + uv = wrapuv(uv); + + float4x4 c; + + if(PS_FMT == FMT_8H) + { + c = sample_4p(sample_4a(uv)); + } + else if(PS_FMT == FMT_4HL) + { + c = sample_4p(fmod(sample_4a(uv), 1.0f / 16)); + } + else if(PS_FMT == FMT_4HH) + { + c = sample_4p(fmod(sample_4a(uv) * 16, 1.0f / 16)); + } + else if(PS_FMT == FMT_8) + { + c = sample_4p(sample_4a(uv)); + } + else + { + c = sample_4c(uv); + } + + if(PS_LTF) + { + t = lerp(lerp(c[0], c[1], dd.x), lerp(c[2], c[3], dd.x), dd.y); + } + else + { + t = c[0]; + } + } + + if(PS_FMT == FMT_32) + { + #if SHADER_MODEL <= 0x300 + if(PS_RT) t.a *= 128.0f / 255; + #endif + } + else if(PS_FMT == FMT_24) + { + t.a = !PS_AEM || any(t.rgb) ? TA.x : 0; + } + else if(PS_FMT == FMT_16) + { + // a bit incompatible with up-scaling because the 1 bit alpha is interpolated + + t.a = t.a >= 0.5 ? TA.y : !PS_AEM || any(t.rgb) ? TA.x : 0; + } + + return t; +} + +float4 tfx(float4 t, float4 c) +{ + if(PS_TFX == 0) + { + if(PS_TCC) + { + c = c * t * 255.0f / 128; + } + else + { + c.rgb = c.rgb * t.rgb * 255.0f / 128; + } + } + else if(PS_TFX == 1) + { + if(PS_TCC) + { + c = t; + } + else + { + c.rgb = t.rgb; + } + } + else if(PS_TFX == 2) + { + c.rgb = c.rgb * t.rgb * 255.0f / 128 + c.a; + + if(PS_TCC) + { + c.a += t.a; + } + } + else if(PS_TFX == 3) + { + c.rgb = c.rgb * t.rgb * 255.0f / 128 + c.a; + + if(PS_TCC) + { + c.a = t.a; + } + } + + return saturate(c); +} + +void datst(PS_INPUT input) +{ +#if PS_DATE > 0 + float alpha = sample_rt(input.tp.xy).a; +#if SHADER_MODEL >= 0x400 + float alpha0x80 = 128. / 255; +#else + float alpha0x80 = 1; +#endif + + if (PS_DATE == 1 && alpha >= alpha0x80) + discard; + else if (PS_DATE == 2 && alpha < alpha0x80) + discard; +#endif +} + +void atst(float4 c) +{ + float a = trunc(c.a * 255); + + if(PS_ATST == 0) // never + { + discard; + } + else if(PS_ATST == 1) // always + { + // nothing to do + } + else if(PS_ATST == 2 || PS_ATST == 3) // l, le + { + clip(AREF - a); + } + else if(PS_ATST == 4) // e + { + clip(0.5f - abs(a - AREF)); + } + else if(PS_ATST == 5 || PS_ATST == 6) // ge, g + { + clip(a - AREF); + } + else if(PS_ATST == 7) // ne + { + clip(abs(a - AREF) - 0.5f); + } +} + +float4 fog(float4 c, float f) +{ + if(PS_FOG) + { + c.rgb = lerp(FogColor, c.rgb, f); + } + + return c; +} + +float4 ps_color(PS_INPUT input) +{ + datst(input); + + float4 t = sample(input.t.xy, input.t.w); + + float4 c = tfx(t, input.c); + + atst(c); + + c = fog(c, input.t.z); + + if (PS_COLCLIP == 2) + { + c.rgb = 256./255. - c.rgb; + } + if (PS_COLCLIP > 0) + { + c.rgb *= c.rgb < 128./255; + } + + if(PS_CLR1) // needed for Cd * (As/Ad/F + 1) blending modes + { + c.rgb = 1; + } + + return c; +} + +#if SHADER_MODEL >= 0x400 + +VS_OUTPUT vs_main(VS_INPUT input) +{ + if(VS_BPPZ == 1) // 24 + { + input.z = input.z & 0xffffff; + } + else if(VS_BPPZ == 2) // 16 + { + input.z = input.z & 0xffff; + } + + VS_OUTPUT output; + + // pos -= 0.05 (1/320 pixel) helps avoiding rounding problems (integral part of pos is usually 5 digits, 0.05 is about as low as we can go) + // example: ceil(afterseveralvertextransformations(y = 133)) => 134 => line 133 stays empty + // input granularity is 1/16 pixel, anything smaller than that won't step drawing up/left by one pixel + // example: 133.0625 (133 + 1/16) should start from line 134, ceil(133.0625 - 0.05) still above 133 + + float4 p = float4(input.p, input.z, 0) - float4(0.05f, 0.05f, 0, 0); + + output.p = p * VertexScale - VertexOffset; +#if VS_RTCOPY + output.tp = (p * VertexScale - VertexOffset) * float4(0.5, -0.5, 0, 0) + 0.5; +#endif + + if(VS_TME) + { + if(VS_FST) + { + output.t.xy = input.t * TextureScale; + output.t.w = 1.0f; + } + else + { + output.t.xy = input.t; + output.t.w = input.q; + } + } + else + { + output.t.xy = 0; + output.t.w = 1.0f; + } + + output.c = input.c; + output.t.z = input.f.a; + + return output; +} + +#if GS_PRIM == 0 + +[maxvertexcount(1)] +void gs_main(point VS_OUTPUT input[1], inout PointStream stream) +{ + stream.Append(input[0]); +} + +#elif GS_PRIM == 1 + +[maxvertexcount(2)] +void gs_main(line VS_OUTPUT input[2], inout LineStream stream) +{ + #if GS_IIP == 0 + input[0].c = input[1].c; + #endif + + stream.Append(input[0]); + stream.Append(input[1]); +} + +#elif GS_PRIM == 2 + +[maxvertexcount(3)] +void gs_main(triangle VS_OUTPUT input[3], inout TriangleStream stream) +{ + #if GS_IIP == 0 + input[0].c = input[2].c; + input[1].c = input[2].c; + #endif + + stream.Append(input[0]); + stream.Append(input[1]); + stream.Append(input[2]); +} + +#elif GS_PRIM == 3 + +[maxvertexcount(4)] +void gs_main(line VS_OUTPUT input[2], inout TriangleStream stream) +{ + input[0].p.z = input[1].p.z; + input[0].t.zw = input[1].t.zw; + + #if GS_IIP == 0 + input[0].c = input[1].c; + #endif + + VS_OUTPUT lb = input[1]; + + lb.p.x = input[0].p.x; + lb.t.x = input[0].t.x; + + VS_OUTPUT rt = input[1]; + + rt.p.y = input[0].p.y; + rt.t.y = input[0].t.y; + + stream.Append(input[0]); + stream.Append(lb); + stream.Append(rt); + stream.Append(input[1]); +} + +#endif + +PS_OUTPUT ps_main(PS_INPUT input) +{ + float4 c = ps_color(input); + + PS_OUTPUT output; + + output.c1 = c.a * 2; // used for alpha blending + + if(PS_AOUT) // 16 bit output + { + float a = 128.0f / 255; // alpha output will be 0x80 + + c.a = PS_FBA ? a : step(0.5, c.a) * a; + } + else if(PS_FBA) + { + if(c.a < 0.5) c.a += 0.5; + } + + output.c0 = c; + + return output; +} + +#elif SHADER_MODEL <= 0x300 + +VS_OUTPUT vs_main(VS_INPUT input) +{ + if(VS_BPPZ == 1) // 24 + { + input.p.z = fmod(input.p.z, 0x1000000); + } + else if(VS_BPPZ == 2) // 16 + { + input.p.z = fmod(input.p.z, 0x10000); + } + + VS_OUTPUT output; + + // pos -= 0.05 (1/320 pixel) helps avoiding rounding problems (integral part of pos is usually 5 digits, 0.05 is about as low as we can go) + // example: ceil(afterseveralvertextransformations(y = 133)) => 134 => line 133 stays empty + // input granularity is 1/16 pixel, anything smaller than that won't step drawing up/left by one pixel + // example: 133.0625 (133 + 1/16) should start from line 134, ceil(133.0625 - 0.05) still above 133 + + float4 p = input.p - float4(0.05f, 0.05f, 0, 0); + + output.p = p * VertexScale - VertexOffset; +#if VS_RTCOPY + output.tp = (p * VertexScale - VertexOffset) * float4(0.5, -0.5, 0, 0) + 0.5; +#endif + + if(VS_LOGZ) + { + output.p.z = log2(1.0f + input.p.z) / 32; + } + + if(VS_TME) + { + if(VS_FST) + { + output.t.xy = input.t * TextureScale; + output.t.w = 1.0f; + } + else + { + output.t.xy = input.t; + output.t.w = input.p.w; + } + } + else + { + output.t.xy = 0; + output.t.w = 1.0f; + } + + output.c = input.c; + output.t.z = input.f.a; + + return output; +} + +float4 ps_main(PS_INPUT input) : COLOR +{ + float4 c = ps_color(input); + + c.a *= 2; + + return c; +} + +#endif +#endif diff --git a/plugins/GSdx/vsprops/ProjectRootDir.props b/plugins/GSdx/vsprops/ProjectRootDir.props index 0456ef11c9..b78b467682 100644 --- a/plugins/GSdx/vsprops/ProjectRootDir.props +++ b/plugins/GSdx/vsprops/ProjectRootDir.props @@ -1,26 +1,26 @@ - - - - $(ProjectDir). - $(ProjectRootDir)\..\.. - $(SvnRootDir)\common - plugins - - - <_ProjectFileVersion>10.0.30128.1 - - - - $(ProjectRootDir) - - - $(SvnRootDir) - - - $(SvnCommonDir) - - - $(PcsxSubsection) - - + + + + $(ProjectDir). + $(ProjectRootDir)\..\.. + $(SvnRootDir)\common + plugins + + + <_ProjectFileVersion>10.0.30128.1 + + + + $(ProjectRootDir) + + + $(SvnRootDir) + + + $(SvnCommonDir) + + + $(PcsxSubsection) + + \ No newline at end of file diff --git a/plugins/GSdx/vsprops/ProjectRootDir.vsprops b/plugins/GSdx/vsprops/ProjectRootDir.vsprops index 986a2b4642..06de526c17 100644 --- a/plugins/GSdx/vsprops/ProjectRootDir.vsprops +++ b/plugins/GSdx/vsprops/ProjectRootDir.vsprops @@ -1,23 +1,23 @@ - - - - - - - + + + + + + + diff --git a/plugins/GSdx/vsprops/avx.props b/plugins/GSdx/vsprops/avx.props index fde99e8659..b8e7d56274 100644 --- a/plugins/GSdx/vsprops/avx.props +++ b/plugins/GSdx/vsprops/avx.props @@ -1,20 +1,20 @@ - - - - AVX - - - <_ProjectFileVersion>10.0.30128.1 - - - - _M_SSE=0x500;%(PreprocessorDefinitions) - /arch:AVX %(AdditionalOptions) - - - - - $(SSEtype) - - + + + + AVX + + + <_ProjectFileVersion>10.0.30128.1 + + + + _M_SSE=0x500;%(PreprocessorDefinitions) + /arch:AVX %(AdditionalOptions) + + + + + $(SSEtype) + + \ No newline at end of file diff --git a/plugins/GSdx/vsprops/common.props b/plugins/GSdx/vsprops/common.props index a5343af22f..a0631fd2f7 100644 --- a/plugins/GSdx/vsprops/common.props +++ b/plugins/GSdx/vsprops/common.props @@ -1,34 +1,34 @@ - - - - <_ProjectFileVersion>10.0.30128.1 - - - - true - WIN32;_WINDOWS;_WIN32_WINNT=0x500;%(PreprocessorDefinitions) - Fast - false - Level4 - ProgramDatabase - 4996;4995;4324;4100;4101;4201;4556;%(DisableSpecificWarnings) - $(DXSDK_DIR)include - true - - - JITProfiling.lib;d3d11.lib;d3dx11.lib;d3d10_1.lib;d3dx10.lib;d3d9.lib;d3dx9.lib;dxguid.lib;winmm.lib;strmiids.lib;xinput.lib;%(AdditionalDependencies) - $(OutDir)$(ProjectName)-$(SSEtype).dll - $(DXSDK_DIR)Lib\x86;./vtune;%(AdditionalLibraryDirectories) - d3d9.dll;d3dx9_43.dll;d3d11.dll;d3dx11_43.dll;%(DelayLoadDLLs) - true - Windows - false - - - .\postBuild.cmd "$(TargetPath)" "$(TargetName)" $(TargetExt) $(PcsxSubsection) - - - "$(SvnCommonDir)\vsprops\preBuild.cmd" "$(ProjectRootDir)" - - + + + + <_ProjectFileVersion>10.0.30128.1 + + + + true + WIN32;_WINDOWS;_WIN32_WINNT=0x500;%(PreprocessorDefinitions) + Fast + false + Level4 + ProgramDatabase + 4996;4995;4324;4100;4101;4201;4556;%(DisableSpecificWarnings) + $(DXSDK_DIR)include + true + + + JITProfiling.lib;d3d11.lib;d3dx11.lib;d3d10_1.lib;d3dx10.lib;d3d9.lib;d3dx9.lib;dxguid.lib;winmm.lib;strmiids.lib;xinput.lib;%(AdditionalDependencies) + $(OutDir)$(ProjectName)-$(SSEtype).dll + $(DXSDK_DIR)Lib\x86;./vtune;%(AdditionalLibraryDirectories) + d3d9.dll;d3dx9_43.dll;d3d11.dll;d3dx11_43.dll;%(DelayLoadDLLs) + true + Windows + false + + + .\postBuild.cmd "$(TargetPath)" "$(TargetName)" $(TargetExt) $(PcsxSubsection) + + + "$(SvnCommonDir)\vsprops\preBuild.cmd" "$(ProjectRootDir)" + + \ No newline at end of file diff --git a/plugins/GSdx/vsprops/common.vsprops b/plugins/GSdx/vsprops/common.vsprops index d81536421d..446ed3a01e 100644 --- a/plugins/GSdx/vsprops/common.vsprops +++ b/plugins/GSdx/vsprops/common.vsprops @@ -1,35 +1,35 @@ - - - - - - - + + + + + + + diff --git a/plugins/GSdx/vsprops/debug.props b/plugins/GSdx/vsprops/debug.props index 561b78eb8b..8918c13511 100644 --- a/plugins/GSdx/vsprops/debug.props +++ b/plugins/GSdx/vsprops/debug.props @@ -1,16 +1,16 @@ - - - - <_ProjectFileVersion>10.0.30128.1 - $(ProjectName)-$(SSEtype)-dbg - true - - - - Disabled - _DEBUG;%(PreprocessorDefinitions) - StackFrameRuntimeCheck - MultiThreadedDebugDLL - - + + + + <_ProjectFileVersion>10.0.30128.1 + $(ProjectName)-$(SSEtype)-dbg + true + + + + Disabled + _DEBUG;%(PreprocessorDefinitions) + StackFrameRuntimeCheck + MultiThreadedDebugDLL + + \ No newline at end of file diff --git a/plugins/GSdx/vsprops/debug.vsprops b/plugins/GSdx/vsprops/debug.vsprops index b7506beeec..da8ce82ebc 100644 --- a/plugins/GSdx/vsprops/debug.vsprops +++ b/plugins/GSdx/vsprops/debug.vsprops @@ -1,19 +1,19 @@ - - - - - + + + + + diff --git a/plugins/GSdx/vsprops/devel.props b/plugins/GSdx/vsprops/devel.props index 5594fcfcf3..f8595168a4 100644 --- a/plugins/GSdx/vsprops/devel.props +++ b/plugins/GSdx/vsprops/devel.props @@ -1,10 +1,10 @@ - - - - - - $(ProjectName)-dev - - - + + + + + + $(ProjectName)-dev + + + \ No newline at end of file diff --git a/plugins/GSdx/vsprops/release.props b/plugins/GSdx/vsprops/release.props index bc871fba6b..78df600b3f 100644 --- a/plugins/GSdx/vsprops/release.props +++ b/plugins/GSdx/vsprops/release.props @@ -1,26 +1,26 @@ - - - - <_ProjectFileVersion>10.0.30128.1 - false - $(ProjectName)-$(SSEtype) - - - - MaxSpeed - AnySuitable - true - Speed - true - true - NDEBUG;_SECURE_SCL=0;%(PreprocessorDefinitions) - true - MultiThreadedDLL - false - - - true - true - - + + + + <_ProjectFileVersion>10.0.30128.1 + false + $(ProjectName)-$(SSEtype) + + + + MaxSpeed + AnySuitable + true + Speed + true + true + NDEBUG;_SECURE_SCL=0;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + + + true + true + + \ No newline at end of file diff --git a/plugins/GSdx/vsprops/release.vsprops b/plugins/GSdx/vsprops/release.vsprops index c9fd3740b2..9ac028daa9 100644 --- a/plugins/GSdx/vsprops/release.vsprops +++ b/plugins/GSdx/vsprops/release.vsprops @@ -1,26 +1,26 @@ - - - - - + + + + + diff --git a/plugins/GSdx/vsprops/sse2.props b/plugins/GSdx/vsprops/sse2.props index 79e5975d28..97cc8ed3a8 100644 --- a/plugins/GSdx/vsprops/sse2.props +++ b/plugins/GSdx/vsprops/sse2.props @@ -1,20 +1,20 @@ - - - - SSE2 - - - <_ProjectFileVersion>10.0.30128.1 - - - - _M_SSE=0x200;%(PreprocessorDefinitions) - StreamingSIMDExtensions2 - - - - - $(SSEtype) - - + + + + SSE2 + + + <_ProjectFileVersion>10.0.30128.1 + + + + _M_SSE=0x200;%(PreprocessorDefinitions) + StreamingSIMDExtensions2 + + + + + $(SSEtype) + + \ No newline at end of file diff --git a/plugins/GSdx/vsprops/sse2.vsprops b/plugins/GSdx/vsprops/sse2.vsprops index 9211140cc0..20a33158a1 100644 --- a/plugins/GSdx/vsprops/sse2.vsprops +++ b/plugins/GSdx/vsprops/sse2.vsprops @@ -1,16 +1,16 @@ - - - - - + + + + + diff --git a/plugins/GSdx/vsprops/sse4.props b/plugins/GSdx/vsprops/sse4.props index 4ebc675a05..493174b82f 100644 --- a/plugins/GSdx/vsprops/sse4.props +++ b/plugins/GSdx/vsprops/sse4.props @@ -1,20 +1,20 @@ - - - - SSE4 - - - <_ProjectFileVersion>10.0.30128.1 - - - - _M_SSE=0x401;%(PreprocessorDefinitions) - StreamingSIMDExtensions2 - - - - - $(SSEtype) - - + + + + SSE4 + + + <_ProjectFileVersion>10.0.30128.1 + + + + _M_SSE=0x401;%(PreprocessorDefinitions) + StreamingSIMDExtensions2 + + + + + $(SSEtype) + + \ No newline at end of file diff --git a/plugins/GSdx/vsprops/sse4.vsprops b/plugins/GSdx/vsprops/sse4.vsprops index da3ee6c270..3922eb8fdb 100644 --- a/plugins/GSdx/vsprops/sse4.vsprops +++ b/plugins/GSdx/vsprops/sse4.vsprops @@ -1,16 +1,16 @@ - - - - - + + + + + diff --git a/plugins/GSdx/vsprops/ssse3.props b/plugins/GSdx/vsprops/ssse3.props index 0aed809ab7..cb14dd851b 100644 --- a/plugins/GSdx/vsprops/ssse3.props +++ b/plugins/GSdx/vsprops/ssse3.props @@ -1,21 +1,21 @@ - - - - SSSE3 - - - <_ProjectFileVersion>10.0.30128.1 - <_PropertySheetDisplayName>sse3 - - - - _M_SSE=0x301;%(PreprocessorDefinitions) - StreamingSIMDExtensions2 - - - - - $(SSEtype) - - + + + + SSSE3 + + + <_ProjectFileVersion>10.0.30128.1 + <_PropertySheetDisplayName>sse3 + + + + _M_SSE=0x301;%(PreprocessorDefinitions) + StreamingSIMDExtensions2 + + + + + $(SSEtype) + + \ No newline at end of file diff --git a/plugins/GSdx/vsprops/ssse3.vsprops b/plugins/GSdx/vsprops/ssse3.vsprops index fc76dac7f5..e09b985060 100644 --- a/plugins/GSdx/vsprops/ssse3.vsprops +++ b/plugins/GSdx/vsprops/ssse3.vsprops @@ -1,16 +1,16 @@ - - - - - + + + + +