mirror of https://github.com/PCSX2/pcsx2.git
Merge pull request #863 from turtleli/gsdx-dx-select-shader
gsdx:windows: refactor dx9/dx11 compile shader code, allow external shader selection via GUI, widen and rearrange GUI
This commit is contained in:
commit
76e61d4ef1
|
@ -26,10 +26,6 @@
|
|||
#error GSdx FX is not compatible with GSdx9. Use GSdx OGL or DX10/11.
|
||||
#endif
|
||||
|
||||
#ifdef SHADER_MODEL
|
||||
#include "GSdx_FX_Settings.ini"
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
[GLOBALS|FUNCTIONS]
|
||||
------------------------------------------------------------------------------*/
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "GSDevice11.h"
|
||||
#include "GSUtil.h"
|
||||
#include "resource.h"
|
||||
#include <fstream>
|
||||
|
||||
GSDevice11::GSDevice11()
|
||||
{
|
||||
|
@ -171,11 +172,13 @@ bool GSDevice11::Create(GSWnd* wnd)
|
|||
{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
};
|
||||
|
||||
CompileShader(IDR_CONVERT_FX, "vs_main", NULL, &m_convert.vs, il_convert, countof(il_convert), &m_convert.il);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_CONVERT_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "convert.fx", "vs_main", NULL, &m_convert.vs, il_convert, countof(il_convert), &m_convert.il);
|
||||
|
||||
for(size_t i = 0; i < countof(m_convert.ps); i++)
|
||||
{
|
||||
CompileShader(IDR_CONVERT_FX, format("ps_main%d", i).c_str(), NULL, &m_convert.ps[i]);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "convert.fx", format("ps_main%d", i).c_str(), NULL, &m_convert.ps[i]);
|
||||
}
|
||||
|
||||
memset(&dsd, 0, sizeof(dsd));
|
||||
|
@ -201,9 +204,10 @@ bool GSDevice11::Create(GSWnd* wnd)
|
|||
|
||||
hr = m_dev->CreateBuffer(&bd, NULL, &m_merge.cb);
|
||||
|
||||
theApp.LoadResource(IDR_MERGE_FX, shader);
|
||||
for(size_t i = 0; i < countof(m_merge.ps); i++)
|
||||
{
|
||||
CompileShader(IDR_MERGE_FX, format("ps_main%d", i).c_str(), NULL, &m_merge.ps[i]);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "merge.fx", format("ps_main%d", i).c_str(), NULL, &m_merge.ps[i]);
|
||||
}
|
||||
|
||||
memset(&bsd, 0, sizeof(bsd));
|
||||
|
@ -229,9 +233,10 @@ bool GSDevice11::Create(GSWnd* wnd)
|
|||
|
||||
hr = m_dev->CreateBuffer(&bd, NULL, &m_interlace.cb);
|
||||
|
||||
theApp.LoadResource(IDR_INTERLACE_FX, shader);
|
||||
for(size_t i = 0; i < countof(m_interlace.ps); i++)
|
||||
{
|
||||
CompileShader(IDR_INTERLACE_FX, format("ps_main%d", i).c_str(), NULL, &m_interlace.ps[i]);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "interlace.fx", format("ps_main%d", i).c_str(), NULL, &m_interlace.ps[i]);
|
||||
}
|
||||
|
||||
// Shade Boost
|
||||
|
@ -262,7 +267,8 @@ bool GSDevice11::Create(GSWnd* wnd)
|
|||
|
||||
hr = m_dev->CreateBuffer(&bd, NULL, &m_shadeboost.cb);
|
||||
|
||||
CompileShader(IDR_SHADEBOOST_FX, "ps_main", macro, &m_shadeboost.ps);
|
||||
theApp.LoadResource(IDR_SHADEBOOST_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "shadeboost.fx", "ps_main", macro, &m_shadeboost.ps);
|
||||
|
||||
// External fx shader
|
||||
|
||||
|
@ -748,7 +754,25 @@ void GSDevice11::InitExternalFX()
|
|||
if (!ExShader_Compiled)
|
||||
{
|
||||
try {
|
||||
CompileShader("shaders/GSdx.fx", "ps_main", NULL, &m_shaderfx.ps);
|
||||
std::string config_name(theApp.GetConfig("shaderfx_conf", "shaders/GSdx_FX_Settings.ini"));
|
||||
std::ifstream fconfig(config_name);
|
||||
std::stringstream shader;
|
||||
if (fconfig.good())
|
||||
shader << fconfig.rdbuf() << "\n";
|
||||
else
|
||||
fprintf(stderr, "GSdx: External shader config '%s' not loaded.\n", config_name.c_str());
|
||||
|
||||
std::string shader_name(theApp.GetConfig("shaderfx_glsl", "shaders/GSdx.fx"));
|
||||
std::ifstream fshader(shader_name);
|
||||
if (fshader.good())
|
||||
{
|
||||
shader << fshader.rdbuf();
|
||||
CompileShader(shader.str().c_str(), shader.str().length(), shader_name.c_str(), "ps_main", NULL, &m_shaderfx.ps);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "GSdx: External shader '%s' not loaded and will be disabled!\n", shader_name.c_str());
|
||||
}
|
||||
}
|
||||
catch (GSDXRecoverableError) {
|
||||
printf("GSdx: failed to compile external post-processing shader. \n");
|
||||
|
@ -784,7 +808,9 @@ void GSDevice11::InitFXAA()
|
|||
if (!FXAA_Compiled)
|
||||
{
|
||||
try {
|
||||
CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_FXAA_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "fxaa.fx", "ps_main", NULL, &m_fxaa.ps);
|
||||
}
|
||||
catch (GSDXRecoverableError) {
|
||||
printf("GSdx: failed to compile fxaa shader.\n");
|
||||
|
@ -1296,7 +1322,7 @@ void GSDevice11::OMSetRenderTargets(const GSVector2i& rtsize, int count, ID3D11U
|
|||
}
|
||||
}
|
||||
|
||||
void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11VertexShader** vs, D3D11_INPUT_ELEMENT_DESC* layout, int count, ID3D11InputLayout** il)
|
||||
void GSDevice11::CompileShader(const char* source, size_t size, const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11VertexShader** vs, D3D11_INPUT_ELEMENT_DESC* layout, int count, ID3D11InputLayout** il)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -1306,7 +1332,7 @@ void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO*
|
|||
|
||||
CComPtr<ID3D11Blob> shader, error;
|
||||
|
||||
hr = D3DX11CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, &m[0], NULL, entry, m_shader.vs.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
hr = D3DX11CompileFromMemory(source, size, fn, &m[0], NULL, entry, m_shader.vs.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
|
||||
if(error)
|
||||
{
|
||||
|
@ -1333,7 +1359,7 @@ void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO*
|
|||
}
|
||||
}
|
||||
|
||||
void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11GeometryShader** gs)
|
||||
void GSDevice11::CompileShader(const char* source, size_t size, const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11GeometryShader** gs)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -1343,7 +1369,7 @@ void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO*
|
|||
|
||||
CComPtr<ID3D11Blob> shader, error;
|
||||
|
||||
hr = D3DX11CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, &m[0], NULL, entry, m_shader.gs.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
hr = D3DX11CompileFromMemory(source, size, fn, &m[0], NULL, entry, m_shader.gs.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
|
||||
if(error)
|
||||
{
|
||||
|
@ -1363,7 +1389,7 @@ void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO*
|
|||
}
|
||||
}
|
||||
|
||||
void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11GeometryShader** gs, D3D11_SO_DECLARATION_ENTRY* layout, int count)
|
||||
void GSDevice11::CompileShader(const char* source, size_t size, const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11GeometryShader** gs, D3D11_SO_DECLARATION_ENTRY* layout, int count)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -1373,7 +1399,7 @@ void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO*
|
|||
|
||||
CComPtr<ID3D11Blob> shader, error;
|
||||
|
||||
hr = D3DX11CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, &m[0], NULL, entry, m_shader.gs.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
hr = D3DX11CompileFromMemory(source, size, fn, &m[0], NULL, entry, m_shader.gs.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
|
||||
if(error)
|
||||
{
|
||||
|
@ -1393,7 +1419,7 @@ void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO*
|
|||
}
|
||||
}
|
||||
|
||||
void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11PixelShader** ps)
|
||||
void GSDevice11::CompileShader(const char* source, size_t size, const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11PixelShader** ps)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -1403,7 +1429,7 @@ void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO*
|
|||
|
||||
CComPtr<ID3D11Blob> shader, error;
|
||||
|
||||
hr = D3DX11CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, &m[0], NULL, entry, m_shader.ps.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
hr = D3DX11CompileFromMemory(source, size, fn, &m[0], NULL, entry, m_shader.ps.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
|
||||
if(error)
|
||||
{
|
||||
|
@ -1415,7 +1441,7 @@ void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO*
|
|||
throw GSDXRecoverableError();
|
||||
}
|
||||
|
||||
hr = m_dev->CreatePixelShader((void*)shader->GetBufferPointer(), shader->GetBufferSize(),NULL, ps);
|
||||
hr = m_dev->CreatePixelShader((void*)shader->GetBufferPointer(), shader->GetBufferSize(), NULL, ps);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
|
@ -1423,7 +1449,7 @@ void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO*
|
|||
}
|
||||
}
|
||||
|
||||
void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11ComputeShader** cs)
|
||||
void GSDevice11::CompileShader(const char* source, size_t size, const char *fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11ComputeShader** cs)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -1433,7 +1459,7 @@ void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO*
|
|||
|
||||
CComPtr<ID3D11Blob> shader, error;
|
||||
|
||||
hr = D3DX11CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, &m[0], NULL, entry, m_shader.cs.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
hr = D3DX11CompileFromMemory(source, size, fn, &m[0], NULL, entry, m_shader.cs.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
|
||||
if(error)
|
||||
{
|
||||
|
@ -1445,103 +1471,7 @@ void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO*
|
|||
throw GSDXRecoverableError();
|
||||
}
|
||||
|
||||
hr = m_dev->CreateComputeShader((void*)shader->GetBufferPointer(), shader->GetBufferSize(),NULL, cs);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
}
|
||||
}
|
||||
|
||||
void GSDevice11::CompileShader(const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11VertexShader** vs, D3D11_INPUT_ELEMENT_DESC* layout, int count, ID3D11InputLayout** il)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
vector<D3D11_SHADER_MACRO> m;
|
||||
|
||||
PrepareShaderMacro(m, macro);
|
||||
|
||||
CComPtr<ID3D11Blob> shader, error;
|
||||
|
||||
hr = D3DX11CompileFromFile(fn, &m[0], NULL, entry, m_shader.vs.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
|
||||
if(error)
|
||||
{
|
||||
printf("%s\n", (const char*)error->GetBufferPointer());
|
||||
}
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
}
|
||||
|
||||
hr = m_dev->CreateVertexShader((void*)shader->GetBufferPointer(), shader->GetBufferSize(), NULL, vs);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
}
|
||||
|
||||
hr = m_dev->CreateInputLayout(layout, count, shader->GetBufferPointer(), shader->GetBufferSize(), il);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
}
|
||||
}
|
||||
|
||||
void GSDevice11::CompileShader(const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11PixelShader** ps)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
vector<D3D11_SHADER_MACRO> m;
|
||||
|
||||
PrepareShaderMacro(m, macro);
|
||||
|
||||
CComPtr<ID3D11Blob> shader, error;
|
||||
|
||||
hr = D3DX11CompileFromFile(fn, &m[0], NULL, entry, m_shader.ps.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
|
||||
if(error)
|
||||
{
|
||||
printf("%s\n", (const char*)error->GetBufferPointer());
|
||||
}
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
}
|
||||
|
||||
hr = m_dev->CreatePixelShader((void*)shader->GetBufferPointer(), shader->GetBufferSize(),NULL, ps);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
}
|
||||
}
|
||||
void GSDevice11::CompileShader(const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11ComputeShader** cs)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
vector<D3D11_SHADER_MACRO> m;
|
||||
|
||||
PrepareShaderMacro(m, macro);
|
||||
|
||||
CComPtr<ID3D11Blob> shader, error;
|
||||
|
||||
hr = D3DX11CompileFromFile(fn, &m[0], NULL, entry, m_shader.cs.c_str(), 0, 0, NULL, &shader, &error, NULL);
|
||||
|
||||
if(error)
|
||||
{
|
||||
printf("%s\n", (const char*)error->GetBufferPointer());
|
||||
}
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
}
|
||||
|
||||
hr = m_dev->CreateComputeShader((void*)shader->GetBufferPointer(), shader->GetBufferSize(),NULL, cs);
|
||||
hr = m_dev->CreateComputeShader((void*)shader->GetBufferPointer(), shader->GetBufferSize(), NULL, cs);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
|
|
|
@ -226,13 +226,10 @@ public:
|
|||
operator ID3D11Device*() {return m_dev;}
|
||||
operator ID3D11DeviceContext*() {return m_ctx;}
|
||||
|
||||
void CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11VertexShader** vs, D3D11_INPUT_ELEMENT_DESC* layout, int count, ID3D11InputLayout** il);
|
||||
void CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11GeometryShader** gs);
|
||||
void CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11GeometryShader** gs, D3D11_SO_DECLARATION_ENTRY* layout, int count);
|
||||
void CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11PixelShader** ps);
|
||||
void CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11ComputeShader** cs);
|
||||
void CompileShader(const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11ComputeShader** cs);
|
||||
void CompileShader(const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11VertexShader** vs, D3D11_INPUT_ELEMENT_DESC* layout, int count, ID3D11InputLayout** il);
|
||||
void CompileShader(const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11PixelShader** ps);
|
||||
void CompileShader(const char* source, size_t size, const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11VertexShader** vs, D3D11_INPUT_ELEMENT_DESC* layout, int count, ID3D11InputLayout** il);
|
||||
void CompileShader(const char* source, size_t size, const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11GeometryShader** gs);
|
||||
void CompileShader(const char* source, size_t size, const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11GeometryShader** gs, D3D11_SO_DECLARATION_ENTRY* layout, int count);
|
||||
void CompileShader(const char* source, size_t size, const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11PixelShader** ps);
|
||||
void CompileShader(const char* source, size_t size, const char* fn, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11ComputeShader** cs);
|
||||
};
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "GSdx.h"
|
||||
#include "GSDevice9.h"
|
||||
#include "resource.h"
|
||||
#include <fstream>
|
||||
|
||||
GSDevice9::GSDevice9()
|
||||
: m_lost(false)
|
||||
|
@ -289,11 +290,13 @@ bool GSDevice9::Create(GSWnd* wnd)
|
|||
D3DDECL_END()
|
||||
};
|
||||
|
||||
CompileShader(IDR_CONVERT_FX, "vs_main", NULL, &m_convert.vs, il_convert, countof(il_convert), &m_convert.il);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_CONVERT_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "vs_main", NULL, &m_convert.vs, il_convert, countof(il_convert), &m_convert.il);
|
||||
|
||||
for(size_t i = 0; i < countof(m_convert.ps); i++)
|
||||
{
|
||||
CompileShader(IDR_CONVERT_FX, format("ps_main%d", i), NULL, &m_convert.ps[i]);
|
||||
CompileShader((const char *)shader.data(), shader.size(), format("ps_main%d", i), NULL, &m_convert.ps[i]);
|
||||
}
|
||||
|
||||
m_convert.dss.DepthEnable = false;
|
||||
|
@ -322,9 +325,10 @@ bool GSDevice9::Create(GSWnd* wnd)
|
|||
|
||||
// merge
|
||||
|
||||
theApp.LoadResource(IDR_MERGE_FX, shader);
|
||||
for(size_t i = 0; i < countof(m_merge.ps); i++)
|
||||
{
|
||||
CompileShader(IDR_MERGE_FX, format("ps_main%d", i), NULL, &m_merge.ps[i]);
|
||||
CompileShader((const char *)shader.data(), shader.size(), format("ps_main%d", i), NULL, &m_merge.ps[i]);
|
||||
}
|
||||
|
||||
m_merge.bs.BlendEnable = true;
|
||||
|
@ -338,9 +342,10 @@ bool GSDevice9::Create(GSWnd* wnd)
|
|||
|
||||
// interlace
|
||||
|
||||
theApp.LoadResource(IDR_INTERLACE_FX, shader);
|
||||
for(size_t i = 0; i < countof(m_interlace.ps); i++)
|
||||
{
|
||||
CompileShader(IDR_INTERLACE_FX, format("ps_main%d", i), NULL, &m_interlace.ps[i]);
|
||||
CompileShader((const char *)shader.data(), shader.size(), format("ps_main%d", i), NULL, &m_interlace.ps[i]);
|
||||
}
|
||||
|
||||
// Shade Boost
|
||||
|
@ -363,7 +368,8 @@ bool GSDevice9::Create(GSWnd* wnd)
|
|||
{NULL, NULL},
|
||||
};
|
||||
|
||||
CompileShader(IDR_SHADEBOOST_FX, "ps_main", macro, &m_shadeboost.ps);
|
||||
theApp.LoadResource(IDR_SHADEBOOST_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "ps_main", macro, &m_shadeboost.ps);
|
||||
|
||||
// create shader layout
|
||||
|
||||
|
@ -933,7 +939,25 @@ void GSDevice9::InitExternalFX()
|
|||
if (!ExShader_Compiled)
|
||||
{
|
||||
try {
|
||||
CompileShader("shaders/GSdx.fx", "ps_main", NULL, &m_shaderfx.ps);
|
||||
std::string config_name(theApp.GetConfig("shaderfx_conf", "shaders/GSdx_FX_Settings.ini"));
|
||||
std::ifstream fconfig(config_name);
|
||||
std::stringstream shader;
|
||||
if (fconfig.good())
|
||||
shader << fconfig.rdbuf() << "\n";
|
||||
else
|
||||
fprintf(stderr, "GSdx: External shader config '%s' not loaded.\n", config_name.c_str());
|
||||
|
||||
std::string shader_name(theApp.GetConfig("shaderfx_glsl", "shaders/GSdx.fx"));
|
||||
std::ifstream fshader(shader_name);
|
||||
if (fshader.good())
|
||||
{
|
||||
shader << fshader.rdbuf();
|
||||
CompileShader(shader.str().c_str(), shader.str().length(), "ps_main", NULL, &m_shaderfx.ps);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "GSdx: External shader '%s' not loaded and will be disabled!\n", shader_name.c_str());
|
||||
}
|
||||
}
|
||||
catch (GSDXRecoverableError) {
|
||||
printf("GSdx: failed to compile external post-processing shader. \n");
|
||||
|
@ -965,7 +989,9 @@ void GSDevice9::InitFXAA()
|
|||
if (!FXAA_Compiled)
|
||||
{
|
||||
try {
|
||||
CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_FXAA_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "ps_main", NULL, &m_fxaa.ps);
|
||||
}
|
||||
catch (GSDXRecoverableError) {
|
||||
printf("GSdx: Failed to compile fxaa shader.\n");
|
||||
|
@ -1421,84 +1447,7 @@ void GSDevice9::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector4
|
|||
}
|
||||
}
|
||||
|
||||
void GSDevice9::CompileShader(const char* fn, const string& entry, const D3DXMACRO* macro, IDirect3DVertexShader9** vs, const D3DVERTEXELEMENT9* layout, int count, IDirect3DVertexDeclaration9** il)
|
||||
{
|
||||
vector<D3DXMACRO> m;
|
||||
|
||||
PrepareShaderMacro(m, macro);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
CComPtr<ID3DXBuffer> shader, error;
|
||||
|
||||
hr = D3DXCompileShaderFromFile(fn, &m[0], NULL, entry.c_str(), m_shader.vs.c_str(), 0, &shader, &error, NULL);
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = m_dev->CreateVertexShader((DWORD*)shader->GetBufferPointer(), vs);
|
||||
}
|
||||
else if(error)
|
||||
{
|
||||
printf("%s\n", (const char*)error->GetBufferPointer());
|
||||
}
|
||||
|
||||
ASSERT(SUCCEEDED(hr));
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
}
|
||||
|
||||
hr = m_dev->CreateVertexDeclaration(layout, il);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
}
|
||||
}
|
||||
|
||||
void GSDevice9::CompileShader(const char* fn, const string& entry, const D3DXMACRO* macro, IDirect3DPixelShader9** ps)
|
||||
{
|
||||
uint32 flags = 0;
|
||||
|
||||
if(m_shader.level >= D3D_FEATURE_LEVEL_9_3)
|
||||
{
|
||||
flags |= D3DXSHADER_AVOID_FLOW_CONTROL;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= D3DXSHADER_SKIPVALIDATION;
|
||||
}
|
||||
|
||||
vector<D3DXMACRO> m;
|
||||
|
||||
PrepareShaderMacro(m, macro);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
CComPtr<ID3DXBuffer> shader, error;
|
||||
|
||||
hr = D3DXCompileShaderFromFile(fn, &m[0], NULL, entry.c_str(), m_shader.ps.c_str(), flags, &shader, &error, NULL);
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = m_dev->CreatePixelShader((DWORD*)shader->GetBufferPointer(), ps);
|
||||
}
|
||||
else if(error)
|
||||
{
|
||||
printf("%s\n", (const char*)error->GetBufferPointer());
|
||||
}
|
||||
|
||||
ASSERT(SUCCEEDED(hr));
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO* macro, IDirect3DVertexShader9** vs, const D3DVERTEXELEMENT9* layout, int count, IDirect3DVertexDeclaration9** il)
|
||||
void GSDevice9::CompileShader(const char *source, size_t size, const string& entry, const D3DXMACRO* macro, IDirect3DVertexShader9** vs, const D3DVERTEXELEMENT9* layout, int count, IDirect3DVertexDeclaration9** il)
|
||||
{
|
||||
vector<D3DXMACRO> m;
|
||||
|
||||
|
@ -1508,7 +1457,7 @@ void GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO* m
|
|||
|
||||
CComPtr<ID3DXBuffer> shader, error;
|
||||
|
||||
hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), &m[0], NULL, entry.c_str(), m_shader.vs.c_str(), 0, &shader, &error, NULL);
|
||||
hr = D3DXCompileShader(source, size, &m[0], NULL, entry.c_str(), m_shader.vs.c_str(), 0, &shader, &error, NULL);
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
|
@ -1519,6 +1468,8 @@ void GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO* m
|
|||
printf("%s\n", (const char*)error->GetBufferPointer());
|
||||
}
|
||||
|
||||
ASSERT(SUCCEEDED(hr));
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
|
@ -1532,7 +1483,7 @@ void GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO* m
|
|||
}
|
||||
}
|
||||
|
||||
void GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO* macro, IDirect3DPixelShader9** ps)
|
||||
void GSDevice9::CompileShader(const char *source, size_t size, const string& entry, const D3DXMACRO* macro, IDirect3DPixelShader9** ps)
|
||||
{
|
||||
uint32 flags = 0;
|
||||
|
||||
|
@ -1552,8 +1503,7 @@ void GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO* m
|
|||
HRESULT hr;
|
||||
|
||||
CComPtr<ID3DXBuffer> shader, error;
|
||||
|
||||
hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), &m[0], NULL, entry.c_str(), m_shader.ps.c_str(), flags, &shader, &error, NULL);
|
||||
hr = D3DXCompileShader(source, size, &m[0], NULL, entry.c_str(), m_shader.ps.c_str(), flags, &shader, &error, NULL);
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
|
@ -1564,9 +1514,10 @@ void GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO* m
|
|||
printf("%s\n", (const char*)error->GetBufferPointer());
|
||||
}
|
||||
|
||||
ASSERT(SUCCEEDED(hr));
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
throw GSDXRecoverableError();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -237,11 +237,8 @@ public:
|
|||
IDirect3DDevice9* operator->() {return m_dev;}
|
||||
operator IDirect3DDevice9*() {return m_dev;}
|
||||
|
||||
void CompileShader(uint32 id, const string& entry, const D3DXMACRO* macro, IDirect3DVertexShader9** vs, const D3DVERTEXELEMENT9* layout, int count, IDirect3DVertexDeclaration9** il);
|
||||
void CompileShader(uint32 id, const string& entry, const D3DXMACRO* macro, IDirect3DPixelShader9** ps);
|
||||
|
||||
void CompileShader(const char* fn, const string& entry, const D3DXMACRO* macro, IDirect3DVertexShader9** vs, const D3DVERTEXELEMENT9* layout, int count, IDirect3DVertexDeclaration9** il);
|
||||
void CompileShader(const char* fn, const string& entry, const D3DXMACRO* macro, IDirect3DPixelShader9** ps);
|
||||
void CompileShader(const char *source, size_t size, const string& entry, const D3DXMACRO* macro, IDirect3DVertexShader9** vs, const D3DVERTEXELEMENT9* layout, int count, IDirect3DVertexDeclaration9** il);
|
||||
void CompileShader(const char *source, size_t size, const string& entry, const D3DXMACRO* macro, IDirect3DPixelShader9** ps);
|
||||
|
||||
void SetupVS(VSSelector sel, const VSConstantBuffer* cb);
|
||||
void SetupGS(GSSelector sel) {}
|
||||
|
|
|
@ -268,6 +268,31 @@ void GSDialog::ComboBoxFixDroppedWidth(UINT id)
|
|||
}
|
||||
}
|
||||
|
||||
void GSDialog::OpenFileDialog(UINT id, const char *title)
|
||||
{
|
||||
char filename[512];
|
||||
OPENFILENAME ofn = { 0 };
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = m_hWnd;
|
||||
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST;
|
||||
ofn.lpstrFile = filename;
|
||||
ofn.lpstrFile[0] = 0;
|
||||
ofn.nMaxFile = 512;
|
||||
ofn.lpstrTitle = title;
|
||||
|
||||
// GetOpenFileName changes the current directory, so we need to save and
|
||||
// restore the current directory or everything using relative paths will
|
||||
// break.
|
||||
char current_directory[512];
|
||||
GetCurrentDirectory(512, current_directory);
|
||||
|
||||
if (GetOpenFileName(&ofn))
|
||||
SendMessage(GetDlgItem(m_hWnd, id), WM_SETTEXT, 0, (LPARAM)filename);
|
||||
|
||||
SetCurrentDirectory(current_directory);
|
||||
|
||||
}
|
||||
|
||||
void GSDialog::AddTooltip(UINT id)
|
||||
{
|
||||
static UINT tooltipStructSize = GetTooltipStructSize();
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
bool ComboBoxGetSelData(UINT id, INT_PTR& data);
|
||||
void ComboBoxFixDroppedWidth(UINT id);
|
||||
|
||||
void OpenFileDialog(UINT id, const char *title);
|
||||
|
||||
void AddTooltip(UINT id);
|
||||
|
||||
static void InitCommonControls();
|
||||
|
|
|
@ -295,7 +295,9 @@ bool GSRendererCS::CreateDevice(GSDevice* dev_unk)
|
|||
|
||||
try
|
||||
{
|
||||
dev->CompileShader(IDR_CS_FX, "ps_main0", macro, &m_ps0);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_CS_FX, shader);
|
||||
dev->CompileShader((const char *)shader.data(), shader.size(), "cs.fx", "ps_main0", macro, &m_ps0);
|
||||
}
|
||||
catch (GSDXRecoverableError)
|
||||
{
|
||||
|
@ -530,7 +532,9 @@ void GSRendererCS::Draw()
|
|||
{"COLOR", 1, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 28, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
};
|
||||
|
||||
dev->CompileShader(IDR_CS_FX, "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_CS_FX, shader);
|
||||
dev->CompileShader((const char *)shader.data(), shader.size(), "cs.fx", "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
|
||||
m_vs[vs_sel] = vs;
|
||||
}
|
||||
|
@ -574,7 +578,9 @@ void GSRendererCS::Draw()
|
|||
{NULL, NULL},
|
||||
};
|
||||
|
||||
dev->CompileShader(IDR_CS_FX, "gs_main", macro, &gs[j]);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_CS_FX, shader);
|
||||
dev->CompileShader((const char *)shader.data(), shader.size(), "cs.fx", "gs_main", macro, &gs[j]);
|
||||
|
||||
m_gs[gs_sel] = gs[j];
|
||||
}
|
||||
|
@ -613,7 +619,9 @@ void GSRendererCS::Draw()
|
|||
{NULL, NULL},
|
||||
};
|
||||
|
||||
dev->CompileShader(IDR_CS_FX, "ps_main1", macro, &ps[1]);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_CS_FX, shader);
|
||||
dev->CompileShader((const char *)shader.data(), shader.size(), "cs.fx", "ps_main1", macro, &ps[1]);
|
||||
|
||||
m_ps1[ps_sel] = ps[1];
|
||||
}
|
||||
|
|
|
@ -170,6 +170,8 @@ void GSSettingsDlg::OnInit()
|
|||
|
||||
// External FX shader
|
||||
CheckDlgButton(m_hWnd, IDC_SHADER_FX, theApp.GetConfig("shaderfx", 0));
|
||||
SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), WM_SETTEXT, 0, (LPARAM)theApp.GetConfig("shaderfx_glsl", "shaders\\GSdx.fx").c_str());
|
||||
SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), WM_SETTEXT, 0, (LPARAM)theApp.GetConfig("shaderfx_conf", "shaders\\GSdx_FX_Settings.ini").c_str());
|
||||
|
||||
// Hacks
|
||||
CheckDlgButton(m_hWnd, IDC_HACKS_ENABLED, theApp.GetConfig("UserHacks", 0));
|
||||
|
@ -220,6 +222,7 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
|
|||
UpdateControls();
|
||||
break;
|
||||
case IDC_SHADEBOOST:
|
||||
case IDC_SHADER_FX:
|
||||
case IDC_PALTEX:
|
||||
case IDC_HACKS_ENABLED:
|
||||
if (code == BN_CLICKED)
|
||||
|
@ -233,6 +236,14 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
|
|||
if (code == BN_CLICKED)
|
||||
HacksDlg.DoModal();
|
||||
break;
|
||||
case IDC_SHADER_FX_BUTTON:
|
||||
if (code == BN_CLICKED)
|
||||
OpenFileDialog(IDC_SHADER_FX_EDIT, "Select External Shader");
|
||||
break;
|
||||
case IDC_SHADER_FX_CONF_BUTTON:
|
||||
if (code == BN_CLICKED)
|
||||
OpenFileDialog(IDC_SHADER_FX_CONF_EDIT, "Select External Shader Config");
|
||||
break;
|
||||
case IDOK:
|
||||
{
|
||||
INT_PTR data;
|
||||
|
@ -308,8 +319,17 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
|
|||
theApp.SetConfig("shaderfx", (int)IsDlgButtonChecked(m_hWnd, IDC_SHADER_FX));
|
||||
|
||||
// External FX Shader(OpenGL)
|
||||
theApp.SetConfig("shaderfx_conf", "shaders/GSdx_FX_Settings.ini");
|
||||
theApp.SetConfig("shaderfx_glsl", "shaders/GSdx.fx");
|
||||
int shader_fx_length = (int)SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), WM_GETTEXTLENGTH, 0, 0);
|
||||
int shader_fx_conf_length = (int)SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), WM_GETTEXTLENGTH, 0, 0);
|
||||
int length = std::max(shader_fx_length, shader_fx_conf_length) + 1;
|
||||
char *buffer = new char[length];
|
||||
|
||||
SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), WM_GETTEXT, (WPARAM)length, (LPARAM)buffer);
|
||||
theApp.SetConfig("shaderfx_glsl", buffer); // Not really glsl only ;)
|
||||
SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), WM_GETTEXT, (WPARAM)length, (LPARAM)buffer);
|
||||
theApp.SetConfig("shaderfx_conf", buffer);
|
||||
|
||||
delete [] buffer;
|
||||
|
||||
theApp.SetConfig("UserHacks", (int)IsDlgButtonChecked(m_hWnd, IDC_HACKS_ENABLED));
|
||||
}
|
||||
|
@ -398,7 +418,9 @@ void GSSettingsDlg::UpdateControls()
|
|||
EnableWindow(GetDlgItem(m_hWnd, IDC_RESX_EDIT), hw && !integer_scaling);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_RESY), hw && !integer_scaling);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_RESY_EDIT), hw && !integer_scaling);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_CUSTOM_TEXT), hw && !integer_scaling);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_UPSCALE_MULTIPLIER), hw);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_UPSCALE_MULTIPLIER_TEXT), hw);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_FILTER), hw);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_PALTEX), hw);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9 && hw);
|
||||
|
@ -416,19 +438,26 @@ void GSSettingsDlg::UpdateControls()
|
|||
EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT_TEXT), ogl && hw);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_TC_DEPTH), ogl && hw);
|
||||
|
||||
|
||||
//EnableWindow(GetDlgItem(m_hWnd, IDC_AA1), sw); // Let uers set software params regardless of renderer used
|
||||
//EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_EDIT), sw);
|
||||
//EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS), sw);
|
||||
|
||||
|
||||
// Shade Boost
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADEBUTTON), IsDlgButtonChecked(m_hWnd, IDC_SHADEBOOST) == BST_CHECKED);
|
||||
|
||||
// Hacks
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_HACKS_ENABLED), hw);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_HACKSBUTTON), hw && IsDlgButtonChecked(m_hWnd, IDC_HACKS_ENABLED));
|
||||
}
|
||||
|
||||
// External shader
|
||||
bool external_shader_selected = IsDlgButtonChecked(m_hWnd, IDC_SHADER_FX) == BST_CHECKED;
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_TEXT), external_shader_selected);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), external_shader_selected);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_BUTTON), external_shader_selected);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_TEXT), external_shader_selected);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), external_shader_selected);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_BUTTON), external_shader_selected);
|
||||
|
||||
// Shade Boost
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADEBUTTON), IsDlgButtonChecked(m_hWnd, IDC_SHADEBOOST) == BST_CHECKED);
|
||||
}
|
||||
|
||||
// Shade Boost Dialog
|
||||
|
@ -551,7 +580,7 @@ void GSHacksDlg::OnInit()
|
|||
int renderer = SendMessage(hwnd_renderer, CB_GETITEMDATA, SendMessage(hwnd_renderer, CB_GETCURSEL, 0, 0), 0);
|
||||
// It can only be accessed with a HW renderer, so this is sufficient.
|
||||
bool dx9 = renderer == 0;
|
||||
bool dx11 = renderer == 3;
|
||||
// bool dx11 = renderer == 3;
|
||||
bool ogl = renderer == 12;
|
||||
unsigned short cb = 0;
|
||||
|
||||
|
|
|
@ -118,7 +118,9 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
|||
|
||||
GSVertexShader11 vs;
|
||||
|
||||
CompileShader(IDR_TFX_FX, "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "tfx.fx", "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
|
||||
m_vs[sel] = vs;
|
||||
|
||||
|
@ -163,7 +165,9 @@ void GSDevice11::SetupGS(GSSelector sel)
|
|||
{NULL, NULL},
|
||||
};
|
||||
|
||||
CompileShader(IDR_TFX_FX, "gs_main", macro, &gs);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "tfx.fx", "gs_main", macro, &gs);
|
||||
|
||||
m_gs[sel] = gs;
|
||||
}
|
||||
|
@ -228,7 +232,9 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
|
|||
|
||||
CComPtr<ID3D11PixelShader> ps;
|
||||
|
||||
CompileShader(IDR_TFX_FX, "ps_main", macro, &ps);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "tfx.fx", "ps_main", macro, &ps);
|
||||
|
||||
m_ps[sel] = ps;
|
||||
|
||||
|
|
|
@ -96,7 +96,9 @@ void GSDevice9::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
|||
|
||||
GSVertexShader9 vs;
|
||||
|
||||
CompileShader(IDR_TFX_FX, "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
|
||||
m_vs[sel] = vs;
|
||||
|
||||
|
@ -179,7 +181,9 @@ void GSDevice9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSel
|
|||
|
||||
CComPtr<IDirect3DPixelShader9> ps;
|
||||
|
||||
CompileShader(IDR_TFX_FX, "ps_main", macro, &ps);
|
||||
vector<unsigned char> shader;
|
||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "ps_main", macro, &ps);
|
||||
|
||||
m_ps[sel] = ps;
|
||||
|
||||
|
|
|
@ -181,57 +181,63 @@ BEGIN
|
|||
CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,129,157,49,10
|
||||
END
|
||||
|
||||
IDD_CONFIG DIALOGEX 0, 0, 185, 391
|
||||
IDD_CONFIG DIALOGEX 0, 0, 243, 412
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "GSdx Settings"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL IDB_LOGO10,IDC_LOGO11,"Static",SS_BITMAP | SS_REALSIZECONTROL,6,6,173,42
|
||||
DEFPUSHBUTTON "OK",IDOK,40,371,50,14
|
||||
LTEXT "Renderer:",IDC_STATIC,6,72,34,8
|
||||
COMBOBOX IDC_RENDERER,68,70,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Interlacing (F5):",IDC_STATIC,6,101,53,8
|
||||
COMBOBOX IDC_INTERLACE,68,99,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Custom Resolution:",IDC_STATIC,25,148,65,8
|
||||
EDITTEXT IDC_RESX_EDIT,94,146,39,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,120,146,11,14
|
||||
EDITTEXT IDC_RESY_EDIT,136,146,39,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,154,146,11,14
|
||||
LTEXT "Extra rendering threads:",IDC_STATIC,11,340,83,8
|
||||
EDITTEXT IDC_SWTHREADS_EDIT,94,337,35,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,130,335,11,14
|
||||
COMBOBOX IDC_UPSCALE_MULTIPLIER,94,130,81,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Internal Resolution:",IDC_STATIC,11,132,79,8
|
||||
CONTROL "Edge Anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,354,93,10
|
||||
PUSHBUTTON "Cancel",IDCANCEL,95,371,50,14
|
||||
CONTROL IDB_LOGO9,IDC_LOGO9,"Static",SS_BITMAP | SS_REALSIZECONTROL,6,6,173,44
|
||||
CONTROL IDB_LOGOGL,IDC_LOGOGL,"Static",SS_BITMAP | SS_REALSIZECONTROL,6,6,173,42
|
||||
GROUPBOX "Enhancements",IDC_STATIC,6,116,173,58,BS_CENTER
|
||||
GROUPBOX "Software Mode Settings",IDC_STATIC,6,328,173,41,BS_CENTER
|
||||
GROUPBOX "Hardware Mode Settings",IDC_STATIC,6,208,173,118,BS_CENTER
|
||||
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,297,58,8
|
||||
CONTROL "Alpha Correction",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,297,81,8
|
||||
CONTROL "Allow 8-Bit Textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,219,79,10
|
||||
CONTROL "Enable Shade Boost",IDC_SHADEBOOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,178,79,10
|
||||
CONTROL "Accurate Date",IDC_ACCURATE_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,297,67,8
|
||||
PUSHBUTTON "Settings...",IDC_SHADEBUTTON,94,176,81,14
|
||||
CONTROL "Enable HW Hacks",IDC_HACKS_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,281,71,10
|
||||
PUSHBUTTON "Configure Hacks...",IDC_HACKSBUTTON,94,279,81,14
|
||||
CONTROL IDB_LOGO10,IDC_LOGO11,"Static",SS_BITMAP | SS_REALSIZECONTROL,35,6,173,42
|
||||
CONTROL IDB_LOGO9,IDC_LOGO9,"Static",SS_BITMAP | SS_REALSIZECONTROL,34,6,175,44
|
||||
CONTROL IDB_LOGOGL,IDC_LOGOGL,"Static",SS_BITMAP | SS_REALSIZECONTROL,34,6,175,44
|
||||
LTEXT "Adapter:",IDC_STATIC,6,57,30,8
|
||||
COMBOBOX IDC_ADAPTER,68,55,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Enable FXAA",IDC_FXAA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,194,61,10
|
||||
CONTROL "Enable FX Shader",IDC_SHADER_FX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,194,71,10
|
||||
RTEXT "Anisotropic Filtering:",IDC_AFCOMBO_TEXT,18,249,72,8
|
||||
COMBOBOX IDC_AFCOMBO,94,247,81,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "OpenCL Device:",IDC_STATIC,6,86,52,8
|
||||
COMBOBOX IDC_OPENCL_DEVICE,68,84,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Hardware Depth",IDC_TC_DEPTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,297,72,8
|
||||
COMBOBOX IDC_ACCURATE_BLEND_UNIT,94,309,81,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Blending Unit Accuracy:",IDC_ACCURATE_BLEND_UNIT_TEXT,11,311,79,10
|
||||
COMBOBOX IDC_CRC_LEVEL,94,263,81,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "CRC Hack Level:",IDC_CRC_LEVEL_TEXT,36,265,54,8
|
||||
COMBOBOX IDC_FILTER,94,231,81,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Texture Filtering:",IDC_FILTER_TEXT,32,233,58,8
|
||||
COMBOBOX IDC_ADAPTER,71,55,166,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Renderer:",IDC_STATIC,6,72,34,8
|
||||
COMBOBOX IDC_RENDERER,71,70,166,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "OpenCL Device:",IDC_STATIC,6,87,52,8
|
||||
COMBOBOX IDC_OPENCL_DEVICE,71,85,166,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Interlacing (F5):",IDC_STATIC,6,102,53,8
|
||||
COMBOBOX IDC_INTERLACE,71,100,166,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
GROUPBOX "Hardware Mode Settings",IDC_STATIC,6,116,231,152,BS_CENTER
|
||||
CONTROL "Allow 8-Bit Textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,128,90,10
|
||||
LTEXT "Internal Resolution:",IDC_UPSCALE_MULTIPLIER_TEXT,22,144,79,8
|
||||
COMBOBOX IDC_UPSCALE_MULTIPLIER,105,142,127,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Custom Resolution:",IDC_CUSTOM_TEXT,22,160,79,8
|
||||
EDITTEXT IDC_RESX_EDIT,105,158,61,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,145,158,11,14
|
||||
EDITTEXT IDC_RESY_EDIT,171,158,61,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,221,158,11,14
|
||||
LTEXT "Texture Filtering:",IDC_FILTER_TEXT,22,176,79,8
|
||||
COMBOBOX IDC_FILTER,105,174,127,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Anisotropic Filtering:",IDC_AFCOMBO_TEXT,22,192,79,8
|
||||
COMBOBOX IDC_AFCOMBO,105,190,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "CRC Hack Level:",IDC_CRC_LEVEL_TEXT,22,208,79,8
|
||||
COMBOBOX IDC_CRC_LEVEL,105,206,127,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Enable HW Hacks",IDC_HACKS_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,223,71,10
|
||||
PUSHBUTTON "Configure Hacks...",IDC_HACKSBUTTON,105,221,127,14
|
||||
CONTROL "Accurate Date",IDC_ACCURATE_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,239,67,8
|
||||
CONTROL "Hardware Depth",IDC_TC_DEPTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,239,72,8
|
||||
LTEXT "Blending Unit Accuracy:",IDC_ACCURATE_BLEND_UNIT_TEXT,22,252,79,10
|
||||
COMBOBOX IDC_ACCURATE_BLEND_UNIT,105,251,127,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,239,90,8
|
||||
CONTROL "Alpha Correction",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,239,74,8
|
||||
GROUPBOX "Software Mode Settings",IDC_STATIC,6,269,231,25,BS_CENTER
|
||||
CONTROL "Edge Anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,279,91,10
|
||||
LTEXT "Extra rendering threads:",IDC_STATIC,116,280,83,8
|
||||
EDITTEXT IDC_SWTHREADS_EDIT,198,278,34,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,221,277,11,14
|
||||
GROUPBOX "Custom Shader Settings",IDC_STATIC,6,295,231,94,BS_CENTER
|
||||
CONTROL "Enable Shade Boost",IDC_SHADEBOOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,307,90,10
|
||||
PUSHBUTTON "Configure Shade Boost...",IDC_SHADEBUTTON,105,305,127,14
|
||||
CONTROL "Enable External Shader",IDC_SHADER_FX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,322,90,10
|
||||
CONTROL "Enable FXAA",IDC_FXAA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,322,61,10
|
||||
LTEXT "External Shader",IDC_SHADER_FX_TEXT,22,337,52,8
|
||||
EDITTEXT IDC_SHADER_FX_EDIT,22,345,170,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Browse",IDC_SHADER_FX_BUTTON,196,345,36,14
|
||||
LTEXT "External Shader Config",IDC_SHADER_FX_CONF_TEXT,22,362,75,8
|
||||
EDITTEXT IDC_SHADER_FX_CONF_EDIT,22,371,170,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Browse",IDC_SHADER_FX_CONF_BUTTON,196,371,36,14
|
||||
DEFPUSHBUTTON "OK",IDOK,69,392,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,125,392,50,14
|
||||
END
|
||||
|
||||
|
||||
|
@ -287,15 +293,14 @@ BEGIN
|
|||
IDD_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 6
|
||||
RIGHTMARGIN, 179
|
||||
RIGHTMARGIN, 237
|
||||
VERTGUIDE, 11
|
||||
VERTGUIDE, 90
|
||||
VERTGUIDE, 94
|
||||
VERTGUIDE, 175
|
||||
VERTGUIDE, 22
|
||||
VERTGUIDE, 101
|
||||
VERTGUIDE, 105
|
||||
VERTGUIDE, 232
|
||||
TOPMARGIN, 6
|
||||
BOTTOMMARGIN, 385
|
||||
HORZGUIDE, 194
|
||||
HORZGUIDE, 297
|
||||
BOTTOMMARGIN, 406
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
|
|
@ -76,7 +76,15 @@
|
|||
#define IDC_CRC_LEVEL 2071
|
||||
#define IDC_CRC_LEVEL_TEXT 2072
|
||||
#define IDC_TC_DEPTH 2073
|
||||
#define IDC_COLORSPACE 2075
|
||||
#define IDC_COLORSPACE 2074
|
||||
#define IDC_SHADER_FX_EDIT 2075
|
||||
#define IDC_SHADER_FX_CONF_EDIT 2076
|
||||
#define IDC_SHADER_FX_BUTTON 2077
|
||||
#define IDC_SHADER_FX_CONF_BUTTON 2078
|
||||
#define IDC_SHADER_FX_TEXT 2079
|
||||
#define IDC_SHADER_FX_CONF_TEXT 2080
|
||||
#define IDC_CUSTOM_TEXT 2081
|
||||
#define IDC_UPSCALE_MULTIPLIER_TEXT 2082
|
||||
#define IDR_CONVERT_FX 10000
|
||||
#define IDR_TFX_FX 10001
|
||||
#define IDR_MERGE_FX 10002
|
||||
|
@ -95,7 +103,7 @@
|
|||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 10013
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 2074
|
||||
#define _APS_NEXT_CONTROL_VALUE 2083
|
||||
#define _APS_NEXT_SYMED_VALUE 5000
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue