mirror of https://github.com/PCSX2/pcsx2.git
gsdx-d3d11: Update d3d shader macro handling to a much better algorithm.
Bonus, remove unused options variable D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS.
This commit is contained in:
parent
cec185fd66
commit
6a122268cb
|
@ -248,10 +248,6 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
||||||
m_hack_topleft_offset = (!nvidia_gpu || m_upscale_multiplier == 1 || spritehack_enabled) ? 0.0f : -0.01f;
|
m_hack_topleft_offset = (!nvidia_gpu || m_upscale_multiplier == 1 || spritehack_enabled) ? 0.0f : -0.01f;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS options;
|
|
||||||
|
|
||||||
hr = m_dev->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &options, sizeof(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS));
|
|
||||||
|
|
||||||
// debug
|
// debug
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
CComPtr<ID3D11Debug> debug;
|
CComPtr<ID3D11Debug> debug;
|
||||||
|
@ -283,23 +279,20 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
||||||
{"COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 28, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
{"COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 28, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ShaderMacro sm_model(m_shader.model);
|
||||||
|
|
||||||
std::vector<char> shader;
|
std::vector<char> shader;
|
||||||
theApp.LoadResource(IDR_CONVERT_FX, shader);
|
theApp.LoadResource(IDR_CONVERT_FX, shader);
|
||||||
CreateShader(shader, "convert.fx", nullptr, "vs_main", nullptr, &m_convert.vs, il_convert, countof(il_convert), &m_convert.il);
|
CreateShader(shader, "convert.fx", nullptr, "vs_main", sm_model.GetPtr(), &m_convert.vs, il_convert, countof(il_convert), &m_convert.il);
|
||||||
|
|
||||||
std::string convert_mstr[1];
|
ShaderMacro sm_convert(m_shader.model);
|
||||||
|
sm_convert.AddMacro("PS_SCALE_FACTOR", std::max(1, m_upscale_multiplier));
|
||||||
|
|
||||||
convert_mstr[0] = format("%d", std::max(1, m_upscale_multiplier));
|
D3D_SHADER_MACRO* sm_convert_ptr = sm_convert.GetPtr();
|
||||||
|
|
||||||
D3D_SHADER_MACRO convert_macro[] =
|
|
||||||
{
|
|
||||||
{"PS_SCALE_FACTOR", convert_mstr[0].c_str()},
|
|
||||||
{NULL, NULL},
|
|
||||||
};
|
|
||||||
|
|
||||||
for(size_t i = 0; i < countof(m_convert.ps); i++)
|
for(size_t i = 0; i < countof(m_convert.ps); i++)
|
||||||
{
|
{
|
||||||
CreateShader(shader, "convert.fx", nullptr, format("ps_main%d", i).c_str(), convert_macro, &m_convert.ps[i]);
|
CreateShader(shader, "convert.fx", nullptr, format("ps_main%d", i).c_str(), sm_convert_ptr, & m_convert.ps[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&dsd, 0, sizeof(dsd));
|
memset(&dsd, 0, sizeof(dsd));
|
||||||
|
@ -331,7 +324,7 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
||||||
theApp.LoadResource(IDR_MERGE_FX, shader);
|
theApp.LoadResource(IDR_MERGE_FX, shader);
|
||||||
for(size_t i = 0; i < countof(m_merge.ps); i++)
|
for(size_t i = 0; i < countof(m_merge.ps); i++)
|
||||||
{
|
{
|
||||||
CreateShader(shader, "merge.fx", nullptr, format("ps_main%d", i).c_str(), nullptr, &m_merge.ps[i]);
|
CreateShader(shader, "merge.fx", nullptr, format("ps_main%d", i).c_str(), sm_model.GetPtr(), &m_merge.ps[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&bsd, 0, sizeof(bsd));
|
memset(&bsd, 0, sizeof(bsd));
|
||||||
|
@ -360,28 +353,16 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
||||||
theApp.LoadResource(IDR_INTERLACE_FX, shader);
|
theApp.LoadResource(IDR_INTERLACE_FX, shader);
|
||||||
for(size_t i = 0; i < countof(m_interlace.ps); i++)
|
for(size_t i = 0; i < countof(m_interlace.ps); i++)
|
||||||
{
|
{
|
||||||
CreateShader(shader, "interlace.fx", nullptr, format("ps_main%d", i).c_str(), nullptr, &m_interlace.ps[i]);
|
CreateShader(shader, "interlace.fx", nullptr, format("ps_main%d", i).c_str(), sm_model.GetPtr(), &m_interlace.ps[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shade Boos
|
// Shade Boost
|
||||||
|
|
||||||
int ShadeBoost_Contrast = theApp.GetConfigI("ShadeBoost_Contrast");
|
ShaderMacro sm_sboost(m_shader.model);
|
||||||
int ShadeBoost_Brightness = theApp.GetConfigI("ShadeBoost_Brightness");
|
|
||||||
int ShadeBoost_Saturation = theApp.GetConfigI("ShadeBoost_Saturation");
|
|
||||||
|
|
||||||
std::string str[3];
|
sm_sboost.AddMacro("SB_SATURATION", theApp.GetConfigI("ShadeBoost_Saturation"));
|
||||||
|
sm_sboost.AddMacro("SB_BRIGHTNESS", theApp.GetConfigI("ShadeBoost_Brightness"));
|
||||||
str[0] = format("%d", ShadeBoost_Saturation);
|
sm_sboost.AddMacro("SB_CONTRAST", theApp.GetConfigI("ShadeBoost_Contrast"));
|
||||||
str[1] = format("%d", ShadeBoost_Brightness);
|
|
||||||
str[2] = format("%d", ShadeBoost_Contrast);
|
|
||||||
|
|
||||||
D3D_SHADER_MACRO macro[] =
|
|
||||||
{
|
|
||||||
{"SB_SATURATION", str[0].c_str()},
|
|
||||||
{"SB_BRIGHTNESS", str[1].c_str()},
|
|
||||||
{"SB_CONTRAST", str[2].c_str()},
|
|
||||||
{NULL, NULL},
|
|
||||||
};
|
|
||||||
|
|
||||||
memset(&bd, 0, sizeof(bd));
|
memset(&bd, 0, sizeof(bd));
|
||||||
|
|
||||||
|
@ -392,7 +373,7 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
||||||
hr = m_dev->CreateBuffer(&bd, NULL, &m_shadeboost.cb);
|
hr = m_dev->CreateBuffer(&bd, NULL, &m_shadeboost.cb);
|
||||||
|
|
||||||
theApp.LoadResource(IDR_SHADEBOOST_FX, shader);
|
theApp.LoadResource(IDR_SHADEBOOST_FX, shader);
|
||||||
CreateShader(shader, "shadeboost.fx", nullptr, "ps_main", macro, &m_shadeboost.ps);
|
CreateShader(shader, "shadeboost.fx", nullptr, "ps_main", sm_sboost.GetPtr(), &m_shadeboost.ps);
|
||||||
|
|
||||||
// External fx shader
|
// External fx shader
|
||||||
|
|
||||||
|
@ -1007,8 +988,8 @@ void GSDevice11::InitExternalFX()
|
||||||
shader << fshader.rdbuf();
|
shader << fshader.rdbuf();
|
||||||
const std::string& s = shader.str();
|
const std::string& s = shader.str();
|
||||||
std::vector<char> buff(s.begin(), s.end());
|
std::vector<char> buff(s.begin(), s.end());
|
||||||
|
ShaderMacro sm(m_shader.model);
|
||||||
CreateShader(buff, shader_name.c_str(), D3D_COMPILE_STANDARD_FILE_INCLUDE, "ps_main", nullptr, &m_shaderfx.ps);
|
CreateShader(buff, shader_name.c_str(), D3D_COMPILE_STANDARD_FILE_INCLUDE, "ps_main", sm.GetPtr(), &m_shaderfx.ps);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1051,7 +1032,8 @@ void GSDevice11::InitFXAA()
|
||||||
try {
|
try {
|
||||||
std::vector<char> shader;
|
std::vector<char> shader;
|
||||||
theApp.LoadResource(IDR_FXAA_FX, shader);
|
theApp.LoadResource(IDR_FXAA_FX, shader);
|
||||||
CreateShader(shader, "fxaa.fx", nullptr, "ps_main", nullptr, &m_fxaa.ps);
|
ShaderMacro sm(m_shader.model);
|
||||||
|
CreateShader(shader, "fxaa.fx", nullptr, "ps_main", sm.GetPtr(), &m_fxaa.ps);
|
||||||
}
|
}
|
||||||
catch (GSDXRecoverableError) {
|
catch (GSDXRecoverableError) {
|
||||||
printf("GSdx: failed to compile fxaa shader.\n");
|
printf("GSdx: failed to compile fxaa shader.\n");
|
||||||
|
@ -1484,6 +1466,27 @@ void GSDevice11::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GSDevice11::ShaderMacro::ShaderMacro(std::string& smodel)
|
||||||
|
{
|
||||||
|
mlist.emplace_back("SHADER_MODEL", smodel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GSDevice11::ShaderMacro::AddMacro(const char* n, int d)
|
||||||
|
{
|
||||||
|
mlist.emplace_back(n, std::to_string(d));
|
||||||
|
}
|
||||||
|
|
||||||
|
D3D_SHADER_MACRO* GSDevice11::ShaderMacro::GetPtr(void)
|
||||||
|
{
|
||||||
|
mout.clear();
|
||||||
|
|
||||||
|
for (auto& i : mlist)
|
||||||
|
mout.emplace_back(i.name.c_str(), i.def.c_str());
|
||||||
|
|
||||||
|
mout.emplace_back(nullptr, nullptr);
|
||||||
|
return (D3D_SHADER_MACRO*)mout.data();
|
||||||
|
}
|
||||||
|
|
||||||
void GSDevice11::CreateShader(std::vector<char> source, const char* fn, ID3DInclude *include, const char* entry, D3D_SHADER_MACRO* macro, ID3D11VertexShader** vs, D3D11_INPUT_ELEMENT_DESC* layout, int count, ID3D11InputLayout** il)
|
void GSDevice11::CreateShader(std::vector<char> source, const char* fn, ID3DInclude *include, const char* entry, D3D_SHADER_MACRO* macro, ID3D11VertexShader** vs, D3D11_INPUT_ELEMENT_DESC* layout, int count, ID3D11InputLayout** il)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -1543,10 +1546,6 @@ void GSDevice11::CompileShader(std::vector<char> source, const char* fn, ID3DInc
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
std::vector<D3D_SHADER_MACRO> m;
|
|
||||||
|
|
||||||
PrepareShaderMacro(m, macro);
|
|
||||||
|
|
||||||
CComPtr<ID3DBlob> error;
|
CComPtr<ID3DBlob> error;
|
||||||
|
|
||||||
UINT flags = 0;
|
UINT flags = 0;
|
||||||
|
@ -1555,7 +1554,7 @@ void GSDevice11::CompileShader(std::vector<char> source, const char* fn, ID3DInc
|
||||||
flags = D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION | D3DCOMPILE_AVOID_FLOW_CONTROL;
|
flags = D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION | D3DCOMPILE_AVOID_FLOW_CONTROL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hr = s_pD3DCompile(source.data(), source.size(), fn, &m[0], include, entry, shader_model.c_str(), flags, 0, shader, &error);
|
hr = s_pD3DCompile(source.data(), source.size(), fn, macro, include, entry, shader_model.c_str(), flags, 0, shader, &error);
|
||||||
|
|
||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
|
|
|
@ -315,6 +315,29 @@ public:
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
class ShaderMacro
|
||||||
|
{
|
||||||
|
struct mcstr
|
||||||
|
{
|
||||||
|
const char* name, * def;
|
||||||
|
mcstr(const char* n, const char* d) : name(n), def(d) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mstring
|
||||||
|
{
|
||||||
|
std::string name, def;
|
||||||
|
mstring(const char* n, std::string d) : name(n), def(d) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<mstring> mlist;
|
||||||
|
std::vector<mcstr> mout;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ShaderMacro(std::string& smodel);
|
||||||
|
void AddMacro(const char* n, int d);
|
||||||
|
D3D_SHADER_MACRO* GetPtr(void);
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float m_hack_topleft_offset;
|
float m_hack_topleft_offset;
|
||||||
int m_upscale_multiplier;
|
int m_upscale_multiplier;
|
||||||
|
@ -533,27 +556,5 @@ public:
|
||||||
void CreateShader(std::vector<char> source, const char* fn, ID3DInclude *include, const char* entry, D3D_SHADER_MACRO* macro, ID3D11PixelShader** ps);
|
void CreateShader(std::vector<char> source, const char* fn, ID3DInclude *include, const char* entry, D3D_SHADER_MACRO* macro, ID3D11PixelShader** ps);
|
||||||
|
|
||||||
void CompileShader(std::vector<char> source, const char* fn, ID3DInclude *include, const char* entry, D3D_SHADER_MACRO* macro, ID3DBlob** shader, std::string shader_model);
|
void CompileShader(std::vector<char> source, const char* fn, ID3DInclude *include, const char* entry, D3D_SHADER_MACRO* macro, ID3DBlob** shader, std::string shader_model);
|
||||||
|
|
||||||
template<class T> void PrepareShaderMacro(std::vector<T>& dst, const T* src)
|
|
||||||
{
|
|
||||||
dst.clear();
|
|
||||||
|
|
||||||
while (src && src->Definition && src->Name)
|
|
||||||
{
|
|
||||||
dst.push_back(*src++);
|
|
||||||
}
|
|
||||||
|
|
||||||
T m;
|
|
||||||
|
|
||||||
m.Name = "SHADER_MODEL";
|
|
||||||
m.Definition = m_shader.model.c_str();
|
|
||||||
|
|
||||||
dst.push_back(m);
|
|
||||||
|
|
||||||
m.Name = NULL;
|
|
||||||
m.Definition = NULL;
|
|
||||||
|
|
||||||
dst.push_back(m);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -103,19 +103,11 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
||||||
|
|
||||||
if(i == m_vs.end())
|
if(i == m_vs.end())
|
||||||
{
|
{
|
||||||
std::string str[3];
|
ShaderMacro sm(m_shader.model);
|
||||||
|
|
||||||
str[0] = format("%d", sel.bppz);
|
sm.AddMacro("VS_BPPZ", sel.bppz);
|
||||||
str[1] = format("%d", sel.tme);
|
sm.AddMacro("VS_TME", sel.tme);
|
||||||
str[2] = format("%d", sel.fst);
|
sm.AddMacro("VS_FST", sel.fst);
|
||||||
|
|
||||||
D3D_SHADER_MACRO macro[] =
|
|
||||||
{
|
|
||||||
{"VS_BPPZ", str[0].c_str()},
|
|
||||||
{"VS_TME", str[1].c_str()},
|
|
||||||
{"VS_FST", str[2].c_str()},
|
|
||||||
{NULL, NULL},
|
|
||||||
};
|
|
||||||
|
|
||||||
D3D11_INPUT_ELEMENT_DESC layout[] =
|
D3D11_INPUT_ELEMENT_DESC layout[] =
|
||||||
{
|
{
|
||||||
|
@ -132,7 +124,7 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
||||||
|
|
||||||
std::vector<char> shader;
|
std::vector<char> shader;
|
||||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||||
CreateShader(shader, "tfx.fx", nullptr, "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
CreateShader(shader, "tfx.fx", nullptr, "vs_main", sm.GetPtr(), &vs.vs, layout, countof(layout), &vs.il);
|
||||||
|
|
||||||
m_vs[sel] = vs;
|
m_vs[sel] = vs;
|
||||||
|
|
||||||
|
@ -166,25 +158,16 @@ void GSDevice11::SetupGS(GSSelector sel, const GSConstantBuffer* cb)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string str[4];
|
ShaderMacro sm(m_shader.model);
|
||||||
|
|
||||||
str[0] = format("%d", sel.iip);
|
sm.AddMacro("GS_IIP", sel.iip);
|
||||||
str[1] = format("%d", sel.prim);
|
sm.AddMacro("GS_PRIM", sel.prim);
|
||||||
str[2] = format("%d", sel.point);
|
sm.AddMacro("GS_POINT", sel.point);
|
||||||
str[3] = format("%d", sel.line);
|
sm.AddMacro("GS_LINE", sel.line);
|
||||||
|
|
||||||
D3D_SHADER_MACRO macro[] =
|
|
||||||
{
|
|
||||||
{"GS_IIP", str[0].c_str()},
|
|
||||||
{"GS_PRIM", str[1].c_str()},
|
|
||||||
{"GS_POINT", str[2].c_str()},
|
|
||||||
{"GS_LINE", str[3].c_str()},
|
|
||||||
{NULL, NULL},
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<char> shader;
|
std::vector<char> shader;
|
||||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||||
CreateShader(shader, "tfx.fx", nullptr, "gs_main", macro, &gs);
|
CreateShader(shader, "tfx.fx", nullptr, "gs_main", sm.GetPtr(), &gs);
|
||||||
|
|
||||||
m_gs[sel] = gs;
|
m_gs[sel] = gs;
|
||||||
}
|
}
|
||||||
|
@ -207,81 +190,45 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
|
||||||
|
|
||||||
if(i == m_ps.end())
|
if(i == m_ps.end())
|
||||||
{
|
{
|
||||||
std::string str[31];
|
ShaderMacro sm(m_shader.model);
|
||||||
|
|
||||||
str[0] = format("%d", sel.fst);
|
sm.AddMacro("PS_SCALE_FACTOR", std::max(1, m_upscale_multiplier));
|
||||||
str[1] = format("%d", sel.wms);
|
sm.AddMacro("PS_FST", sel.fst);
|
||||||
str[2] = format("%d", sel.wmt);
|
sm.AddMacro("PS_WMS", sel.wms);
|
||||||
str[3] = format("%d", sel.fmt);
|
sm.AddMacro("PS_WMT", sel.wmt);
|
||||||
str[4] = format("%d", sel.aem);
|
sm.AddMacro("PS_FMT", sel.fmt);
|
||||||
str[5] = format("%d", sel.tfx);
|
sm.AddMacro("PS_AEM", sel.aem);
|
||||||
str[6] = format("%d", sel.tcc);
|
sm.AddMacro("PS_TFX", sel.tfx);
|
||||||
str[7] = format("%d", sel.atst);
|
sm.AddMacro("PS_TCC", sel.tcc);
|
||||||
str[8] = format("%d", sel.fog);
|
sm.AddMacro("PS_ATST", sel.atst);
|
||||||
str[9] = format("%d", sel.clr1);
|
sm.AddMacro("PS_FOG", sel.fog);
|
||||||
str[10] = format("%d", sel.fba);
|
sm.AddMacro("PS_CLR1", sel.clr1);
|
||||||
str[11] = format("%d", sel.fbmask);
|
sm.AddMacro("PS_FBA", sel.fba);
|
||||||
str[12] = format("%d", sel.ltf);
|
sm.AddMacro("PS_FBMASK", sel.fbmask);
|
||||||
str[13] = format("%d", sel.spritehack);
|
sm.AddMacro("PS_LTF", sel.ltf);
|
||||||
str[14] = format("%d", sel.tcoffsethack);
|
sm.AddMacro("PS_SPRITEHACK", sel.spritehack);
|
||||||
str[15] = format("%d", sel.point_sampler);
|
sm.AddMacro("PS_TCOFFSETHACK", sel.tcoffsethack);
|
||||||
str[16] = format("%d", sel.shuffle);
|
sm.AddMacro("PS_POINT_SAMPLER", sel.point_sampler);
|
||||||
str[17] = format("%d", sel.read_ba);
|
sm.AddMacro("PS_SHUFFLE", sel.shuffle);
|
||||||
str[18] = format("%d", sel.channel);
|
sm.AddMacro("PS_READ_BA", sel.read_ba);
|
||||||
str[19] = format("%d", sel.tales_of_abyss_hle);
|
sm.AddMacro("PS_CHANNEL_FETCH", sel.channel);
|
||||||
str[20] = format("%d", sel.urban_chaos_hle);
|
sm.AddMacro("PS_TALES_OF_ABYSS_HLE", sel.tales_of_abyss_hle);
|
||||||
str[21] = format("%d", sel.dfmt);
|
sm.AddMacro("PS_URBAN_CHAOS_HLE", sel.urban_chaos_hle);
|
||||||
str[22] = format("%d", sel.depth_fmt);
|
sm.AddMacro("PS_DFMT", sel.dfmt);
|
||||||
str[23] = format("%d", sel.fmt >> 2);
|
sm.AddMacro("PS_DEPTH_FMT", sel.depth_fmt);
|
||||||
str[24] = format("%d", sel.invalid_tex0);
|
sm.AddMacro("PS_PAL_FMT", sel.fmt >> 2);
|
||||||
str[25] = format("%d", m_upscale_multiplier ? m_upscale_multiplier : 1);
|
sm.AddMacro("PS_INVALID_TEX0", sel.invalid_tex0);
|
||||||
str[26] = format("%d", sel.hdr);
|
sm.AddMacro("PS_HDR", sel.hdr);
|
||||||
str[27] = format("%d", sel.blend_a);
|
sm.AddMacro("PS_BLEND_A", sel.blend_a);
|
||||||
str[28] = format("%d", sel.blend_b);
|
sm.AddMacro("PS_BLEND_B", sel.blend_b);
|
||||||
str[29] = format("%d", sel.blend_c);
|
sm.AddMacro("PS_BLEND_C", sel.blend_c);
|
||||||
str[30] = format("%d", sel.blend_d);
|
sm.AddMacro("PS_BLEND_D", sel.blend_d);
|
||||||
|
|
||||||
D3D_SHADER_MACRO macro[] =
|
|
||||||
{
|
|
||||||
{"PS_FST", str[0].c_str()},
|
|
||||||
{"PS_WMS", str[1].c_str()},
|
|
||||||
{"PS_WMT", str[2].c_str()},
|
|
||||||
{"PS_FMT", str[3].c_str()},
|
|
||||||
{"PS_AEM", str[4].c_str()},
|
|
||||||
{"PS_TFX", str[5].c_str()},
|
|
||||||
{"PS_TCC", str[6].c_str()},
|
|
||||||
{"PS_ATST", str[7].c_str()},
|
|
||||||
{"PS_FOG", str[8].c_str()},
|
|
||||||
{"PS_CLR1", str[9].c_str()},
|
|
||||||
{"PS_FBA", str[10].c_str()},
|
|
||||||
{"PS_FBMASK", str[11].c_str()},
|
|
||||||
{"PS_LTF", str[12].c_str()},
|
|
||||||
{"PS_SPRITEHACK", str[13].c_str()},
|
|
||||||
{"PS_TCOFFSETHACK", str[14].c_str()},
|
|
||||||
{"PS_POINT_SAMPLER", str[15].c_str()},
|
|
||||||
{"PS_SHUFFLE", str[16].c_str() },
|
|
||||||
{"PS_READ_BA", str[17].c_str() },
|
|
||||||
{"PS_CHANNEL_FETCH", str[18].c_str() },
|
|
||||||
{"PS_TALES_OF_ABYSS_HLE", str[19].c_str() },
|
|
||||||
{"PS_URBAN_CHAOS_HLE", str[20].c_str() },
|
|
||||||
{"PS_DFMT", str[21].c_str() },
|
|
||||||
{"PS_DEPTH_FMT", str[22].c_str() },
|
|
||||||
{"PS_PAL_FMT", str[23].c_str() },
|
|
||||||
{"PS_INVALID_TEX0", str[24].c_str() },
|
|
||||||
{"PS_SCALE_FACTOR", str[25].c_str() },
|
|
||||||
{"PS_HDR", str[26].c_str() },
|
|
||||||
{"PS_BLEND_A", str[27].c_str() },
|
|
||||||
{"PS_BLEND_B", str[28].c_str() },
|
|
||||||
{"PS_BLEND_C", str[29].c_str() },
|
|
||||||
{"PS_BLEND_D", str[30].c_str() },
|
|
||||||
{NULL, NULL},
|
|
||||||
};
|
|
||||||
|
|
||||||
CComPtr<ID3D11PixelShader> ps;
|
CComPtr<ID3D11PixelShader> ps;
|
||||||
|
|
||||||
std::vector<char> shader;
|
std::vector<char> shader;
|
||||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||||
CreateShader(shader, "tfx.fx", nullptr, "ps_main", macro, &ps);
|
CreateShader(shader, "tfx.fx", nullptr, "ps_main", sm.GetPtr(), &ps);
|
||||||
|
|
||||||
m_ps[sel] = ps;
|
m_ps[sel] = ps;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue