opencl device selection in settings dialog

This commit is contained in:
gabest11 2014-09-22 02:50:51 +02:00 committed by Gregory Hainaut
parent 6f5cd1cd4d
commit e3ba15de94
12 changed files with 275 additions and 125 deletions

View File

@ -145,6 +145,8 @@ void GSDialog::ComboBoxInit(UINT id, const vector<GSSetting>& settings, uint32 s
ComboBoxAppend(id, str.c_str(), (LPARAM)s.id, s.id == selid);
}
}
ComboBoxFixDroppedWidth(id);
}
int GSDialog::ComboBoxAppend(UINT id, const char* str, LPARAM data, bool select)
@ -178,3 +180,49 @@ bool GSDialog::ComboBoxGetSelData(UINT id, INT_PTR& data)
return false;
}
void GSDialog::ComboBoxFixDroppedWidth(UINT id)
{
HWND hWnd = GetDlgItem(m_hWnd, id);
int count = (int)SendMessage(hWnd, CB_GETCOUNT, 0, 0);
if(count > 0)
{
HDC hDC = GetDC(hWnd);
SelectObject(hDC, (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0));
int width = (int)SendMessage(hWnd, CB_GETDROPPEDWIDTH, 0, 0);
for(int i = 0; i < count; i++)
{
int len = (int)SendMessage(hWnd, CB_GETLBTEXTLEN, i, 0);
if(len > 0)
{
char* buff = new char[len + 1];
SendMessage(hWnd, CB_GETLBTEXT, i, (LPARAM)buff);
SIZE size;
if(GetTextExtentPoint32(hDC, buff, strlen(buff), &size))
{
size.cx += 10;
if(size.cx > width) width = size.cx;
}
delete [] buff;
}
}
ReleaseDC(hWnd, hDC);
if(width > 0)
{
SendMessage(hWnd, CB_SETDROPPEDWIDTH, width, 0);
}
}
}

View File

@ -53,4 +53,5 @@ public:
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);
void ComboBoxFixDroppedWidth(UINT id);
};

View File

@ -645,6 +645,9 @@ void GSRendererCL::Enqueue()
pk.setArg(1, m_cl.vb.buff[m_cl.wqidx]);
pk.setArg(2, m_cl.ib.buff[m_cl.wqidx]);
pk.setArg(3, m_cl.pb.buff[m_cl.wqidx]);
pk.setArg(4, (cl_uint)m_vb_start);
pk.setArg(6, (cl_uint)m_pb_start);
TileSelector tsel;
@ -704,8 +707,7 @@ void GSRendererCL::Enqueue()
{
uint32 prim_count = std::min(total_prim_count, MAX_PRIM_COUNT);
pk.setArg(3, (cl_uint)m_vb_start);
pk.setArg(4, (cl_uint)(*head)->ib_start);
pk.setArg(5, (cl_uint)(*head)->ib_start);
m_cl.queue[2].enqueueNDRangeKernel(pk, cl::NullRange, cl::NDRange(prim_count), cl::NullRange);
@ -1621,58 +1623,35 @@ GSRendererCL::CL::CL()
{
WIs = INT_MAX;
std::vector<cl::Platform> platforms;
std::string ocldev = theApp.GetConfig("ocldev", "");
cl::Platform::get(&platforms);
for(auto& p : platforms)
{
std::string platform_vendor = p.getInfo<CL_PLATFORM_VENDOR>();
std::vector<cl::Device> ds;
p.getDevices(CL_DEVICE_TYPE_ALL, &ds);
for(auto& device : ds)
{
std::string vendor = device.getInfo<CL_DEVICE_VENDOR>();
std::string name = device.getInfo<CL_DEVICE_NAME>();
std::string version = device.getInfo<CL_DEVICE_OPENCL_C_VERSION>();
printf("%s %s %s", vendor.c_str(), name.c_str(), version.c_str());
cl_device_type type = device.getInfo<CL_DEVICE_TYPE>();
switch(type)
{
case CL_DEVICE_TYPE_GPU: printf(" GPU"); break;
case CL_DEVICE_TYPE_CPU: printf(" CPU"); break;
}
if(strstr(version.c_str(), "OpenCL C 1.1") != NULL
|| strstr(version.c_str(), "OpenCL C 1.2") != NULL)
{
#ifdef IOCL_DEBUG
if(type == CL_DEVICE_TYPE_CPU && strstr(platform_vendor.c_str(), "Intel") != NULL)
#else
//if(type == CL_DEVICE_TYPE_CPU && strstr(platform_vendor.c_str(), "Intel") != NULL)
//if(type == CL_DEVICE_TYPE_GPU && strstr(platform_vendor.c_str(), "Intel") != NULL)
//if(type == CL_DEVICE_TYPE_GPU && strstr(platform_vendor.c_str(), "Advanced Micro Devices") != NULL)
if(type == CL_DEVICE_TYPE_GPU)
ocldev = "Intel(R) Corporation Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz OpenCL C 1.2 CPU";
#endif
{
devices.push_back(device);
WIs = std::min(WIs, (uint32)device.getInfo<CL_DEVICE_MAX_WORK_GROUP_SIZE>());
list<OCLDevice> ocldevs;
printf(" *");
}
}
GSUtil::GetOCLDevices(ocldevs);
printf("\n");
for(auto dev : ocldevs)
{
if(dev.name == ocldev)
{
devices.push_back(dev.device);
WIs = std::min(WIs, (uint32)dev.device.getInfo<CL_DEVICE_MAX_WORK_GROUP_SIZE>());
break; // TODO: multiple devices?
}
}
if(!devices.empty()) break;
if(devices.empty() && !ocldevs.empty())
{
auto dev = ocldevs.front();
devices.push_back(dev.device);
WIs = std::min(WIs, (uint32)dev.device.getInfo<CL_DEVICE_MAX_WORK_GROUP_SIZE>());
}
if(devices.empty())

View File

@ -40,11 +40,15 @@ void GSSettingsDlg::OnInit()
m_modes.clear();
CComPtr<IDirect3D9> d3d9;
d3d9.Attach(Direct3DCreate9(D3D_SDK_VERSION));
CComPtr<IDXGIFactory1> dxgi_factory;
if (GSUtil::CheckDXGI())
if(GSUtil::CheckDXGI())
{
CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&dxgi_factory);
}
if(!m_IsOpen2)
{
@ -81,51 +85,49 @@ void GSSettingsDlg::OnInit()
adapters.push_back(Adapter("Default Hardware Device", "default", GSUtil::CheckDirect3D11Level(NULL, D3D_DRIVER_TYPE_HARDWARE)));
adapters.push_back(Adapter("Reference Device", "ref", GSUtil::CheckDirect3D11Level(NULL, D3D_DRIVER_TYPE_REFERENCE)));
if (dxgi_factory)
if(dxgi_factory)
{
for (int i = 0;; i++)
for(int i = 0;; i++)
{
CComPtr<IDXGIAdapter1> adapter;
if (S_OK != dxgi_factory->EnumAdapters1(i, &adapter))
if(S_OK != dxgi_factory->EnumAdapters1(i, &adapter))
break;
DXGI_ADAPTER_DESC1 desc;
HRESULT hr = adapter->GetDesc1(&desc);
if (S_OK == hr)
if(S_OK == hr)
{
D3D_FEATURE_LEVEL level = GSUtil::CheckDirect3D11Level(adapter, D3D_DRIVER_TYPE_UNKNOWN);
// GSDX isn't unicode!?
// GSDX isn't unicode!?
#if 1
int size = WideCharToMultiByte(CP_ACP, 0,
desc.Description, sizeof(desc.Description),
NULL, 0,
NULL, NULL);
int size = WideCharToMultiByte(CP_ACP, 0, desc.Description, sizeof(desc.Description), NULL, 0, NULL, NULL);
char *buf = new char[size];
WideCharToMultiByte(CP_ACP, 0,
desc.Description, sizeof(desc.Description),
buf, size,
NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, desc.Description, sizeof(desc.Description), buf, size, NULL, NULL);
adapters.push_back(Adapter(buf, GSAdapter(desc), level));
delete [] buf;
delete[] buf;
#else
adapters.push_back(Adapter(desc.Description, GSAdapter(desc), level));
#endif
}
}
}
else if (d3d9)
else if(d3d9)
{
int n = d3d9->GetAdapterCount();
for (int i = 0; i < n; i++)
for(int i = 0; i < n; i++)
{
D3DADAPTER_IDENTIFIER9 desc;
if (D3D_OK != d3d9->GetAdapterIdentifier(i, 0, &desc))
if(D3D_OK != d3d9->GetAdapterIdentifier(i, 0, &desc))
break;
// GSDX isn't unicode!?
// GSDX isn't unicode!?
#if 0
wchar_t buf[sizeof desc.Description * sizeof(WCHAR)];
MultiByteToWideChar(CP_ACP /* I have no idea if this is right */, 0,
desc.Description, sizeof(desc.Description),
buf, sizeof buf / sizeof *buf);
MultiByteToWideChar(CP_ACP /* I have no idea if this is right */, 0, desc.Description, sizeof(desc.Description), buf, sizeof buf / sizeof *buf);
adapters.push_back(Adapter(buf, GSAdapter(desc), (D3D_FEATURE_LEVEL)0));
#else
adapters.push_back(Adapter(desc.Description, GSAdapter(desc), (D3D_FEATURE_LEVEL)0));
@ -135,17 +137,37 @@ void GSSettingsDlg::OnInit()
std::string adapter_setting = theApp.GetConfig("Adapter", "default");
vector<GSSetting> adapter_settings;
unsigned adapter_sel = 0;
unsigned int adapter_sel = 0;
for (unsigned i = 0; i < adapters.size(); i++)
for(unsigned int i = 0; i < adapters.size(); i++)
{
if (adapters[i].id == adapter_setting)
if(adapters[i].id == adapter_setting)
{
adapter_sel = i;
}
adapter_settings.push_back(GSSetting(i, adapters[i].name.c_str(), ""));
}
std::string ocldev = theApp.GetConfig("ocldev", "");
unsigned int ocl_sel = 0;
for(unsigned int i = 0; i < theApp.m_ocl_devs.size(); i++)
{
if(ocldev == theApp.m_ocl_devs[i].name)
{
ocl_sel = i;
break;
}
}
ComboBoxInit(IDC_ADAPTER, adapter_settings, adapter_sel);
ComboBoxInit(IDC_OPENCL_DEVICE, theApp.m_ocl_devs, ocl_sel);
UpdateRenderers();
ComboBoxInit(IDC_INTERLACE, theApp.m_gs_interlace, theApp.GetConfig("Interlace", 7)); // 7 = "auto", detects interlace based on SMODE2 register
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));
@ -233,6 +255,11 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
theApp.SetConfig("Adapter", adapters[(int)data].id.c_str());
}
if(ComboBoxGetSelData(IDC_OPENCL_DEVICE, data))
{
theApp.SetConfig("ocldev", theApp.m_ocl_devs[(int)data].name.c_str());
}
if(!m_IsOpen2 && ComboBoxGetSelData(IDC_RESOLUTION, data))
{
const D3DDISPLAYMODE* mode = (D3DDISPLAYMODE*)data;
@ -266,7 +293,7 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
theApp.SetConfig("upscale_multiplier", 1);
}
if (ComboBoxGetSelData(IDC_AFCOMBO, data))
if(ComboBoxGetSelData(IDC_AFCOMBO, data))
{
theApp.SetConfig("MaxAnisotropy", (int)data);
}
@ -360,16 +387,19 @@ void GSSettingsDlg::UpdateControls()
if(ComboBoxGetSelData(IDC_RENDERER, i))
{
bool dx9 = (i / 3) == 0;
bool dx11 = (i / 3) == 1;
bool ogl = (i / 3) == 4;
bool hw = (i % 3) == 0;
//bool sw = (i % 3) == 1;
bool dx9 = i >= 0 && i <= 2 || i == 14;
bool dx11 = i >= 3 && i <= 5 || i == 15;
bool ogl = i >= 12 && i <= 13 || i == 17;
bool hw = i == 0 || i == 3 || i == 12;
//bool sw = i == 1 || i == 4 || i == 10 || i == 13;
bool ocl = i >= 14 && i <= 17;
bool native = !!IsDlgButtonChecked(m_hWnd, IDC_NATIVERES);
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), dx9 ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO11), dx11 ? SW_SHOW : SW_HIDE);
EnableWindow(GetDlgItem(m_hWnd, IDC_OPENCL_DEVICE), ocl);
EnableWindow(GetDlgItem(m_hWnd, IDC_WINDOWED), dx9);
EnableWindow(GetDlgItem(m_hWnd, IDC_RESX), hw && !native && scaling == 1);
EnableWindow(GetDlgItem(m_hWnd, IDC_RESX_EDIT), hw && !native && scaling == 1);

View File

@ -69,16 +69,19 @@ public:
class GSSettingsDlg : public GSDialog
{
list<D3DDISPLAYMODE> m_modes;
struct Adapter
{
std::string name;
std::string id;
D3D_FEATURE_LEVEL level;
Adapter(const std::string &n, const std::string &i, const D3D_FEATURE_LEVEL &l)
: name(n), id(i), level(l) {}
Adapter(const std::string &n, const std::string &i, const D3D_FEATURE_LEVEL &l) : name(n), id(i), level(l) {}
};
std::vector<const Adapter> adapters;
bool m_IsOpen2;
uint32 m_lastValidMsaa; // used to revert to previous dialog value if the user changed to invalid one, or lesser one and canceled
void UpdateRenderers();
void UpdateControls();
@ -87,8 +90,6 @@ protected:
void OnInit();
bool OnCommand(HWND hWnd, UINT id, UINT code);
uint32 m_lastValidMsaa; // used to revert to previous dialog value if the user changed to invalid one, or lesser one and canceled
// Shade Boost
GSShadeBostDlg ShadeBoostDlg;
GSHacksDlg HacksDlg;

View File

@ -226,6 +226,60 @@ bool GSUtil::CheckSSE()
return true;
}
void GSUtil::GetOCLDevices(list<OCLDevice>& devs)
{
devs.clear();
try
{
std::vector<cl::Platform> platforms;
cl::Platform::get(&platforms);
for(auto& p : platforms)
{
std::string platform_vendor = p.getInfo<CL_PLATFORM_VENDOR>();
std::vector<cl::Device> ds;
p.getDevices(CL_DEVICE_TYPE_ALL, &ds);
for(auto& device : ds)
{
std::string vendor = device.getInfo<CL_DEVICE_VENDOR>();
std::string name = device.getInfo<CL_DEVICE_NAME>();
std::string version = device.getInfo<CL_DEVICE_OPENCL_C_VERSION>();
string type;
switch(device.getInfo<CL_DEVICE_TYPE>())
{
case CL_DEVICE_TYPE_GPU: type = "GPU"; break;
case CL_DEVICE_TYPE_CPU: type = "CPU"; break;
}
int major, minor;
if(!type.empty() && sscanf(version.c_str(), "OpenCL C %d.%d", &major, &minor) == 2 && major == 1 && minor >= 1 || major > 1)
{
name = vendor + " " + name + " " + version + type;
OCLDevice dev;
dev.device = device;
dev.name = name;
devs.push_back(dev);
}
}
}
}
catch(cl::Error err)
{
printf("%s (%d)\n", err.what(), err.err());
}
}
#ifdef _WINDOWS
bool GSUtil::CheckDirectX()

View File

@ -23,6 +23,12 @@
#include "GS.h"
struct OCLDevice
{
cl::Device device;
string name;
};
class GSUtil
{
public:
@ -39,6 +45,7 @@ public:
static bool HasCompatibleBits(uint32 spsm, uint32 dpsm);
static bool CheckSSE();
static void GetOCLDevices(list<OCLDevice>& devs);
#ifdef _WINDOWS

View File

@ -21,6 +21,7 @@
#include "stdafx.h"
#include "GSdx.h"
#include "GSUtil.h"
static void* s_hModule;
@ -198,6 +199,19 @@ GSdxApp::GSdxApp()
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", ""));
//
list<OCLDevice> ocldevs;
GSUtil::GetOCLDevices(ocldevs);
int index = 0;
for(auto dev : ocldevs)
{
m_ocl_devs.push_back(GSSetting(index++, dev.name.c_str(), ""));
}
}
#ifdef _LINUX

View File

@ -69,6 +69,8 @@ public:
vector<GSSetting> m_gpu_dithering;
vector<GSSetting> m_gpu_aspectratio;
vector<GSSetting> m_gpu_scale;
vector<GSSetting> m_ocl_devs;
};
struct GSDXError {};

View File

@ -55,7 +55,7 @@ BEGIN
"#include ""res/fxaa.fx""\r\n"
"#include ""res/cs.fx""\r\n"
"#include ""res/shadeboost.fx""\r\n"
"#include ""res/tfx.cl""\r\n"
"#include ""res/tfx.cl""\r\0"
END
#endif // APSTUDIO_INVOKED
@ -230,49 +230,51 @@ BEGIN
CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,129,157,49,10
END
IDD_CONFIG2 DIALOGEX 0, 0, 187, 360
IDD_CONFIG2 DIALOGEX 0, 0, 187, 370
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Settings..."
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL IDB_LOGO10,IDC_LOGO11,"Static",SS_BITMAP | SS_CENTERIMAGE,6,6,173,42
DEFPUSHBUTTON "OK",IDOK,40,336,50,14
DEFPUSHBUTTON "OK",IDOK,40,346,50,14
LTEXT "Renderer:",IDC_STATIC,6,72,34,8
COMBOBOX IDC_RENDERER,70,70,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Interlacing (F5):",IDC_STATIC,6,87,53,8
COMBOBOX IDC_INTERLACE,70,85,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Custom Resolution:",IDC_STATIC,26,149,65,8
EDITTEXT IDC_RESX_EDIT,92,147,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,120,147,11,14
EDITTEXT IDC_RESY_EDIT,130,147,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,154,147,11,14
CONTROL "Native",IDC_NATIVERES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,120,33,10
LTEXT "Extra rendering threads:",IDC_STATIC,11,289,80,8
EDITTEXT IDC_SWTHREADS_EDIT,94,287,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,129,278,11,14
COMBOBOX IDC_UPSCALE_MULTIPLIER,92,132,74,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Or use Scaling:",IDC_STATIC,38,134,49,8
LTEXT "Original PS2 Resolution:",IDC_STATIC,10,120,80,8
CONTROL "Edge Anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,305,93,10
PUSHBUTTON "Cancel",IDCANCEL,95,336,50,14
LTEXT "Interlacing (F5):",IDC_STATIC,6,101,53,8
COMBOBOX IDC_INTERLACE,70,99,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Custom Resolution:",IDC_STATIC,26,163,65,8
EDITTEXT IDC_RESX_EDIT,92,161,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,120,161,11,14
EDITTEXT IDC_RESY_EDIT,130,161,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,154,161,11,14
CONTROL "Native",IDC_NATIVERES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,134,33,10
LTEXT "Extra rendering threads:",IDC_STATIC,11,303,80,8
EDITTEXT IDC_SWTHREADS_EDIT,94,301,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,129,292,11,14
COMBOBOX IDC_UPSCALE_MULTIPLIER,92,146,74,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Or use Scaling:",IDC_STATIC,38,148,49,8
LTEXT "Original PS2 Resolution:",IDC_STATIC,10,134,80,8
CONTROL "Edge Anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,319,93,10
PUSHBUTTON "Cancel",IDCANCEL,95,346,50,14
CONTROL IDB_LOGO9,IDC_LOGO9,"Static",SS_BITMAP | SS_CENTERIMAGE,6,6,175,44
GROUPBOX "D3D Internal Resolution (can cause glitches)",IDC_STATIC,6,102,175,64,BS_CENTER
GROUPBOX "Software Mode Settings",IDC_STATIC,6,276,175,50,BS_CENTER
GROUPBOX "Hardware Mode Settings",IDC_STATIC,6,200,175,74,BS_CENTER
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,213,58,10
CONTROL "Alpha Correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,229,87,10
CONTROL "Allow 8-Bit Textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,229,82,10
CONTROL "Texture Filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,10,213,67,10
CONTROL "Enable Shade Boost",IDC_SHADEBOOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,172,79,10
PUSHBUTTON "Settings...",IDC_SHADEBUTTON,92,169,75,14
CONTROL "Enable HW Hacks",IDC_HACKS_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,245,71,10
PUSHBUTTON "Configure...",IDC_HACKSBUTTON,92,242,75,14
GROUPBOX "D3D Internal Resolution (can cause glitches)",IDC_STATIC,6,116,175,64,BS_CENTER
GROUPBOX "Software Mode Settings",IDC_STATIC,6,290,175,50,BS_CENTER
GROUPBOX "Hardware Mode Settings",IDC_STATIC,6,214,175,74,BS_CENTER
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,227,58,10
CONTROL "Alpha Correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,243,87,10
CONTROL "Allow 8-Bit Textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,243,82,10
CONTROL "Texture Filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,10,227,67,10
CONTROL "Enable Shade Boost",IDC_SHADEBOOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,186,79,10
PUSHBUTTON "Settings...",IDC_SHADEBUTTON,92,183,75,14
CONTROL "Enable HW Hacks",IDC_HACKS_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,259,71,10
PUSHBUTTON "Configure...",IDC_HACKSBUTTON,92,256,75,14
LTEXT "Adapter:",IDC_STATIC,6,57,30,8
COMBOBOX IDC_ADAPTER,70,55,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable FXAA",IDC_FXAA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,187,80,10
CONTROL "Enable FX Shader",IDC_SHADER_FX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,187,80,10
CONTROL "Anisotropic Filtering",IDC_ANISOTROPIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,260,77,8
COMBOBOX IDC_AFCOMBO,93,258,35,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable FXAA",IDC_FXAA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,201,80,10
CONTROL "Enable FX Shader",IDC_SHADER_FX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,201,80,10
CONTROL "Anisotropic Filtering",IDC_ANISOTROPIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,274,77,8
COMBOBOX IDC_AFCOMBO,93,272,35,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "OpenCL Device:",IDC_STATIC,6,86,52,8
COMBOBOX IDC_OPENCL_DEVICE,70,84,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
@ -338,7 +340,7 @@ BEGIN
VERTGUIDE, 11
VERTGUIDE, 87
TOPMARGIN, 6
BOTTOMMARGIN, 335
BOTTOMMARGIN, 360
END
END
#endif // APSTUDIO_INVOKED

View File

@ -551,9 +551,11 @@ int GetVertexPerPrim(int prim_class)
__kernel void KERNEL_PRIM(
__global gs_env* env,
__global uchar* vb_base,
__global uchar* ib_base,
__global uchar* ib_base,
__global uchar* pb_base,
uint vb_start,
uint ib_start)
uint ib_start,
uint pb_start)
{
size_t prim_index = get_global_id(0);
@ -563,7 +565,11 @@ __kernel void KERNEL_PRIM(
ib += prim_index * VERTEX_PER_PRIM;
prim->pb_index = ib[0] >> 24;
uint pb_index = ib[0] >> 24;
prim->pb_index = pb_index;
__global gs_param* pb = (__global gs_param*)(pb_base + pb_start + pb_index * TFX_PARAM_SIZE);
__global gs_vertex* v0 = &vb[ib[0] & 0x00ffffff];
__global gs_vertex* v1 = &vb[ib[1] & 0x00ffffff];
@ -633,10 +639,10 @@ __kernel void KERNEL_PRIM(
dp1.xy = dp1.xy * sign(cp);
dp2.xy = dp2.xy * sign(cp);
b.zero.x = (dp1.y < 0 || dp1.y == 0 && dp1.x > 0) ? CL_FLT_EPSILON : 0;
b.zero.y = (dp0.y < 0 || dp0.y == 0 && dp0.x > 0) ? CL_FLT_EPSILON : 0;
b.zero.z = (dp2.y < 0 || dp2.y == 0 && dp2.x > 0) ? CL_FLT_EPSILON : 0;
b.zero.x = select(0.0f, CL_FLT_EPSILON, (dp1.y < 0) | (dp1.y == 0) & (dp1.x > 0));
b.zero.y = select(0.0f, CL_FLT_EPSILON, (dp0.y < 0) | (dp0.y == 0) & (dp0.x > 0));
b.zero.z = select(0.0f, CL_FLT_EPSILON, (dp2.y < 0) | (dp2.y == 0) & (dp2.x > 0));
// any barycentric(reject_corner) < 0, tile outside the triangle
b.reject_corner.x = 0.0f + max(max(max(b.dx.x + b.dy.x, b.dx.x), b.dy.x), 0.0f) * BIN_SIZE;
@ -669,6 +675,11 @@ __kernel void KERNEL_PRIM(
prim->v[1].tc.xy = (prim->v[1].tc.xy - prim->v[0].tc.xy) / (prim->v[1].p.xy - prim->v[0].p.xy);
}
int4 scissor = pb->scissor;
pmin = select(pmin, scissor.xy, pmin < scissor.xy);
pmax = select(pmax, scissor.zw, pmax > scissor.zw);
int4 r = (int4)(pmin, pmax + (int2)(BIN_SIZE - 1)) >> BIN_SIZE_BITS;
env->bbox[prim_index] = convert_uchar4_sat(r);
@ -1167,7 +1178,7 @@ int4 SampleTexture(__global uchar* tex, __global gs_param* pb, float3 t)
uv0.y = Wrap(uv0.y, pb->minv, pb->maxv, WMT);
uv1.x = Wrap(uv1.x, pb->minu, pb->maxu, WMS);
uv1.y = Wrap(uv1.y, pb->minv, pb->maxv, WMT);
int4 c00 = ReadTexel(tex, uv0.x, uv0.y, 0, pb);
int4 c01 = ReadTexel(tex, uv1.x, uv0.y, 0, pb);
int4 c10 = ReadTexel(tex, uv0.x, uv1.y, 0, pb);

View File

@ -71,6 +71,7 @@
#define IDC_SHADER_FX 2088
#define IDC_ANISOTROPIC 2089
#define IDC_AFCOMBO 2090
#define IDC_OPENCL_DEVICE 2091
#define IDC_COLORSPACE 3000
#define IDR_CONVERT_FX 10000
#define IDR_TFX_FX 10001
@ -91,7 +92,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 10012
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 2091
#define _APS_NEXT_CONTROL_VALUE 2092
#define _APS_NEXT_SYMED_VALUE 5000
#endif
#endif