- Experimental OpenCL renderer (missing features: point, line, texture cache, mipmap, aa1, device selection). Needs any OpenCL SDK for the common headers and stub lib to compile, tested with AMD and Intel. Too bad it is not part of the Windows SDK yet.

- Renumbered renderer ids, compatible with old numbering, but it does not follow the mod3 logic anymore.
This commit is contained in:
gabest11 2014-09-15 15:49:16 +02:00 committed by Gregory Hainaut
parent 1b555ea3b5
commit db7c26cde7
21 changed files with 3947 additions and 182 deletions

View File

@ -123,13 +123,13 @@ protected:
int maxcount = std::max<int>(m_maxcount * 3 / 2, 10000);
Vertex* vertices = (Vertex*)_aligned_malloc(sizeof(Vertex) * maxcount, 32);
if (!vertices)
if(vertices == NULL)
{
printf("GSdx: failed to allocate %d bytes for verticles.\n", sizeof(Vertex) * maxcount);
throw GSDXError();
}
if (m_vertices != NULL)
if(m_vertices != NULL)
{
memcpy(vertices, m_vertices, sizeof(Vertex) * m_maxcount);
_aligned_free(m_vertices);

View File

@ -37,6 +37,7 @@
#include "GSWndDX.h"
#include "GSWndWGL.h"
#include "GSRendererCS.h"
#include "GSRendererCL.h"
#include "GSSettingsDlg.h"
static HRESULT s_hr = E_FAIL;
@ -203,6 +204,7 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
}
GSWnd* wnd[2];
try
{
if(s_renderer != renderer)
@ -216,36 +218,23 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
s_gs = NULL;
}
if(renderer == 15)
{
#ifdef _WINDOWS
dev = new GSDevice11();
if(dev == NULL)
{
return -1;
}
delete s_gs;
s_gs = new GSRendererCS();
s_renderer = renderer;
#endif
}
else
{
switch(renderer / 3)
switch(renderer)
{
default:
#ifdef _WINDOWS
case 0: dev = new GSDevice9(); break;
case 1: dev = new GSDevice11(); break;
#endif
case 3: dev = new GSDeviceNull(); break;
case 4: dev = new GSDeviceOGL(); break;
#ifdef _WINDOWS
case 0: case 1: case 2: case 14:
dev = new GSDevice9();
break;
case 3: case 4: case 5: case 15:
dev = new GSDevice11();
break;
#endif
case 9: case 10: case 11: case 16:
dev = new GSDeviceNull();
break;
case 12: case 13: case 17:
dev = new GSDeviceOGL();
break;
}
if(dev == NULL)
@ -255,39 +244,46 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
if(s_gs == NULL)
{
switch(renderer % 3)
{
default:
case 0:
switch(renderer)
{
default:
#ifdef _WINDOWS
case 0: s_gs = (GSRenderer*)new GSRendererDX9(); break;
case 3: s_gs = (GSRenderer*)new GSRendererDX11(); break;
#endif
case 12: s_gs = (GSRenderer*)new GSRendererOGL(); break;
}
case 0:
s_gs = (GSRenderer*)new GSRendererDX9();
break;
case 1:
case 3:
s_gs = (GSRenderer*)new GSRendererDX11();
break;
#endif
case 12:
s_gs = (GSRenderer*)new GSRendererOGL();
break;
case 1: case 4: case 10: case 13:
s_gs = new GSRendererSW(threads);
break;
case 2:
case 2: case 5: case 11:
s_gs = new GSRendererNull();
break;
case 14: case 15: case 16: case 17:
s_gs = new GSRendererCL();
break;
}
s_renderer = renderer;
}
}
if (s_gs->m_wnd == NULL)
{
#ifdef _WINDOWS
if (renderer / 3 == 4)
switch(renderer)
{
case 12: case 13: case 17:
s_gs->m_wnd = new GSWndWGL();
else
break;
default:
s_gs->m_wnd = new GSWndDX();
break;
}
#else
#ifdef ENABLE_GLES
wnd[0] = NULL;
@ -681,9 +677,11 @@ EXPORT_C GSkeyEvent(GSKeyEventData* e)
{
try
{
if (gsopen_done)
if(gsopen_done)
{
s_gs->KeyEvent(e);
}
}
catch (GSDXRecoverableError)
{
}
@ -1218,15 +1216,11 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow
{
::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);
FILE* file = fopen("c:\\temp1\\log.txt", "a");
fprintf(file, "-------------------------\n\n");
Console console("GSdx", true);
if(1)
{
GSLocalMemory * pMem = new GSLocalMemory();
GSLocalMemory& mem(*pMem);
GSLocalMemory* mem = new GSLocalMemory();
static struct {int psm; const char* name;} s_format[] =
{
@ -1258,7 +1252,7 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow
int w = 1 << tbw;
int h = 1 << tbw;
fprintf(file, "%d x %d\n\n", w, h);
printf("%d x %d\n\n", w, h);
for(size_t i = 0; i < countof(s_format); i++)
{
@ -1308,7 +1302,7 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow
clock_t start, end;
_ftprintf(file, _T("[%4s] "), s_format[i].name);
printf("[%4s] ", s_format[i].name);
start = clock();
@ -1317,12 +1311,12 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow
int x = 0;
int y = 0;
(mem.*wi)(x, y, ptr, trlen, BITBLTBUF, TRXPOS, TRXREG);
(mem->*wi)(x, y, ptr, trlen, BITBLTBUF, TRXPOS, TRXREG);
}
end = clock();
fprintf(file, "%6d %6d | ", (int)((float)trlen * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000));
printf("%6d %6d | ", (int)((float)trlen * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000));
start = clock();
@ -1331,25 +1325,25 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow
int x = 0;
int y = 0;
(mem.*ri)(x, y, ptr, trlen, BITBLTBUF, TRXPOS, TRXREG);
(mem->*ri)(x, y, ptr, trlen, BITBLTBUF, TRXPOS, TRXREG);
}
end = clock();
fprintf(file, "%6d %6d | ", (int)((float)trlen * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000));
printf("%6d %6d | ", (int)((float)trlen * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000));
const GSOffset* o = mem.GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
const GSOffset* o = mem->GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
start = clock();
for(int j = 0; j < n; j++)
{
(mem.*rtx)(o, r, ptr, w * 4, TEXA);
(mem->*rtx)(o, r, ptr, w * 4, TEXA);
}
end = clock();
fprintf(file, "%6d %6d ", (int)((float)len * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000));
printf("%6d %6d ", (int)((float)len * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000));
if(psm.pal > 0)
{
@ -1357,32 +1351,30 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow
for(int j = 0; j < n; j++)
{
(mem.*rtxP)(o, r, ptr, w, TEXA);
(mem->*rtxP)(o, r, ptr, w, TEXA);
}
end = clock();
fprintf(file, "| %6d %6d ", (int)((float)len * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000));
printf("| %6d %6d ", (int)((float)len * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000));
}
fprintf(file, "\n");
fflush(file);
printf("\n");
}
fprintf(file, "\n");
printf("\n");
}
_aligned_free(ptr);
delete pMem;
delete mem;
}
//
if(0)
{
GSLocalMemory * pMem2 = new GSLocalMemory();
GSLocalMemory& mem2(*pMem2);
GSLocalMemory* mem = new GSLocalMemory();
uint8* ptr = (uint8*)_aligned_malloc(1024 * 1024 * 4, 32);
@ -1413,13 +1405,13 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow
int x = 0;
int y = 0;
(mem2.*wi)(x, y, ptr, trlen, BITBLTBUF, TRXPOS, TRXREG);
delete pMem2;
(mem->*wi)(x, y, ptr, trlen, BITBLTBUF, TRXPOS, TRXREG);
delete mem;
}
//
fclose(file);
PostQuitMessage(0);
}

View File

@ -173,7 +173,6 @@ public: // TODO
// Shaders...
hash_map<uint32, GSVertexShader9 > m_vs;
D3DXHANDLE m_vs_params;
hash_map<uint32, CComPtr<IDirect3DPixelShader9> > m_ps;
hash_map<uint32, Direct3DSamplerState9* > m_ps_ss;
hash_map<uint32, Direct3DDepthStencilState9* > m_om_dss;

View File

@ -692,14 +692,14 @@ void GSLocalMemory::WriteImageColumn(int l, int r, int y, int h, const uint8* sr
{
switch(psm)
{
case PSM_PSMCT32: WriteColumn32<alignment, 0xffffffff>(y, BlockPtr32(x, y, bp, bw), &src[x * 4], srcpitch); break;
case PSM_PSMCT16: WriteColumn16<alignment>(y, BlockPtr16(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMCT16S: WriteColumn16<alignment>(y, BlockPtr16S(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMT8: WriteColumn8<alignment>(y, BlockPtr8(x, y, bp, bw), &src[x], srcpitch); break;
case PSM_PSMT4: WriteColumn4<alignment>(y, BlockPtr4(x, y, bp, bw), &src[x >> 1], srcpitch); break;
case PSM_PSMZ32: WriteColumn32<alignment, 0xffffffff>(y, BlockPtr32Z(x, y, bp, bw), &src[x * 4], srcpitch); break;
case PSM_PSMZ16: WriteColumn16<alignment>(y, BlockPtr16Z(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMZ16S: WriteColumn16<alignment>(y, BlockPtr16SZ(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMCT32: GSBlock::WriteColumn32<alignment, 0xffffffff>(y, BlockPtr32(x, y, bp, bw), &src[x * 4], srcpitch); break;
case PSM_PSMCT16: GSBlock::WriteColumn16<alignment>(y, BlockPtr16(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMCT16S: GSBlock::WriteColumn16<alignment>(y, BlockPtr16S(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMT8: GSBlock::WriteColumn8<alignment>(y, BlockPtr8(x, y, bp, bw), &src[x], srcpitch); break;
case PSM_PSMT4: GSBlock::WriteColumn4<alignment>(y, BlockPtr4(x, y, bp, bw), &src[x >> 1], srcpitch); break;
case PSM_PSMZ32: GSBlock::WriteColumn32<alignment, 0xffffffff>(y, BlockPtr32Z(x, y, bp, bw), &src[x * 4], srcpitch); break;
case PSM_PSMZ16: GSBlock::WriteColumn16<alignment>(y, BlockPtr16Z(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMZ16S: GSBlock::WriteColumn16<alignment>(y, BlockPtr16SZ(x, y, bp, bw), &src[x * 2], srcpitch); break;
// TODO
default: __assume(0);
}
@ -719,14 +719,14 @@ void GSLocalMemory::WriteImageBlock(int l, int r, int y, int h, const uint8* src
{
switch(psm)
{
case PSM_PSMCT32: WriteBlock32<alignment, 0xffffffff>(BlockPtr32(x, y, bp, bw), &src[x * 4], srcpitch); break;
case PSM_PSMCT16: WriteBlock16<alignment>(BlockPtr16(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMCT16S: WriteBlock16<alignment>(BlockPtr16S(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMT8: WriteBlock8<alignment>(BlockPtr8(x, y, bp, bw), &src[x], srcpitch); break;
case PSM_PSMT4: WriteBlock4<alignment>(BlockPtr4(x, y, bp, bw), &src[x >> 1], srcpitch); break;
case PSM_PSMZ32: WriteBlock32<alignment, 0xffffffff>(BlockPtr32Z(x, y, bp, bw), &src[x * 4], srcpitch); break;
case PSM_PSMZ16: WriteBlock16<alignment>(BlockPtr16Z(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMZ16S: WriteBlock16<alignment>(BlockPtr16SZ(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMCT32: GSBlock::WriteBlock32<alignment, 0xffffffff>(BlockPtr32(x, y, bp, bw), &src[x * 4], srcpitch); break;
case PSM_PSMCT16: GSBlock::WriteBlock16<alignment>(BlockPtr16(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMCT16S: GSBlock::WriteBlock16<alignment>(BlockPtr16S(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMT8: GSBlock::WriteBlock8<alignment>(BlockPtr8(x, y, bp, bw), &src[x], srcpitch); break;
case PSM_PSMT4: GSBlock::WriteBlock4<alignment>(BlockPtr4(x, y, bp, bw), &src[x >> 1], srcpitch); break;
case PSM_PSMZ32: GSBlock::WriteBlock32<alignment, 0xffffffff>(BlockPtr32Z(x, y, bp, bw), &src[x * 4], srcpitch); break;
case PSM_PSMZ16: GSBlock::WriteBlock16<alignment>(BlockPtr16Z(x, y, bp, bw), &src[x * 2], srcpitch); break;
case PSM_PSMZ16S: GSBlock::WriteBlock16<alignment>(BlockPtr16SZ(x, y, bp, bw), &src[x * 2], srcpitch); break;
// TODO
default: __assume(0);
}
@ -801,27 +801,27 @@ void GSLocalMemory::WriteImageTopBottom(int l, int r, int y, int h, const uint8*
{
case PSM_PSMCT32:
case PSM_PSMZ32:
ReadColumn32(y, dst, buff, 32);
GSBlock::ReadColumn32(y, dst, buff, 32);
memcpy(&buff[32], &src[x * 4], 32);
WriteColumn32<32, 0xffffffff>(y, dst, buff, 32);
GSBlock::WriteColumn32<32, 0xffffffff>(y, dst, buff, 32);
break;
case PSM_PSMCT16:
case PSM_PSMCT16S:
case PSM_PSMZ16:
case PSM_PSMZ16S:
ReadColumn16(y, dst, buff, 32);
GSBlock::ReadColumn16(y, dst, buff, 32);
memcpy(&buff[32], &src[x * 2], 32);
WriteColumn16<32>(y, dst, buff, 32);
GSBlock::WriteColumn16<32>(y, dst, buff, 32);
break;
case PSM_PSMT8:
ReadColumn8(y, dst, buff, 16);
GSBlock::ReadColumn8(y, dst, buff, 16);
for(int i = 0, j = y2; i < h2; i++, j++) memcpy(&buff[j * 16], &src[i * srcpitch + x], 16);
WriteColumn8<32>(y, dst, buff, 16);
GSBlock::WriteColumn8<32>(y, dst, buff, 16);
break;
case PSM_PSMT4:
ReadColumn4(y, dst, buff, 16);
GSBlock::ReadColumn4(y, dst, buff, 16);
for(int i = 0, j = y2; i < h2; i++, j++) memcpy(&buff[j * 16], &src[i * srcpitch + (x >> 1)], 16);
WriteColumn4<32>(y, dst, buff, 16);
GSBlock::WriteColumn4<32>(y, dst, buff, 16);
break;
// TODO
default:
@ -888,27 +888,27 @@ void GSLocalMemory::WriteImageTopBottom(int l, int r, int y, int h, const uint8*
{
case PSM_PSMCT32:
case PSM_PSMZ32:
ReadColumn32(y, dst, buff, 32);
GSBlock::ReadColumn32(y, dst, buff, 32);
memcpy(&buff[0], &src[x * 4], 32);
WriteColumn32<32, 0xffffffff>(y, dst, buff, 32);
GSBlock::WriteColumn32<32, 0xffffffff>(y, dst, buff, 32);
break;
case PSM_PSMCT16:
case PSM_PSMCT16S:
case PSM_PSMZ16:
case PSM_PSMZ16S:
ReadColumn16(y, dst, buff, 32);
GSBlock::ReadColumn16(y, dst, buff, 32);
memcpy(&buff[0], &src[x * 2], 32);
WriteColumn16<32>(y, dst, buff, 32);
GSBlock::WriteColumn16<32>(y, dst, buff, 32);
break;
case PSM_PSMT8:
ReadColumn8(y, dst, buff, 16);
GSBlock::ReadColumn8(y, dst, buff, 16);
for(int i = 0; i < h; i++) memcpy(&buff[i * 16], &src[i * srcpitch + x], 16);
WriteColumn8<32>(y, dst, buff, 16);
GSBlock::WriteColumn8<32>(y, dst, buff, 16);
break;
case PSM_PSMT4:
ReadColumn4(y, dst, buff, 16);
GSBlock::ReadColumn4(y, dst, buff, 16);
for(int i = 0; i < h; i++) memcpy(&buff[i * 16], &src[i * srcpitch + (x >> 1)], 16);
WriteColumn4<32>(y, dst, buff, 16);
GSBlock::WriteColumn4<32>(y, dst, buff, 16);
break;
// TODO
default:
@ -1060,7 +1060,7 @@ void GSLocalMemory::WriteImage24(int& tx, int& ty, const uint8* src, int len, GI
{
for(int x = tx; x < tw; x += 8)
{
UnpackAndWriteBlock24(src + (x - tx) * 3, srcpitch, BlockPtr32(x, y, bp, bw));
GSBlock::UnpackAndWriteBlock24(src + (x - tx) * 3, srcpitch, BlockPtr32(x, y, bp, bw));
}
}
@ -1094,7 +1094,7 @@ void GSLocalMemory::WriteImage8H(int& tx, int& ty, const uint8* src, int len, GI
{
for(int x = tx; x < tw; x += 8)
{
UnpackAndWriteBlock8H(src + (x - tx), srcpitch, BlockPtr32(x, y, bp, bw));
GSBlock::UnpackAndWriteBlock8H(src + (x - tx), srcpitch, BlockPtr32(x, y, bp, bw));
}
}
@ -1128,7 +1128,7 @@ void GSLocalMemory::WriteImage4HL(int& tx, int& ty, const uint8* src, int len, G
{
for(int x = tx; x < tw; x += 8)
{
UnpackAndWriteBlock4HL(src + (x - tx) / 2, srcpitch, BlockPtr32(x, y, bp, bw));
GSBlock::UnpackAndWriteBlock4HL(src + (x - tx) / 2, srcpitch, BlockPtr32(x, y, bp, bw));
}
}
@ -1162,7 +1162,7 @@ void GSLocalMemory::WriteImage4HH(int& tx, int& ty, const uint8* src, int len, G
{
for(int x = tx; x < tw; x += 8)
{
UnpackAndWriteBlock4HH(src + (x - tx) / 2, srcpitch, BlockPtr32(x, y, bp, bw));
GSBlock::UnpackAndWriteBlock4HH(src + (x - tx) / 2, srcpitch, BlockPtr32(x, y, bp, bw));
}
}
@ -1196,7 +1196,7 @@ void GSLocalMemory::WriteImage24Z(int& tx, int& ty, const uint8* src, int len, G
{
for(int x = tx; x < tw; x += 8)
{
UnpackAndWriteBlock24(src + (x - tx) * 3, srcpitch, BlockPtr32Z(x, y, bp, bw));
GSBlock::UnpackAndWriteBlock24(src + (x - tx) * 3, srcpitch, BlockPtr32Z(x, y, bp, bw));
}
}
@ -1612,7 +1612,7 @@ void GSLocalMemory::ReadTexture32(const GSOffset* RESTRICT o, const GSVector4i&
{
FOREACH_BLOCK_START(r, 8, 8, 32)
{
ReadBlock32(src, dst, dstpitch);
GSBlock::ReadBlock32(src, dst, dstpitch);
}
FOREACH_BLOCK_END
}
@ -1623,7 +1623,7 @@ void GSLocalMemory::ReadTexture24(const GSOffset* RESTRICT o, const GSVector4i&
{
FOREACH_BLOCK_START(r, 8, 8, 32)
{
ReadAndExpandBlock24<true>(src, dst, dstpitch, TEXA);
GSBlock::ReadAndExpandBlock24<true>(src, dst, dstpitch, TEXA);
}
FOREACH_BLOCK_END
}
@ -1631,7 +1631,7 @@ void GSLocalMemory::ReadTexture24(const GSOffset* RESTRICT o, const GSVector4i&
{
FOREACH_BLOCK_START(r, 8, 8, 32)
{
ReadAndExpandBlock24<false>(src, dst, dstpitch, TEXA);
GSBlock::ReadAndExpandBlock24<false>(src, dst, dstpitch, TEXA);
}
FOREACH_BLOCK_END
}
@ -1643,7 +1643,7 @@ void GSLocalMemory::ReadTexture16(const GSOffset* RESTRICT o, const GSVector4i&
{
FOREACH_BLOCK_START(r, 16, 8, 32)
{
ReadAndExpandBlock16<true>(src, dst, dstpitch, TEXA);
GSBlock::ReadAndExpandBlock16<true>(src, dst, dstpitch, TEXA);
}
FOREACH_BLOCK_END
}
@ -1651,7 +1651,7 @@ void GSLocalMemory::ReadTexture16(const GSOffset* RESTRICT o, const GSVector4i&
{
FOREACH_BLOCK_START(r, 16, 8, 32)
{
ReadAndExpandBlock16<false>(src, dst, dstpitch, TEXA);
GSBlock::ReadAndExpandBlock16<false>(src, dst, dstpitch, TEXA);
}
FOREACH_BLOCK_END
}
@ -1663,7 +1663,7 @@ void GSLocalMemory::ReadTexture8(const GSOffset* RESTRICT o, const GSVector4i& r
FOREACH_BLOCK_START(r, 16, 16, 32)
{
ReadAndExpandBlock8_32(src, dst, dstpitch, pal);
GSBlock::ReadAndExpandBlock8_32(src, dst, dstpitch, pal);
}
FOREACH_BLOCK_END
}
@ -1674,7 +1674,7 @@ void GSLocalMemory::ReadTexture4(const GSOffset* RESTRICT o, const GSVector4i& r
FOREACH_BLOCK_START(r, 32, 16, 32)
{
ReadAndExpandBlock4_32(src, dst, dstpitch, pal);
GSBlock::ReadAndExpandBlock4_32(src, dst, dstpitch, pal);
}
FOREACH_BLOCK_END
}
@ -1685,7 +1685,7 @@ void GSLocalMemory::ReadTexture8H(const GSOffset* RESTRICT o, const GSVector4i&
FOREACH_BLOCK_START(r, 8, 8, 32)
{
ReadAndExpandBlock8H_32(src, dst, dstpitch, pal);
GSBlock::ReadAndExpandBlock8H_32(src, dst, dstpitch, pal);
}
FOREACH_BLOCK_END
}
@ -1696,7 +1696,7 @@ void GSLocalMemory::ReadTexture4HL(const GSOffset* RESTRICT o, const GSVector4i&
FOREACH_BLOCK_START(r, 8, 8, 32)
{
ReadAndExpandBlock4HL_32(src, dst, dstpitch, pal);
GSBlock::ReadAndExpandBlock4HL_32(src, dst, dstpitch, pal);
}
FOREACH_BLOCK_END
}
@ -1707,7 +1707,7 @@ void GSLocalMemory::ReadTexture4HH(const GSOffset* RESTRICT o, const GSVector4i&
FOREACH_BLOCK_START(r, 8, 8, 32)
{
ReadAndExpandBlock4HH_32(src, dst, dstpitch, pal);
GSBlock::ReadAndExpandBlock4HH_32(src, dst, dstpitch, pal);
}
FOREACH_BLOCK_END
}
@ -1718,7 +1718,7 @@ void GSLocalMemory::ReadTextureBlock32(uint32 bp, uint8* dst, int dstpitch, cons
{
ALIGN_STACK(32);
ReadBlock32(BlockPtr(bp), dst, dstpitch);
GSBlock::ReadBlock32(BlockPtr(bp), dst, dstpitch);
}
void GSLocalMemory::ReadTextureBlock24(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
@ -1727,11 +1727,11 @@ void GSLocalMemory::ReadTextureBlock24(uint32 bp, uint8* dst, int dstpitch, cons
if(TEXA.AEM)
{
ReadAndExpandBlock24<true>(BlockPtr(bp), dst, dstpitch, TEXA);
GSBlock::ReadAndExpandBlock24<true>(BlockPtr(bp), dst, dstpitch, TEXA);
}
else
{
ReadAndExpandBlock24<false>(BlockPtr(bp), dst, dstpitch, TEXA);
GSBlock::ReadAndExpandBlock24<false>(BlockPtr(bp), dst, dstpitch, TEXA);
}
}
@ -1741,11 +1741,11 @@ void GSLocalMemory::ReadTextureBlock16(uint32 bp, uint8* dst, int dstpitch, cons
if(TEXA.AEM)
{
ReadAndExpandBlock16<true>(BlockPtr(bp), dst, dstpitch, TEXA);
GSBlock::ReadAndExpandBlock16<true>(BlockPtr(bp), dst, dstpitch, TEXA);
}
else
{
ReadAndExpandBlock16<false>(BlockPtr(bp), dst, dstpitch, TEXA);
GSBlock::ReadAndExpandBlock16<false>(BlockPtr(bp), dst, dstpitch, TEXA);
}
}
@ -1753,35 +1753,35 @@ void GSLocalMemory::ReadTextureBlock8(uint32 bp, uint8* dst, int dstpitch, const
{
ALIGN_STACK(32);
ReadAndExpandBlock8_32(BlockPtr(bp), dst, dstpitch, m_clut);
GSBlock::ReadAndExpandBlock8_32(BlockPtr(bp), dst, dstpitch, m_clut);
}
void GSLocalMemory::ReadTextureBlock4(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
ALIGN_STACK(32);
ReadAndExpandBlock4_32(BlockPtr(bp), dst, dstpitch, m_clut);
GSBlock::ReadAndExpandBlock4_32(BlockPtr(bp), dst, dstpitch, m_clut);
}
void GSLocalMemory::ReadTextureBlock8H(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
ALIGN_STACK(32);
ReadAndExpandBlock8H_32(BlockPtr(bp), dst, dstpitch, m_clut);
GSBlock::ReadAndExpandBlock8H_32(BlockPtr(bp), dst, dstpitch, m_clut);
}
void GSLocalMemory::ReadTextureBlock4HL(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
ALIGN_STACK(32);
ReadAndExpandBlock4HL_32(BlockPtr(bp), dst, dstpitch, m_clut);
GSBlock::ReadAndExpandBlock4HL_32(BlockPtr(bp), dst, dstpitch, m_clut);
}
void GSLocalMemory::ReadTextureBlock4HH(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
ALIGN_STACK(32);
ReadAndExpandBlock4HH_32(BlockPtr(bp), dst, dstpitch, m_clut);
GSBlock::ReadAndExpandBlock4HH_32(BlockPtr(bp), dst, dstpitch, m_clut);
}
///////////////////
@ -1870,7 +1870,7 @@ void GSLocalMemory::ReadTexture8P(const GSOffset* RESTRICT o, const GSVector4i&
{
FOREACH_BLOCK_START(r, 16, 16, 8)
{
ReadBlock8(src, dst, dstpitch);
GSBlock::ReadBlock8(src, dst, dstpitch);
}
FOREACH_BLOCK_END
}
@ -1879,7 +1879,7 @@ void GSLocalMemory::ReadTexture4P(const GSOffset* RESTRICT o, const GSVector4i&
{
FOREACH_BLOCK_START(r, 32, 16, 8)
{
ReadBlock4P(src, dst, dstpitch);
GSBlock::ReadBlock4P(src, dst, dstpitch);
}
FOREACH_BLOCK_END
}
@ -1888,7 +1888,7 @@ void GSLocalMemory::ReadTexture8HP(const GSOffset* RESTRICT o, const GSVector4i&
{
FOREACH_BLOCK_START(r, 8, 8, 8)
{
ReadBlock8HP(src, dst, dstpitch);
GSBlock::ReadBlock8HP(src, dst, dstpitch);
}
FOREACH_BLOCK_END
}
@ -1897,7 +1897,7 @@ void GSLocalMemory::ReadTexture4HLP(const GSOffset* RESTRICT o, const GSVector4i
{
FOREACH_BLOCK_START(r, 8, 8, 8)
{
ReadBlock4HLP(src, dst, dstpitch);
GSBlock::ReadBlock4HLP(src, dst, dstpitch);
}
FOREACH_BLOCK_END
}
@ -1906,7 +1906,7 @@ void GSLocalMemory::ReadTexture4HHP(const GSOffset* RESTRICT o, const GSVector4i
{
FOREACH_BLOCK_START(r, 8, 8, 8)
{
ReadBlock4HHP(src, dst, dstpitch);
GSBlock::ReadBlock4HHP(src, dst, dstpitch);
}
FOREACH_BLOCK_END
}
@ -1915,35 +1915,35 @@ void GSLocalMemory::ReadTexture4HHP(const GSOffset* RESTRICT o, const GSVector4i
void GSLocalMemory::ReadTextureBlock8P(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
ReadBlock8(BlockPtr(bp), dst, dstpitch);
GSBlock::ReadBlock8(BlockPtr(bp), dst, dstpitch);
}
void GSLocalMemory::ReadTextureBlock4P(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
ALIGN_STACK(32);
ReadBlock4P(BlockPtr(bp), dst, dstpitch);
GSBlock::ReadBlock4P(BlockPtr(bp), dst, dstpitch);
}
void GSLocalMemory::ReadTextureBlock8HP(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
ALIGN_STACK(32);
ReadBlock8HP(BlockPtr(bp), dst, dstpitch);
GSBlock::ReadBlock8HP(BlockPtr(bp), dst, dstpitch);
}
void GSLocalMemory::ReadTextureBlock4HLP(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
ALIGN_STACK(32);
ReadBlock4HLP(BlockPtr(bp), dst, dstpitch);
GSBlock::ReadBlock4HLP(BlockPtr(bp), dst, dstpitch);
}
void GSLocalMemory::ReadTextureBlock4HHP(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const
{
ALIGN_STACK(32);
ReadBlock4HHP(BlockPtr(bp), dst, dstpitch);
GSBlock::ReadBlock4HHP(BlockPtr(bp), dst, dstpitch);
}
//

View File

@ -76,7 +76,7 @@ struct GSPixelOffset4
uint32 fbp, zbp, fpsm, zpsm, bw;
};
class GSLocalMemory : public GSBlock
class GSLocalMemory : public GSAlignedClass<32>
{
public:
typedef uint32 (*pixelAddress)(int x, int y, uint32 bp, uint32 bw);

File diff suppressed because it is too large Load Diff

310
plugins/GSdx/GSRendererCL.h Normal file
View File

@ -0,0 +1,310 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#pragma once
#include "GSRenderer.h"
//#include "GSTextureCacheCL.h"
__aligned(struct, 32) GSVertexCL
{
GSVector4 p, t;
};
class GSRendererCL : public GSRenderer
{
typedef void (GSRendererCL::*ConvertVertexBufferPtr)(GSVertexCL* RESTRICT dst, const GSVertex* RESTRICT src, size_t count);
ConvertVertexBufferPtr m_cvb[4][2][2];
template<uint32 primclass, uint32 tme, uint32 fst>
void ConvertVertexBuffer(GSVertexCL* RESTRICT dst, const GSVertex* RESTRICT src, size_t count);
union PrimSelector
{
struct
{
uint32 prim:2; // 0
};
uint32 key;
operator uint32() const { return key; }
};
union TileSelector
{
struct
{
uint32 prim:2; // 0
uint32 mode:2; // 2
uint32 clear:1; // 4
};
uint32 key;
operator uint32() const { return key; }
};
union JobSelector
{
struct
{
uint32 dummy:1; // 0
};
uint32 key;
operator uint32() const { return key; }
};
union TFXSelector
{
struct
{
uint32 fpsm:3; // 0
uint32 zpsm:3; // 3
uint32 ztst:2; // 6 (0: off, 1: write, 2: test (ge), 3: test (g))
uint32 atst:3; // 8
uint32 afail:2; // 11
uint32 iip:1; // 13
uint32 tfx:3; // 14
uint32 tcc:1; // 17
uint32 fst:1; // 18
uint32 ltf:1; // 19
uint32 tlu:1; // 20
uint32 fge:1; // 21
uint32 date:1; // 22
uint32 abe:1; // 23
uint32 aba:2; // 24
uint32 abb:2; // 26
uint32 abc:2; // 28
uint32 abd:2; // 30
uint32 pabe:1; // 32
uint32 aa1:1; // 33
uint32 fwrite:1; // 34
uint32 ftest:1; // 35
uint32 rfb:1; // 36
uint32 zwrite:1; // 37
uint32 ztest:1; // 38
uint32 zoverflow:1; // 39 (z max >= 0x80000000)
uint32 wms:2; // 40
uint32 wmt:2; // 42
uint32 datm:1; // 44
uint32 colclamp:1; // 45
uint32 fba:1; // 46
uint32 dthe:1; // 47
uint32 prim:2; // 48
uint32 tw:3; // 50 (encodes values between 3 -> 10, texture cache makes sure it is at least 3)
uint32 lcm:1; // 53
uint32 mmin:2; // 54
uint32 noscissor:1; // 55
uint32 tpsm:4; // 56
uint32 aem:1; // 60
// TODO
};
struct
{
uint32 _pad1:24;
uint32 ababcd:8;
uint32 _pad2:2;
uint32 fb:2;
uint32 _pad3:1;
uint32 zb:2;
};
struct
{
uint32 lo;
uint32 hi;
};
uint64 key;
operator uint64() const { return key; }
bool IsSolidRect() const
{
return prim == GS_SPRITE_CLASS
&& iip == 0
&& tfx == TFX_NONE
&& abe == 0
&& ztst <= 1
&& atst <= 1
&& date == 0
&& fge == 0;
}
};
__aligned(struct, 32) TFXParameter
{
GSVector4i scissor;
GSVector4i bbox;
GSVector4i rect;
GSVector4i dimx; // 4x4 signed char
TFXSelector sel;
uint32 fbp, zbp, bw;
uint32 fm, zm;
uint32 fog; // rgb
uint8 aref, afix;
uint8 ta0, ta1;
uint32 tbp[7], tbw[7];
int minu, maxu, minv, maxv; // umsk, ufix, vmsk, vfix
int lod; // lcm == 1
int mxl;
float l; // TEX1.L * -0x10000
float k; // TEX1.K * 0x10000
uint32 clut[256];
};
struct TFXJob
{
struct {int x, y, z, w;} rect;
TFXSelector sel;
uint32 ib_start, ib_count;
uint32 pb_start;
};
class CL
{
std::string kernel_str;
std::map<uint32, cl::Kernel> prim_map;
std::map<uint32, cl::Kernel> tile_map;
std::map<uint64, cl::Kernel> tfx_map;
public:
std::vector<cl::Device> devices;
cl::Context context;
cl::CommandQueue queue[3];
cl::Buffer vm;
cl::Buffer tex;
struct { cl::Buffer buff[2]; size_t head, tail, size; unsigned char* ptr; void* mapped_ptr; } vb, ib, pb;
cl::Buffer env;
cl::CommandQueue* wq;
int wqidx;
size_t WIs;
public:
CL();
virtual ~CL();
cl::Kernel& GetPrimKernel(const PrimSelector& sel);
cl::Kernel& GetTileKernel(const TileSelector& sel);
cl::Kernel& GetTFXKernel(const TFXSelector& sel);
void Map();
void Unmap();
};
CL m_cl;
std::list<TFXJob> m_jobs;
uint32 m_vb_start;
uint32 m_vb_count;
void Enqueue();
/*
class RasterizerData : public GSAlignedClass<32>
{
__aligned(struct, 16) TextureLevel
{
GSVector4i r;
// TODO: GSTextureCacheCL::Texture* t;
};
public:
GSRendererCL* m_parent;
const uint32* m_fb_pages;
const uint32* m_zb_pages;
//cl::Buffer m_vbuff;
//cl::Buffer m_ibuff;
// TODO: buffers
TextureLevel m_tex[7 + 1]; // NULL terminated
//cl::Buffer m_clut;
//cl::Buffer m_dimx;
// TODO: struct in a cl::Buffer
TFXSelector m_sel;
GSVector4i m_scissor;
GSVector4i m_bbox;
uint32 m_fm, m_zm;
int m_aref, m_afix;
uint32 m_fog; // rgb
int m_lod; // lcm == 1
int m_mxl;
float m_l; // TEX1.L * -0x10000
float m_k; // TEX1.K * 0x10000
// TODO: struct { GSVector4i min, max, minmax, mask, invmask; } t; // [u] x 4 [v] x 4
RasterizerData(GSRendererCL* parent)
: m_parent(parent)
, m_fb_pages(NULL)
, m_zb_pages(NULL)
{
m_sel.key = 0;
}
virtual ~RasterizerData()
{
// TODO: ReleasePages();
}
// TODO: void UsePages(const uint32* fb_pages, int fpsm, const uint32* zb_pages, int zpsm);
// TODO: void ReleasePages();
// TODO: void SetSource(GSTextureCacheCL::Texture* t, const GSVector4i& r, int level);
// TODO: void UpdateSource();
};
*/
protected:
// GSTextureCacheCL* m_tc;
GSTexture* m_texture[2];
uint8* m_output;
uint8 m_rw_pages[512]; // TODO: bit array for faster clearing (bit 0: write, bit 1: read)
uint8 m_tex_pages[512];
uint32 m_tmp_pages[512 + 1];
void Reset();
void VSync(int field);
void ResetDevice();
GSTexture* GetOutput(int i);
void Draw();
void Sync(int reason);
void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r);
void InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut = false);
void UsePages(const uint32* pages, int type);
void ReleasePages(const uint32* pages, int type);
//bool CheckSourcePages(RasterizerData* data);
bool SetupParameter(TFXParameter* pb, GSVertexCL* vertex, size_t vertex_count, const uint32* index, size_t index_count);
public:
GSRendererCL();
virtual ~GSRendererCL();
};

View File

@ -429,6 +429,15 @@ void GSRendererSW::Draw()
GSVector4i scissor = GSVector4i(context->scissor.in);
GSVector4i bbox = GSVector4i(m_vt.m_min.p.floor().xyxy(m_vt.m_max.p.ceil()));
// points and lines may have zero area bbox (single line: 0, 0 - 256, 0)
if(m_vt.m_primclass == GS_POINT_CLASS || m_vt.m_primclass == GS_LINE_CLASS)
{
if(bbox.x == bbox.z) bbox.z++;
if(bbox.y == bbox.w) bbox.w++;
}
GSVector4i r = bbox.rintersect(scissor);
scissor.z = std::min<int>(scissor.z, (int)context->FRAME.FBW * 64); // TODO: find a game that overflows and check which one is the right behaviour
@ -973,7 +982,7 @@ bool GSRendererSW::GetScanlineGlobalData(SharedData* data)
gd.sel.zpsm = 3;
gd.sel.atst = ATST_ALWAYS;
gd.sel.tfx = TFX_NONE;
gd.sel.ababcd = 255;
gd.sel.ababcd = 0xff;
gd.sel.prim = primclass;
uint32 fm = context->FRAME.FBMSK;
@ -1101,7 +1110,7 @@ bool GSRendererSW::GetScanlineGlobalData(SharedData* data)
gd.sel.mmin = (context->TEX1.MMIN & 1) + 1; // 1: round, 2: tri
gd.sel.lcm = context->TEX1.LCM;
int mxl = (std::min<int>((int)context->TEX1.MXL, 6) << 16);
int mxl = std::min<int>((int)context->TEX1.MXL, 6) << 16;
int k = context->TEX1.K << 12;
if((int)m_vt.m_lod.x >= (int)context->TEX1.MXL)

View File

@ -329,17 +329,20 @@ void GSSettingsDlg::UpdateRenderers()
{
GSSetting r = theApp.m_gs_renderers[i];
if(i >= 3 && i <= 5)
if(r.id >= 3 && r.id <= 5 || r.id == 15)
{
if(level < D3D_FEATURE_LEVEL_10_0) continue;
r.name = std::string("Direct3D") + (level >= D3D_FEATURE_LEVEL_11_0 ? "11" : "10");
r.name += (level >= D3D_FEATURE_LEVEL_11_0 ? "11" : "10");
}
renderers.push_back(r);
if (r.id == renderer_setting)
if(r.id == renderer_setting)
{
renderer_sel = renderer_setting;
}
}
ComboBoxInit(IDC_RENDERER, renderers, renderer_sel);
}
@ -607,13 +610,13 @@ bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
break;
case IDC_SPRITEHACK:
helpstr = "Sprite Hack\n\nHelps getting rid of black inner lines in some filtered sprites."
" Half option is the preferred one. Use it for Mana Khemia or Ar tonelico for example."
" Half option is the preferred one. Use it for Mana Khemia or Ar Tonelico for example."
" Full can be used for Tales of Destiny.";
break;
case IDC_WILDHACK:
helpstr = "WildArms\n\nLowers the GS precision to avoid gaps between pixels when"
" upscaling. Full option fixes the text on WildArms games, while Half option might improve portraits"
" in Ar tonelico.";
" in Ar Tonelico.";
break;
case IDC_MSAACB:
case IDC_STATIC_MSAA:

View File

@ -1551,7 +1551,8 @@ void GSState::Read(uint8* mem, int len)
return;
}
if (!m_init_read_fifo_supported) {
if(!m_init_read_fifo_supported)
{
if(m_tr.x == sx && m_tr.y == sy)
{
InvalidateLocalMem(m_env.BITBLTBUF, GSVector4i(sx, sy, sx + w, sy + h));
@ -2316,20 +2317,20 @@ void GSState::GrowVertexBuffer()
GSVertex* vertex = (GSVertex*)_aligned_malloc(sizeof(GSVertex) * maxcount, 32);
uint32* index = (uint32*)_aligned_malloc(sizeof(uint32) * maxcount * 3, 32); // worst case is slightly less than vertex number * 3
if (!vertex || !index)
if(vertex == NULL || index == NULL)
{
printf("GSdx: failed to allocate %d bytes for verticles and %d for indices.\n", sizeof(GSVertex) * maxcount, sizeof(uint32) * maxcount * 3);
throw GSDXError();
}
if (m_vertex.buff != NULL)
if(m_vertex.buff != NULL)
{
memcpy(vertex, m_vertex.buff, sizeof(GSVertex) * m_vertex.tail);
_aligned_free(m_vertex.buff);
}
if (m_index.buff != NULL)
if(m_index.buff != NULL)
{
memcpy(index, m_index.buff, sizeof(uint32) * m_index.tail);

View File

@ -41,8 +41,29 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
return TRUE;
}
bool GSdxApp::LoadResource(int id, vector<unsigned char>& buff, const char* type)
{
buff.clear();
HRSRC hRsrc = FindResource((HMODULE)s_hModule, MAKEINTRESOURCE(id), type != NULL ? type : RT_RCDATA);
if(!hRsrc) return false;
HGLOBAL hGlobal = ::LoadResource((HMODULE)s_hModule, hRsrc);
if(!hGlobal) return false;
DWORD size = SizeofResource((HMODULE)s_hModule, hRsrc);
if(!size) return false;
buff.resize(size);
memcpy(buff.data(), LockResource(hGlobal), size);
return true;
}
#else
bool GSdxApp::LoadResource(int id, vector<unsigned char>& buff, const char* type)
{
buff.clear();
printf("LoadResource not implemented\n");
return false;
}
size_t GSdxApp::GetPrivateProfileString(const char* lpAppName, const char* lpKeyName, const char* lpDefault, char* lpReturnedString, size_t nSize, const char* lpFileName)
{
BuildConfigurationMap(lpFileName);
@ -108,10 +129,12 @@ GSdxApp::GSdxApp()
m_gs_renderers.push_back(GSSetting(0, "Direct3D9", "Hardware"));
m_gs_renderers.push_back(GSSetting(1, "Direct3D9", "Software"));
m_gs_renderers.push_back(GSSetting(14, "Direct3D9", "OpenCL"));
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(3, "Direct3D", "Hardware"));
m_gs_renderers.push_back(GSSetting(4, "Direct3D", "Software"));
m_gs_renderers.push_back(GSSetting(15, "Direct3D", "OpenCL"));
m_gs_renderers.push_back(GSSetting(5, "Direct3D", "Null"));
#ifdef _LINUX
// note: SDL was removed. We keep those bits for compatibility of the renderer
// position in the linux dialog.
@ -119,9 +142,11 @@ GSdxApp::GSdxApp()
m_gs_renderers.push_back(GSSetting(8, "SDL 1.3", "Null"));
#endif
m_gs_renderers.push_back(GSSetting(10, "Null", "Software"));
m_gs_renderers.push_back(GSSetting(16, "Null", "OpenCL"));
m_gs_renderers.push_back(GSSetting(11, "Null", "Null"));
m_gs_renderers.push_back(GSSetting(12, "OpenGL", "Hardware"));
m_gs_renderers.push_back(GSSetting(13, "OpenGL", "Software"));
m_gs_renderers.push_back(GSSetting(17, "OpenGL", "OpenCL"));
m_gs_interlace.push_back(GSSetting(0, "None", ""));
m_gs_interlace.push_back(GSSetting(1, "Weave tff", "saw-tooth"));

View File

@ -39,6 +39,7 @@ public:
#ifdef _WINDOWS
HMODULE GetModuleHandle() {return (HMODULE)GetModuleHandlePtr();}
#endif
#ifdef _LINUX
void BuildConfigurationMap(const char* lpFileName);
void ReloadConfig();
@ -48,6 +49,8 @@ public:
int GetPrivateProfileInt(const char* lpAppName, const char* lpKeyName, int nDefault, const char* lpFileName);
#endif
bool LoadResource(int id, vector<unsigned char>& buff, const char* type = NULL);
string GetConfig(const char* entry, const char* value);
void SetConfig(const char* entry, const char* value);
int GetConfig(const char* entry, int value);

View File

@ -51,9 +51,11 @@ BEGIN
"#include ""res/tfx.fx""\r\n"
"#include ""res/convert.fx""\r\n"
"#include ""res/interlace.fx""\r\n"
"#include ""res/merge.fx""\r\0"
"#include ""res/fxaa.fx""\r\0"
"#include ""res/shadeboost.fx""\r\0"
"#include ""res/merge.fx""\r\n"
"#include ""res/fxaa.fx""\r\n"
"#include ""res/cs.fx""\r\n"
"#include ""res/shadeboost.fx""\r\n"
"#include ""res/tfx.cl""\r\n"
END
#endif // APSTUDIO_INVOKED
@ -64,13 +66,14 @@ END
// RCDATA
//
IDR_CONVERT_FX RCDATA "res\\convert.fx"
IDR_TFX_FX RCDATA "res\\tfx.fx"
IDR_MERGE_FX RCDATA "res\\merge.fx"
IDR_CONVERT_FX RCDATA "res\\convert.fx"
IDR_INTERLACE_FX RCDATA "res\\interlace.fx"
IDR_MERGE_FX RCDATA "res\\merge.fx"
IDR_FXAA_FX RCDATA "res\\fxaa.fx"
IDR_CS_FX RCDATA "res\\cs.fx"
IDR_SHADEBOOST_FX RCDATA "res\\shadeboost.fx"
IDR_TFX_CL RCDATA "res\\tfx.cl"
/////////////////////////////////////////////////////////////////////////////
//
@ -394,6 +397,10 @@ END
#include "res/convert.fx"
#include "res/interlace.fx"
#include "res/merge.fx"
#include "res/fxaa.fx"
#include "res/cs.fx"
#include "res/shadeboost.fx"
#include "res/tfx.cl"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -687,6 +687,7 @@
<AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Release AVX2|Win32'">AssemblyAndSourceCode</AssemblerOutput>
</ClCompile>
<ClCompile Include="GSRenderer.cpp" />
<ClCompile Include="GSRendererCL.cpp" />
<ClCompile Include="GSRendererCS.cpp" />
<ClCompile Include="GSRendererDX.cpp" />
<ClCompile Include="GSRendererDX11.cpp" />
@ -1970,6 +1971,7 @@
<ClInclude Include="GSPerfMon.h" />
<ClInclude Include="GSRasterizer.h" />
<ClInclude Include="GSRenderer.h" />
<ClInclude Include="GSRendererCL.h" />
<ClInclude Include="GSRendererCS.h" />
<ClInclude Include="GSRendererDX.h" />
<ClInclude Include="GSRendererDX11.h" />
@ -2057,6 +2059,7 @@
<None Include="res\interlace.fx" />
<None Include="res\merge.fx" />
<None Include="res\shadeboost.fx" />
<None Include="res\tfx.cl" />
<None Include="res\tfx.fx" />
<None Include="baseclasses\activex.rcv" />
<None Include="baseclasses\activex.ver" />

View File

@ -348,6 +348,9 @@
<ClCompile Include="GSSetupPrimCodeGenerator.x86.avx2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GSRendererCL.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GLLoader.h">
@ -707,6 +710,9 @@
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GSRendererCL.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\logo10.bmp">
@ -737,10 +743,13 @@
<None Include="res\fxaa.fx">
<Filter>Shaders</Filter>
</None>
<None Include="res\shadeboost.fx">
<Filter>Shaders</Filter>
</None>
<None Include="res\cs.fx">
<Filter>Shaders</Filter>
</None>
<None Include="res\shadeboost.fx">
<None Include="res\tfx.cl">
<Filter>Shaders</Filter>
</None>
</ItemGroup>

View File

@ -1,3 +1,5 @@
#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency
#ifndef VS_TME
#define VS_TME 1
#define VS_FST 1
@ -381,3 +383,5 @@ void ps_main1(GS_OUTPUT input)
WritePixel(addr.x, c, PS_FPSM);
WritePixel(addr.y, z, PS_ZPSM);
}
#endif

1619
plugins/GSdx/res/tfx.cl Normal file

File diff suppressed because it is too large Load Diff

View File

@ -43,6 +43,7 @@
#include <d3dx9.h>
#include <comutil.h>
#include "../../common/include/comptr.h"
#include <CL/cl.hpp>
#define D3DCOLORWRITEENABLE_RGBA (D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA)
#define D3D11_SHADER_MACRO D3D10_SHADER_MACRO

View File

@ -8,22 +8,22 @@
<ItemDefinitionGroup>
<ClCompile>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_WINDOWS;_WIN32_WINNT=0x500;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_WINDOWS;_WIN32_WINNT=0x500;__CL_ENABLE_EXCEPTIONS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FloatingPointModel>Fast</FloatingPointModel>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4996;4995;4324;4100;4101;4201;4556;4127;4512;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(DXSDK_DIR)include;$(VTUNE_AMPLIFIER_XE_2013_DIR)include;$(SolutionDir)3rdparty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(DXSDK_DIR)include;$(INTELOCLSDKROOT)include;$(VTUNE_AMPLIFIER_XE_2015_DIR)include;$(SolutionDir)3rdparty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalDependencies>d3d11.lib;d3dx11.lib;d3d10_1.lib;d3dx10.lib;d3d9.lib;d3dx9.lib;dxgi.lib;dxguid.lib;winmm.lib;strmiids.lib;xinput.lib;opengl32.lib;comsuppw.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>d3d11.lib;d3dx11.lib;d3d10_1.lib;d3dx10.lib;d3d9.lib;d3dx9.lib;dxgi.lib;dxguid.lib;winmm.lib;strmiids.lib;xinput.lib;opengl32.lib;opencl.lib;comsuppw.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>d3d9.dll;d3dx9_43.dll;d3d11.dll;d3dx11_43.dll;dxgi.dll;opengl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalLibraryDirectories>$(VTUNE_AMPLIFIER_XE_2013_DIR)lib32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(VTUNE_AMPLIFIER_XE_2015_DIR)lib32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>.\postBuild.cmd "$(TargetPath)" "$(TargetName)" $(TargetExt) $(PcsxSubsection)</Command>

View File

@ -5,7 +5,7 @@
<PropertyGroup />
<ItemDefinitionGroup>
<Link>
<AdditionalLibraryDirectories>$(DXSDK_DIR)Lib\x64;$(ProjectDir)vtune\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(DXSDK_DIR)Lib\x64;$(INTELOCLSDKROOT)lib\x64;$(ProjectDir)vtune\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<PreprocessorDefinitions>_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -5,7 +5,7 @@
<PropertyGroup />
<ItemDefinitionGroup>
<Link>
<AdditionalLibraryDirectories>$(DXSDK_DIR)Lib\x86;$(ProjectDir)vtune\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(DXSDK_DIR)Lib\x86;$(INTELOCLSDKROOT)lib\x86;$(ProjectDir)vtune\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<ClCompile />
<ClCompile>