mirror of https://github.com/PCSX2/pcsx2.git
The core of GSdx is now compatible with intel's compiler on linux.
- GSWnd is not implemented, no config dialogs either - no output, just the null device - threading classes were not tested (my first experience with pthread) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4315 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
0b3a1eee8c
commit
3030166596
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2007-2009 Gabest
|
||||
* http://www.gabest.org
|
||||
*
|
||||
|
@ -6,15 +6,15 @@
|
|||
* 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.
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
@ -23,13 +23,20 @@
|
|||
#include "GSdx.h"
|
||||
#include "GSUtil.h"
|
||||
#include "GPURendererSW.h"
|
||||
#include "GSDeviceNull.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
#include "GPUSettingsDlg.h"
|
||||
#include "GSDevice9.h"
|
||||
#include "GSDevice11.h"
|
||||
#include "GPUSettingsDlg.h"
|
||||
|
||||
static HRESULT s_hr = E_FAIL;
|
||||
|
||||
#endif
|
||||
|
||||
#define PSE_LT_GPU 2
|
||||
|
||||
static HRESULT s_hr = E_FAIL;
|
||||
static GPURenderer* s_gpu = NULL;
|
||||
|
||||
EXPORT_C_(uint32) PSEgetLibType()
|
||||
|
@ -62,10 +69,12 @@ EXPORT_C_(int32) GPUshutdown()
|
|||
|
||||
EXPORT_C_(int32) GPUclose()
|
||||
{
|
||||
delete s_gpu;
|
||||
|
||||
delete s_gpu;
|
||||
|
||||
s_gpu = NULL;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
if(SUCCEEDED(s_hr))
|
||||
{
|
||||
::CoUninitialize();
|
||||
|
@ -73,13 +82,22 @@ EXPORT_C_(int32) GPUclose()
|
|||
s_hr = E_FAIL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(int32) GPUopen(HWND hWnd)
|
||||
EXPORT_C_(int32) GPUopen(void* hWnd)
|
||||
{
|
||||
GPUclose();
|
||||
|
||||
if(!GSUtil::CheckSSE())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
s_hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
|
||||
if(!GSUtil::CheckDirectX())
|
||||
|
@ -87,20 +105,20 @@ EXPORT_C_(int32) GPUopen(HWND hWnd)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if(!GSUtil::CheckSSE())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int renderer = theApp.GetConfig("Renderer", 1);
|
||||
int threads = theApp.GetConfig("swthreads", 1);
|
||||
|
||||
switch(renderer)
|
||||
{
|
||||
default:
|
||||
default:
|
||||
#ifdef _WINDOWS
|
||||
case 0: s_gpu = new GPURendererSW(new GSDevice9(), threads); break;
|
||||
case 1: s_gpu = new GPURendererSW(new GSDevice11(), threads); break;
|
||||
// TODO: case 3: s_gpu = new GPURendererNull(new GSDeviceNull()); 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))
|
||||
|
@ -115,6 +133,8 @@ EXPORT_C_(int32) GPUopen(HWND hWnd)
|
|||
|
||||
EXPORT_C_(int32) GPUconfigure()
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
|
||||
GPUSettingsDlg dlg;
|
||||
|
||||
if(IDOK == dlg.DoModal())
|
||||
|
@ -123,6 +143,12 @@ EXPORT_C_(int32) GPUconfigure()
|
|||
GPUinit();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// TODO: linux
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -178,13 +204,13 @@ EXPORT_C_(uint32) GPUdmaChain(const uint8* mem, uint32 addr)
|
|||
|
||||
do
|
||||
{
|
||||
if(addr == last[1] || addr == last[2])
|
||||
if(addr == last[1] || addr == last[2])
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
(addr < last[0] ? last[1] : last[2]) = addr;
|
||||
|
||||
|
||||
last[0] = addr;
|
||||
|
||||
uint8 size = mem[addr + 3];
|
||||
|
@ -255,14 +281,14 @@ EXPORT_C_(int32) GPUfreeze(uint32 type, GPUFreezeData* data)
|
|||
else if(type == 2)
|
||||
{
|
||||
int slot = *(int*)data + 1;
|
||||
|
||||
|
||||
if(slot < 1 || slot > 9)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -282,4 +308,4 @@ EXPORT_C GPUshowScreenPic(uint8* mem)
|
|||
EXPORT_C GPUcursor(int player, int x, int y)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2007-2009 Gabest
|
||||
* http://www.gabest.org
|
||||
*
|
||||
|
@ -6,20 +6,20 @@
|
|||
* 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.
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GPUDrawScanline.h"
|
||||
|
||||
GPUDrawScanline::GPUDrawScanline()
|
||||
|
@ -51,7 +51,7 @@ void GPUDrawScanline::BeginDraw(const void* param)
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2007-2009 Gabest
|
||||
* http://www.gabest.org
|
||||
*
|
||||
|
@ -6,22 +6,22 @@
|
|||
* 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.
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
// TODO: x64
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GPUDrawScanlineCodeGenerator.h"
|
||||
|
||||
static const int _args = 8;
|
||||
|
@ -98,7 +98,7 @@ L("loop");
|
|||
WriteFrame();
|
||||
|
||||
L("step");
|
||||
|
||||
|
||||
// if(steps <= 0) break;
|
||||
|
||||
test(ecx, ecx);
|
||||
|
@ -162,10 +162,10 @@ void GPUDrawScanlineCodeGenerator::Init()
|
|||
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]);
|
||||
paddw(xmm3, ptr[&m_local.d.t]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -298,7 +298,7 @@ void GPUDrawScanlineCodeGenerator::SampleTexture()
|
|||
{
|
||||
if(!m_sel.tme)
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
// xmm2 = s
|
||||
|
@ -445,7 +445,7 @@ void GPUDrawScanlineCodeGenerator::SampleTexture()
|
|||
// xmm7 = test
|
||||
// xmm0, xmm6 = free
|
||||
// xmm1 = used
|
||||
|
||||
|
||||
// spill (TODO)
|
||||
|
||||
movdqa(ptr[&m_local.temp.fd], xmm1);
|
||||
|
@ -887,13 +887,13 @@ 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)
|
||||
|
||||
if(m_sel.md || m_sel.tme)
|
||||
{
|
||||
movdqa(xmm2, xmm0);
|
||||
movdqa(xmm2, xmm0);
|
||||
psllw(xmm2, 15);
|
||||
}
|
||||
|
||||
|
||||
psrlw(xmm0, 11);
|
||||
psllw(xmm0, 3);
|
||||
|
||||
|
@ -960,7 +960,7 @@ void GPUDrawScanlineCodeGenerator::ReadTexel(const Xmm& dst, const Xmm& addr)
|
|||
}
|
||||
}
|
||||
|
||||
template<int shift>
|
||||
template<int shift>
|
||||
void GPUDrawScanlineCodeGenerator::modulate16(const Xmm& a, const Operand& f)
|
||||
{
|
||||
if(shift == 0 && m_cpu.has(util::Cpu::tSSSE3))
|
||||
|
@ -974,7 +974,7 @@ void GPUDrawScanlineCodeGenerator::modulate16(const Xmm& a, const Operand& f)
|
|||
}
|
||||
}
|
||||
|
||||
template<int shift>
|
||||
template<int shift>
|
||||
void GPUDrawScanlineCodeGenerator::lerp16(const Xmm& a, const Xmm& b, const Operand& f)
|
||||
{
|
||||
psubw(a, b);
|
||||
|
@ -1009,7 +1009,7 @@ void GPUDrawScanlineCodeGenerator::blend(const Xmm& a, const Xmm& b, const Xmm&
|
|||
movdqa(a, b);
|
||||
}
|
||||
|
||||
const GSVector4i GPUDrawScanlineCodeGenerator::m_test[8] =
|
||||
const GSVector4i GPUDrawScanlineCodeGenerator::m_test[8] =
|
||||
{
|
||||
GSVector4i(0xffff0000, 0xffffffff, 0xffffffff, 0xffffffff),
|
||||
GSVector4i(0x00000000, 0xffffffff, 0xffffffff, 0xffffffff),
|
||||
|
@ -1021,10 +1021,10 @@ const GSVector4i GPUDrawScanlineCodeGenerator::m_test[8] =
|
|||
GSVector4i::zero(),
|
||||
};
|
||||
|
||||
__declspec(align(16)) const uint16 GPUDrawScanlineCodeGenerator::m_dither[4][16] =
|
||||
__declspec(align(16)) const uint16 GPUDrawScanlineCodeGenerator::m_dither[4][16] =
|
||||
{
|
||||
{7, 0, 6, 1, 7, 0, 6, 1, 7, 0, 6, 1, 7, 0, 6, 1},
|
||||
{2, 5, 3, 4, 2, 5, 3, 4, 2, 5, 3, 4, 2, 5, 3, 4},
|
||||
{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},
|
||||
{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},
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2007-2009 Gabest
|
||||
* http://www.gabest.org
|
||||
*
|
||||
|
@ -6,20 +6,20 @@
|
|||
* 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.
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GPULocalMemory.h"
|
||||
#include "GSdx.h"
|
||||
|
||||
|
@ -30,14 +30,14 @@ const GSVector4i GPULocalMemory::m_rxxx(0x0000001f);
|
|||
|
||||
GPULocalMemory::GPULocalMemory()
|
||||
{
|
||||
m_scale.x = min(max(theApp.GetConfig("scale_x", 0), 0), 2);
|
||||
m_scale.y = min(max(theApp.GetConfig("scale_y", 0), 0), 2);
|
||||
m_scale.x = std::min<int>(std::max<int>(theApp.GetConfig("scale_x", 0), 0), 2);
|
||||
m_scale.y = std::min<int>(std::max<int>(theApp.GetConfig("scale_y", 0), 0), 2);
|
||||
|
||||
//
|
||||
|
||||
int size = (1 << (12 + 11)) * sizeof(uint16);
|
||||
|
||||
m_vm = (uint16*)VirtualAlloc(NULL, size * 2, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
m_vm = (uint16*)vmalloc(size * 2, false);
|
||||
|
||||
memset(m_vm, 0, size);
|
||||
|
||||
|
@ -50,7 +50,7 @@ GPULocalMemory::GPULocalMemory()
|
|||
|
||||
size = 256 * 256 * (1 + 1 + 4) * 32;
|
||||
|
||||
m_texture.buff[0] = (uint8*)VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
m_texture.buff[0] = (uint8*)vmalloc(size, false);
|
||||
m_texture.buff[1] = m_texture.buff[0] + 256 * 256 * 32;
|
||||
m_texture.buff[2] = m_texture.buff[1] + 256 * 256 * 32;
|
||||
|
||||
|
@ -78,9 +78,9 @@ GPULocalMemory::GPULocalMemory()
|
|||
|
||||
GPULocalMemory::~GPULocalMemory()
|
||||
{
|
||||
VirtualFree(m_vm, 0, MEM_RELEASE);
|
||||
vmfree(m_vm);
|
||||
|
||||
VirtualFree(m_texture.buff[0], 0, MEM_RELEASE);
|
||||
vmfree(m_texture.buff[0]);
|
||||
}
|
||||
|
||||
const uint16* GPULocalMemory::GetCLUT(int tp, int cx, int cy)
|
||||
|
@ -128,11 +128,11 @@ const uint16* GPULocalMemory::GetCLUT(int tp, int cx, int cy)
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
|
||||
m_clut.tp = tp;
|
||||
m_clut.cx = cx;
|
||||
m_clut.cy = cy;
|
||||
|
@ -161,16 +161,16 @@ const void* GPULocalMemory::GetTexture(int tp, int tx, int ty)
|
|||
|
||||
switch(tp)
|
||||
{
|
||||
case 0:
|
||||
ReadPage4(tx, ty, (uint8*)buff);
|
||||
case 0:
|
||||
ReadPage4(tx, ty, (uint8*)buff);
|
||||
bpp = 4;
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
ReadPage8(tx, ty, (uint8*)buff);
|
||||
bpp = 8;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 2:
|
||||
case 3:
|
||||
ReadPage16(tx, ty, (uint16*)buff);
|
||||
bpp = 16;
|
||||
default:
|
||||
|
@ -571,8 +571,10 @@ void GPULocalMemory::Expand24(const uint16* RESTRICT src, uint32* RESTRICT dst,
|
|||
|
||||
void GPULocalMemory::SaveBMP(const string& path, const GSVector4i& r2, int tp, int cx, int cy)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
|
||||
GSVector4i r;
|
||||
|
||||
|
||||
r.left = r2.left << m_scale.x;
|
||||
r.top = r2.top << m_scale.y;
|
||||
r.right = r2.right << m_scale.x;
|
||||
|
@ -593,7 +595,7 @@ void GPULocalMemory::SaveBMP(const string& path, const GSVector4i& r2, int tp, i
|
|||
bih.biCompression = BI_RGB;
|
||||
bih.biSizeImage = bih.biWidth * bih.biHeight * 4;
|
||||
|
||||
BITMAPFILEHEADER bfh;
|
||||
BITMAPFILEHEADER bfh;
|
||||
memset(&bfh, 0, sizeof(bfh));
|
||||
bfh.bfType = 'MB';
|
||||
bfh.bfOffBits = sizeof(bfh) + sizeof(bih);
|
||||
|
@ -623,7 +625,7 @@ void GPULocalMemory::SaveBMP(const string& path, const GSVector4i& r2, int tp, i
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 1: // 8 bpp
|
||||
|
||||
for(int i = 0, k = r.width(); i < k; i++)
|
||||
|
@ -664,4 +666,10 @@ void GPULocalMemory::SaveBMP(const string& path, const GSVector4i& r2, int tp, i
|
|||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// TODO: linux
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2007-2009 Gabest
|
||||
* http://www.gabest.org
|
||||
*
|
||||
|
@ -6,66 +6,82 @@
|
|||
* 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.
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GPURenderer.h"
|
||||
#include "GSdx.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
map<HWND, GPURenderer*> GPURenderer::m_wnd2gpu;
|
||||
|
||||
#endif
|
||||
|
||||
GPURenderer::GPURenderer(GSDevice* dev)
|
||||
: m_dev(dev)
|
||||
, m_hWnd(NULL)
|
||||
, m_wndproc(NULL)
|
||||
{
|
||||
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(HWND hWnd)
|
||||
bool GPURenderer::Create(void* hWnd)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
|
||||
// TODO: move subclassing inside GSWnd::Attach
|
||||
|
||||
m_hWnd = hWnd;
|
||||
m_hWnd = (HWND)hWnd;
|
||||
|
||||
m_wndproc = (WNDPROC)GetWindowLongPtr(hWnd, GWLP_WNDPROC);
|
||||
SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)WndProc);
|
||||
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[hWnd] = this;
|
||||
m_wnd2gpu[m_hWnd] = this;
|
||||
|
||||
DWORD style = GetWindowLong(hWnd, GWL_STYLE);
|
||||
style |= WS_OVERLAPPEDWINDOW;
|
||||
SetWindowLong(hWnd, GWL_STYLE, style);
|
||||
SetWindowLong(m_hWnd, GWL_STYLE, GetWindowLong(m_hWnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW);
|
||||
|
||||
#endif
|
||||
|
||||
m_wnd.Show();
|
||||
|
||||
|
@ -74,7 +90,7 @@ bool GPURenderer::Create(HWND hWnd)
|
|||
return false;
|
||||
}
|
||||
|
||||
m_dev->SetVsync(m_vsync);
|
||||
m_dev->SetVSync(m_vsync);
|
||||
|
||||
Reset();
|
||||
|
||||
|
@ -111,8 +127,12 @@ void GPURenderer::VSync()
|
|||
|
||||
// m_env.STATUS.LCF = ~m_env.STATUS.LCF; // ?
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
if(!IsWindow(m_hWnd)) return;
|
||||
|
||||
#endif
|
||||
|
||||
Flush();
|
||||
|
||||
if(!m_dev->IsLost(true))
|
||||
|
@ -127,7 +147,7 @@ void GPURenderer::VSync()
|
|||
ResetDevice();
|
||||
}
|
||||
|
||||
// osd
|
||||
// osd
|
||||
|
||||
if((m_perfmon.GetFrame() & 0x1f) == 0)
|
||||
{
|
||||
|
@ -141,7 +161,7 @@ void GPURenderer::VSync()
|
|||
int h = r.height() << m_scale.y;
|
||||
|
||||
string s = format(
|
||||
"%I64d | %d x %d | %.2f fps (%d%%) | %d/%d | %d%% CPU | %.2f | %.2f",
|
||||
"%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),
|
||||
|
@ -157,12 +177,10 @@ void GPURenderer::VSync()
|
|||
s = format("%s | %.2f mpps", s.c_str(), fps * fillrate / (1024 * 1024));
|
||||
}
|
||||
|
||||
SetWindowText(m_hWnd, s.c_str());
|
||||
m_wnd.SetWindowText(s.c_str());
|
||||
}
|
||||
|
||||
GSVector4i r;
|
||||
|
||||
GetClientRect(m_hWnd, r);
|
||||
GSVector4i r = m_wnd.GetClientRect();
|
||||
|
||||
m_dev->Present(r.fit(m_aspectratio), 0);
|
||||
}
|
||||
|
@ -186,6 +204,8 @@ bool GPURenderer::MakeSnapshot(const string& path)
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
LRESULT CALLBACK GPURenderer::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
map<HWND, GPURenderer*>::iterator i = m_wnd2gpu.find(hWnd);
|
||||
|
@ -221,3 +241,4 @@ LRESULT GPURenderer::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
|||
return CallWindowProc(m_wndproc, m_hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2007-2009 Gabest
|
||||
* http://www.gabest.org
|
||||
*
|
||||
|
@ -6,15 +6,15 @@
|
|||
* 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.
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
@ -40,25 +40,29 @@ protected:
|
|||
virtual void ResetDevice() {}
|
||||
virtual GSTexture* GetOutput() = 0;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
HWND m_hWnd;
|
||||
WNDPROC m_wndproc;
|
||||
static map<HWND, GPURenderer*> m_wnd2gpu;
|
||||
GSWnd m_wnd;
|
||||
|
||||
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(HWND hWnd);
|
||||
virtual bool Create(void* hWnd);
|
||||
virtual void VSync();
|
||||
virtual bool MakeSnapshot(const string& path);
|
||||
};
|
||||
|
||||
template<class Vertex>
|
||||
template<class Vertex>
|
||||
class GPURendererT : public GPURenderer
|
||||
{
|
||||
protected:
|
||||
|
@ -72,7 +76,7 @@ protected:
|
|||
m_count = 0;
|
||||
m_vl.RemoveAll();
|
||||
|
||||
__super::Reset();
|
||||
GPURenderer::Reset();
|
||||
}
|
||||
|
||||
void ResetPrim()
|
||||
|
@ -80,7 +84,7 @@ protected:
|
|||
m_vl.RemoveAll();
|
||||
}
|
||||
|
||||
void FlushPrim()
|
||||
void FlushPrim()
|
||||
{
|
||||
if(m_count > 0)
|
||||
{
|
||||
|
@ -110,8 +114,10 @@ protected:
|
|||
|
||||
void GrowVertexBuffer()
|
||||
{
|
||||
if(m_vertices != NULL) _aligned_free(m_vertices);
|
||||
|
||||
m_maxcount = max(10000, m_maxcount * 3/2);
|
||||
m_vertices = (Vertex*)_aligned_realloc(m_vertices, sizeof(Vertex) * m_maxcount, 16);
|
||||
m_vertices = (Vertex*)_aligned_malloc(sizeof(Vertex) * m_maxcount, 16);
|
||||
m_maxcount -= 100;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2007-2009 Gabest
|
||||
* http://www.gabest.org
|
||||
*
|
||||
|
@ -6,36 +6,40 @@
|
|||
* 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.
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GPURendererSW.h"
|
||||
#include "GSdx.h"
|
||||
//#include "GSdx.h"
|
||||
|
||||
GPURendererSW::GPURendererSW(GSDevice* dev, int threads)
|
||||
: GPURendererT(dev)
|
||||
: GPURendererT<GSVertexSW>(dev)
|
||||
, m_texture(NULL)
|
||||
{
|
||||
m_output = (uint32*)_aligned_malloc(m_mem.GetWidth() * m_mem.GetHeight() * sizeof(uint32), 16);
|
||||
|
||||
m_rl.Create<GPUDrawScanline>(threads);
|
||||
}
|
||||
|
||||
GPURendererSW::~GPURendererSW()
|
||||
{
|
||||
delete m_texture;
|
||||
|
||||
_aligned_free(m_output);
|
||||
}
|
||||
|
||||
void GPURendererSW::ResetDevice()
|
||||
void GPURendererSW::ResetDevice()
|
||||
{
|
||||
delete m_texture;
|
||||
|
||||
|
@ -53,12 +57,9 @@ GSTexture* GPURendererSW::GetOutput()
|
|||
|
||||
if(m_dev->ResizeTexture(&m_texture, r.width(), r.height()))
|
||||
{
|
||||
// TODO
|
||||
static uint32* buff = (uint32*)_aligned_malloc(m_mem.GetWidth() * m_mem.GetHeight() * sizeof(uint32), 16);
|
||||
m_mem.ReadFrame32(r, m_output, !!m_env.STATUS.ISRGB24);
|
||||
|
||||
m_mem.ReadFrame32(r, buff, !!m_env.STATUS.ISRGB24);
|
||||
|
||||
m_texture->Update(r.rsize(), buff, m_mem.GetWidth() * sizeof(uint32));
|
||||
m_texture->Update(r.rsize(), m_output, m_mem.GetWidth() * sizeof(uint32));
|
||||
}
|
||||
|
||||
return m_texture;
|
||||
|
@ -153,7 +154,7 @@ void GPURendererSW::Draw()
|
|||
|
||||
Invalidate(r);
|
||||
|
||||
m_rl.Sync();
|
||||
m_rl.Sync();
|
||||
|
||||
GSRasterizerStats stats;
|
||||
|
||||
|
@ -161,7 +162,7 @@ void GPURendererSW::Draw()
|
|||
|
||||
m_perfmon.Put(GSPerfMon::Draw, 1);
|
||||
m_perfmon.Put(GSPerfMon::Prim, stats.prims);
|
||||
m_perfmon.Put(GSPerfMon::Fillrate, stats.pixels);
|
||||
m_perfmon.Put(GSPerfMon::Fillrate, stats.pixels);
|
||||
}
|
||||
|
||||
void GPURendererSW::VertexKick()
|
||||
|
@ -184,7 +185,7 @@ void GPURendererSW::VertexKick()
|
|||
dst.c = GSVector4(GSVector4i::load((int)m_v.RGB.u32).u8to32() << 7);
|
||||
|
||||
int count = 0;
|
||||
|
||||
|
||||
if(GSVertexSW* v = DrawingKick(count))
|
||||
{
|
||||
// TODO
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2007-2009 Gabest
|
||||
* http://www.gabest.org
|
||||
*
|
||||
|
@ -6,15 +6,15 @@
|
|||
* 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.
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
@ -29,6 +29,7 @@ class GPURendererSW : public GPURendererT<GSVertexSW>
|
|||
protected:
|
||||
GSRasterizerList m_rl;
|
||||
GSTexture* m_texture;
|
||||
uint32* m_output;
|
||||
|
||||
void ResetDevice();
|
||||
GSTexture* GetOutput();
|
||||
|
|
|
@ -25,44 +25,6 @@
|
|||
#include "GPUSettingsDlg.h"
|
||||
#include "resource.h"
|
||||
|
||||
GSSetting GPUSettingsDlg::g_renderers[] =
|
||||
{
|
||||
{0, "Direct3D9 (Software)", ""},
|
||||
{1, "Direct3D11 (Software)", ""},
|
||||
// {2, "Null (Null)", ""},
|
||||
};
|
||||
|
||||
GSSetting GPUSettingsDlg::g_filter[] =
|
||||
{
|
||||
{0, "Nearest", ""},
|
||||
{1, "Bilinear (polygons only)", ""},
|
||||
{2, "Bilinear", ""},
|
||||
};
|
||||
|
||||
GSSetting GPUSettingsDlg::g_dithering[] =
|
||||
{
|
||||
{0, "Disabled", ""},
|
||||
{1, "Auto", ""},
|
||||
};
|
||||
|
||||
GSSetting GPUSettingsDlg::g_aspectratio[] =
|
||||
{
|
||||
{0, "Stretch", ""},
|
||||
{1, "4:3", ""},
|
||||
{2, "16:9", ""},
|
||||
};
|
||||
|
||||
GSSetting GPUSettingsDlg::g_scale[] =
|
||||
{
|
||||
{0 | (0 << 2), "H x 1 - V x 1", ""},
|
||||
{1 | (0 << 2), "H x 2 - V x 1", ""},
|
||||
{0 | (1 << 2), "H x 1 - V x 2", ""},
|
||||
{1 | (1 << 2), "H x 2 - V x 2", ""},
|
||||
{2 | (1 << 2), "H x 4 - V x 2", ""},
|
||||
{1 | (2 << 2), "H x 2 - V x 4", ""},
|
||||
{2 | (2 << 2), "H x 4 - V x 4", ""},
|
||||
};
|
||||
|
||||
GPUSettingsDlg::GPUSettingsDlg()
|
||||
: GSDialog(IDD_GPUCONFIG)
|
||||
{
|
||||
|
@ -103,18 +65,11 @@ void GPUSettingsDlg::OnInit()
|
|||
}
|
||||
}
|
||||
|
||||
vector<GSSetting> renderers;
|
||||
|
||||
for(size_t i = 0; i < countof(g_renderers); i++)
|
||||
{
|
||||
renderers.push_back(g_renderers[i]);
|
||||
}
|
||||
|
||||
ComboBoxInit(IDC_RENDERER, &renderers[0], renderers.size(), theApp.GetConfig("Renderer", 0));
|
||||
ComboBoxInit(IDC_FILTER, g_filter, countof(g_filter), theApp.GetConfig("filter", 0));
|
||||
ComboBoxInit(IDC_DITHERING, g_dithering, countof(g_dithering), theApp.GetConfig("dithering", 1));
|
||||
ComboBoxInit(IDC_ASPECTRATIO, g_aspectratio, countof(g_aspectratio), theApp.GetConfig("AspectRatio", 1));
|
||||
ComboBoxInit(IDC_SCALE, g_scale, countof(g_scale), theApp.GetConfig("scale_x", 0) | (theApp.GetConfig("scale_y", 0) << 2));
|
||||
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));
|
||||
|
||||
|
|
|
@ -36,10 +36,4 @@ protected:
|
|||
|
||||
public:
|
||||
GPUSettingsDlg();
|
||||
|
||||
static GSSetting g_renderers[];
|
||||
static GSSetting g_filter[];
|
||||
static GSSetting g_dithering[];
|
||||
static GSSetting g_aspectratio[];
|
||||
static GSSetting g_scale[];
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2007-2009 Gabest
|
||||
* http://www.gabest.org
|
||||
*
|
||||
|
@ -6,22 +6,22 @@
|
|||
* 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.
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
// TODO: x64
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSVertexSW.h"
|
||||
#include "GPUSetupPrimCodeGenerator.h"
|
||||
|
||||
|
@ -212,9 +212,9 @@ void GPUSetupPrimCodeGenerator::Generate()
|
|||
ret();
|
||||
}
|
||||
|
||||
const GSVector4 GPUSetupPrimCodeGenerator::m_shift[3] =
|
||||
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),
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2007-2009 Gabest
|
||||
* http://www.gabest.org
|
||||
*
|
||||
|
@ -6,15 +6,15 @@
|
|||
* 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.
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
@ -38,7 +38,7 @@ GPUState::GPUState()
|
|||
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[0x06] = &GPUState::SCH_HorizontalDisplayRange;
|
||||
m_fpGPUStatusCommandHandlers[0x07] = &GPUState::SCH_VerticalDisplayRange;
|
||||
m_fpGPUStatusCommandHandlers[0x08] = &GPUState::SCH_DisplayMode;
|
||||
m_fpGPUStatusCommandHandlers[0x10] = &GPUState::SCH_GPUInfo;
|
||||
|
@ -81,21 +81,21 @@ void GPUState::SetPrim(GPUReg* r)
|
|||
}
|
||||
|
||||
GPURegPRIM PRIM = r->PRIM;
|
||||
|
||||
|
||||
PRIM.VTX = 0;
|
||||
|
||||
switch(r->PRIM.TYPE)
|
||||
{
|
||||
case GPU_POLYGON:
|
||||
case GPU_POLYGON:
|
||||
PRIM.u32 = (r->PRIM.u32 & 0xF7000000) | 3; // TYPE IIP TME ABE TGE
|
||||
break;
|
||||
case GPU_LINE:
|
||||
case GPU_LINE:
|
||||
PRIM.u32 = (r->PRIM.u32 & 0xF2000000) | 2; // TYPE IIP ABE
|
||||
PRIM.TGE = 1; // ?
|
||||
break;
|
||||
case GPU_SPRITE:
|
||||
break;
|
||||
case GPU_SPRITE:
|
||||
PRIM.u32 = (r->PRIM.u32 & 0xE7000000) | 2; // TYPE TME ABE TGE
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if(m_env.PRIM.u32 != PRIM.u32)
|
||||
|
@ -200,7 +200,7 @@ void GPUState::WriteStatus(uint32 status)
|
|||
|
||||
m_status[b] = status;
|
||||
|
||||
(this->*m_fpGPUStatusCommandHandlers[b])((GPUReg*)&status);
|
||||
(this->*m_fpGPUStatusCommandHandlers[b])((GPUReg*)&status);
|
||||
}
|
||||
|
||||
uint32 GPUState::ReadStatus()
|
||||
|
@ -292,30 +292,30 @@ void GPUState::SCH_GPUInfo(GPUReg* r)
|
|||
|
||||
switch(r->GPUINFO.PARAM)
|
||||
{
|
||||
case 0x2:
|
||||
value = m_env.TWIN.u32;
|
||||
case 0x2:
|
||||
value = m_env.TWIN.u32;
|
||||
break;
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x3:
|
||||
value = m_env.DRAREATL.u32;
|
||||
case 0x3:
|
||||
value = m_env.DRAREATL.u32;
|
||||
break;
|
||||
case 0x4:
|
||||
value = m_env.DRAREABR.u32;
|
||||
case 0x4:
|
||||
value = m_env.DRAREABR.u32;
|
||||
break;
|
||||
case 0x5:
|
||||
case 0x6:
|
||||
value = m_env.DROFF.u32;
|
||||
case 0x5:
|
||||
case 0x6:
|
||||
value = m_env.DROFF.u32;
|
||||
break;
|
||||
case 0x7:
|
||||
value = 2;
|
||||
case 0x7:
|
||||
value = 2;
|
||||
break;
|
||||
case 0x8:
|
||||
case 0xf:
|
||||
case 0x8:
|
||||
case 0xf:
|
||||
value = 0xBFC03720; // ?
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
default:
|
||||
ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ int GPUState::PH_Command(GPUReg* r, int size)
|
|||
return 1;
|
||||
|
||||
case 2: // fillrect
|
||||
|
||||
|
||||
if(size < 3) return 0;
|
||||
|
||||
Flush();
|
||||
|
@ -375,7 +375,7 @@ int GPUState::PH_Polygon(GPUReg* r, int size)
|
|||
|
||||
if(r[0].POLYGON.TME) required += vertices;
|
||||
|
||||
if(r[0].POLYGON.IIP) required += vertices - 1;
|
||||
if(r[0].POLYGON.IIP) required += vertices - 1;
|
||||
|
||||
if(size < required) return 0;
|
||||
|
||||
|
@ -401,7 +401,7 @@ int GPUState::PH_Polygon(GPUReg* r, int size)
|
|||
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;
|
||||
|
@ -507,7 +507,7 @@ int GPUState::PH_Sprite(GPUReg* r, int size)
|
|||
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;
|
||||
|
@ -647,7 +647,7 @@ int GPUState::PH_Environment(GPUReg* r, int size)
|
|||
|
||||
return 1;
|
||||
|
||||
case 2: // texture window setting
|
||||
case 2: // texture window setting
|
||||
|
||||
m_env.TWIN = r->TWIN;
|
||||
|
||||
|
@ -705,7 +705,9 @@ void GPUState::Buffer::Reserve(int size)
|
|||
{
|
||||
maxbytes = (maxbytes + size + 1023) & ~1023;
|
||||
|
||||
buff = (uint8*)_aligned_realloc(buff, maxbytes, 16);
|
||||
if(buff != NULL) _aligned_free(buff);
|
||||
|
||||
buff = (uint8*)_aligned_malloc(maxbytes, 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,20 +20,30 @@
|
|||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GSdx.h"
|
||||
#include "GSUtil.h"
|
||||
#include "GSRendererDX9.h"
|
||||
#include "GSRendererDX11.h"
|
||||
#include "GSRendererSW.h"
|
||||
#include "GSRendererNull.h"
|
||||
#include "GSDeviceNull.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
#include "GSRendererDX9.h"
|
||||
#include "GSRendererDX11.h"
|
||||
#include "GSDevice9.h"
|
||||
#include "GSDevice11.h"
|
||||
#include "GSSettingsDlg.h"
|
||||
|
||||
static HRESULT s_hr = E_FAIL;
|
||||
static bool s_isdx11avail = false; // set on GSinit
|
||||
|
||||
#endif
|
||||
|
||||
#define PS2E_LT_GS 0x01
|
||||
#define PS2E_GS_VERSION 0x0006
|
||||
#define PS2E_X86 0x01 // 32 bit
|
||||
#define PS2E_X86_64 0x02 // 64 bit
|
||||
|
||||
static HRESULT s_hr = E_FAIL;
|
||||
static GSRenderer* s_gs = NULL;
|
||||
static void (*s_irq)() = NULL;
|
||||
static uint8* s_basemem = NULL;
|
||||
|
@ -41,9 +51,7 @@ static int s_renderer = -1;
|
|||
static bool s_framelimit = true;
|
||||
static bool s_vsync = false;
|
||||
static bool s_exclusive = true;
|
||||
|
||||
static bool s_IsGsOpen2 = false; // boolean to remove some stuff from the config panel in new PCSX2's/
|
||||
static bool isdx11avail = false; // set on GSinit
|
||||
static bool s_isgsopen2 = false; // boolean to remove some stuff from the config panel in new PCSX2's/
|
||||
|
||||
EXPORT_C_(uint32) PS2EgetLibType()
|
||||
{
|
||||
|
@ -65,24 +73,29 @@ EXPORT_C_(uint32) PS2EgetLibVersion2(uint32 type)
|
|||
|
||||
EXPORT_C_(void) PS2EsetEmuVersion(const char* emuId, uint32 version)
|
||||
{
|
||||
s_IsGsOpen2 = true;
|
||||
s_isgsopen2 = true;
|
||||
}
|
||||
|
||||
EXPORT_C_(uint32) PS2EgetCpuPlatform()
|
||||
{
|
||||
#if _M_AMD64
|
||||
|
||||
return PS2E_X86_64;
|
||||
|
||||
#else
|
||||
|
||||
return PS2E_X86;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
EXPORT_C GSsetBaseMem(uint8* mem)
|
||||
{
|
||||
s_basemem = mem;
|
||||
if( s_gs )
|
||||
|
||||
if(s_gs)
|
||||
{
|
||||
s_gs->SetRegsMem( s_basemem );
|
||||
s_gs->SetRegsMem(s_basemem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +104,7 @@ EXPORT_C GSsetSettingsDir(const char* dir)
|
|||
theApp.SetConfigDir(dir);
|
||||
}
|
||||
|
||||
EXPORT_C_(INT32) GSinit()
|
||||
EXPORT_C_(int) GSinit()
|
||||
{
|
||||
if(!GSUtil::CheckSSE())
|
||||
{
|
||||
|
@ -100,8 +113,6 @@ EXPORT_C_(INT32) GSinit()
|
|||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
//_CrtSetBreakAlloc( 1273 );
|
||||
|
||||
s_hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
|
||||
if(!GSUtil::CheckDirectX())
|
||||
|
@ -109,7 +120,7 @@ EXPORT_C_(INT32) GSinit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
isdx11avail = GSUtil::IsDirect3D11Available();
|
||||
s_isdx11avail = GSUtil::IsDirect3D11Available();
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -121,10 +132,9 @@ EXPORT_C GSshutdown()
|
|||
delete s_gs;
|
||||
|
||||
s_gs = NULL;
|
||||
|
||||
s_renderer = -1;
|
||||
|
||||
GSUtil::UnloadDynamicLibraries();
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
if(SUCCEEDED(s_hr))
|
||||
|
@ -139,17 +149,18 @@ EXPORT_C GSshutdown()
|
|||
|
||||
EXPORT_C GSclose()
|
||||
{
|
||||
if( !s_gs ) return;
|
||||
if(s_gs == NULL) return;
|
||||
|
||||
s_gs->ResetDevice();
|
||||
|
||||
delete s_gs->m_dev;
|
||||
|
||||
s_gs->m_dev = NULL;
|
||||
|
||||
s_gs->m_wnd.Detach();
|
||||
}
|
||||
|
||||
static INT32 _GSopen(void* dsp, char* title, int renderer, int threads = -1)
|
||||
static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
|
||||
{
|
||||
GSDevice* dev = NULL;
|
||||
|
||||
|
@ -165,7 +176,7 @@ static INT32 _GSopen(void* dsp, char* title, int renderer, int threads = -1)
|
|||
|
||||
try
|
||||
{
|
||||
if (s_renderer != renderer)
|
||||
if(s_renderer != renderer)
|
||||
{
|
||||
// Emulator has made a render change request, which requires a completely
|
||||
// new s_gs -- if the emu doesn't save/restore the GS state across this
|
||||
|
@ -179,29 +190,36 @@ static INT32 _GSopen(void* dsp, char* title, int renderer, int threads = -1)
|
|||
switch(renderer)
|
||||
{
|
||||
default:
|
||||
#ifdef _WINDOWS
|
||||
case 0: case 1: case 2: dev = new GSDevice9(); break;
|
||||
case 3: case 4: case 5: dev = new GSDevice11(); break;
|
||||
#endif
|
||||
case 12: case 13: new GSDeviceNull(); break;
|
||||
}
|
||||
|
||||
if(!dev) return -1;
|
||||
if(dev == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!s_gs)
|
||||
if(s_gs == NULL)
|
||||
{
|
||||
switch(renderer)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
s_gs = new GSRendererDX9();
|
||||
#ifdef _WINDOWS
|
||||
case 0:
|
||||
s_gs = new GSRendererDX9();
|
||||
break;
|
||||
case 3:
|
||||
s_gs = new GSRendererDX11();
|
||||
break;
|
||||
case 2: case 5: case 8: case 11: case 13:
|
||||
s_gs = new GSRendererNull();
|
||||
case 3:
|
||||
s_gs = new GSRendererDX11();
|
||||
break;
|
||||
case 1: case 4: case 7: case 10: case 12:
|
||||
s_gs = new GSRendererSW(threads);
|
||||
s_gs = new GSRendererSW(threads);
|
||||
break;
|
||||
#endif
|
||||
case 2: case 5: case 8: case 11: case 13:
|
||||
s_gs = new GSRendererNull();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -221,10 +239,10 @@ static INT32 _GSopen(void* dsp, char* title, int renderer, int threads = -1)
|
|||
|
||||
s_gs->SetRegsMem(s_basemem);
|
||||
s_gs->SetIrqCallback(s_irq);
|
||||
s_gs->SetVsync(s_vsync);
|
||||
s_gs->SetVSync(s_vsync);
|
||||
s_gs->SetFrameLimit(s_framelimit);
|
||||
|
||||
if(*(HWND*)dsp == NULL)
|
||||
if(*dsp == NULL)
|
||||
{
|
||||
// old-style API expects us to create and manage our own window:
|
||||
|
||||
|
@ -234,17 +252,19 @@ static INT32 _GSopen(void* dsp, char* title, int renderer, int threads = -1)
|
|||
if(!s_gs->CreateWnd(title, w, h))
|
||||
{
|
||||
GSclose();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
s_gs->m_wnd.Show();
|
||||
|
||||
*(HWND*)dsp = s_gs->m_wnd.GetHandle();
|
||||
*dsp = s_gs->m_wnd.GetHandle();
|
||||
}
|
||||
else
|
||||
{
|
||||
s_gs->SetMultithreaded(true);
|
||||
s_gs->m_wnd.Attach(*(HWND*)dsp, false);
|
||||
|
||||
s_gs->m_wnd.Attach(*dsp, false);
|
||||
}
|
||||
|
||||
if(!s_gs->CreateDevice(dev))
|
||||
|
@ -263,23 +283,25 @@ static INT32 _GSopen(void* dsp, char* title, int renderer, int threads = -1)
|
|||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(INT32) GSopen2(void* dsp, INT32 flags)
|
||||
EXPORT_C_(int) GSopen2(void** dsp, uint32 flags)
|
||||
{
|
||||
int renderer = theApp.GetConfig("renderer", 0);
|
||||
|
||||
if(flags & 4)
|
||||
{
|
||||
renderer = isdx11avail ? 4 : 1; // dx11 / dx9 sw
|
||||
#ifdef _WINDOWS
|
||||
renderer = s_isdx11avail ? 4 : 1; // dx11 / dx9 sw
|
||||
#endif
|
||||
}
|
||||
|
||||
INT32 retval = _GSopen(dsp, NULL, renderer);
|
||||
int retval = _GSopen(dsp, NULL, renderer);
|
||||
|
||||
s_gs->SetAspectRatio(0); // PCSX2 manages the aspect ratios
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt)
|
||||
EXPORT_C_(int) GSopen(void** dsp, char* title, int mt)
|
||||
{
|
||||
int renderer;
|
||||
|
||||
|
@ -291,7 +313,9 @@ EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt)
|
|||
{
|
||||
// pcsx2 sent a switch renderer request
|
||||
|
||||
renderer = isdx11avail ? 4 : 1; // dx11 / dx9 sw
|
||||
#ifdef _WINDOWS
|
||||
renderer = s_isdx11avail ? 4 : 1; // dx11 / dx9 sw
|
||||
#endif
|
||||
|
||||
mt = 1;
|
||||
}
|
||||
|
@ -302,7 +326,7 @@ EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt)
|
|||
renderer = theApp.GetConfig("renderer", 0);
|
||||
}
|
||||
|
||||
*(HWND*)dsp = NULL;
|
||||
*dsp = NULL;
|
||||
|
||||
int retval = _GSopen(dsp, title, renderer);
|
||||
|
||||
|
@ -385,9 +409,9 @@ EXPORT_C_(uint32) GSmakeSnapshot(char* path)
|
|||
{
|
||||
string s(path);
|
||||
|
||||
if(!s.empty() && s[s.length() - 1] != '\\')
|
||||
if(!s.empty() && s[s.length() - 1] != DIRECTORY_SEPARATOR)
|
||||
{
|
||||
s = s + "\\";
|
||||
s = s + DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
return s_gs->MakeSnapshot(s + "gsdx");
|
||||
|
@ -420,7 +444,9 @@ EXPORT_C GSconfigure()
|
|||
{
|
||||
if(!GSUtil::CheckSSE()) return;
|
||||
|
||||
if(GSSettingsDlg(s_IsGsOpen2).DoModal() == IDOK)
|
||||
#ifdef _WINDOWS
|
||||
|
||||
if(GSSettingsDlg(s_isgsopen2).DoModal() == IDOK)
|
||||
{
|
||||
if(s_gs != NULL && s_gs->m_wnd.IsManaged())
|
||||
{
|
||||
|
@ -429,9 +455,15 @@ EXPORT_C GSconfigure()
|
|||
GSshutdown();
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// TODO: linux
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
EXPORT_C_(INT32) GStest()
|
||||
EXPORT_C_(int) GStest()
|
||||
{
|
||||
if(!GSUtil::CheckSSE())
|
||||
{
|
||||
|
@ -482,7 +514,7 @@ EXPORT_C GSirqCallback(void (*irq)())
|
|||
|
||||
EXPORT_C_(int) GSsetupRecording(int start, void* data)
|
||||
{
|
||||
if(!s_gs) return 0;
|
||||
if(s_gs == NULL) return 0;
|
||||
|
||||
if(start & 1)
|
||||
{
|
||||
|
@ -506,24 +538,23 @@ EXPORT_C GSgetLastTag(uint32* tag)
|
|||
s_gs->GetLastTag(tag);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
EXPORT_C GSgetTitleInfo2(char* dest, size_t length)
|
||||
{
|
||||
if(!s_gs->m_GStitleInfoBuffer[0])
|
||||
string s = "GSdx";
|
||||
|
||||
if(s_gs->m_GStitleInfoBuffer[0])
|
||||
{
|
||||
strcpy(dest, "GSdx");
|
||||
}
|
||||
else
|
||||
{
|
||||
EnterCriticalSection(&s_gs->m_pGSsetTitle_Crit);
|
||||
snprintf(dest, length - 1, "GSdx | %s", s_gs->m_GStitleInfoBuffer);
|
||||
dest[length - 1] = 0; // just in case!
|
||||
LeaveCriticalSection(&s_gs->m_pGSsetTitle_Crit);
|
||||
GSAutoLock lock(&s_gs->m_pGSsetTitle_Crit);
|
||||
|
||||
string s = format("GSdx | %s", s_gs->m_GStitleInfoBuffer);
|
||||
|
||||
if(s.size() > length - 1)
|
||||
{
|
||||
s = s.substr(0, length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(dest, s.c_str());
|
||||
}
|
||||
|
||||
EXPORT_C GSsetFrameSkip(int frameskip)
|
||||
|
@ -537,7 +568,7 @@ EXPORT_C GSsetVsync(int enabled)
|
|||
|
||||
if(s_gs)
|
||||
{
|
||||
s_gs->SetVsync(s_vsync);
|
||||
s_gs->SetVSync(s_vsync);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,7 +578,7 @@ EXPORT_C GSsetExclusive(int enabled)
|
|||
|
||||
if(s_gs)
|
||||
{
|
||||
s_gs->SetVsync(s_vsync);
|
||||
s_gs->SetVSync(s_vsync);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,7 +619,7 @@ public:
|
|||
{
|
||||
if(m_console == NULL)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
||||
|
||||
AllocConsole();
|
||||
|
||||
|
@ -623,8 +654,8 @@ public:
|
|||
{
|
||||
if(m_console != NULL)
|
||||
{
|
||||
FreeConsole();
|
||||
|
||||
FreeConsole();
|
||||
|
||||
m_console = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -663,7 +694,8 @@ EXPORT_C GSReplay(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
|
|||
s_vsync = !!theApp.GetConfig("vsync", 0);
|
||||
|
||||
HWND hWnd = NULL;
|
||||
_GSopen(&hWnd, "", renderer);
|
||||
|
||||
_GSopen((void**)&hWnd, "", renderer);
|
||||
|
||||
uint32 crc;
|
||||
fread(&crc, 4, 1, fp);
|
||||
|
|
|
@ -19,5 +19,5 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSAlignedClass.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSBlock.h"
|
||||
|
||||
const GSVector4i GSBlock::m_r16mask(0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15);
|
||||
|
|
|
@ -19,9 +19,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSCapture.h"
|
||||
#include "GSVector.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
//
|
||||
// GSSource
|
||||
|
@ -335,20 +336,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
//
|
||||
// GSCapture
|
||||
//
|
||||
|
||||
GSCapture::GSCapture()
|
||||
: m_capturing(false)
|
||||
{
|
||||
}
|
||||
|
||||
GSCapture::~GSCapture()
|
||||
{
|
||||
EndCapture();
|
||||
}
|
||||
|
||||
#define BeginEnumPins(pBaseFilter, pEnumPins, pPin) \
|
||||
{CComPtr<IEnumPins> pEnumPins; \
|
||||
if(pBaseFilter && SUCCEEDED(pBaseFilter->EnumPins(&pEnumPins))) \
|
||||
|
@ -378,14 +365,32 @@ static IPin* GetFirstPin(IBaseFilter* pBF, PIN_DIRECTION dir)
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// GSCapture
|
||||
//
|
||||
|
||||
GSCapture::GSCapture()
|
||||
: m_capturing(false)
|
||||
{
|
||||
}
|
||||
|
||||
GSCapture::~GSCapture()
|
||||
{
|
||||
EndCapture();
|
||||
}
|
||||
|
||||
bool GSCapture::BeginCapture(int fps)
|
||||
{
|
||||
CAutoLock cAutoLock(this);
|
||||
GSAutoLock lock(this);
|
||||
|
||||
ASSERT(fps != 0);
|
||||
|
||||
EndCapture();
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
GSCaptureDlg dlg;
|
||||
|
||||
if(IDOK != dlg.DoModal()) return false;
|
||||
|
@ -464,6 +469,8 @@ bool GSCapture::BeginCapture(int fps)
|
|||
|
||||
CComQIPtr<IGSSource>(m_src)->DeliverNewSegment();
|
||||
|
||||
#endif
|
||||
|
||||
m_capturing = true;
|
||||
|
||||
return true;
|
||||
|
@ -471,7 +478,7 @@ bool GSCapture::BeginCapture(int fps)
|
|||
|
||||
bool GSCapture::DeliverFrame(const void* bits, int pitch, bool rgba)
|
||||
{
|
||||
CAutoLock cAutoLock(this);
|
||||
GSAutoLock lock(this);
|
||||
|
||||
if(bits == NULL || pitch == 0)
|
||||
{
|
||||
|
@ -480,6 +487,8 @@ bool GSCapture::DeliverFrame(const void* bits, int pitch, bool rgba)
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
if(m_src)
|
||||
{
|
||||
CComQIPtr<IGSSource>(m_src)->DeliverFrame(bits, pitch, rgba);
|
||||
|
@ -487,12 +496,16 @@ bool GSCapture::DeliverFrame(const void* bits, int pitch, bool rgba)
|
|||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GSCapture::EndCapture()
|
||||
{
|
||||
CAutoLock cAutoLock(this);
|
||||
GSAutoLock lock(this);
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
if(m_src)
|
||||
{
|
||||
|
@ -508,6 +521,8 @@ bool GSCapture::EndCapture()
|
|||
m_graph = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
m_capturing = false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -21,16 +21,25 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "GSCaptureDlg.h"
|
||||
#include "GSVector.h"
|
||||
#include "GSThread.h"
|
||||
|
||||
class GSCapture : protected CCritSec
|
||||
#ifdef _WINDOWS
|
||||
#include "GSCaptureDlg.h"
|
||||
#endif
|
||||
|
||||
class GSCapture : protected GSCritSec
|
||||
{
|
||||
bool m_capturing;
|
||||
GSVector2i m_size;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
CComPtr<IGraphBuilder> m_graph;
|
||||
CComPtr<IBaseFilter> m_src;
|
||||
|
||||
#endif
|
||||
|
||||
public:
|
||||
GSCapture();
|
||||
virtual ~GSCapture();
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSClut.h"
|
||||
#include "GSLocalMemory.h"
|
||||
|
||||
GSClut::GSClut(GSLocalMemory* mem)
|
||||
: m_mem(mem)
|
||||
{
|
||||
uint8* p = (uint8*)VirtualAlloc(NULL, 2 * 4096, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
uint8* p = (uint8*)vmalloc(2 * 4096, false);
|
||||
|
||||
m_clut = (uint16*)&p[0]; // 1k + 1k for buffer overruns (sfex: PSM == PSM_PSMT8, CPSM == PSM_PSMCT32, CSA != 0)
|
||||
m_buff32 = (uint32*)&p[2048]; // 1k
|
||||
|
@ -88,7 +88,7 @@ GSClut::GSClut(GSLocalMemory* mem)
|
|||
|
||||
GSClut::~GSClut()
|
||||
{
|
||||
VirtualFree(m_clut, 0, MEM_RELEASE);
|
||||
vmfree(m_clut);
|
||||
}
|
||||
|
||||
void GSClut::Invalidate()
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSCodeBuffer.h"
|
||||
|
||||
GSCodeBuffer::GSCodeBuffer(size_t blocksize)
|
||||
|
@ -34,7 +34,7 @@ GSCodeBuffer::~GSCodeBuffer()
|
|||
{
|
||||
for(list<void*>::iterator i = m_buffers.begin(); i != m_buffers.end(); i++)
|
||||
{
|
||||
VirtualFree(*i, 0, MEM_RELEASE);
|
||||
vmfree(*i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ void* GSCodeBuffer::GetBuffer(size_t size)
|
|||
|
||||
if(m_ptr == NULL || m_pos + size > m_blocksize)
|
||||
{
|
||||
m_ptr = (uint8*)VirtualAlloc(NULL, m_blocksize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||
m_ptr = (uint8*)vmalloc(m_blocksize, true);
|
||||
|
||||
m_pos = 0;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSCrc.h"
|
||||
|
||||
CRC::Game CRC::m_games[] =
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSdx.h"
|
||||
#include "GSDevice.h"
|
||||
|
||||
|
@ -137,9 +137,9 @@ void GSDevice::Recycle(GSTexture* t)
|
|||
t->last_frame_used = m_frame;
|
||||
|
||||
m_pool.push_front(t);
|
||||
|
||||
|
||||
//printf("%d\n",m_pool.size());
|
||||
|
||||
|
||||
while(m_pool.size() > 300)
|
||||
{
|
||||
delete m_pool.back();
|
||||
|
@ -240,6 +240,7 @@ void GSDevice::Interlace(const GSVector2i& ds, int field, int mode, float yoffse
|
|||
if(!m_weavebob || !(m_weavebob->GetSize() == ds))
|
||||
{
|
||||
delete m_weavebob;
|
||||
|
||||
m_weavebob = CreateRenderTarget(ds.x, ds.y, false);
|
||||
}
|
||||
|
||||
|
@ -256,6 +257,7 @@ void GSDevice::Interlace(const GSVector2i& ds, int field, int mode, float yoffse
|
|||
if(!m_blend || !(m_blend->GetSize() == ds))
|
||||
{
|
||||
delete m_blend;
|
||||
|
||||
m_blend = CreateRenderTarget(ds.x, ds.y, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,10 +85,11 @@ public:
|
|||
virtual void Present(const GSVector4i& r, int shader);
|
||||
virtual void Flip() {}
|
||||
|
||||
virtual void SetVSync(bool enable) {m_vsync = enable;}
|
||||
|
||||
virtual void BeginScene() {}
|
||||
virtual void DrawPrimitive() {};
|
||||
virtual void EndScene();
|
||||
virtual void SetVsync(bool enable) { m_vsync = enable; }
|
||||
|
||||
virtual void ClearRenderTarget(GSTexture* t, const GSVector4& c) {}
|
||||
virtual void ClearRenderTarget(GSTexture* t, uint32 c) {}
|
||||
|
|
|
@ -174,7 +174,7 @@ bool GSDevice11::Create(GSWnd* wnd)
|
|||
//scd.BufferDesc.RefreshRate.Numerator = 60;
|
||||
//scd.BufferDesc.RefreshRate.Denominator = 1;
|
||||
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
scd.OutputWindow = m_wnd->GetHandle();
|
||||
scd.OutputWindow = (HWND)m_wnd->GetHandle();
|
||||
scd.SampleDesc.Count = 1;
|
||||
scd.SampleDesc.Quality = 0;
|
||||
|
||||
|
|
|
@ -307,21 +307,6 @@ bool GSDevice9::Create(GSWnd* wnd)
|
|||
return true;
|
||||
}
|
||||
|
||||
void GSDevice9::SetVsync(bool enable)
|
||||
{
|
||||
if(m_vsync == enable) return;
|
||||
|
||||
__super::SetVsync(enable);
|
||||
|
||||
// Clever trick: Delete the backbuffer, so that the next Present will fail and
|
||||
// cause a DXDevice9::Reset call, which re-creates the backbuffer with current
|
||||
// vsync settings. :)
|
||||
|
||||
delete m_backbuffer;
|
||||
|
||||
m_backbuffer = NULL;
|
||||
}
|
||||
|
||||
bool GSDevice9::Reset(int w, int h)
|
||||
{
|
||||
if(!__super::Reset(w, h))
|
||||
|
@ -376,7 +361,7 @@ bool GSDevice9::Reset(int w, int h)
|
|||
memset(&m_pp, 0, sizeof(m_pp));
|
||||
|
||||
m_pp.Windowed = TRUE;
|
||||
m_pp.hDeviceWindow = m_wnd->GetHandle();
|
||||
m_pp.hDeviceWindow = (HWND)m_wnd->GetHandle();
|
||||
m_pp.SwapEffect = D3DSWAPEFFECT_FLIP;
|
||||
m_pp.BackBufferFormat = D3DFMT_X8R8G8B8;
|
||||
m_pp.BackBufferWidth = 1;
|
||||
|
@ -408,7 +393,7 @@ bool GSDevice9::Reset(int w, int h)
|
|||
flags |= D3DCREATE_PUREDEVICE;
|
||||
}
|
||||
|
||||
hr = m_d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_wnd->GetHandle(), flags, &m_pp, &m_dev);
|
||||
hr = m_d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, (HWND)m_wnd->GetHandle(), flags, &m_pp, &m_dev);
|
||||
|
||||
if(FAILED(hr)) return false;
|
||||
}
|
||||
|
@ -495,6 +480,21 @@ void GSDevice9::Flip()
|
|||
}
|
||||
}
|
||||
|
||||
void GSDevice9::SetVSync(bool enable)
|
||||
{
|
||||
if(m_vsync == enable) return;
|
||||
|
||||
__super::SetVSync(enable);
|
||||
|
||||
// Clever trick: Delete the backbuffer, so that the next Present will fail and
|
||||
// cause a DXDevice9::Reset call, which re-creates the backbuffer with current
|
||||
// vsync settings. :)
|
||||
|
||||
delete m_backbuffer;
|
||||
|
||||
m_backbuffer = NULL;
|
||||
}
|
||||
|
||||
void GSDevice9::BeginScene()
|
||||
{
|
||||
// m_dev->BeginScene();
|
||||
|
|
|
@ -159,7 +159,7 @@ public:
|
|||
bool IsLost(bool update);
|
||||
void Flip();
|
||||
|
||||
void SetVsync(bool enable);
|
||||
void SetVSync(bool enable);
|
||||
|
||||
void BeginScene();
|
||||
void DrawPrimitive();
|
||||
|
|
|
@ -88,3 +88,101 @@ bool GSDeviceDX::SetFeatureLevel(D3D_FEATURE_LEVEL level, bool compat_mode)
|
|||
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
|
||||
};
|
||||
|
|
|
@ -260,10 +260,12 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
struct D3D9Blend {int bogus, op, src, dst;};
|
||||
static const D3D9Blend m_blendMapD3D9[3*3*3*3];
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
protected:
|
||||
|
||||
struct {D3D_FEATURE_LEVEL level; string model, vs, gs, ps;} m_shader;
|
||||
uint32 m_msaa;
|
||||
DXGI_SAMPLE_DESC m_msaa_desc;
|
||||
|
|
|
@ -24,10 +24,8 @@
|
|||
|
||||
bool GSDeviceNull::Create(GSWnd* wnd)
|
||||
{
|
||||
if(!__super::Create(wnd))
|
||||
{
|
||||
if(!GSDevice::Create(wnd))
|
||||
return false;
|
||||
}
|
||||
|
||||
Reset(1, 1);
|
||||
|
||||
|
@ -36,7 +34,7 @@ bool GSDeviceNull::Create(GSWnd* wnd)
|
|||
|
||||
bool GSDeviceNull::Reset(int w, int h)
|
||||
{
|
||||
if(!__super::Reset(w, h))
|
||||
if(!GSDevice::Reset(w, h))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -123,24 +123,26 @@ void GSDialog::SetTextAsInt(UINT id, int i)
|
|||
SetText(id, buff);
|
||||
}
|
||||
|
||||
void GSDialog::ComboBoxInit(UINT id, const GSSetting* settings, int count, uint32 selid, uint32 maxid)
|
||||
void GSDialog::ComboBoxInit(UINT id, const vector<GSSetting>& settings, uint32 selid, uint32 maxid)
|
||||
{
|
||||
HWND hWnd = GetDlgItem(m_hWnd, id);
|
||||
|
||||
SendMessage(hWnd, CB_RESETCONTENT, 0, 0);
|
||||
|
||||
for(int i = 0; i < count; i++)
|
||||
for(int i = 0; i < settings.size(); i++)
|
||||
{
|
||||
if(settings[i].id <= maxid)
|
||||
{
|
||||
string str(settings[i].name);
|
||||
const GSSetting& s = settings[i];
|
||||
|
||||
if(!settings[i].note.empty())
|
||||
if(s.id <= maxid)
|
||||
{
|
||||
string str(s.name);
|
||||
|
||||
if(!s.note.empty())
|
||||
{
|
||||
str = str + " (" + settings[i].note + ")";
|
||||
str = str + " (" + s.note + ")";
|
||||
}
|
||||
|
||||
ComboBoxAppend(id, str.c_str(), (LPARAM)settings[i].id, settings[i].id == selid);
|
||||
ComboBoxAppend(id, str.c_str(), (LPARAM)s.id, s.id == selid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
void SetText(UINT id, const char* str);
|
||||
void SetTextAsInt(UINT id, int i);
|
||||
|
||||
void ComboBoxInit(UINT id, const GSSetting* settings, int count, uint32 selid, uint32 maxid = ~0);
|
||||
void ComboBoxInit(UINT id, const vector<GSSetting>& settings, uint32 selid, uint32 maxid = ~0);
|
||||
int ComboBoxAppend(UINT id, const char* str, LPARAM data = 0, bool select = false);
|
||||
bool ComboBoxGetSelData(UINT id, INT_PTR& data);
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSDirtyRect.h"
|
||||
|
||||
GSDirtyRect::GSDirtyRect()
|
||||
|
@ -47,10 +47,10 @@ GSVector4i GSDirtyRect::GetDirtyRect(const GIFRegTEX0& TEX0)
|
|||
{
|
||||
GSVector2i dst = GSLocalMemory::m_psm[TEX0.PSM].bs;
|
||||
|
||||
r.left = MulDiv(left, dst.x, src.x);
|
||||
r.top = MulDiv(top, dst.y, src.y);
|
||||
r.right = MulDiv(right, dst.x, src.x);
|
||||
r.bottom = MulDiv(bottom, dst.y, src.y);
|
||||
r.left = left * dst.x / src.x;
|
||||
r.top = top * dst.y / src.y;
|
||||
r.right = right * dst.x / src.x;
|
||||
r.bottom = bottom * dst.y / src.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSDrawScanline.h"
|
||||
#include "GSTextureCacheSW.h"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// TODO: x64 (use the extra regs to avoid spills of zs, zd, uf, vf, rb, ga and keep a few constants in the last two like aref or afix)
|
||||
// TODO: for edges doing 4 pixels is wasteful (needed memory access * 4)
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSDrawScanlineCodeGenerator.h"
|
||||
|
||||
static const int _args = 16;
|
||||
|
@ -722,7 +722,7 @@ void GSDrawScanlineCodeGenerator::Step()
|
|||
// q += stq.zzzz();
|
||||
|
||||
vmovaps(xmm4, ptr[&m_local.d4.stq]);
|
||||
|
||||
|
||||
vshufps(xmm2, xmm4, xmm4, _MM_SHUFFLE(0, 0, 0, 0));
|
||||
vshufps(xmm3, xmm4, xmm4, _MM_SHUFFLE(1, 1, 1, 1));
|
||||
vshufps(xmm4, xmm4, xmm4, _MM_SHUFFLE(2, 2, 2, 2));
|
||||
|
@ -2750,7 +2750,7 @@ void GSDrawScanlineCodeGenerator::WriteMask()
|
|||
vpcmpeqd(xmm1, xmm4);
|
||||
vpackssdw(xmm1, xmm1);
|
||||
}
|
||||
|
||||
|
||||
vpmovmskb(edx, xmm1);
|
||||
|
||||
not(edx);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSDump.h"
|
||||
|
||||
GSDump::GSDump()
|
||||
|
|
|
@ -19,6 +19,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSFunctionMap.h"
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
{
|
||||
m_active = NULL;
|
||||
|
||||
hash_map<KEY, ActivePtr*>::iterator i = m_map_active.find(key);
|
||||
typename hash_map<KEY, ActivePtr*>::iterator i = m_map_active.find(key);
|
||||
|
||||
if(i != m_map_active.end())
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
hash_map<KEY, VALUE>::iterator i = m_map.find(key);
|
||||
typename hash_map<KEY, VALUE>::iterator i = m_map.find(key);
|
||||
|
||||
ActivePtr* p = new ActivePtr();
|
||||
|
||||
|
@ -120,7 +120,9 @@ public:
|
|||
{
|
||||
int64 ttpf = 0;
|
||||
|
||||
for(hash_map<KEY, ActivePtr*>::iterator i = m_map_active.begin(); i != m_map_active.end(); i++)
|
||||
typename hash_map<KEY, ActivePtr*>::iterator i;
|
||||
|
||||
for(i = m_map_active.begin(); i != m_map_active.end(); i++)
|
||||
{
|
||||
ActivePtr* p = i->second;
|
||||
|
||||
|
@ -132,7 +134,7 @@ public:
|
|||
|
||||
printf("GS stats\n");
|
||||
|
||||
for(hash_map<KEY, ActivePtr*>::iterator i = m_map_active.begin(); i != m_map_active.end(); i++)
|
||||
for(i = m_map_active.begin(); i != m_map_active.end(); i++)
|
||||
{
|
||||
KEY key = i->first;
|
||||
ActivePtr* p = i->second;
|
||||
|
@ -143,7 +145,7 @@ public:
|
|||
int64 tpf = p->frames > 0 ? p->ticks / p->frames : 0;
|
||||
int64 ppf = p->frames > 0 ? p->pixels / p->frames : 0;
|
||||
|
||||
printf("[%016I64x]%c %6.2f%% | %5.2f%% | f %4I64d | p %10I64d | tpp %4I64d | tpf %9I64d | ppf %7I64d\n",
|
||||
printf("[%016llx]%c %6.2f%% | %5.2f%% | f %4lld | p %10lld | tpp %4lld | tpf %9lld | ppf %7lld\n",
|
||||
(uint64)key, m_map.find(key) == m_map.end() ? '*' : ' ',
|
||||
(float)(tpf * 10000 / 50000000) / 100,
|
||||
(float)(tpf * 10000 / ttpf) / 100,
|
||||
|
@ -166,8 +168,12 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
#include "vtune/JITProfiling.h"
|
||||
|
||||
#endif
|
||||
|
||||
template<class CG, class KEY, class VALUE>
|
||||
class GSCodeGeneratorFunctionMap : public GSFunctionMap<KEY, VALUE>
|
||||
{
|
||||
|
@ -189,7 +195,7 @@ public:
|
|||
{
|
||||
VALUE ret = NULL;
|
||||
|
||||
hash_map<uint64, VALUE>::iterator i = m_cgmap.find(key);
|
||||
typename hash_map<uint64, VALUE>::iterator i = m_cgmap.find(key);
|
||||
|
||||
if(i != m_cgmap.end())
|
||||
{
|
||||
|
@ -200,18 +206,20 @@ public:
|
|||
CG* cg = new CG(m_param, key, m_cb.GetBuffer(MAX_SIZE), MAX_SIZE);
|
||||
|
||||
ASSERT(cg->getSize() < MAX_SIZE);
|
||||
|
||||
|
||||
m_cb.ReleaseBuffer(cg->getSize());
|
||||
|
||||
ret = (VALUE)cg->getCode();
|
||||
|
||||
m_cgmap[key] = ret;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
// vtune method registration
|
||||
|
||||
|
||||
if(iJIT_IsProfilingActive())
|
||||
{
|
||||
string name = format("%s<%016I64x>()", m_name.c_str(), (uint64)key);
|
||||
string name = format("%s<%016llx>()", m_name.c_str(), (uint64)key);
|
||||
|
||||
iJIT_Method_Load ml;
|
||||
|
||||
|
@ -225,6 +233,8 @@ public:
|
|||
iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &ml);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
delete cg;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSLocalMemory.h"
|
||||
|
||||
#define ASSERT_BLOCK(r, w, h) \
|
||||
|
@ -83,7 +83,7 @@ GSLocalMemory::psm_t GSLocalMemory::m_psm[64];
|
|||
GSLocalMemory::GSLocalMemory()
|
||||
: m_clut(this)
|
||||
{
|
||||
m_vm8 = (uint8*)VirtualAlloc(NULL, m_vmsize * 2, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
m_vm8 = (uint8*)vmalloc(m_vmsize * 2, false);
|
||||
|
||||
memset(m_vm8, 0, m_vmsize);
|
||||
|
||||
|
@ -442,7 +442,7 @@ GSLocalMemory::GSLocalMemory()
|
|||
|
||||
GSLocalMemory::~GSLocalMemory()
|
||||
{
|
||||
VirtualFree(m_vm8, 0, MEM_RELEASE);
|
||||
vmfree(m_vm8);
|
||||
|
||||
for_each(m_omap.begin(), m_omap.end(), aligned_free_second());
|
||||
for_each(m_po4map.begin(), m_po4map.end(), aligned_free_second());
|
||||
|
@ -705,7 +705,7 @@ void GSLocalMemory::WriteImageTopBottom(int l, int r, int y, int h, const uint8*
|
|||
|
||||
if(h2 > 0)
|
||||
{
|
||||
if(((DWORD_PTR)&src[l * trbpp >> 3] & 15) == 0 && (srcpitch & 15) == 0)
|
||||
if(((size_t)&src[l * trbpp >> 3] & 15) == 0 && (srcpitch & 15) == 0)
|
||||
{
|
||||
WriteImageColumn<psm, bsx, bsy, true>(l, r, y, h2, src, srcpitch, BITBLTBUF);
|
||||
}
|
||||
|
@ -846,7 +846,7 @@ void GSLocalMemory::WriteImage(int& tx, int& ty, const uint8* src, int len, GIFR
|
|||
|
||||
if(h2 > 0)
|
||||
{
|
||||
if(((DWORD_PTR)&s[la * trbpp >> 3] & 15) == 0 && (srcpitch & 15) == 0)
|
||||
if(((size_t)&s[la * trbpp >> 3] & 15) == 0 && (srcpitch & 15) == 0)
|
||||
{
|
||||
WriteImageBlock<psm, bsx, bsy, true>(la, ra, ty, h2, s, srcpitch, BITBLTBUF);
|
||||
}
|
||||
|
@ -1708,7 +1708,7 @@ void GSLocalMemory::ReadTexture(const GSOffset* RESTRICT o, const GSVector4i& r,
|
|||
|
||||
GSVector4i cr = r.ralign<GSVector4i::Inside>(psm.bs);
|
||||
|
||||
bool aligned = ((DWORD_PTR)(dst + (cr.left - r.left) * sizeof(uint32)) & 0xf) == 0;
|
||||
bool aligned = ((size_t)(dst + (cr.left - r.left) * sizeof(uint32)) & 0xf) == 0;
|
||||
|
||||
if(cr.rempty() || !aligned)
|
||||
{
|
||||
|
@ -1851,8 +1851,10 @@ void GSLocalMemory::ReadTextureBlock4HHP(uint32 bp, uint8* dst, int dstpitch, co
|
|||
|
||||
//
|
||||
|
||||
bool GSLocalMemory::SaveBMP(const string& fn, uint32 bp, uint32 bw, uint32 psm, int w, int h)
|
||||
void GSLocalMemory::SaveBMP(const string& fn, uint32 bp, uint32 bw, uint32 psm, int w, int h)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
|
||||
int pitch = w * 4;
|
||||
int size = pitch * h;
|
||||
void* bits = _aligned_malloc(size, 32);
|
||||
|
@ -1903,7 +1905,11 @@ bool GSLocalMemory::SaveBMP(const string& fn, uint32 bp, uint32 bw, uint32 psm,
|
|||
fclose(fp);
|
||||
}
|
||||
|
||||
::_aligned_free(bits);
|
||||
_aligned_free(bits);
|
||||
|
||||
return true;
|
||||
#else
|
||||
|
||||
// TODO: linux
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -883,6 +883,6 @@ public:
|
|||
|
||||
//
|
||||
|
||||
bool SaveBMP(const string& fn, uint32 bp, uint32 bw, uint32 psm, int w, int h);
|
||||
void SaveBMP(const string& fn, uint32 bp, uint32 bw, uint32 psm, int w, int h);
|
||||
};
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
// TODO: JIT Draw* (flags: depth, texture, color (+iip), scissor)
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSRasterizer.h"
|
||||
|
||||
// Using a spinning finish on the main (MTGS) thread is apparently a big win still, over trying
|
||||
|
@ -845,68 +845,36 @@ void GSRasterizer::DrawEdge(const GSVertexSW& v0, const GSVertexSW& v1, const GS
|
|||
|
||||
//
|
||||
|
||||
GSRasterizerMT::GSRasterizerMT(IDrawScanline* ds, HANDLE ready, volatile long& sync)
|
||||
GSRasterizerMT::GSRasterizerMT(IDrawScanline* ds, volatile long& sync)
|
||||
: GSRasterizer(ds)
|
||||
, m_ready(ready)
|
||||
, m_sync(sync)
|
||||
, m_data(NULL)
|
||||
{
|
||||
m_exit = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
m_draw = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
|
||||
CreateThread();
|
||||
}
|
||||
|
||||
GSRasterizerMT::~GSRasterizerMT()
|
||||
{
|
||||
SetEvent(m_exit);
|
||||
Draw(NULL);
|
||||
|
||||
CloseThread();
|
||||
|
||||
CloseHandle(m_exit);
|
||||
CloseHandle(m_draw);
|
||||
}
|
||||
|
||||
void GSRasterizerMT::Draw(const GSRasterizerData* data)
|
||||
{
|
||||
m_data = data;
|
||||
|
||||
SetEvent(m_draw);
|
||||
m_draw.Set();
|
||||
}
|
||||
|
||||
void GSRasterizerMT::ThreadProc()
|
||||
{
|
||||
// _mm_setcsr(MXCSR);
|
||||
|
||||
HANDLE events[] = {m_exit, m_draw};
|
||||
|
||||
while(true)
|
||||
while(m_draw.Wait() && m_data != NULL)
|
||||
{
|
||||
switch(WaitForMultipleObjects(countof(events), events, FALSE, INFINITE))
|
||||
{
|
||||
case WAIT_OBJECT_0 + 0: // exit
|
||||
GSRasterizer::Draw(m_data);
|
||||
|
||||
return;
|
||||
|
||||
case WAIT_OBJECT_0 + 1: // draw
|
||||
|
||||
__super::Draw(m_data);
|
||||
|
||||
#ifdef UseSpinningFinish
|
||||
|
||||
_interlockedbittestandreset(&m_sync, m_id);
|
||||
|
||||
#else
|
||||
|
||||
SetEvent(m_ready);
|
||||
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
_interlockedbittestandreset(&m_sync, m_id);
|
||||
}
|
||||
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -919,25 +887,12 @@ GSRasterizerList::GSRasterizerList()
|
|||
GSRasterizerList::~GSRasterizerList()
|
||||
{
|
||||
for(size_t i = 0; i < size(); i++) delete (*this)[i];
|
||||
|
||||
for(size_t i = 0; i < m_ready.size(); i++) CloseHandle(m_ready[i]);
|
||||
}
|
||||
|
||||
void GSRasterizerList::Sync()
|
||||
{
|
||||
#ifdef UseSpinningFinish
|
||||
|
||||
while(m_sync) _mm_pause();
|
||||
|
||||
#else
|
||||
|
||||
if(m_threads > 1)
|
||||
{
|
||||
WaitForMultipleObjects(m_threads - 1, &m_ready[0], TRUE, INFINITE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
m_stats.ticks = __rdtsc() - m_start;
|
||||
|
||||
for(int i = 0; i < m_threads; i++)
|
||||
|
@ -959,8 +914,6 @@ void GSRasterizerList::Draw(const GSRasterizerData* data, int width, int height)
|
|||
|
||||
m_threads = std::min<int>(1 + (height >> THREAD_HEIGHT), size());
|
||||
|
||||
#ifdef UseSpinningFinish
|
||||
|
||||
m_sync = 0;
|
||||
|
||||
for(int i = 1; i < m_threads; i++)
|
||||
|
@ -968,17 +921,13 @@ void GSRasterizerList::Draw(const GSRasterizerData* data, int width, int height)
|
|||
m_sync |= 1 << i;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
for(int i = 1; i < m_threads; i++)
|
||||
{
|
||||
(*this)[i]->SetThreadId(i, m_threads);
|
||||
|
||||
(*this)[i]->Draw(data);
|
||||
}
|
||||
|
||||
(*this)[0]->SetThreadId(0, m_threads);
|
||||
|
||||
(*this)[0]->Draw(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
uint64 frame;
|
||||
const void* param;
|
||||
};
|
||||
|
||||
|
||||
class IDrawScanline : public GSAlignedClass<32>
|
||||
{
|
||||
public:
|
||||
|
@ -120,15 +120,13 @@ class GSRasterizerMT : public GSRasterizer, private GSThread
|
|||
{
|
||||
protected:
|
||||
volatile long& m_sync;
|
||||
HANDLE m_exit;
|
||||
HANDLE m_draw;
|
||||
HANDLE m_ready;
|
||||
GSAutoResetEvent m_draw;
|
||||
const GSRasterizerData* m_data;
|
||||
|
||||
void ThreadProc();
|
||||
|
||||
public:
|
||||
GSRasterizerMT(IDrawScanline* ds, HANDLE ready, volatile long& sync);
|
||||
GSRasterizerMT(IDrawScanline* ds, volatile long& sync);
|
||||
virtual ~GSRasterizerMT();
|
||||
|
||||
// IRasterizer
|
||||
|
@ -139,7 +137,6 @@ public:
|
|||
class GSRasterizerList : protected vector<IRasterizer*>
|
||||
{
|
||||
protected:
|
||||
std::vector<HANDLE> m_ready;
|
||||
volatile long m_sync;
|
||||
GSRasterizerStats m_stats;
|
||||
int64 m_start;
|
||||
|
@ -157,11 +154,7 @@ public:
|
|||
|
||||
for(int i = 1; i < threads; i++)
|
||||
{
|
||||
HANDLE ready = CreateEvent(NULL, FALSE, TRUE, NULL);
|
||||
|
||||
push_back(new GSRasterizerMT(new DS(), ready, m_sync));
|
||||
|
||||
m_ready.push_back(ready);
|
||||
push_back(new GSRasterizerMT(new DS(), m_sync));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSRenderer.h"
|
||||
|
||||
GSRenderer::GSRenderer()
|
||||
: GSState()
|
||||
, m_tex_buff((uint8*)_aligned_malloc(1024 * 1024 * sizeof(uint32), 32))
|
||||
, m_vt(this)
|
||||
, m_dev(NULL)
|
||||
, m_shader(0)
|
||||
|
@ -35,23 +34,13 @@ GSRenderer::GSRenderer()
|
|||
m_aspectratio = theApp.GetConfig("aspectratio", 1);
|
||||
m_filter = theApp.GetConfig("filter", 1);
|
||||
m_vsync = !!theApp.GetConfig("vsync", 0);
|
||||
m_nativeres = !!theApp.GetConfig("nativeres", 0);
|
||||
|
||||
m_upscale_multiplier = theApp.GetConfig("upscale_multiplier", 1);
|
||||
if(m_nativeres) m_upscale_multiplier = 1;
|
||||
else if (m_upscale_multiplier > 6) m_upscale_multiplier = 1;
|
||||
|
||||
m_aa1 = !!theApp.GetConfig("aa1", 0);
|
||||
|
||||
if(m_nativeres) m_filter = 2;
|
||||
|
||||
s_n = 0;
|
||||
s_dump = !!theApp.GetConfig("dump", 0);
|
||||
s_save = !!theApp.GetConfig("save", 0);
|
||||
s_savez = !!theApp.GetConfig("savez", 0);
|
||||
s_saven = theApp.GetConfig("saven", 0);
|
||||
|
||||
InitializeCriticalSection(&m_pGSsetTitle_Crit);
|
||||
}
|
||||
|
||||
GSRenderer::~GSRenderer()
|
||||
|
@ -61,11 +50,7 @@ GSRenderer::~GSRenderer()
|
|||
m_dev->Reset(1, 1, GSDevice::Windowed);
|
||||
}*/
|
||||
|
||||
_aligned_free(m_tex_buff);
|
||||
|
||||
delete m_dev;
|
||||
|
||||
DeleteCriticalSection(&m_pGSsetTitle_Crit);
|
||||
}
|
||||
|
||||
bool GSRenderer::CreateWnd(const string& title, int w, int h)
|
||||
|
@ -84,11 +69,20 @@ bool GSRenderer::CreateDevice(GSDevice* dev)
|
|||
}
|
||||
|
||||
m_dev = dev;
|
||||
m_dev->SetVsync(m_vsync && m_framelimit);
|
||||
m_dev->SetVSync(m_vsync && m_framelimit);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GSRenderer::ResetDevice()
|
||||
{
|
||||
InvalidateTextureCache();
|
||||
|
||||
ResetPrim();
|
||||
|
||||
if(m_dev) m_dev->Reset(1, 1);
|
||||
}
|
||||
|
||||
bool GSRenderer::Merge(int field)
|
||||
{
|
||||
bool en[2];
|
||||
|
@ -270,15 +264,16 @@ bool GSRenderer::Merge(int field)
|
|||
void GSRenderer::SetFrameLimit(bool limit)
|
||||
{
|
||||
m_framelimit = limit;
|
||||
if( m_dev ) m_dev->SetVsync(m_vsync && m_framelimit);
|
||||
|
||||
if(m_dev) m_dev->SetVSync(m_vsync && m_framelimit);
|
||||
}
|
||||
|
||||
void GSRenderer::SetVsync(bool enabled)
|
||||
void GSRenderer::SetVSync(bool enabled)
|
||||
{
|
||||
m_vsync = enabled;
|
||||
if( m_dev ) m_dev->SetVsync(m_vsync);
|
||||
}
|
||||
|
||||
if(m_dev) m_dev->SetVSync(m_vsync);
|
||||
}
|
||||
|
||||
void GSRenderer::VSync(int field)
|
||||
{
|
||||
|
@ -320,11 +315,11 @@ void GSRenderer::VSync(int field)
|
|||
{//GSdx owns the window's title, be verbose.
|
||||
string s2 = m_regs->SMODE2.INT ? (string("Interlaced ") + (m_regs->SMODE2.FFMD ? "(frame)" : "(field)")) : "Progressive";
|
||||
s = format(
|
||||
"%I64d | %d x %d | %.2f fps (%d%%) | %s - %s | %s | %d/%d/%d | %d%% CPU | %.2f | %.2f",
|
||||
"%lld | %d x %d | %.2f fps (%d%%) | %s - %s | %s | %d/%d/%d | %d%% CPU | %.2f | %.2f",
|
||||
m_perfmon.GetFrame(), r.width(), r.height(), fps, (int)(100.0 * fps / GetFPS()),
|
||||
s2.c_str(),
|
||||
GSSettingsDlg::g_interlace[m_interlace].name.c_str(),
|
||||
GSSettingsDlg::g_aspectratio[m_aspectratio].name.c_str(),
|
||||
theApp.m_gs_interlace[m_interlace].name.c_str(),
|
||||
theApp.m_gs_aspectratio[m_aspectratio].name.c_str(),
|
||||
(int)m_perfmon.Get(GSPerfMon::Quad),
|
||||
(int)m_perfmon.Get(GSPerfMon::Prim),
|
||||
(int)m_perfmon.Get(GSPerfMon::Draw),
|
||||
|
@ -343,14 +338,10 @@ void GSRenderer::VSync(int field)
|
|||
}
|
||||
else
|
||||
{
|
||||
//Satisfy PCSX2's request for title info: minimal verbosity due to more external title text
|
||||
s = format(
|
||||
"%dx%d | %s",
|
||||
r.width(), r.height(),
|
||||
GSSettingsDlg::g_interlace[m_interlace].name.c_str()
|
||||
);
|
||||
}
|
||||
// Satisfy PCSX2's request for title info: minimal verbosity due to more external title text
|
||||
|
||||
s = format("%dx%d | %s", r.width(), r.height(), theApp.m_gs_interlace[m_interlace].name.c_str());
|
||||
}
|
||||
|
||||
if(m_capture.IsCapturing())
|
||||
{
|
||||
|
@ -368,12 +359,11 @@ void GSRenderer::VSync(int field)
|
|||
// be noticeable). Besides, these locks are extremely short -- overhead of conditional
|
||||
// is way more expensive than just waiting for the CriticalSection in 1 of 10,000,000 tries. --air
|
||||
|
||||
EnterCriticalSection(&m_pGSsetTitle_Crit);
|
||||
GSAutoLock lock(&m_pGSsetTitle_Crit);
|
||||
|
||||
strncpy(m_GStitleInfoBuffer, s.c_str(), countof(m_GStitleInfoBuffer) - 1);
|
||||
m_GStitleInfoBuffer[sizeof(m_GStitleInfoBuffer) - 1] = 0;// make sure null terminated even if text overflows
|
||||
|
||||
LeaveCriticalSection(&m_pGSsetTitle_Crit);
|
||||
m_GStitleInfoBuffer[sizeof(m_GStitleInfoBuffer) - 1] = 0; // make sure null terminated even if text overflows
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -396,7 +386,15 @@ void GSRenderer::VSync(int field)
|
|||
|
||||
if(!m_snapshot.empty())
|
||||
{
|
||||
if(!m_dump && (::GetAsyncKeyState(VK_SHIFT) & 0x8000))
|
||||
bool shift = false;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
shift = !!(::GetAsyncKeyState(VK_SHIFT) & 0x8000);
|
||||
|
||||
#endif
|
||||
|
||||
if(!m_dump && shift)
|
||||
{
|
||||
GSFreezeData fd;
|
||||
fd.size = 0;
|
||||
|
@ -421,7 +419,15 @@ void GSRenderer::VSync(int field)
|
|||
{
|
||||
if(m_dump)
|
||||
{
|
||||
m_dump.VSync(field, !(::GetAsyncKeyState(VK_CONTROL) & 0x8000), m_regs);
|
||||
bool control = false;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
control = !!(::GetAsyncKeyState(VK_CONTROL) & 0x8000);
|
||||
|
||||
#endif
|
||||
|
||||
m_dump.VSync(field, !control, m_regs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,7 +487,7 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
|
|||
{
|
||||
if(e->type == KEYPRESS)
|
||||
{
|
||||
// TODO: linux
|
||||
#ifdef _WINDOWS
|
||||
|
||||
int step = (::GetAsyncKeyState(VK_SHIFT) & 0x8000) ? -1 : 1;
|
||||
|
||||
|
@ -500,6 +506,12 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
|
|||
m_aa1 = !m_aa1;
|
||||
return;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// TODO: linux
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -782,8 +794,10 @@ bool GSRenderer::IsLinear()
|
|||
{
|
||||
return mmag;
|
||||
}
|
||||
|
||||
// if FST => assume Q = 1.0f (should not, but Q is very often bogus, 0 or DEN)
|
||||
// Fixme : Why should Q be bogus?
|
||||
// Fixme : Why should Q be bogus? (it used to be - Gabest)
|
||||
|
||||
if(!TEX1.LCM && !PRIM->FST)
|
||||
{
|
||||
float K = (float)TEX1.K / 16;
|
||||
|
@ -791,8 +805,8 @@ bool GSRenderer::IsLinear()
|
|||
|
||||
// TODO: abs(Qmin) may not be <= abs(Qmax), check the sign
|
||||
|
||||
float LODmin = K + log(1.0f / abs(m_vt.m_max.t.z)) * f;
|
||||
float LODmax = K + log(1.0f / abs(m_vt.m_min.t.z)) * f;
|
||||
float LODmin = K + log(1.0f / fabs(m_vt.m_max.t.z)) * f;
|
||||
float LODmax = K + log(1.0f / fabs(m_vt.m_min.t.z)) * f;
|
||||
|
||||
return LODmax <= 0 ? mmag : LODmin > 0 ? mmin : mmag || mmin;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "GSState.h"
|
||||
#include "GSVertexTrace.h"
|
||||
#include "GSVertexList.h"
|
||||
#include "GSSettingsDlg.h"
|
||||
//#include "GSSettingsDlg.h"
|
||||
#include "GSCapture.h"
|
||||
|
||||
class GSRenderer : public GSState
|
||||
|
@ -42,14 +42,10 @@ protected:
|
|||
int m_interlace;
|
||||
int m_aspectratio;
|
||||
int m_filter;
|
||||
int m_upscale_multiplier;
|
||||
bool m_vsync;
|
||||
bool m_nativeres;
|
||||
bool m_aa1;
|
||||
bool m_framelimit;
|
||||
|
||||
uint8* m_tex_buff;
|
||||
|
||||
virtual GSTexture* GetOutput(int i) = 0;
|
||||
|
||||
GSVertexTrace m_vt;
|
||||
|
@ -78,38 +74,23 @@ public:
|
|||
|
||||
virtual bool CreateWnd(const string& title, int w, int h);
|
||||
virtual bool CreateDevice(GSDevice* dev);
|
||||
virtual void ResetDevice()
|
||||
{
|
||||
InvalidateTextureCache();
|
||||
ResetPrim();
|
||||
if( m_dev ) m_dev->Reset(1, 1);
|
||||
}
|
||||
virtual void ResetDevice();
|
||||
virtual void VSync(int field);
|
||||
virtual bool MakeSnapshot(const string& path);
|
||||
virtual void KeyEvent(GSKeyEventData* e);
|
||||
virtual bool CanUpscale()
|
||||
{
|
||||
return !m_nativeres && m_regs->PMODE.EN != 0; // upscale ratio depends on the display size, with no output it may not be set correctly (ps2 logo to game transition)
|
||||
}
|
||||
virtual int upscale_Multiplier()
|
||||
{
|
||||
return m_upscale_multiplier;
|
||||
}
|
||||
|
||||
void SetAspectRatio(int aspect) { m_aspectratio = aspect; }
|
||||
void SetVsync(bool enabled);
|
||||
virtual bool CanUpscale() {return false;}
|
||||
virtual int GetUpscaleMultiplier() {return 1;}
|
||||
void SetAspectRatio(int aspect) {m_aspectratio = aspect;}
|
||||
void SetVSync(bool enabled);
|
||||
void SetFrameLimit(bool limit);
|
||||
virtual void SetExclusive(bool isExcl) {}
|
||||
|
||||
virtual void BeginCapture();
|
||||
virtual void EndCapture();
|
||||
|
||||
// TODO : Implement proper locking here *if needed* (not sure yet if it is) --air
|
||||
uint8* GetTextureBufferLock() { return m_tex_buff; }
|
||||
void ReleaseTextureBufferLock() { }
|
||||
|
||||
public:
|
||||
CRITICAL_SECTION m_pGSsetTitle_Crit;
|
||||
GSCritSec m_pGSsetTitle_Crit;
|
||||
|
||||
char m_GStitleInfoBuffer[128];
|
||||
};
|
||||
|
||||
|
@ -126,7 +107,7 @@ protected:
|
|||
m_count = 0;
|
||||
m_vl.RemoveAll();
|
||||
|
||||
__super::Reset();
|
||||
GSRenderer::Reset();
|
||||
}
|
||||
|
||||
void ResetPrim()
|
||||
|
@ -157,8 +138,10 @@ protected:
|
|||
|
||||
void GrowVertexBuffer()
|
||||
{
|
||||
if(m_vertices != NULL) _aligned_free(m_vertices);
|
||||
|
||||
m_maxcount = max(10000, m_maxcount * 3/2);
|
||||
m_vertices = (Vertex*)_aligned_realloc(m_vertices, sizeof(Vertex) * m_maxcount, 32);
|
||||
m_vertices = (Vertex*)_aligned_malloc(sizeof(Vertex) * m_maxcount, 32);
|
||||
m_maxcount -= 100;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,41 +55,52 @@ void GSRendererDX11::VertexKick(bool skip)
|
|||
int Vdiff = 0;
|
||||
int Uadjust = 0;
|
||||
int Vadjust = 0;
|
||||
int multiplier = upscale_Multiplier();
|
||||
|
||||
if (multiplier > 1) {
|
||||
int multiplier = GetUpscaleMultiplier();
|
||||
|
||||
if(multiplier > 1)
|
||||
{
|
||||
Udiff = m_v.UV.U & 4095;
|
||||
Vdiff = m_v.UV.V & 4095;
|
||||
if (Udiff != 0){
|
||||
|
||||
if(Udiff != 0)
|
||||
{
|
||||
if (Udiff >= 4080) {/*printf("U+ %d %d\n", Udiff, m_v.UV.U);*/ Uadjust = -1; }
|
||||
else if (Udiff <= 16) {/*printf("U- %d %d\n", Udiff, m_v.UV.U);*/ Uadjust = 1; }
|
||||
}
|
||||
if (Vdiff != 0){
|
||||
|
||||
if(Vdiff != 0)
|
||||
{
|
||||
if (Vdiff >= 4080) {/*printf("V+ %d %d\n", Vdiff, m_v.UV.V);*/ Vadjust = -1; }
|
||||
else if (Vdiff <= 16) {/*printf("V- %d %d\n", Vdiff, m_v.UV.V);*/ Vadjust = 1; }
|
||||
}
|
||||
|
||||
Udiff = m_v.UV.U & 255;
|
||||
Vdiff = m_v.UV.V & 255;
|
||||
if (Udiff != 0){
|
||||
|
||||
if(Udiff != 0)
|
||||
{
|
||||
if (Udiff >= 248) { Uadjust = -1; }
|
||||
else if (Udiff <= 8) { Uadjust = 1; }
|
||||
}
|
||||
|
||||
if (Vdiff != 0){
|
||||
if(Vdiff != 0)
|
||||
{
|
||||
if (Vdiff >= 248) { Vadjust = -1; }
|
||||
else if (Vdiff <= 8) { Vadjust = 1; }
|
||||
}
|
||||
|
||||
Udiff = m_v.UV.U & 15;
|
||||
Vdiff = m_v.UV.V & 15;
|
||||
if (Udiff != 0){
|
||||
|
||||
if(Udiff != 0)
|
||||
{
|
||||
if (Udiff >= 15) { Uadjust = -1; }
|
||||
else if (Udiff <= 1) { Uadjust = 1; }
|
||||
}
|
||||
|
||||
if (Vdiff != 0){
|
||||
if(Vdiff != 0)
|
||||
{
|
||||
if (Vdiff >= 15) { Vadjust = -1; }
|
||||
else if (Vdiff <= 1) { Vadjust = 1; }
|
||||
}
|
||||
|
|
|
@ -88,41 +88,52 @@ void GSRendererDX9::VertexKick(bool skip)
|
|||
|
||||
int Udiff = 0;
|
||||
int Vdiff = 0;
|
||||
int multiplier = upscale_Multiplier();
|
||||
|
||||
if (multiplier > 1) {
|
||||
int multiplier = GetUpscaleMultiplier();
|
||||
|
||||
if(multiplier > 1)
|
||||
{
|
||||
Udiff = m_v.UV.U & 4095;
|
||||
Vdiff = m_v.UV.V & 4095;
|
||||
if (Udiff != 0){
|
||||
|
||||
if(Udiff != 0)
|
||||
{
|
||||
if (Udiff >= 4080) {/*printf("U+ %d %d\n", Udiff, m_v.UV.U);*/ Uadjust = -1; }
|
||||
else if (Udiff <= 16) {/*printf("U- %d %d\n", Udiff, m_v.UV.U);*/ Uadjust = 1; }
|
||||
}
|
||||
if (Vdiff != 0){
|
||||
|
||||
if(Vdiff != 0)
|
||||
{
|
||||
if (Vdiff >= 4080) {/*printf("V+ %d %d\n", Vdiff, m_v.UV.V);*/ Vadjust = -1; }
|
||||
else if (Vdiff <= 16) {/*printf("V- %d %d\n", Vdiff, m_v.UV.V);*/ Vadjust = 1; }
|
||||
}
|
||||
|
||||
Udiff = m_v.UV.U & 255;
|
||||
Vdiff = m_v.UV.V & 255;
|
||||
if (Udiff != 0){
|
||||
|
||||
if(Udiff != 0)
|
||||
{
|
||||
if (Udiff >= 248) { Uadjust = -1; }
|
||||
else if (Udiff <= 8) { Uadjust = 1; }
|
||||
}
|
||||
|
||||
if (Vdiff != 0){
|
||||
if(Vdiff != 0)
|
||||
{
|
||||
if (Vdiff >= 248) { Vadjust = -1; }
|
||||
else if (Vdiff <= 8) { Vadjust = 1; }
|
||||
}
|
||||
|
||||
Udiff = m_v.UV.U & 15;
|
||||
Vdiff = m_v.UV.V & 15;
|
||||
if (Udiff != 0){
|
||||
|
||||
if(Udiff != 0)
|
||||
{
|
||||
if (Udiff >= 15) { Uadjust = -1; }
|
||||
else if (Udiff <= 1) { Uadjust = 1; }
|
||||
}
|
||||
|
||||
if (Vdiff != 0){
|
||||
if(Vdiff != 0)
|
||||
{
|
||||
if (Vdiff >= 15) { Vadjust = -1; }
|
||||
else if (Vdiff <= 1) { Vadjust = 1; }
|
||||
}
|
||||
|
@ -132,7 +143,6 @@ void GSRendererDX9::VertexKick(bool skip)
|
|||
dst.t.y -= (float) Vadjust;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -32,10 +32,11 @@ class GSRendererHW : public GSRendererT<Vertex>
|
|||
{
|
||||
int m_width;
|
||||
int m_height;
|
||||
int m_upscale_multiplier;
|
||||
int m_UserHacks_SkipDraw;
|
||||
int m_skip;
|
||||
bool m_reset;
|
||||
bool m_nativeres;
|
||||
int m_upscale_multiplier;
|
||||
int m_userhacks_skipdraw;
|
||||
|
||||
#pragma region hacks
|
||||
|
||||
|
@ -515,7 +516,7 @@ protected:
|
|||
{
|
||||
if(s_save && s_n >= s_saven)
|
||||
{
|
||||
t->Save(format("c:\\temp2\\_%05d_f%I64d_fr%d_%05x_%d.bmp", s_n, m_perfmon.GetFrame(), i, (int)TEX0.TBP0, (int)TEX0.PSM));
|
||||
t->Save(format("c:\\temp2\\_%05d_f%lld_fr%d_%05x_%d.bmp", s_n, m_perfmon.GetFrame(), i, (int)TEX0.TBP0, (int)TEX0.PSM));
|
||||
}
|
||||
|
||||
s_n++;
|
||||
|
@ -541,7 +542,7 @@ protected:
|
|||
|
||||
void Draw()
|
||||
{
|
||||
if(IsBadFrame(m_skip, m_UserHacks_SkipDraw)) return;
|
||||
if(IsBadFrame(m_skip, m_userhacks_skipdraw)) return;
|
||||
|
||||
GSDrawingEnvironment& env = m_env;
|
||||
GSDrawingContext* context = m_context;
|
||||
|
@ -583,7 +584,7 @@ protected:
|
|||
|
||||
if(s_save && s_n >= s_saven && tex)
|
||||
{
|
||||
s = format("c:\\temp2\\_%05d_f%I64d_tex_%05x_%d_%d%d_%02x_%02x_%02x_%02x.dds",
|
||||
s = format("c:\\temp2\\_%05d_f%lld_tex_%05x_%d_%d%d_%02x_%02x_%02x_%02x.dds",
|
||||
s_n, frame, (int)context->TEX0.TBP0, (int)context->TEX0.PSM,
|
||||
(int)context->CLAMP.WMS, (int)context->CLAMP.WMT,
|
||||
(int)context->CLAMP.MINU, (int)context->CLAMP.MAXU,
|
||||
|
@ -593,7 +594,7 @@ protected:
|
|||
|
||||
if(tex->m_palette)
|
||||
{
|
||||
s = format("c:\\temp2\\_%05d_f%I64d_tpx_%05x_%d.dds", s_n, frame, context->TEX0.CBP, context->TEX0.CPSM);
|
||||
s = format("c:\\temp2\\_%05d_f%lld_tpx_%05x_%d.dds", s_n, frame, context->TEX0.CBP, context->TEX0.CPSM);
|
||||
|
||||
tex->m_palette->Save(s, true);
|
||||
}
|
||||
|
@ -603,14 +604,14 @@ protected:
|
|||
|
||||
if(s_save && s_n >= s_saven)
|
||||
{
|
||||
s = format("c:\\temp2\\_%05d_f%I64d_rt0_%05x_%d.bmp", s_n, frame, context->FRAME.Block(), context->FRAME.PSM);
|
||||
s = format("c:\\temp2\\_%05d_f%lld_rt0_%05x_%d.bmp", s_n, frame, context->FRAME.Block(), context->FRAME.PSM);
|
||||
|
||||
rt->m_texture->Save(s);
|
||||
}
|
||||
|
||||
if(s_savez && s_n >= s_saven)
|
||||
{
|
||||
s = format("c:\\temp2\\_%05d_f%I64d_rz0_%05x_%d.bmp", s_n, frame, context->ZBUF.Block(), context->ZBUF.PSM);
|
||||
s = format("c:\\temp2\\_%05d_f%lld_rz0_%05x_%d.bmp", s_n, frame, context->ZBUF.Block(), context->ZBUF.PSM);
|
||||
|
||||
ds->m_texture->Save(s);
|
||||
}
|
||||
|
@ -686,14 +687,14 @@ protected:
|
|||
|
||||
if(s_save && s_n >= s_saven)
|
||||
{
|
||||
s = format("c:\\temp2\\_%05d_f%I64d_rt1_%05x_%d.bmp", s_n, frame, context->FRAME.Block(), context->FRAME.PSM);
|
||||
s = format("c:\\temp2\\_%05d_f%lld_rt1_%05x_%d.bmp", s_n, frame, context->FRAME.Block(), context->FRAME.PSM);
|
||||
|
||||
rt->m_texture->Save(s);
|
||||
}
|
||||
|
||||
if(s_savez && s_n >= s_saven)
|
||||
{
|
||||
s = format("c:\\temp2\\_%05d_f%I64d_rz1_%05x_%d.bmp", s_n, frame, context->ZBUF.Block(), context->ZBUF.PSM);
|
||||
s = format("c:\\temp2\\_%05d_f%lld_rz1_%05x_%d.bmp", s_n, frame, context->ZBUF.Block(), context->ZBUF.PSM);
|
||||
|
||||
ds->m_texture->Save(s);
|
||||
}
|
||||
|
@ -711,7 +712,12 @@ protected:
|
|||
return false;
|
||||
}
|
||||
|
||||
return __super::CanUpscale();
|
||||
return !m_nativeres && m_regs->PMODE.EN != 0; // upscale ratio depends on the display size, with no output it may not be set correctly (ps2 logo to game transition)
|
||||
}
|
||||
|
||||
int GetUpscaleMultiplier()
|
||||
{
|
||||
return m_upscale_multiplier;
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -720,24 +726,35 @@ public:
|
|||
, m_tc(tc)
|
||||
, m_width(1024)
|
||||
, m_height(1024)
|
||||
, m_upscale_multiplier(1)
|
||||
, m_skip(0)
|
||||
, m_reset(false)
|
||||
, m_UserHacks_SkipDraw (0)
|
||||
, m_upscale_multiplier(1)
|
||||
{
|
||||
if(!m_nativeres)
|
||||
m_nativeres = !!theApp.GetConfig("nativeres", 0);
|
||||
m_upscale_multiplier = theApp.GetConfig("upscale_multiplier", 1);
|
||||
m_userhacks_skipdraw = theApp.GetConfig("UserHacks_SkipDraw", 0);
|
||||
|
||||
if(m_nativeres)
|
||||
{
|
||||
m_filter = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_width = theApp.GetConfig("resx", m_width);
|
||||
m_height = theApp.GetConfig("resy", m_height);
|
||||
|
||||
m_upscale_multiplier = theApp.GetConfig("upscale_multiplier", m_upscale_multiplier);
|
||||
if (m_upscale_multiplier > 6) m_upscale_multiplier = 1; //use the normal upscale math
|
||||
if (m_upscale_multiplier > 1)
|
||||
|
||||
if(m_upscale_multiplier > 6)
|
||||
{
|
||||
m_width = 640 * m_upscale_multiplier; //512 is also common, but this is not always detected right.
|
||||
m_height = 512 * m_upscale_multiplier; //448 is also common, but this is not always detected right.
|
||||
m_upscale_multiplier = 1; // use the normal upscale math
|
||||
}
|
||||
else if(m_upscale_multiplier > 1)
|
||||
{
|
||||
m_width = 640 * m_upscale_multiplier; // 512 is also common, but this is not always detected right.
|
||||
m_height = 512 * m_upscale_multiplier; // 448 is also common, but this is not always detected right.
|
||||
}
|
||||
}
|
||||
m_UserHacks_SkipDraw = theApp.GetConfig("UserHacks_SkipDraw", m_UserHacks_SkipDraw);
|
||||
}
|
||||
|
||||
virtual ~GSRendererHW()
|
||||
|
|
|
@ -19,5 +19,5 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSRendererNull.h"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "GSRenderer.h"
|
||||
#include "GSDeviceNull.h"
|
||||
|
||||
class GSRendererNull : public GSRendererT<GSVertexNull>
|
||||
{
|
||||
|
|
|
@ -19,13 +19,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSRendererSW.h"
|
||||
|
||||
const GSVector4 g_pos_scale(1.0f / 16, 1.0f / 16, 1.0f, 128.0f);
|
||||
|
||||
GSRendererSW::GSRendererSW(int threads)
|
||||
: GSRendererT()
|
||||
{
|
||||
InitVertexKick(GSRendererSW);
|
||||
|
||||
|
@ -34,6 +33,8 @@ GSRendererSW::GSRendererSW(int threads)
|
|||
memset(m_texture, 0, sizeof(m_texture));
|
||||
|
||||
m_rl.Create<GSDrawScanline>(threads);
|
||||
|
||||
m_output = (uint8*)_aligned_malloc(1024 * 1024 * sizeof(uint32), 32);
|
||||
}
|
||||
|
||||
GSRendererSW::~GSRendererSW()
|
||||
|
@ -44,6 +45,8 @@ GSRendererSW::~GSRendererSW()
|
|||
{
|
||||
delete m_texture[i];
|
||||
}
|
||||
|
||||
_aligned_free(m_output);
|
||||
}
|
||||
|
||||
void GSRendererSW::Reset()
|
||||
|
@ -53,12 +56,12 @@ void GSRendererSW::Reset()
|
|||
|
||||
m_reset = true;
|
||||
|
||||
__super::Reset();
|
||||
GSRendererT<GSVertexSW>::Reset();
|
||||
}
|
||||
|
||||
void GSRendererSW::VSync(int field)
|
||||
{
|
||||
__super::VSync(field);
|
||||
GSRendererT<GSVertexSW>::VSync(field);
|
||||
|
||||
m_tc->IncAge();
|
||||
|
||||
|
@ -93,29 +96,25 @@ GSTexture* GSRendererSW::GetOutput(int i)
|
|||
|
||||
if(m_dev->ResizeTexture(&m_texture[i], w, h))
|
||||
{
|
||||
uint8* buff = GetTextureBufferLock();
|
||||
|
||||
static int pitch = 1024 * 4;
|
||||
|
||||
GSVector4i r(0, 0, w, h);
|
||||
|
||||
const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[DISPFB.PSM];
|
||||
|
||||
(m_mem.*psm.rtx)(m_mem.GetOffset(DISPFB.Block(), DISPFB.FBW, DISPFB.PSM), r.ralign<GSVector4i::Outside>(psm.bs), buff, pitch, m_env.TEXA);
|
||||
(m_mem.*psm.rtx)(m_mem.GetOffset(DISPFB.Block(), DISPFB.FBW, DISPFB.PSM), r.ralign<GSVector4i::Outside>(psm.bs), m_output, pitch, m_env.TEXA);
|
||||
|
||||
m_texture[i]->Update(r, buff, pitch);
|
||||
m_texture[i]->Update(r, m_output, pitch);
|
||||
|
||||
if(s_dump)
|
||||
{
|
||||
if(s_save && s_n >= s_saven)
|
||||
{
|
||||
m_texture[i]->Save(format("c:\\temp1\\_%05d_f%I64d_fr%d_%05x_%d.bmp", s_n, m_perfmon.GetFrame(), i, (int)DISPFB.Block(), (int)DISPFB.PSM));
|
||||
m_texture[i]->Save(format("c:\\temp1\\_%05d_f%lld_fr%d_%05x_%d.bmp", s_n, m_perfmon.GetFrame(), i, (int)DISPFB.Block(), (int)DISPFB.PSM));
|
||||
}
|
||||
|
||||
s_n++;
|
||||
}
|
||||
|
||||
ReleaseTextureBufferLock();
|
||||
}
|
||||
|
||||
return m_texture[i];
|
||||
|
@ -145,7 +144,7 @@ void GSRendererSW::Draw()
|
|||
|
||||
if(s_save && s_n >= s_saven && PRIM->TME)
|
||||
{
|
||||
s = format("c:\\temp1\\_%05d_f%I64d_tex_%05x_%d.bmp", s_n, frame, (int)m_context->TEX0.TBP0, (int)m_context->TEX0.PSM);
|
||||
s = format("c:\\temp1\\_%05d_f%ll_tex_%05x_%d.bmp", s_n, frame, (int)m_context->TEX0.TBP0, (int)m_context->TEX0.PSM);
|
||||
|
||||
m_mem.SaveBMP(s, m_context->TEX0.TBP0, m_context->TEX0.TBW, m_context->TEX0.PSM, 1 << m_context->TEX0.TW, 1 << m_context->TEX0.TH);
|
||||
}
|
||||
|
@ -154,14 +153,14 @@ void GSRendererSW::Draw()
|
|||
|
||||
if(s_save && s_n >= s_saven)
|
||||
{
|
||||
s = format("c:\\temp1\\_%05d_f%I64d_rt0_%05x_%d.bmp", s_n, frame, m_context->FRAME.Block(), m_context->FRAME.PSM);
|
||||
s = format("c:\\temp1\\_%05d_f%lld_rt0_%05x_%d.bmp", s_n, frame, m_context->FRAME.Block(), m_context->FRAME.PSM);
|
||||
|
||||
m_mem.SaveBMP(s, m_context->FRAME.Block(), m_context->FRAME.FBW, m_context->FRAME.PSM, GetFrameRect().width(), 512);//GetFrameSize(1).cy);
|
||||
}
|
||||
|
||||
if(s_savez && s_n >= s_saven)
|
||||
{
|
||||
s = format("c:\\temp1\\_%05d_f%I64d_rz0_%05x_%d.bmp", s_n, frame, m_context->ZBUF.Block(), m_context->ZBUF.PSM);
|
||||
s = format("c:\\temp1\\_%05d_f%lld_rz0_%05x_%d.bmp", s_n, frame, m_context->ZBUF.Block(), m_context->ZBUF.PSM);
|
||||
|
||||
m_mem.SaveBMP(s, m_context->ZBUF.Block(), m_context->FRAME.FBW, m_context->ZBUF.PSM, GetFrameRect().width(), 512);
|
||||
}
|
||||
|
@ -213,14 +212,14 @@ void GSRendererSW::Draw()
|
|||
|
||||
if(s_save && s_n >= s_saven)
|
||||
{
|
||||
s = format("c:\\temp1\\_%05d_f%I64d_rt1_%05x_%d.bmp", s_n, frame, m_context->FRAME.Block(), m_context->FRAME.PSM);
|
||||
s = format("c:\\temp1\\_%05d_f%lld_rt1_%05x_%d.bmp", s_n, frame, m_context->FRAME.Block(), m_context->FRAME.PSM);
|
||||
|
||||
m_mem.SaveBMP(s, m_context->FRAME.Block(), m_context->FRAME.FBW, m_context->FRAME.PSM, GetFrameRect().width(), 512);//GetFrameSize(1).cy);
|
||||
}
|
||||
|
||||
if(s_savez && s_n >= s_saven)
|
||||
{
|
||||
s = format("c:\\temp1\\_%05d_f%I64d_rz1_%05x_%d.bmp", s_n, frame, m_context->ZBUF.Block(), m_context->ZBUF.PSM);
|
||||
s = format("c:\\temp1\\_%05d_f%lld_rz1_%05x_%d.bmp", s_n, frame, m_context->ZBUF.Block(), m_context->ZBUF.PSM);
|
||||
|
||||
m_mem.SaveBMP(s, m_context->ZBUF.Block(), m_context->FRAME.FBW, m_context->ZBUF.PSM, GetFrameRect().width(), 512);
|
||||
}
|
||||
|
@ -230,7 +229,7 @@ void GSRendererSW::Draw()
|
|||
|
||||
if(0)//stats.ticks > 5000000)
|
||||
{
|
||||
printf("* [%I64d | %012I64x] ticks %I64d prims %d (%d) pixels %d (%d)\n",
|
||||
printf("* [%lld | %012llx] ticks %lld prims %d (%d) pixels %d (%d)\n",
|
||||
m_perfmon.GetFrame(), gd.sel.key,
|
||||
stats.ticks,
|
||||
stats.prims, stats.prims > 0 ? (int)(stats.ticks / stats.prims) : -1,
|
||||
|
|
|
@ -31,6 +31,7 @@ protected:
|
|||
GSRasterizerList m_rl;
|
||||
GSTextureCacheSW* m_tc;
|
||||
GSTexture* m_texture[2];
|
||||
uint8* m_output;
|
||||
bool m_reset;
|
||||
|
||||
void Reset();
|
||||
|
|
|
@ -19,6 +19,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSSetting.h"
|
||||
|
||||
|
|
|
@ -26,4 +26,12 @@ struct GSSetting
|
|||
uint32 id;
|
||||
std::string name;
|
||||
std::string note;
|
||||
|
||||
|
||||
GSSetting(uint32 id, const char* name, const char* note)
|
||||
{
|
||||
this->id = id;
|
||||
this->name = name;
|
||||
this->note = note;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -23,49 +23,9 @@
|
|||
#include "GSdx.h"
|
||||
#include "GSSettingsDlg.h"
|
||||
#include "GSUtil.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "GSDevice9.h"
|
||||
|
||||
GSSetting GSSettingsDlg::g_renderers[] =
|
||||
{
|
||||
{0, "Direct3D9 (Hardware)", ""},
|
||||
{1, "Direct3D9 (Software)", ""},
|
||||
{2, "Direct3D9 (Null)", ""},
|
||||
{3, "Direct3D%d ", "Hardware"},
|
||||
{4, "Direct3D%d ", "Software"},
|
||||
{5, "Direct3D%d ", "Null"},
|
||||
{12, "Null (Software)", ""},
|
||||
{13, "Null (Null)", ""},
|
||||
};
|
||||
|
||||
GSSetting GSSettingsDlg::g_interlace[] =
|
||||
{
|
||||
{0, "None", ""},
|
||||
{1, "Weave tff", "saw-tooth"},
|
||||
{2, "Weave bff", "saw-tooth"},
|
||||
{3, "Bob tff", "use blend if shaking"},
|
||||
{4, "Bob bff", "use blend if shaking"},
|
||||
{5, "Blend tff", "slight blur, 1/2 fps"},
|
||||
{6, "Blend bff", "slight blur, 1/2 fps"},
|
||||
};
|
||||
|
||||
GSSetting GSSettingsDlg::g_aspectratio[] =
|
||||
{
|
||||
{0, "Stretch", ""},
|
||||
{1, "4:3", ""},
|
||||
{2, "16:9", ""},
|
||||
};
|
||||
|
||||
GSSetting GSSettingsDlg::g_upscale_multiplier[] =
|
||||
{
|
||||
{1, "Custom", ""},
|
||||
{2, "2x Native", ""},
|
||||
{3, "3x Native", ""},
|
||||
{4, "4x Native", ""},
|
||||
{5, "5x Native", ""},
|
||||
{6, "6x Native", ""},
|
||||
};
|
||||
#include "GSDevice11.h"
|
||||
#include "resource.h"
|
||||
|
||||
GSSettingsDlg::GSSettingsDlg( bool isOpen2 )
|
||||
: GSDialog(isOpen2 ? IDD_CONFIG2 : IDD_CONFIG)
|
||||
|
@ -117,21 +77,24 @@ void GSSettingsDlg::OnInit()
|
|||
|
||||
vector<GSSetting> renderers;
|
||||
|
||||
for(size_t i = 0; i < countof(g_renderers); i++)
|
||||
for(size_t i = 0; i < theApp.m_gs_renderers.size(); i++)
|
||||
{
|
||||
GSSetting r = theApp.m_gs_renderers[i];
|
||||
|
||||
if(i >= 3 && i <= 5)
|
||||
{
|
||||
if(!isdx11avail_config) continue;
|
||||
g_renderers[i].name = std::string("Direct3D") + (GSUtil::HasD3D11Features() ? "11" : "10");
|
||||
|
||||
r.name = std::string("Direct3D") + (GSUtil::HasD3D11Features() ? "11" : "10");
|
||||
}
|
||||
|
||||
renderers.push_back(g_renderers[i]);
|
||||
renderers.push_back(r);
|
||||
}
|
||||
|
||||
ComboBoxInit(IDC_RENDERER, &renderers[0], renderers.size(), theApp.GetConfig("Renderer", 0));
|
||||
ComboBoxInit(IDC_INTERLACE, g_interlace, countof(g_interlace), theApp.GetConfig("Interlace", 0));
|
||||
ComboBoxInit(IDC_ASPECTRATIO, g_aspectratio, countof(g_aspectratio), theApp.GetConfig("AspectRatio", 1));
|
||||
ComboBoxInit(IDC_UPSCALE_MULTIPLIER, g_upscale_multiplier, countof(g_upscale_multiplier), theApp.GetConfig("upscale_multiplier", 1));
|
||||
ComboBoxInit(IDC_RENDERER, renderers, theApp.GetConfig("Renderer", 0));
|
||||
ComboBoxInit(IDC_INTERLACE, theApp.m_gs_interlace, theApp.GetConfig("Interlace", 0));
|
||||
ComboBoxInit(IDC_ASPECTRATIO, theApp.m_gs_aspectratio, theApp.GetConfig("AspectRatio", 1));
|
||||
ComboBoxInit(IDC_UPSCALE_MULTIPLIER, theApp.m_gs_upscale_multiplier, theApp.GetConfig("upscale_multiplier", 1));
|
||||
|
||||
CheckDlgButton(m_hWnd, IDC_WINDOWED, theApp.GetConfig("windowed", 1));
|
||||
CheckDlgButton(m_hWnd, IDC_FILTER, theApp.GetConfig("filter", 2));
|
||||
|
|
|
@ -39,9 +39,4 @@ protected:
|
|||
|
||||
public:
|
||||
GSSettingsDlg( bool isOpen2 );
|
||||
|
||||
static GSSetting g_renderers[];
|
||||
static GSSetting g_interlace[];
|
||||
static GSSetting g_aspectratio[];
|
||||
static GSSetting g_upscale_multiplier[];
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
// TODO: x64
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSSetupPrimCodeGenerator.h"
|
||||
|
||||
using namespace Xbyak;
|
||||
|
|
|
@ -19,24 +19,27 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSTables.h"
|
||||
|
||||
const uint8 blockTable32[4][8] = {
|
||||
const uint8 blockTable32[4][8] =
|
||||
{
|
||||
{ 0, 1, 4, 5, 16, 17, 20, 21},
|
||||
{ 2, 3, 6, 7, 18, 19, 22, 23},
|
||||
{ 8, 9, 12, 13, 24, 25, 28, 29},
|
||||
{ 10, 11, 14, 15, 26, 27, 30, 31}
|
||||
};
|
||||
|
||||
const uint8 blockTable32Z[4][8] = {
|
||||
const uint8 blockTable32Z[4][8] =
|
||||
{
|
||||
{ 24, 25, 28, 29, 8, 9, 12, 13},
|
||||
{ 26, 27, 30, 31, 10, 11, 14, 15},
|
||||
{ 16, 17, 20, 21, 0, 1, 4, 5},
|
||||
{ 18, 19, 22, 23, 2, 3, 6, 7}
|
||||
};
|
||||
|
||||
const uint8 blockTable16[8][4] = {
|
||||
const uint8 blockTable16[8][4] =
|
||||
{
|
||||
{ 0, 2, 8, 10 },
|
||||
{ 1, 3, 9, 11 },
|
||||
{ 4, 6, 12, 14 },
|
||||
|
@ -47,7 +50,8 @@ const uint8 blockTable16[8][4] = {
|
|||
{ 21, 23, 29, 31 }
|
||||
};
|
||||
|
||||
const uint8 blockTable16S[8][4] = {
|
||||
const uint8 blockTable16S[8][4] =
|
||||
{
|
||||
{ 0, 2, 16, 18 },
|
||||
{ 1, 3, 17, 19 },
|
||||
{ 8, 10, 24, 26 },
|
||||
|
@ -58,7 +62,8 @@ const uint8 blockTable16S[8][4] = {
|
|||
{ 13, 15, 29, 31 }
|
||||
};
|
||||
|
||||
const uint8 blockTable16Z[8][4] = {
|
||||
const uint8 blockTable16Z[8][4] =
|
||||
{
|
||||
{ 24, 26, 16, 18 },
|
||||
{ 25, 27, 17, 19 },
|
||||
{ 28, 30, 20, 22 },
|
||||
|
@ -69,7 +74,8 @@ const uint8 blockTable16Z[8][4] = {
|
|||
{ 13, 15, 5, 7 }
|
||||
};
|
||||
|
||||
const uint8 blockTable16SZ[8][4] = {
|
||||
const uint8 blockTable16SZ[8][4] =
|
||||
{
|
||||
{ 24, 26, 8, 10 },
|
||||
{ 25, 27, 9, 11 },
|
||||
{ 16, 18, 0, 2 },
|
||||
|
@ -80,14 +86,16 @@ const uint8 blockTable16SZ[8][4] = {
|
|||
{ 21, 23, 5, 7 }
|
||||
};
|
||||
|
||||
const uint8 blockTable8[4][8] = {
|
||||
const uint8 blockTable8[4][8] =
|
||||
{
|
||||
{ 0, 1, 4, 5, 16, 17, 20, 21},
|
||||
{ 2, 3, 6, 7, 18, 19, 22, 23},
|
||||
{ 8, 9, 12, 13, 24, 25, 28, 29},
|
||||
{ 10, 11, 14, 15, 26, 27, 30, 31}
|
||||
};
|
||||
|
||||
const uint8 blockTable4[8][4] = {
|
||||
const uint8 blockTable4[8][4] =
|
||||
{
|
||||
{ 0, 2, 8, 10 },
|
||||
{ 1, 3, 9, 11 },
|
||||
{ 4, 6, 12, 14 },
|
||||
|
@ -98,7 +106,8 @@ const uint8 blockTable4[8][4] = {
|
|||
{ 21, 23, 29, 31 }
|
||||
};
|
||||
|
||||
const uint8 columnTable32[8][8] = {
|
||||
const uint8 columnTable32[8][8] =
|
||||
{
|
||||
{ 0, 1, 4, 5, 8, 9, 12, 13 },
|
||||
{ 2, 3, 6, 7, 10, 11, 14, 15 },
|
||||
{ 16, 17, 20, 21, 24, 25, 28, 29 },
|
||||
|
@ -109,7 +118,8 @@ const uint8 columnTable32[8][8] = {
|
|||
{ 50, 51, 54, 55, 58, 59, 62, 63 },
|
||||
};
|
||||
|
||||
const uint8 columnTable16[8][16] = {
|
||||
const uint8 columnTable16[8][16] =
|
||||
{
|
||||
{ 0, 2, 8, 10, 16, 18, 24, 26,
|
||||
1, 3, 9, 11, 17, 19, 25, 27 },
|
||||
{ 4, 6, 12, 14, 20, 22, 28, 30,
|
||||
|
@ -128,7 +138,8 @@ const uint8 columnTable16[8][16] = {
|
|||
101, 103, 109, 111, 117, 119, 125, 127 },
|
||||
};
|
||||
|
||||
const uint8 columnTable8[16][16] = {
|
||||
const uint8 columnTable8[16][16] =
|
||||
{
|
||||
{ 0, 4, 16, 20, 32, 36, 48, 52, // column 0
|
||||
2, 6, 18, 22, 34, 38, 50, 54 },
|
||||
{ 8, 12, 24, 28, 40, 44, 56, 60,
|
||||
|
@ -163,7 +174,8 @@ const uint8 columnTable8[16][16] = {
|
|||
203, 207, 219, 223, 235, 239, 251, 255 },
|
||||
};
|
||||
|
||||
const uint16 columnTable4[16][32] = {
|
||||
const uint16 columnTable4[16][32] =
|
||||
{
|
||||
{ 0, 8, 32, 40, 64, 72, 96, 104, // column 0
|
||||
2, 10, 34, 42, 66, 74, 98, 106,
|
||||
4, 12, 36, 44, 68, 76, 100, 108,
|
||||
|
@ -261,101 +273,3 @@ const uint8 clutTableT16I4[16] =
|
|||
0, 2, 8, 10, 16, 18, 24, 26,
|
||||
4, 6, 12, 14, 20, 22, 28, 30
|
||||
};
|
||||
|
||||
// (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 D3D9Blend 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
|
||||
};
|
||||
|
|
|
@ -37,13 +37,3 @@ extern const uint8 clutTableT32I8[128];
|
|||
extern const uint8 clutTableT32I4[16];
|
||||
extern const uint8 clutTableT16I8[32];
|
||||
extern const uint8 clutTableT16I4[16];
|
||||
|
||||
struct D3D9Blend
|
||||
{
|
||||
int bogus;
|
||||
int op;
|
||||
int src;
|
||||
int dst;
|
||||
};
|
||||
|
||||
extern const D3D9Blend blendMapD3D9[3*3*3*3];
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSTexture.h"
|
||||
|
||||
GSTexture::GSTexture()
|
||||
|
|
|
@ -19,19 +19,24 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSTextureCache.h"
|
||||
|
||||
GSTextureCache::GSTextureCache(GSRenderer* r)
|
||||
: m_renderer(r)
|
||||
{
|
||||
m_paltex = !!theApp.GetConfig("paltex", 0);
|
||||
|
||||
m_temp = (uint8*)_aligned_malloc(1024 * 1024 * sizeof(uint32), 32);
|
||||
|
||||
UserHacks_HalfPixelOffset = !!theApp.GetConfig("UserHacks_HalfPixelOffset", 0);
|
||||
}
|
||||
|
||||
GSTextureCache::~GSTextureCache()
|
||||
{
|
||||
RemoveAll();
|
||||
|
||||
_aligned_free(m_temp);
|
||||
}
|
||||
|
||||
void GSTextureCache::RemoveAll()
|
||||
|
@ -173,9 +178,9 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
|
|||
|
||||
if(m_renderer->CanUpscale())
|
||||
{
|
||||
int multiplier = m_renderer->upscale_Multiplier();
|
||||
int multiplier = m_renderer->GetUpscaleMultiplier();
|
||||
|
||||
if (multiplier > 1) //it's limited to a maximum of 4 on reading the config
|
||||
if(multiplier > 1) // it's limited to a maximum of 4 on reading the config
|
||||
{
|
||||
|
||||
#if 0 //#ifdef USE_UPSCALE_HACKS //not happy with this yet..
|
||||
|
@ -523,7 +528,7 @@ void GSTextureCache::IncAge()
|
|||
//Fixme: Several issues in here. Not handling depth stencil, pitch conversion doesnt work.
|
||||
GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* dst)
|
||||
{
|
||||
Source* src = new Source(m_renderer);
|
||||
Source* src = new Source(m_renderer, m_temp);
|
||||
|
||||
src->m_TEX0 = TEX0;
|
||||
src->m_TEXA = TEXA;
|
||||
|
@ -660,7 +665,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
}
|
||||
|
||||
GSVector4 sr(0, 0, w, h);
|
||||
|
||||
|
||||
GSTexture* st = src->m_texture ? src->m_texture : dst->m_texture;
|
||||
GSTexture* dt = m_renderer->m_dev->CreateRenderTarget(w, h, false);
|
||||
|
||||
|
@ -736,12 +741,13 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
|
||||
// Offset hack. Can be enabled via GSdx options.
|
||||
// The offset will be used in Draw().
|
||||
|
||||
float modx = 0.0f;
|
||||
float mody = 0.0f;
|
||||
if (UserHacks_HalfPixelOffset && hack)
|
||||
|
||||
if(UserHacks_HalfPixelOffset && hack)
|
||||
{
|
||||
int multiplier = m_renderer->upscale_Multiplier();
|
||||
switch (multiplier)
|
||||
switch(m_renderer->GetUpscaleMultiplier())
|
||||
{
|
||||
case 2: modx = 2.2f; mody = 2.2f; dst->m_texture->LikelyOffset = true; break;
|
||||
case 3: modx = 3.1f; mody = 3.1f; dst->m_texture->LikelyOffset = true; break;
|
||||
|
@ -751,9 +757,9 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
default: modx = 0.0f; mody = 0.0f; dst->m_texture->LikelyOffset = false; break;
|
||||
}
|
||||
}
|
||||
|
||||
dst->m_texture->OffsetHack_modx = modx;
|
||||
dst->m_texture->OffsetHack_mody = mody;
|
||||
|
||||
}
|
||||
|
||||
if(src->m_texture == NULL)
|
||||
|
@ -830,13 +836,14 @@ void GSTextureCache::Surface::Update()
|
|||
|
||||
// GSTextureCache::Source
|
||||
|
||||
GSTextureCache::Source::Source(GSRenderer* r)
|
||||
GSTextureCache::Source::Source(GSRenderer* r, uint8* temp)
|
||||
: Surface(r)
|
||||
, m_palette(NULL)
|
||||
, m_initpalette(true)
|
||||
, m_fmt(0)
|
||||
, m_target(false)
|
||||
, m_complete(false)
|
||||
, m_temp(temp)
|
||||
{
|
||||
memset(m_valid, 0, sizeof(m_valid));
|
||||
|
||||
|
@ -859,7 +866,7 @@ GSTextureCache::Source::~Source()
|
|||
|
||||
void GSTextureCache::Source::Update(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& rect)
|
||||
{
|
||||
__super::Update();
|
||||
Surface::Update();
|
||||
|
||||
if(m_complete || m_target)
|
||||
{
|
||||
|
@ -1000,7 +1007,7 @@ void GSTextureCache::Source::Flush(uint32 count)
|
|||
rtx = psm.rtxP;
|
||||
}
|
||||
|
||||
uint8* buff = m_renderer->GetTextureBufferLock();
|
||||
uint8* buff = m_temp;
|
||||
|
||||
for(uint32 i = 0; i < count; i++)
|
||||
{
|
||||
|
@ -1031,11 +1038,9 @@ void GSTextureCache::Source::Flush(uint32 count)
|
|||
}
|
||||
}
|
||||
|
||||
m_renderer->ReleaseTextureBufferLock();
|
||||
|
||||
if(count < m_write.count)
|
||||
{
|
||||
memcpy(m_write.rect[0], &m_write.rect[count], (m_write.count - count) * sizeof(m_write.rect[0]));
|
||||
memcpy(&m_write.rect[0], &m_write.rect[count], (m_write.count - count) * sizeof(m_write.rect[0]));
|
||||
}
|
||||
|
||||
m_write.count -= count;
|
||||
|
@ -1053,7 +1058,7 @@ GSTextureCache::Target::Target(GSRenderer* r)
|
|||
|
||||
void GSTextureCache::Target::Update()
|
||||
{
|
||||
__super::Update();
|
||||
Surface::Update();
|
||||
|
||||
// FIXME: the union of the rects may also update wrong parts of the render target (but a lot faster :)
|
||||
|
||||
|
|
|
@ -72,9 +72,10 @@ public:
|
|||
int m_fmt;
|
||||
bool m_target;
|
||||
bool m_complete;
|
||||
uint8* m_temp;
|
||||
|
||||
public:
|
||||
explicit Source(GSRenderer* r);
|
||||
Source(GSRenderer* r, uint8* temp);
|
||||
virtual ~Source();
|
||||
|
||||
virtual void Update(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& rect);
|
||||
|
@ -94,12 +95,9 @@ public:
|
|||
virtual void Update();
|
||||
};
|
||||
|
||||
protected:
|
||||
GSRenderer* m_renderer;
|
||||
bool m_paltex;
|
||||
|
||||
struct SourceMap
|
||||
class SourceMap
|
||||
{
|
||||
public:
|
||||
hash_set<Source*> m_surfaces;
|
||||
list<Source*> m_map[MAX_PAGES];
|
||||
uint32 m_pages[16];
|
||||
|
@ -110,10 +108,14 @@ protected:
|
|||
void Add(Source* s, const GIFRegTEX0& TEX0, const GSOffset* o);
|
||||
void RemoveAll();
|
||||
void RemoveAt(Source* s);
|
||||
};
|
||||
|
||||
} m_src;
|
||||
|
||||
protected:
|
||||
GSRenderer* m_renderer;
|
||||
SourceMap m_src;
|
||||
list<Target*> m_dst[2];
|
||||
bool m_paltex;
|
||||
uint8* m_temp;
|
||||
|
||||
virtual Source* CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* t = NULL);
|
||||
virtual Target* CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSTextureCacheSW.h"
|
||||
|
||||
GSTextureCacheSW::GSTextureCacheSW(GSState* state)
|
||||
|
|
|
@ -348,9 +348,9 @@ void GSDevice11::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uin
|
|||
{
|
||||
int i = ((bsel.a * 3 + bsel.b) * 3 + bsel.c) * 3 + bsel.d;
|
||||
|
||||
bd.RenderTarget[0].BlendOp = (D3D11_BLEND_OP)blendMapD3D9[i].op;
|
||||
bd.RenderTarget[0].SrcBlend = (D3D11_BLEND)blendMapD3D9[i].src;
|
||||
bd.RenderTarget[0].DestBlend = (D3D11_BLEND)blendMapD3D9[i].dst;
|
||||
bd.RenderTarget[0].BlendOp = (D3D11_BLEND_OP)m_blendMapD3D9[i].op;
|
||||
bd.RenderTarget[0].SrcBlend = (D3D11_BLEND)m_blendMapD3D9[i].src;
|
||||
bd.RenderTarget[0].DestBlend = (D3D11_BLEND)m_blendMapD3D9[i].dst;
|
||||
bd.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
||||
bd.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
|
||||
bd.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
|
||||
|
@ -384,15 +384,15 @@ void GSDevice11::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uin
|
|||
; // god knows, best just not to mess with it for now
|
||||
}
|
||||
|
||||
if(blendMapD3D9[i].bogus == 1)
|
||||
if(m_blendMapD3D9[i].bogus == 1)
|
||||
{
|
||||
(bsel.a == 0 ? bd.RenderTarget[0].SrcBlend : bd.RenderTarget[0].DestBlend) = D3D11_BLEND_ONE;
|
||||
|
||||
const string afixstr = format("%d >> 7", afix);
|
||||
const char *col[3] = {"Cs", "Cd", "0"};
|
||||
const char *alpha[3] = {"As", "Ad", afixstr.c_str()};
|
||||
printf("Impossible blend for D3D: (%s - %s) * %s + %s\n",
|
||||
col[bsel.a], col[bsel.b], alpha[bsel.c], col[bsel.d]);
|
||||
|
||||
printf("Impossible blend for D3D: (%s - %s) * %s + %s\n", col[bsel.a], col[bsel.b], alpha[bsel.c], col[bsel.d]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -284,9 +284,9 @@ void GSDevice9::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint
|
|||
{
|
||||
int i = ((bsel.a * 3 + bsel.b) * 3 + bsel.c) * 3 + bsel.d;
|
||||
|
||||
bs->BlendOp = (D3DBLENDOP)blendMapD3D9[i].op;
|
||||
bs->SrcBlend = (D3DBLEND)blendMapD3D9[i].src;
|
||||
bs->DestBlend = (D3DBLEND)blendMapD3D9[i].dst;
|
||||
bs->BlendOp = (D3DBLENDOP)m_blendMapD3D9[i].op;
|
||||
bs->SrcBlend = (D3DBLEND)m_blendMapD3D9[i].src;
|
||||
bs->DestBlend = (D3DBLEND)m_blendMapD3D9[i].dst;
|
||||
bs->BlendOpAlpha = D3DBLENDOP_ADD;
|
||||
bs->SrcBlendAlpha = D3DBLEND_ONE;
|
||||
bs->DestBlendAlpha = D3DBLEND_ZERO;
|
||||
|
@ -307,7 +307,7 @@ void GSDevice9::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint
|
|||
; // god knows, best just not to mess with it for now
|
||||
}
|
||||
|
||||
if(blendMapD3D9[i].bogus == 1)
|
||||
if(m_blendMapD3D9[i].bogus == 1)
|
||||
{
|
||||
(bsel.a == 0 ? bs->SrcBlend : bs->DestBlend) = D3DBLEND_ONE;
|
||||
|
||||
|
|
|
@ -19,13 +19,19 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSThread.h"
|
||||
|
||||
GSThread::GSThread()
|
||||
: m_ThreadId(0)
|
||||
, m_hThread(NULL)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
|
||||
m_ThreadId = 0;
|
||||
m_hThread = NULL;
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
GSThread::~GSThread()
|
||||
|
@ -33,20 +39,46 @@ GSThread::~GSThread()
|
|||
CloseThread();
|
||||
}
|
||||
|
||||
DWORD WINAPI GSThread::StaticThreadProc(LPVOID lpParam)
|
||||
#ifdef _WINDOWS
|
||||
|
||||
DWORD WINAPI GSThread::StaticThreadProc(void* lpParam)
|
||||
{
|
||||
((GSThread*)lpParam)->ThreadProc();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void* GSThread::StaticThreadProc(void* param)
|
||||
{
|
||||
((GSThread*)param)->ThreadProc();
|
||||
|
||||
pthread_exit(NULL);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void GSThread::CreateThread()
|
||||
{
|
||||
m_hThread = ::CreateThread(NULL, 0, StaticThreadProc, (LPVOID)this, 0, &m_ThreadId);
|
||||
#ifdef _WINDOWS
|
||||
|
||||
m_hThread = ::CreateThread(NULL, 0, StaticThreadProc, (void*)this, 0, &m_ThreadId);
|
||||
|
||||
#else
|
||||
|
||||
pthread_attr_init(&m_thread_attr);
|
||||
pthread_create(&m_thread, &m_thread_attr, StaticThreadProc, (void*)this);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void GSThread::CloseThread()
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
|
||||
if(m_hThread != NULL)
|
||||
{
|
||||
if(WaitForSingleObject(m_hThread, 5000) != WAIT_OBJECT_0)
|
||||
|
@ -59,5 +91,14 @@ void GSThread::CloseThread()
|
|||
m_hThread = NULL;
|
||||
m_ThreadId = 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void* ret = NULL;
|
||||
|
||||
pthread_join(m_thread, &ret);
|
||||
pthread_attr_destroy(&m_thread_attr);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
class GSThread
|
||||
{
|
||||
// TODO: linux
|
||||
|
||||
DWORD m_ThreadId;
|
||||
HANDLE m_hThread;
|
||||
|
||||
static DWORD WINAPI StaticThreadProc(LPVOID lpParam);
|
||||
static DWORD WINAPI StaticThreadProc(void* lpParam);
|
||||
|
||||
protected:
|
||||
virtual void ThreadProc() = 0;
|
||||
|
@ -40,3 +40,133 @@ public:
|
|||
GSThread();
|
||||
virtual ~GSThread();
|
||||
};
|
||||
|
||||
class GSCritSec
|
||||
{
|
||||
CRITICAL_SECTION m_cs;
|
||||
|
||||
public:
|
||||
GSCritSec() {InitializeCriticalSection(&m_cs);}
|
||||
~GSCritSec() {DeleteCriticalSection(&m_cs);}
|
||||
|
||||
void Lock() {EnterCriticalSection(&m_cs);}
|
||||
bool TryLock() {return TryEnterCriticalSection(&m_cs) == TRUE;}
|
||||
void Unlock() {LeaveCriticalSection(&m_cs);}
|
||||
};
|
||||
|
||||
class GSAutoResetEvent
|
||||
{
|
||||
protected:
|
||||
HANDLE m_hEvent;
|
||||
|
||||
public:
|
||||
GSAutoResetEvent() {m_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);}
|
||||
~GSAutoResetEvent() {CloseHandle(m_hEvent);}
|
||||
|
||||
void Set() {SetEvent(m_hEvent);}
|
||||
bool Wait() {return WaitForSingleObject(m_hEvent, INFINITE) == WAIT_OBJECT_0;}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
class GSThread
|
||||
{
|
||||
pthread_attr_t m_thread_attr;
|
||||
pthread_t m_thread;
|
||||
|
||||
static void* StaticThreadProc(void* param);
|
||||
|
||||
protected:
|
||||
virtual void ThreadProc() = 0;
|
||||
|
||||
void CreateThread();
|
||||
void CloseThread();
|
||||
|
||||
public:
|
||||
GSThread();
|
||||
virtual ~GSThread();
|
||||
};
|
||||
|
||||
class GSCritSec
|
||||
{
|
||||
pthread_mutexattr_t m_mutex_attr;
|
||||
pthread_mutex_t m_mutex;
|
||||
|
||||
public:
|
||||
GSCritSec()
|
||||
{
|
||||
pthread_mutexattr_init(&m_mutex_attr);
|
||||
pthread_mutexattr_settype(&m_mutex_attr, PTHREAD_MUTEX_RECURSIVE_NP);
|
||||
pthread_mutex_init(&m_mutex, &m_mutex_attr);
|
||||
}
|
||||
|
||||
~GSCritSec()
|
||||
{
|
||||
pthread_mutex_destroy(&m_mutex);
|
||||
pthread_mutexattr_destroy(&m_mutex_attr);
|
||||
}
|
||||
|
||||
void Lock() {pthread_mutex_lock(&m_mutex);}
|
||||
bool TryLock() {return pthread_mutex_trylock(&m_mutex) == 0;}
|
||||
void Unlock() {pthread_mutex_unlock(&m_mutex);}
|
||||
};
|
||||
|
||||
class GSAutoResetEvent
|
||||
{
|
||||
protected:
|
||||
pthread_mutexattr_t m_mutex_attr;
|
||||
pthread_mutex_t m_mutex;
|
||||
pthread_cond_t m_cond;
|
||||
pthread_condattr_t m_cond_attr;
|
||||
|
||||
public:
|
||||
GSAutoResetEvent()
|
||||
{
|
||||
pthread_mutexattr_settype(&m_mutex_attr, PTHREAD_MUTEX_FAST_NP);
|
||||
pthread_mutex_init(&m_mutex, &m_mutex_attr);
|
||||
pthread_condattr_init(&m_cond_attr);
|
||||
pthread_cond_init(&m_cond, &m_cond_attr);
|
||||
}
|
||||
|
||||
~GSAutoResetEvent()
|
||||
{
|
||||
pthread_mutex_destroy(&m_mutex);
|
||||
pthread_mutexattr_destroy(&m_mutex_attr);
|
||||
pthread_cond_destroy(&m_cond);
|
||||
pthread_condattr_destroy(&m_cond_attr);
|
||||
}
|
||||
|
||||
void Set()
|
||||
{
|
||||
int ret;
|
||||
|
||||
pthread_mutex_lock(&m_mutex);
|
||||
pthread_cond_signal(&m_cond);
|
||||
pthread_mutex_unlock(&m_mutex);
|
||||
}
|
||||
|
||||
bool Wait()
|
||||
{
|
||||
int ret;
|
||||
|
||||
pthread_mutex_lock(&m_mutex);
|
||||
ret = pthread_cond_wait(&m_cond, &m_mutex);
|
||||
pthread_mutex_unlock(&m_mutex);
|
||||
|
||||
return ret == 0;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
class GSAutoLock
|
||||
{
|
||||
protected:
|
||||
GSCritSec* m_cs;
|
||||
|
||||
public:
|
||||
GSAutoLock(GSCritSec* cs) {m_cs = cs; m_cs->Lock();}
|
||||
~GSAutoLock() {m_cs->Unlock();}
|
||||
};
|
||||
|
|
|
@ -25,6 +25,52 @@
|
|||
#include "svnrev.h"
|
||||
#include "xbyak/xbyak_util.h"
|
||||
|
||||
char* GSUtil::GetLibName()
|
||||
{
|
||||
static string str;
|
||||
|
||||
str = format("GSdx %d", SVN_REV);
|
||||
|
||||
if(SVN_MODS) str += "m";
|
||||
|
||||
#if _M_AMD64
|
||||
str += " 64-bit";
|
||||
#endif
|
||||
|
||||
list<string> sl;
|
||||
|
||||
// TODO: linux (gcc)
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
sl.push_back(format("Intel C++ %d.%02d", __INTEL_COMPILER / 100, __INTEL_COMPILER % 100));
|
||||
#elif _MSC_VER
|
||||
sl.push_back(format("MSVC %d.%02d", _MSC_VER / 100, _MSC_VER % 100));
|
||||
#endif
|
||||
|
||||
#if _M_SSE >= 0x500
|
||||
sl.push_back("AVX");
|
||||
#elif _M_SSE >= 0x402
|
||||
sl.push_back("SSE42");
|
||||
#elif _M_SSE >= 0x401
|
||||
sl.push_back("SSE41");
|
||||
#elif _M_SSE >= 0x301
|
||||
sl.push_back("SSSE3");
|
||||
#elif _M_SSE >= 0x200
|
||||
sl.push_back("SSE2");
|
||||
#elif _M_SSE >= 0x100
|
||||
sl.push_back("SSE");
|
||||
#endif
|
||||
|
||||
for(list<string>::iterator i = sl.begin(); i != sl.end(); )
|
||||
{
|
||||
if(i == sl.begin()) str += " (";
|
||||
str += *i;
|
||||
str += ++i != sl.end() ? ", " : ")";
|
||||
}
|
||||
|
||||
return (char*)str.c_str();
|
||||
}
|
||||
|
||||
static class GSUtilMaps
|
||||
{
|
||||
public:
|
||||
|
@ -99,6 +145,35 @@ bool GSUtil::HasCompatibleBits(uint32 spsm, uint32 dpsm)
|
|||
return (s_maps.CompatibleBitsField[spsm][dpsm >> 5] & (1 << (dpsm & 0x1f))) != 0;
|
||||
}
|
||||
|
||||
bool GSUtil::CheckSSE()
|
||||
{
|
||||
Xbyak::util::Cpu cpu;
|
||||
Xbyak::util::Cpu::Type type;
|
||||
|
||||
#if _M_SSE >= 0x500
|
||||
type = Xbyak::util::Cpu::tAVX;
|
||||
#elif _M_SSE >= 0x402
|
||||
type = Xbyak::util::Cpu::tSSE42;
|
||||
#elif _M_SSE >= 0x401
|
||||
type = Xbyak::util::Cpu::tSSE41;
|
||||
#elif _M_SSE >= 0x301
|
||||
type = Xbyak::util::Cpu::tSSSE3;
|
||||
#elif _M_SSE >= 0x200
|
||||
type = Xbyak::util::Cpu::tSSE2;
|
||||
#endif
|
||||
|
||||
if(!cpu.has(type))
|
||||
{
|
||||
fprintf(stderr, "This CPU does not support SSE %d.%02d", _M_SSE >> 8, _M_SSE & 0xff);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
bool GSUtil::CheckDirectX()
|
||||
{
|
||||
OSVERSIONINFOEX version;
|
||||
|
@ -163,83 +238,4 @@ bool GSUtil::CheckDirectX()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GSUtil::CheckSSE()
|
||||
{
|
||||
Xbyak::util::Cpu cpu;
|
||||
Xbyak::util::Cpu::Type type;
|
||||
|
||||
#if _M_SSE >= 0x500
|
||||
type = Xbyak::util::Cpu::tAVX;
|
||||
#elif _M_SSE >= 0x402
|
||||
type = Xbyak::util::Cpu::tSSE42;
|
||||
#elif _M_SSE >= 0x401
|
||||
type = Xbyak::util::Cpu::tSSE41;
|
||||
#elif _M_SSE >= 0x301
|
||||
type = Xbyak::util::Cpu::tSSSE3;
|
||||
#elif _M_SSE >= 0x200
|
||||
type = Xbyak::util::Cpu::tSSE2;
|
||||
#endif
|
||||
|
||||
if(!cpu.has(type))
|
||||
{
|
||||
string s = format("This CPU does not support SSE %d.%02d", _M_SSE >> 8, _M_SSE & 0xff);
|
||||
|
||||
MessageBox(GetActiveWindow(), s.c_str(), "GSdx", MB_OK);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef IDirect3D9* (WINAPI * LPDIRECT3DCREATE9) (UINT);
|
||||
|
||||
static HMODULE s_hModD3D9 = NULL;
|
||||
static LPDIRECT3DCREATE9 s_DynamicDirect3DCreate9 = NULL;
|
||||
|
||||
|
||||
char* GSUtil::GetLibName()
|
||||
{
|
||||
static string str;
|
||||
|
||||
str = format("GSdx %d", SVN_REV);
|
||||
|
||||
if(SVN_MODS) str += "m";
|
||||
|
||||
#if _M_AMD64
|
||||
str += " 64-bit";
|
||||
#endif
|
||||
|
||||
list<string> sl;
|
||||
|
||||
// TODO: gcc
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
sl.push_back(format("Intel C++ %d.%02d", __INTEL_COMPILER / 100, __INTEL_COMPILER % 100));
|
||||
#elif _MSC_VER
|
||||
sl.push_back(format("MSVC %d.%02d", _MSC_VER / 100, _MSC_VER % 100));
|
||||
#endif
|
||||
|
||||
#if _M_SSE >= 0x500
|
||||
sl.push_back("AVX");
|
||||
#elif _M_SSE >= 0x402
|
||||
sl.push_back("SSE42");
|
||||
#elif _M_SSE >= 0x401
|
||||
sl.push_back("SSE41");
|
||||
#elif _M_SSE >= 0x301
|
||||
sl.push_back("SSSE3");
|
||||
#elif _M_SSE >= 0x200
|
||||
sl.push_back("SSE2");
|
||||
#elif _M_SSE >= 0x100
|
||||
sl.push_back("SSE");
|
||||
#endif
|
||||
|
||||
for(list<string>::iterator i = sl.begin(); i != sl.end(); )
|
||||
{
|
||||
if(i == sl.begin()) str += " (";
|
||||
str += *i;
|
||||
str += ++i != sl.end() ? ", " : ")";
|
||||
}
|
||||
|
||||
return (char*)str.c_str();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -22,22 +22,24 @@
|
|||
#pragma once
|
||||
|
||||
#include "GS.h"
|
||||
#include "GSLocalMemory.h"
|
||||
|
||||
class GSUtil
|
||||
{
|
||||
public:
|
||||
static char* GetLibName();
|
||||
|
||||
static GS_PRIM_CLASS GetPrimClass(uint32 prim);
|
||||
|
||||
static bool HasSharedBits(uint32 spsm, uint32 dpsm);
|
||||
static bool HasSharedBits(uint32 sbp, uint32 spsm, uint32 dbp, uint32 dpsm);
|
||||
static bool HasCompatibleBits(uint32 spsm, uint32 dpsm);
|
||||
|
||||
static bool CheckDirectX();
|
||||
static bool CheckSSE();
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
static bool CheckDirectX();
|
||||
static void UnloadDynamicLibraries();
|
||||
static char* GetLibName();
|
||||
|
||||
// These should probably be located more closely to their respective DX9/DX11 driver files,
|
||||
// and not here in GSUtil (which should be DirectX independent, generally speaking) --air
|
||||
|
@ -45,5 +47,7 @@ public:
|
|||
static void* GetDX9Proc( const char* methodname );
|
||||
static bool IsDirect3D11Available();
|
||||
static bool HasD3D11Features();
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSVector.h"
|
||||
|
||||
const GSVector4 GSVector4::m_ps0123(0.0f, 1.0f, 2.0f, 3.0f);
|
||||
|
|
|
@ -19,12 +19,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "stdafx.h"
|
||||
#include "GSdx.h"
|
||||
#include "GSWnd.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
GSWnd::GSWnd()
|
||||
: m_hWnd(NULL)
|
||||
, m_IsManaged(true)
|
||||
|
@ -36,6 +34,8 @@ GSWnd::~GSWnd()
|
|||
{
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
LRESULT CALLBACK GSWnd::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
GSWnd* wnd = NULL;
|
||||
|
@ -79,11 +79,15 @@ LRESULT GSWnd::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
}
|
||||
|
||||
return DefWindowProc(m_hWnd, message, wParam, lParam);
|
||||
return DefWindowProc((HWND)m_hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool GSWnd::Create(const string& title, int w, int h)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
|
||||
if(m_hWnd) return true;
|
||||
|
||||
WNDCLASS wc;
|
||||
|
@ -135,15 +139,18 @@ bool GSWnd::Create(const string& title, int w, int h)
|
|||
|
||||
m_hWnd = CreateWindow(wc.lpszClassName, title.c_str(), style, r.left, r.top, r.width(), r.height(), NULL, NULL, wc.hInstance, (LPVOID)this);
|
||||
|
||||
if(!m_hWnd)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_hWnd != NULL;
|
||||
|
||||
return true;
|
||||
#else
|
||||
|
||||
// TODO: linux
|
||||
|
||||
return false;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GSWnd::Attach(HWND hWnd, bool isManaged)
|
||||
bool GSWnd::Attach(void* hWnd, bool isManaged)
|
||||
{
|
||||
// TODO: subclass
|
||||
|
||||
|
@ -159,7 +166,16 @@ void GSWnd::Detach()
|
|||
{
|
||||
// close the window, since it's under GSdx care. It's not taking messages anyway, and
|
||||
// that means its big, ugly, and in the way.
|
||||
DestroyWindow(m_hWnd);
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
DestroyWindow((HWND)m_hWnd);
|
||||
|
||||
#else
|
||||
|
||||
// TODO: linux
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
m_hWnd = NULL;
|
||||
|
@ -170,7 +186,15 @@ GSVector4i GSWnd::GetClientRect()
|
|||
{
|
||||
GSVector4i r;
|
||||
|
||||
::GetClientRect(m_hWnd, r);
|
||||
#ifdef _WINDOWS
|
||||
|
||||
::GetClientRect((HWND)m_hWnd, r);
|
||||
|
||||
#else
|
||||
|
||||
r = GSVector4i::zero();
|
||||
|
||||
#endif
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -182,7 +206,15 @@ bool GSWnd::SetWindowText(const char* title)
|
|||
{
|
||||
if(!m_IsManaged) return false;
|
||||
|
||||
::SetWindowText(m_hWnd, title);
|
||||
#ifdef _WINDOWS
|
||||
|
||||
::SetWindowText((HWND)m_hWnd, title);
|
||||
|
||||
#else
|
||||
|
||||
// TODO: linux
|
||||
|
||||
#endif
|
||||
|
||||
return m_HasFrame;
|
||||
}
|
||||
|
@ -191,33 +223,57 @@ void GSWnd::Show()
|
|||
{
|
||||
if(!m_IsManaged) return;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
//SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
||||
|
||||
SetForegroundWindow(m_hWnd);
|
||||
SetForegroundWindow((HWND)m_hWnd);
|
||||
|
||||
ShowWindow(m_hWnd, SW_SHOWNORMAL);
|
||||
ShowWindow((HWND)m_hWnd, SW_SHOWNORMAL);
|
||||
|
||||
UpdateWindow(m_hWnd);
|
||||
UpdateWindow((HWND)m_hWnd);
|
||||
|
||||
#else
|
||||
|
||||
// TODO: linux
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void GSWnd::Hide()
|
||||
{
|
||||
if(!m_IsManaged) return;
|
||||
|
||||
ShowWindow(m_hWnd, SW_HIDE);
|
||||
#ifdef _WINDOWS
|
||||
|
||||
ShowWindow((HWND)m_hWnd, SW_HIDE);
|
||||
|
||||
#else
|
||||
|
||||
// TODO: linux
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void GSWnd::HideFrame()
|
||||
{
|
||||
if(!m_IsManaged) return;
|
||||
|
||||
SetWindowLong(m_hWnd, GWL_STYLE, GetWindowLong(m_hWnd, GWL_STYLE) & ~(WS_CAPTION|WS_THICKFRAME));
|
||||
#ifdef _WINDOWS
|
||||
|
||||
SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
HWND hWnd = (HWND)m_hWnd;
|
||||
|
||||
SetMenu(m_hWnd, NULL);
|
||||
SetWindowLong(hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE) & ~(WS_CAPTION|WS_THICKFRAME));
|
||||
|
||||
SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
|
||||
SetMenu(hWnd, NULL);
|
||||
|
||||
#else
|
||||
|
||||
// TODO: linux
|
||||
|
||||
#endif
|
||||
|
||||
m_HasFrame = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,21 +28,25 @@ class GSWnd
|
|||
bool m_IsManaged; // set true when we're attached to a 3rdparty window that's amanged by the emulator
|
||||
bool m_HasFrame;
|
||||
|
||||
HWND m_hWnd;
|
||||
void* m_hWnd;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
#endif
|
||||
|
||||
public:
|
||||
GSWnd();
|
||||
virtual ~GSWnd();
|
||||
|
||||
bool Create(const string& title, int w, int h);
|
||||
bool Attach(HWND hWnd, bool isManaged = true);
|
||||
bool Attach(void* hWnd, bool isManaged = true);
|
||||
void Detach();
|
||||
bool IsManaged() const { return m_IsManaged; }
|
||||
|
||||
HWND GetHandle() {return m_hWnd;}
|
||||
void* GetHandle() {return m_hWnd;}
|
||||
|
||||
GSVector4i GetClientRect();
|
||||
|
||||
|
|
|
@ -4,47 +4,37 @@
|
|||
<Project>
|
||||
<Option title="GSdx" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Option compiler="icc" />
|
||||
<Build>
|
||||
<Target title="Debug SSE2 Linux">
|
||||
<Option output="bin/Debug/GSdx" prefix_auto="1" extension_auto="1" />
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/libGSdx" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
</Compiler>
|
||||
<Option type="3" />
|
||||
<Option compiler="icc" />
|
||||
<Option createDefFile="1" />
|
||||
<Option createStaticLib="1" />
|
||||
</Target>
|
||||
<Target title="Release SSE2 Linux">
|
||||
<Option output="bin/Release/GSdx" prefix_auto="1" extension_auto="1" />
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/libGSdx" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Option type="3" />
|
||||
<Option compiler="icc" />
|
||||
<Option createDefFile="1" />
|
||||
<Option createStaticLib="1" />
|
||||
<Compiler>
|
||||
<Add option="-Ob2" />
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
<Add library="Cg" />
|
||||
</Linker>
|
||||
</Target>
|
||||
<Environment>
|
||||
<Variable name="SvnRootDir" value="../../" />
|
||||
</Environment>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-fno-operator-names" />
|
||||
<Add option="-Zp16" />
|
||||
<Add option="-fno-rtti" />
|
||||
<Add option="-restrict" />
|
||||
<Add option="-msse2" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-Wno-format" />
|
||||
<Add option="-Wno-unused-parameter" />
|
||||
<Add option="-Wno-unused-value" />
|
||||
<Add option="-Wunused-variable" />
|
||||
<Add option="-fno-guess-branch-probability" />
|
||||
<Add option="-fno-dse" />
|
||||
<Add option="-fno-tree-dse" />
|
||||
<Add option="-fno-strict-aliasing" />
|
||||
<Add option="-pipe -msse -msse2" />
|
||||
<Add option="-m32" />
|
||||
<Add directory="$(SvnRootDir)/common/include" />
|
||||
<Add option="-D_LINUX" />
|
||||
</Compiler>
|
||||
<Unit filename="GPU.cpp" />
|
||||
<Unit filename="GPU.h" />
|
||||
|
@ -60,8 +50,6 @@
|
|||
<Unit filename="GPURendererSW.cpp" />
|
||||
<Unit filename="GPURendererSW.h" />
|
||||
<Unit filename="GPUScanlineEnvironment.h" />
|
||||
<Unit filename="GPUSettingsDlg.cpp" />
|
||||
<Unit filename="GPUSettingsDlg.h" />
|
||||
<Unit filename="GPUSetupPrimCodeGenerator.cpp" />
|
||||
<Unit filename="GPUSetupPrimCodeGenerator.h" />
|
||||
<Unit filename="GPUState.cpp" />
|
||||
|
@ -75,8 +63,6 @@
|
|||
<Unit filename="GSBlock.h" />
|
||||
<Unit filename="GSCapture.cpp" />
|
||||
<Unit filename="GSCapture.h" />
|
||||
<Unit filename="GSCaptureDlg.cpp" />
|
||||
<Unit filename="GSCaptureDlg.h" />
|
||||
<Unit filename="GSClut.cpp" />
|
||||
<Unit filename="GSClut.h" />
|
||||
<Unit filename="GSCodeBuffer.cpp" />
|
||||
|
@ -85,23 +71,8 @@
|
|||
<Unit filename="GSCrc.h" />
|
||||
<Unit filename="GSDevice.cpp" />
|
||||
<Unit filename="GSDevice.h" />
|
||||
<Unit filename="GSDevice11.cpp">
|
||||
<Option compile="0" />
|
||||
<Option link="0" />
|
||||
<Option target="<{~None~}>" />
|
||||
</Unit>
|
||||
<Unit filename="GSDevice11.h" />
|
||||
<Unit filename="GSDevice9.cpp">
|
||||
<Option compile="0" />
|
||||
<Option link="0" />
|
||||
<Option target="<{~None~}>" />
|
||||
</Unit>
|
||||
<Unit filename="GSDevice9.h" />
|
||||
<Unit filename="GSDeviceDX.h" />
|
||||
<Unit filename="GSDeviceNull.cpp" />
|
||||
<Unit filename="GSDeviceNull.h" />
|
||||
<Unit filename="GSDialog.cpp" />
|
||||
<Unit filename="GSDialog.h" />
|
||||
<Unit filename="GSDirtyRect.cpp" />
|
||||
<Unit filename="GSDirtyRect.h" />
|
||||
<Unit filename="GSDrawScanline.cpp" />
|
||||
|
@ -122,14 +93,6 @@
|
|||
<Unit filename="GSRasterizer.h" />
|
||||
<Unit filename="GSRenderer.cpp" />
|
||||
<Unit filename="GSRenderer.h" />
|
||||
<Unit filename="GSRendererDX.cpp" />
|
||||
<Unit filename="GSRendererDX.h" />
|
||||
<Unit filename="GSRendererDX11.cpp" />
|
||||
<Unit filename="GSRendererDX11.h" />
|
||||
<Unit filename="GSRendererDX9.cpp" />
|
||||
<Unit filename="GSRendererDX9.h" />
|
||||
<Unit filename="GSRendererHW.cpp" />
|
||||
<Unit filename="GSRendererHW.h" />
|
||||
<Unit filename="GSRendererNull.cpp" />
|
||||
<Unit filename="GSRendererNull.h" />
|
||||
<Unit filename="GSRendererSW.cpp" />
|
||||
|
@ -137,8 +100,6 @@
|
|||
<Unit filename="GSScanlineEnvironment.h" />
|
||||
<Unit filename="GSSetting.cpp" />
|
||||
<Unit filename="GSSetting.h" />
|
||||
<Unit filename="GSSettingsDlg.cpp" />
|
||||
<Unit filename="GSSettingsDlg.h" />
|
||||
<Unit filename="GSSetupPrimCodeGenerator.cpp" />
|
||||
<Unit filename="GSSetupPrimCodeGenerator.h" />
|
||||
<Unit filename="GSState.cpp" />
|
||||
|
@ -147,25 +108,10 @@
|
|||
<Unit filename="GSTables.h" />
|
||||
<Unit filename="GSTexture.cpp" />
|
||||
<Unit filename="GSTexture.h" />
|
||||
<Unit filename="GSTexture10.h" />
|
||||
<Unit filename="GSTexture11.cpp" />
|
||||
<Unit filename="GSTexture11.h" />
|
||||
<Unit filename="GSTexture7.h" />
|
||||
<Unit filename="GSTexture9.cpp" />
|
||||
<Unit filename="GSTexture9.h" />
|
||||
<Unit filename="GSTextureCache.cpp" />
|
||||
<Unit filename="GSTextureCache.h" />
|
||||
<Unit filename="GSTextureCache10.cpp" />
|
||||
<Unit filename="GSTextureCache10.h" />
|
||||
<Unit filename="GSTextureCache11.cpp" />
|
||||
<Unit filename="GSTextureCache11.h" />
|
||||
<Unit filename="GSTextureCache9.cpp" />
|
||||
<Unit filename="GSTextureCache9.h" />
|
||||
<Unit filename="GSTextureCacheSW.cpp" />
|
||||
<Unit filename="GSTextureCacheSW.h" />
|
||||
<Unit filename="GSTextureFX.cpp" />
|
||||
<Unit filename="GSTextureFX11.cpp" />
|
||||
<Unit filename="GSTextureFX9.cpp" />
|
||||
<Unit filename="GSTextureNull.cpp" />
|
||||
<Unit filename="GSTextureNull.h" />
|
||||
<Unit filename="GSThread.cpp" />
|
||||
|
@ -176,9 +122,7 @@
|
|||
<Unit filename="GSVector.h" />
|
||||
<Unit filename="GSVertex.h" />
|
||||
<Unit filename="GSVertexHW.h" />
|
||||
<Unit filename="GSVertexList.cpp" />
|
||||
<Unit filename="GSVertexList.h" />
|
||||
<Unit filename="GSVertexSW.cpp" />
|
||||
<Unit filename="GSVertexSW.h" />
|
||||
<Unit filename="GSVertexTrace.cpp" />
|
||||
<Unit filename="GSVertexTrace.h" />
|
||||
|
@ -186,11 +130,17 @@
|
|||
<Unit filename="GSWnd.h" />
|
||||
<Unit filename="GSdx.cpp" />
|
||||
<Unit filename="GSdx.h" />
|
||||
<Unit filename="resource.h" />
|
||||
<Unit filename="stdafx.cpp" />
|
||||
<Unit filename="stdafx.h" />
|
||||
<Unit filename="svnrev.h" />
|
||||
<Unit filename="xbyak/xbyak.h" />
|
||||
<Unit filename="xbyak/xbyak_bin2hex.h" />
|
||||
<Unit filename="xbyak/xbyak_mnemonic.h" />
|
||||
<Unit filename="xbyak/xbyak_util.h" />
|
||||
<Extensions>
|
||||
<envvars />
|
||||
<code_completion />
|
||||
<lib_finder disable_auto="1" />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
#include "stdafx.h"
|
||||
#include "GSdx.h"
|
||||
|
||||
static HMODULE s_hModule;
|
||||
static void* s_hModule;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
|
@ -39,16 +41,91 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GSdxApp theApp;
|
||||
#else
|
||||
|
||||
std::string GSdxApp::m_ini( "inis/GSdx.ini" );
|
||||
const char* GSdxApp::m_section = "Settings";
|
||||
size_t GetPrivateProfileString(const char* lpAppName, const char* lpKeyName, const char* lpDefault, char* lpReturnedString, size_t nSize, const char* lpFileName)
|
||||
{
|
||||
// TODO: linux
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool WritePrivateProfileString(const char* lpAppName, const char* lpKeyName, const char* pString, const char* lpFileName)
|
||||
{
|
||||
// TODO: linux
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int GetPrivateProfileInt(const char* lpAppName, const char* lpKeyName, int nDefault, const char* lpFileName)
|
||||
{
|
||||
// TODO: linux
|
||||
|
||||
return nDefault;
|
||||
}
|
||||
#endif
|
||||
|
||||
GSdxApp theApp;
|
||||
|
||||
GSdxApp::GSdxApp()
|
||||
{
|
||||
m_ini = "inis/GSdx.ini";
|
||||
m_section = "Settings";
|
||||
|
||||
m_gs_renderers.push_back(GSSetting(0, "Direct3D9 (Hardware)", ""));
|
||||
m_gs_renderers.push_back(GSSetting(1, "Direct3D9 (Software)", ""));
|
||||
m_gs_renderers.push_back(GSSetting(2, "Direct3D9 (Null)", ""));
|
||||
m_gs_renderers.push_back(GSSetting(3, "Direct3D%d ", "Hardware"));
|
||||
m_gs_renderers.push_back(GSSetting(4, "Direct3D%d ", "Software"));
|
||||
m_gs_renderers.push_back(GSSetting(5, "Direct3D%d ", "Null"));
|
||||
m_gs_renderers.push_back(GSSetting(12, "Null (Software)", ""));
|
||||
m_gs_renderers.push_back(GSSetting(13, "Null (Null)", ""));
|
||||
|
||||
m_gs_interlace.push_back(GSSetting(0, "None", ""));
|
||||
m_gs_interlace.push_back(GSSetting(1, "Weave tff", "saw-tooth"));
|
||||
m_gs_interlace.push_back(GSSetting(2, "Weave bff", "saw-tooth"));
|
||||
m_gs_interlace.push_back(GSSetting(3, "Bob tff", "use blend if shaking"));
|
||||
m_gs_interlace.push_back(GSSetting(4, "Bob bff", "use blend if shaking"));
|
||||
m_gs_interlace.push_back(GSSetting(5, "Blend tff", "slight blur, 1/2 fps"));
|
||||
m_gs_interlace.push_back(GSSetting(6, "Blend bff", "slight blur, 1/2 fps"));
|
||||
|
||||
m_gs_aspectratio.push_back(GSSetting(0, "Stretch", ""));
|
||||
m_gs_aspectratio.push_back(GSSetting(1, "4:3", ""));
|
||||
m_gs_aspectratio.push_back(GSSetting(2, "16:9", ""));
|
||||
|
||||
m_gs_upscale_multiplier.push_back(GSSetting(1, "Custom", ""));
|
||||
m_gs_upscale_multiplier.push_back(GSSetting(2, "2x Native", ""));
|
||||
m_gs_upscale_multiplier.push_back(GSSetting(3, "3x Native", ""));
|
||||
m_gs_upscale_multiplier.push_back(GSSetting(4, "4x Native", ""));
|
||||
m_gs_upscale_multiplier.push_back(GSSetting(5, "5x Native", ""));
|
||||
m_gs_upscale_multiplier.push_back(GSSetting(6, "6x Native", ""));
|
||||
|
||||
m_gpu_renderers.push_back(GSSetting(0, "Direct3D9 (Software)", ""));
|
||||
m_gpu_renderers.push_back(GSSetting(1, "Direct3D11 (Software)", ""));
|
||||
m_gpu_renderers.push_back(GSSetting(2, "Null (Software)", ""));
|
||||
//m_gpu_renderers.push_back(GSSetting(3, "Null (Null)", ""));
|
||||
|
||||
m_gpu_filter.push_back(GSSetting(0, "Nearest", ""));
|
||||
m_gpu_filter.push_back(GSSetting(1, "Bilinear (polygons only)", ""));
|
||||
m_gpu_filter.push_back(GSSetting(2, "Bilinear", ""));
|
||||
|
||||
m_gpu_dithering.push_back(GSSetting(0, "Disabled", ""));
|
||||
m_gpu_dithering.push_back(GSSetting(1, "Auto", ""));
|
||||
|
||||
m_gpu_aspectratio.push_back(GSSetting(0, "Stretch", ""));
|
||||
m_gpu_aspectratio.push_back(GSSetting(1, "4:3", ""));
|
||||
m_gpu_aspectratio.push_back(GSSetting(2, "16:9", ""));
|
||||
|
||||
m_gpu_scale.push_back(GSSetting(0 | (0 << 2), "H x 1 - V x 1", ""));
|
||||
m_gpu_scale.push_back(GSSetting(1 | (0 << 2), "H x 2 - V x 1", ""));
|
||||
m_gpu_scale.push_back(GSSetting(0 | (1 << 2), "H x 1 - V x 2", ""));
|
||||
m_gpu_scale.push_back(GSSetting(1 | (1 << 2), "H x 2 - V x 2", ""));
|
||||
m_gpu_scale.push_back(GSSetting(2 | (1 << 2), "H x 4 - V x 2", ""));
|
||||
m_gpu_scale.push_back(GSSetting(1 | (2 << 2), "H x 2 - V x 4", ""));
|
||||
m_gpu_scale.push_back(GSSetting(2 | (2 << 2), "H x 4 - V x 4", ""));
|
||||
}
|
||||
|
||||
HMODULE GSdxApp::GetModuleHandle()
|
||||
void* GSdxApp::GetModuleHandlePtr()
|
||||
{
|
||||
return s_hModule;
|
||||
}
|
||||
|
@ -63,9 +140,9 @@ void GSdxApp::SetConfigDir(const char* dir)
|
|||
{
|
||||
m_ini = dir;
|
||||
|
||||
if((m_ini[m_ini.length()-1] != '/') && (m_ini[m_ini.length()-1] != '\\'))
|
||||
if(m_ini[m_ini.length() - 1] != DIRECTORY_SEPARATOR)
|
||||
{
|
||||
m_ini += '\\';
|
||||
m_ini += DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
m_ini += "GSdx.ini";
|
||||
|
@ -75,23 +152,27 @@ void GSdxApp::SetConfigDir(const char* dir)
|
|||
string GSdxApp::GetConfig(const char* entry, const char* value)
|
||||
{
|
||||
char buff[4096] = {0};
|
||||
GetPrivateProfileString(m_section, entry, value, buff, countof(buff), m_ini.c_str());
|
||||
|
||||
GetPrivateProfileString(m_section.c_str(), entry, value, buff, countof(buff), m_ini.c_str());
|
||||
|
||||
return string(buff);
|
||||
}
|
||||
|
||||
void GSdxApp::SetConfig(const char* entry, const char* value)
|
||||
{
|
||||
WritePrivateProfileString(m_section, entry, value, m_ini.c_str());
|
||||
WritePrivateProfileString(m_section.c_str(), entry, value, m_ini.c_str());
|
||||
}
|
||||
|
||||
int GSdxApp::GetConfig(const char* entry, int value)
|
||||
{
|
||||
return GetPrivateProfileInt(m_section, entry, value, m_ini.c_str());
|
||||
return GetPrivateProfileInt(m_section.c_str(), entry, value, m_ini.c_str());
|
||||
}
|
||||
|
||||
void GSdxApp::SetConfig(const char* entry, int value)
|
||||
{
|
||||
char buff[32] = {0};
|
||||
itoa(value, buff, 10);
|
||||
|
||||
sprintf(buff, "%d", value);
|
||||
|
||||
SetConfig(entry, buff);
|
||||
}
|
||||
|
|
|
@ -21,18 +21,20 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "GSSetting.h"
|
||||
|
||||
class GSdxApp
|
||||
{
|
||||
static std::string m_ini;
|
||||
static const char* m_section;
|
||||
std::string m_ini;
|
||||
std::string m_section;
|
||||
|
||||
public:
|
||||
GSdxApp();
|
||||
|
||||
void* GetModuleHandlePtr();
|
||||
|
||||
#ifdef _WINDOWS
|
||||
HMODULE GetModuleHandle();
|
||||
#else
|
||||
void* GetModuleHandle();
|
||||
HMODULE GetModuleHandle() {return (HMODULE)GetModuleHandlePtr();}
|
||||
#endif
|
||||
|
||||
string GetConfig(const char* entry, const char* value);
|
||||
|
@ -41,6 +43,17 @@ public:
|
|||
void SetConfig(const char* entry, int value);
|
||||
|
||||
void SetConfigDir(const char* dir);
|
||||
|
||||
vector<GSSetting> m_gs_renderers;
|
||||
vector<GSSetting> m_gs_interlace;
|
||||
vector<GSSetting> m_gs_aspectratio;
|
||||
vector<GSSetting> m_gs_upscale_multiplier;
|
||||
|
||||
vector<GSSetting> m_gpu_renderers;
|
||||
vector<GSSetting> m_gpu_filter;
|
||||
vector<GSSetting> m_gpu_dithering;
|
||||
vector<GSSetting> m_gpu_aspectratio;
|
||||
vector<GSSetting> m_gpu_scale;
|
||||
};
|
||||
|
||||
extern GSdxApp theApp;
|
||||
|
|
|
@ -1803,7 +1803,6 @@
|
|||
<ClInclude Include="GSTextureCache11.h" />
|
||||
<ClInclude Include="GSTextureCache9.h" />
|
||||
<ClInclude Include="GSTextureCacheSW.h" />
|
||||
<ClInclude Include="GSTextureFX11.h" />
|
||||
<ClInclude Include="GSTextureNull.h" />
|
||||
<ClInclude Include="GSThread.h" />
|
||||
<ClInclude Include="GSUtil.h" />
|
||||
|
|
|
@ -416,9 +416,6 @@
|
|||
<ClInclude Include="GSTextureCacheSW.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GSTextureFX11.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GSTextureNull.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -24,7 +24,7 @@ string format(const char* fmt, ...)
|
|||
|
||||
memset(buffer, 0, length + 1);
|
||||
|
||||
result = _vsnprintf(buffer, length, fmt, args);
|
||||
result = vsnprintf(buffer, length, fmt, args);
|
||||
|
||||
length *= 2;
|
||||
}
|
||||
|
@ -38,24 +38,44 @@ string format(const char* fmt, ...)
|
|||
return s;
|
||||
}
|
||||
|
||||
void* vmalloc(size_t size, bool code)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, code ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE);
|
||||
#else
|
||||
// TODO: linux
|
||||
return malloc(size);
|
||||
#endif
|
||||
}
|
||||
|
||||
void vmfree(void* ptr)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
VirtualFree(ptr, 0, MEM_RELEASE);
|
||||
#else
|
||||
// TODO: linux
|
||||
free(ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(_MSC_VER) && !defined(HAVE_ALIGNED_MALLOC)
|
||||
|
||||
// declare linux equivalents (alignment must be power of 2 (1,2,4...2^15)
|
||||
|
||||
void* pcsx2_aligned_malloc(size_t size, size_t alignment)
|
||||
void* _aligned_malloc(size_t size, size_t alignment)
|
||||
{
|
||||
ASSERT(alignment <= 0x8000);
|
||||
uptr r = (uptr)malloc(size + --alignment + 2);
|
||||
uptr o = (r + 2 + alignment) & ~(uptr)alignment;
|
||||
if (!r) return NULL;
|
||||
((u16*)o)[-1] = (u16)(o-r);
|
||||
size_t r = (size_t)malloc(size + --alignment + 2);
|
||||
size_t o = (r + 2 + alignment) & ~(size_t)alignment;
|
||||
if(!r) return NULL;
|
||||
((uint16*)o)[-1] = (uint16)(o-r);
|
||||
return (void*)o;
|
||||
}
|
||||
|
||||
void pcsx2_aligned_free(void* p)
|
||||
void _aligned_free(void* p)
|
||||
{
|
||||
if (!p) return;
|
||||
free((void*)((uptr)p-((u16*)p)[-1]));
|
||||
if(!p) return;
|
||||
free((void*)((size_t)p-((uint16*)p)[-1]));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,60 +43,64 @@
|
|||
// stdc
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
|
||||
// Let's take advantage of the work that's already been done on making things cross-platform by bringing this in.
|
||||
|
||||
//#include "Pcsx2Defs.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#define __aligned(t, n) __declspec(align(n)) t
|
||||
|
||||
#else
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// GCC / Intel Compilers Section
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
#define __aligned(t, n) t __attribute__((aligned(n)))
|
||||
#define __assume(cond) ((void)0) // GCC has no equivalent for __assume
|
||||
|
||||
// Inlining note: GCC needs ((unused)) attributes defined on inlined functions to suppress
|
||||
// warnings when a static inlined function isn't used in the scope of a single file (which
|
||||
// happens *by design* like all the friggen time >_<)
|
||||
|
||||
//# define __fastcall __attribute__((fastcall))
|
||||
# ifdef NDEBUG
|
||||
# define __forceinline __attribute__((always_inline,unused))
|
||||
# else
|
||||
# define __forceinline __attribute__((unused))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WINDOWS
|
||||
|
||||
#include <hash_map>
|
||||
#include <hash_set>
|
||||
|
||||
using namespace stdext;
|
||||
|
||||
#define vsnprintf _vsnprintf
|
||||
#define snprintf _snprintf
|
||||
|
||||
#define DIRECTORY_SEPARATOR '\\'
|
||||
|
||||
#else
|
||||
|
||||
#include <ext/hash_map>
|
||||
#include <ext/hash_set>
|
||||
#define _BACKWARD_BACKWARD_WARNING_H
|
||||
|
||||
using namespace __gnu_cxx;
|
||||
#define hash_map map
|
||||
#define hash_set set
|
||||
|
||||
//#include <ext/hash_map>
|
||||
//#include <ext/hash_set>
|
||||
|
||||
//using namespace __gnu_cxx;
|
||||
|
||||
#define DIRECTORY_SEPARATOR '/'
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#define __aligned(t, n) __declspec(align(n)) t
|
||||
|
||||
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type __stdcall
|
||||
#define EXPORT_C EXPORT_C_(void)
|
||||
|
||||
#else
|
||||
|
||||
#define __aligned(t, n) t __attribute__((aligned(n)))
|
||||
#define __fastcall __attribute__((fastcall))
|
||||
|
||||
#define EXPORT_C_(type) extern "C" type
|
||||
#define EXPORT_C EXPORT_C_(void)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -124,30 +128,41 @@ typedef signed long long int64;
|
|||
|
||||
#define countof(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
#define EXPORT_C extern "C" __declspec(dllexport) void __stdcall
|
||||
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type __stdcall
|
||||
|
||||
#define ALIGN_STACK(n) __aligned(int, n) __dummy;
|
||||
|
||||
#ifndef RESTRICT
|
||||
#ifdef __INTEL_COMPILER
|
||||
#define RESTRICT restrict
|
||||
#elif _MSC_VER >= 1400 // TODO: gcc
|
||||
#define RESTRICT __restrict
|
||||
#else
|
||||
#define RESTRICT
|
||||
#endif
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
|
||||
#define RESTRICT restrict
|
||||
|
||||
#elif _MSC_VER >= 1400 // TODO: gcc
|
||||
|
||||
#define RESTRICT __restrict
|
||||
|
||||
#else
|
||||
|
||||
#define RESTRICT
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_DEBUG) && defined(_MSC_VER)
|
||||
|
||||
#include <assert.h>
|
||||
#define ASSERT assert
|
||||
|
||||
#else
|
||||
|
||||
#define ASSERT(exp) ((void)0)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
#define _M_AMD64
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
@ -163,7 +178,7 @@ typedef signed long long int64;
|
|||
|
||||
#define USE_UPSCALE_HACKS // Hacks intended to fix upscaling / rendering glitches in HW renderers
|
||||
|
||||
// dxsdk beta missing these:
|
||||
// dxsdk is missing these:
|
||||
#define D3D11_SHADER_MACRO D3D10_SHADER_MACRO
|
||||
#define ID3D11Blob ID3D10Blob
|
||||
|
||||
|
@ -237,10 +252,34 @@ typedef signed long long int64;
|
|||
|
||||
#undef min
|
||||
#undef max
|
||||
#undef abs
|
||||
|
||||
#if !defined(_MSC_VER) && !defined(HAVE_ALIGNED_MALLOC)
|
||||
#if !defined(_MSC_VER)
|
||||
|
||||
#if !defined(HAVE_ALIGNED_MALLOC)
|
||||
|
||||
extern void* _aligned_malloc(size_t size, size_t alignment);
|
||||
extern void _aligned_free(void* p);
|
||||
|
||||
#endif
|
||||
|
||||
// http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/mingw32/intrin_x86.h?view=markup
|
||||
// - the other intrin_x86.h of pcsx2 is not up to date, its _interlockedbittestandreset simply does not work.
|
||||
|
||||
__forceinline unsigned char _BitScanForward(unsigned long* const Index, const unsigned long Mask)
|
||||
{
|
||||
__asm__("bsfl %[Mask], %[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask));
|
||||
return Mask ? 1 : 0;
|
||||
}
|
||||
|
||||
__forceinline unsigned char _interlockedbittestandreset(volatile long* a, const long b)
|
||||
{
|
||||
unsigned char retval;
|
||||
__asm__("lock; btrl %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
extern void* vmalloc(size_t size, bool code);
|
||||
extern void vmfree(void* ptr);
|
||||
|
|
Loading…
Reference in New Issue