mirror of https://github.com/PCSX2/pcsx2.git
gsdx: use vector of char as shader container
It will avoid various char cast on Linux. v2: remove cast on windows file and std prefix shader vector v3: forget to remove some char cast
This commit is contained in:
parent
cf131b51a2
commit
1cbade511d
|
@ -183,13 +183,13 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
|||
{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
};
|
||||
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_CONVERT_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "convert.fx", nullptr, "vs_main", nullptr, &m_convert.vs, il_convert, countof(il_convert), &m_convert.il);
|
||||
CompileShader(shader.data(), shader.size(), "convert.fx", nullptr, "vs_main", nullptr, &m_convert.vs, il_convert, countof(il_convert), &m_convert.il);
|
||||
|
||||
for(size_t i = 0; i < countof(m_convert.ps); i++)
|
||||
{
|
||||
CompileShader((const char *)shader.data(), shader.size(), "convert.fx", nullptr, format("ps_main%d", i).c_str(), nullptr, &m_convert.ps[i]);
|
||||
CompileShader(shader.data(), shader.size(), "convert.fx", nullptr, format("ps_main%d", i).c_str(), nullptr, &m_convert.ps[i]);
|
||||
}
|
||||
|
||||
memset(&dsd, 0, sizeof(dsd));
|
||||
|
@ -218,7 +218,7 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
|||
theApp.LoadResource(IDR_MERGE_FX, shader);
|
||||
for(size_t i = 0; i < countof(m_merge.ps); i++)
|
||||
{
|
||||
CompileShader((const char *)shader.data(), shader.size(), "merge.fx", nullptr, format("ps_main%d", i).c_str(), nullptr, &m_merge.ps[i]);
|
||||
CompileShader(shader.data(), shader.size(), "merge.fx", nullptr, format("ps_main%d", i).c_str(), nullptr, &m_merge.ps[i]);
|
||||
}
|
||||
|
||||
memset(&bsd, 0, sizeof(bsd));
|
||||
|
@ -247,7 +247,7 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
|||
theApp.LoadResource(IDR_INTERLACE_FX, shader);
|
||||
for(size_t i = 0; i < countof(m_interlace.ps); i++)
|
||||
{
|
||||
CompileShader((const char *)shader.data(), shader.size(), "interlace.fx", nullptr, format("ps_main%d", i).c_str(), nullptr, &m_interlace.ps[i]);
|
||||
CompileShader(shader.data(), shader.size(), "interlace.fx", nullptr, format("ps_main%d", i).c_str(), nullptr, &m_interlace.ps[i]);
|
||||
}
|
||||
|
||||
// Shade Boos
|
||||
|
@ -279,7 +279,7 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
|||
hr = m_dev->CreateBuffer(&bd, NULL, &m_shadeboost.cb);
|
||||
|
||||
theApp.LoadResource(IDR_SHADEBOOST_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "shadeboost.fx", nullptr, "ps_main", macro, &m_shadeboost.ps);
|
||||
CompileShader(shader.data(), shader.size(), "shadeboost.fx", nullptr, "ps_main", macro, &m_shadeboost.ps);
|
||||
|
||||
// External fx shader
|
||||
|
||||
|
@ -826,9 +826,9 @@ void GSDevice11::InitFXAA()
|
|||
if (!FXAA_Compiled)
|
||||
{
|
||||
try {
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_FXAA_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "fxaa.fx", nullptr, "ps_main", nullptr, &m_fxaa.ps);
|
||||
CompileShader(shader.data(), shader.size(), "fxaa.fx", nullptr, "ps_main", nullptr, &m_fxaa.ps);
|
||||
}
|
||||
catch (GSDXRecoverableError) {
|
||||
printf("GSdx: failed to compile fxaa shader.\n");
|
||||
|
|
|
@ -290,13 +290,13 @@ bool GSDevice9::Create(const std::shared_ptr<GSWnd> &wnd)
|
|||
D3DDECL_END()
|
||||
};
|
||||
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_CONVERT_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "convert.fx", "vs_main", nullptr, &m_convert.vs, il_convert, countof(il_convert), &m_convert.il);
|
||||
CompileShader(shader.data(), shader.size(), "convert.fx", "vs_main", nullptr, &m_convert.vs, il_convert, countof(il_convert), &m_convert.il);
|
||||
|
||||
for(size_t i = 0; i < countof(m_convert.ps); i++)
|
||||
{
|
||||
CompileShader((const char *)shader.data(), shader.size(), "convert.fx", format("ps_main%d", i), nullptr, &m_convert.ps[i]);
|
||||
CompileShader(shader.data(), shader.size(), "convert.fx", format("ps_main%d", i), nullptr, &m_convert.ps[i]);
|
||||
}
|
||||
|
||||
m_convert.dss.DepthEnable = false;
|
||||
|
@ -328,7 +328,7 @@ bool GSDevice9::Create(const std::shared_ptr<GSWnd> &wnd)
|
|||
theApp.LoadResource(IDR_MERGE_FX, shader);
|
||||
for(size_t i = 0; i < countof(m_merge.ps); i++)
|
||||
{
|
||||
CompileShader((const char *)shader.data(), shader.size(), "merge.fx", format("ps_main%d", i), nullptr, &m_merge.ps[i]);
|
||||
CompileShader(shader.data(), shader.size(), "merge.fx", format("ps_main%d", i), nullptr, &m_merge.ps[i]);
|
||||
}
|
||||
|
||||
m_merge.bs.BlendEnable = true;
|
||||
|
@ -345,7 +345,7 @@ bool GSDevice9::Create(const std::shared_ptr<GSWnd> &wnd)
|
|||
theApp.LoadResource(IDR_INTERLACE_FX, shader);
|
||||
for(size_t i = 0; i < countof(m_interlace.ps); i++)
|
||||
{
|
||||
CompileShader((const char *)shader.data(), shader.size(), "interlace.fx", format("ps_main%d", i), nullptr, &m_interlace.ps[i]);
|
||||
CompileShader(shader.data(), shader.size(), "interlace.fx", format("ps_main%d", i), nullptr, &m_interlace.ps[i]);
|
||||
}
|
||||
|
||||
// Shade Boost
|
||||
|
@ -369,7 +369,7 @@ bool GSDevice9::Create(const std::shared_ptr<GSWnd> &wnd)
|
|||
};
|
||||
|
||||
theApp.LoadResource(IDR_SHADEBOOST_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "shadeboost.fx", "ps_main", macro, &m_shadeboost.ps);
|
||||
CompileShader(shader.data(), shader.size(), "shadeboost.fx", "ps_main", macro, &m_shadeboost.ps);
|
||||
|
||||
// create shader layout
|
||||
|
||||
|
@ -996,9 +996,9 @@ void GSDevice9::InitFXAA()
|
|||
if (!FXAA_Compiled)
|
||||
{
|
||||
try {
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_FXAA_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "fxaa.fx", "ps_main", nullptr, &m_fxaa.ps);
|
||||
CompileShader(shader.data(), shader.size(), "fxaa.fx", "ps_main", nullptr, &m_fxaa.ps);
|
||||
}
|
||||
catch (GSDXRecoverableError) {
|
||||
printf("GSdx: Failed to compile fxaa shader.\n");
|
||||
|
|
|
@ -1929,12 +1929,12 @@ GSRendererCL::CL::CL()
|
|||
queue[1] = cl::CommandQueue(context);
|
||||
queue[2] = cl::CommandQueue(context);
|
||||
|
||||
vector<unsigned char> buff;
|
||||
std::vector<char> buff;
|
||||
|
||||
#ifdef _WIN32
|
||||
if(theApp.LoadResource(IDR_TFX_CL, buff))
|
||||
{
|
||||
kernel_str = std::string((const char*)buff.data(), buff.size());
|
||||
kernel_str = std::string(buff.data(), buff.size());
|
||||
}
|
||||
#else
|
||||
ASSERT(0);
|
||||
|
|
|
@ -295,9 +295,9 @@ bool GSRendererCS::CreateDevice(GSDevice* dev_unk)
|
|||
|
||||
try
|
||||
{
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_CS_FX, shader);
|
||||
dev->CompileShader((const char *)shader.data(), shader.size(), "cs.fx", nullptr, "ps_main0", macro, &m_ps0);
|
||||
dev->CompileShader(shader.data(), shader.size(), "cs.fx", nullptr, "ps_main0", macro, &m_ps0);
|
||||
}
|
||||
catch (GSDXRecoverableError)
|
||||
{
|
||||
|
@ -532,9 +532,9 @@ void GSRendererCS::Draw()
|
|||
{"COLOR", 1, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 28, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
};
|
||||
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_CS_FX, shader);
|
||||
dev->CompileShader((const char *)shader.data(), shader.size(), "cs.fx", nullptr, "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
dev->CompileShader(shader.data(), shader.size(), "cs.fx", nullptr, "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
|
||||
m_vs[vs_sel] = vs;
|
||||
}
|
||||
|
@ -578,9 +578,9 @@ void GSRendererCS::Draw()
|
|||
{NULL, NULL},
|
||||
};
|
||||
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_CS_FX, shader);
|
||||
dev->CompileShader((const char *)shader.data(), shader.size(), "cs.fx", nullptr, "gs_main", macro, &gs[j]);
|
||||
dev->CompileShader(shader.data(), shader.size(), "cs.fx", nullptr, "gs_main", macro, &gs[j]);
|
||||
|
||||
m_gs[gs_sel] = gs[j];
|
||||
}
|
||||
|
@ -619,9 +619,9 @@ void GSRendererCS::Draw()
|
|||
{NULL, NULL},
|
||||
};
|
||||
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_CS_FX, shader);
|
||||
dev->CompileShader((const char *)shader.data(), shader.size(), "cs.fx", nullptr, "ps_main1", macro, &ps[1]);
|
||||
dev->CompileShader(shader.data(), shader.size(), "cs.fx", nullptr, "ps_main1", macro, &ps[1]);
|
||||
|
||||
m_ps1[ps_sel] = ps[1];
|
||||
}
|
||||
|
|
|
@ -132,9 +132,9 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
|||
|
||||
GSVertexShader11 vs;
|
||||
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "tfx.fx", nullptr, "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
CompileShader(shader.data(), shader.size(), "tfx.fx", nullptr, "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
|
||||
m_vs[sel] = vs;
|
||||
|
||||
|
@ -184,9 +184,9 @@ void GSDevice11::SetupGS(GSSelector sel, const GSConstantBuffer* cb)
|
|||
{NULL, NULL},
|
||||
};
|
||||
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "tfx.fx", nullptr, "gs_main", macro, &gs);
|
||||
CompileShader(shader.data(), shader.size(), "tfx.fx", nullptr, "gs_main", macro, &gs);
|
||||
|
||||
m_gs[sel] = gs;
|
||||
}
|
||||
|
@ -261,9 +261,9 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe
|
|||
|
||||
CComPtr<ID3D11PixelShader> ps;
|
||||
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "tfx.fx", nullptr, "ps_main", macro, &ps);
|
||||
CompileShader(shader.data(), shader.size(), "tfx.fx", nullptr, "ps_main", macro, &ps);
|
||||
|
||||
m_ps[sel] = ps;
|
||||
|
||||
|
|
|
@ -96,9 +96,9 @@ void GSDevice9::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
|||
|
||||
GSVertexShader9 vs;
|
||||
|
||||
vector<unsigned char> shader;
|
||||
std::vector<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);
|
||||
CompileShader(shader.data(), shader.size(), "tfx.fx", "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
|
||||
|
||||
m_vs[sel] = vs;
|
||||
|
||||
|
@ -183,9 +183,9 @@ void GSDevice9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSel
|
|||
|
||||
CComPtr<IDirect3DPixelShader9> ps;
|
||||
|
||||
vector<unsigned char> shader;
|
||||
std::vector<char> shader;
|
||||
theApp.LoadResource(IDR_TFX_FX, shader);
|
||||
CompileShader((const char *)shader.data(), shader.size(), "tfx.fx", "ps_main", macro, &ps);
|
||||
CompileShader(shader.data(), shader.size(), "tfx.fx", "ps_main", macro, &ps);
|
||||
|
||||
m_ps[sel] = ps;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ 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)
|
||||
bool GSdxApp::LoadResource(int id, std::vector<char>& buff, const char* type)
|
||||
{
|
||||
buff.clear();
|
||||
HRSRC hRsrc = FindResource((HMODULE)s_hModule, MAKEINTRESOURCE(id), type != NULL ? type : RT_RCDATA);
|
||||
|
@ -59,7 +59,7 @@ bool GSdxApp::LoadResource(int id, vector<unsigned char>& buff, const char* type
|
|||
|
||||
#else
|
||||
|
||||
bool GSdxApp::LoadResource(int id, vector<unsigned char>& buff, const char* type)
|
||||
bool GSdxApp::LoadResource(int id, std::vector<char>& buff, const char* type)
|
||||
{
|
||||
buff.clear();
|
||||
printf("LoadResource not implemented\n");
|
||||
|
|
|
@ -53,7 +53,7 @@ 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);
|
||||
bool LoadResource(int id, std::vector<char>& buff, const char* type = nullptr);
|
||||
|
||||
void SetConfig(const char* entry, const char* value);
|
||||
void SetConfig(const char* entry, int value);
|
||||
|
|
Loading…
Reference in New Issue