GS: Remove external shader support.

This commit is contained in:
lightningterror 2022-11-28 16:37:38 +01:00
parent ea6d276a46
commit f76559b791
9 changed files with 0 additions and 192 deletions

View File

@ -395,24 +395,6 @@ void GSDevice::Interlace(const GSVector2i& ds, int field, int mode, float yoffse
} }
} }
#ifndef PCSX2_CORE
void GSDevice::ExternalFX()
{
const GSVector2i s = m_current->GetSize();
if (ResizeTarget(&m_target_tmp))
{
const GSVector4 sRect(0, 0, 1, 1);
const GSVector4 dRect(0, 0, s.x, s.y);
StretchRect(m_current, sRect, m_target_tmp, dRect, ShaderConvert::TRANSPARENCY_FILTER, false);
DoExternalFX(m_target_tmp, m_current);
}
}
#endif
void GSDevice::FXAA() void GSDevice::FXAA()
{ {
const GSVector2i s = m_current->GetSize(); const GSVector2i s = m_current->GetSize();

View File

@ -195,16 +195,6 @@ public:
InterlaceConstantBuffer() { memset(this, 0, sizeof(*this)); } InterlaceConstantBuffer() { memset(this, 0, sizeof(*this)); }
}; };
class ExternalFXConstantBuffer
{
public:
GSVector2 xyFrame;
GSVector4 rcpFrame;
GSVector4 rcpFrameOpt;
ExternalFXConstantBuffer() { memset(this, 0, sizeof(*this)); }
};
#pragma pack(pop) #pragma pack(pop)
enum HWBlendFlags enum HWBlendFlags
@ -771,9 +761,6 @@ protected:
virtual void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset, int bufIdx) = 0; virtual void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset, int bufIdx) = 0;
virtual void DoFXAA(GSTexture* sTex, GSTexture* dTex) {} virtual void DoFXAA(GSTexture* sTex, GSTexture* dTex) {}
virtual void DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float params[4]) {} virtual void DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float params[4]) {}
#ifndef PCSX2_CORE
virtual void DoExternalFX(GSTexture* sTex, GSTexture* dTex) {}
#endif
/// Resolves CAS shader includes for the specified source. /// Resolves CAS shader includes for the specified source.
static bool GetCASShaderSource(std::string* source); static bool GetCASShaderSource(std::string* source);
@ -864,10 +851,6 @@ public:
void ShadeBoost(); void ShadeBoost();
void Resize(int width, int height); void Resize(int width, int height);
#ifndef PCSX2_CORE
void ExternalFX();
#endif
void CAS(GSTexture*& tex, GSVector4i& src_rect, GSVector4& src_uv, const GSVector4& draw_rect, bool sharpen_only); void CAS(GSTexture*& tex, GSVector4i& src_rect, GSVector4& src_uv, const GSVector4& draw_rect, bool sharpen_only);
bool ResizeTexture(GSTexture** t, GSTexture::Type type, int w, int h, bool clear = true, bool prefer_reuse = false); bool ResizeTexture(GSTexture** t, GSTexture::Type type, int w, int h, bool clear = true, bool prefer_reuse = false);

View File

@ -395,11 +395,6 @@ bool GSRenderer::Merge(int field)
if (GSConfig.ShadeBoost) if (GSConfig.ShadeBoost)
g_gs_device->ShadeBoost(); g_gs_device->ShadeBoost();
#ifndef PCSX2_CORE
if (GSConfig.ShaderFX)
g_gs_device->ExternalFX();
#endif
if (GSConfig.FXAA) if (GSConfig.FXAA)
g_gs_device->FXAA(); g_gs_device->FXAA();

View File

@ -267,16 +267,6 @@ bool GSDevice11::Create()
if (!m_shadeboost.ps) if (!m_shadeboost.ps)
return false; return false;
// External fx shader
memset(&bd, 0, sizeof(bd));
bd.ByteWidth = sizeof(ExternalFXConstantBuffer);
bd.Usage = D3D11_USAGE_DEFAULT;
bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
m_dev->CreateBuffer(&bd, nullptr, m_shaderfx.cb.put());
// //
memset(&rd, 0, sizeof(rd)); memset(&rd, 0, sizeof(rd));
@ -844,56 +834,6 @@ void GSDevice11::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool
StretchRect(sTex, sRect, dTex, dRect, m_interlace.ps[shader].get(), m_interlace.cb.get(), linear); StretchRect(sTex, sRect, dTex, dRect, m_interlace.ps[shader].get(), m_interlace.cb.get(), linear);
} }
#ifndef PCSX2_CORE
void GSDevice11::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
{
const GSVector2i s = dTex->GetSize();
const GSVector4 sRect(0, 0, 1, 1);
const GSVector4 dRect(0, 0, s.x, s.y);
ExternalFXConstantBuffer cb;
if (!m_shaderfx.ps)
{
std::string config_name(theApp.GetConfigS("shaderfx_conf"));
std::ifstream fconfig(config_name);
std::stringstream shader;
if (fconfig.good())
shader << fconfig.rdbuf() << "\n";
else
fprintf(stderr, "GS: External shader config '%s' not loaded.\n", config_name.c_str());
std::string shader_name(theApp.GetConfigS("shaderfx_glsl"));
std::ifstream fshader(shader_name);
if (!fshader.good())
{
fprintf(stderr, "GS: External shader '%s' not loaded and will be disabled!\n", shader_name.c_str());
return;
}
shader << fshader.rdbuf();
ShaderMacro sm(m_shader_cache.GetFeatureLevel());
m_shaderfx.ps = m_shader_cache.GetPixelShader(m_dev.get(), shader.str(), sm.GetPtr(), "ps_main");
if (!m_shaderfx.ps)
{
printf("GS: Failed to compile external post-processing shader.\n");
return;
}
}
cb.xyFrame = GSVector2((float)s.x, (float)s.y);
cb.rcpFrame = GSVector4(1.0f / (float)s.x, 1.0f / (float)s.y, 0.0f, 0.0f);
cb.rcpFrameOpt = GSVector4::zero();
m_ctx->UpdateSubresource(m_shaderfx.cb.get(), 0, nullptr, &cb, 0, 0);
StretchRect(sTex, sRect, dTex, dRect, m_shaderfx.ps.get(), m_shaderfx.cb.get(), true);
}
#endif
void GSDevice11::DoFXAA(GSTexture* sTex, GSTexture* dTex) void GSDevice11::DoFXAA(GSTexture* sTex, GSTexture* dTex)
{ {
const GSVector2i s = dTex->GetSize(); const GSVector2i s = dTex->GetSize();

View File

@ -122,9 +122,6 @@ private:
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0, int bufIdx = 0) final; void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0, int bufIdx = 0) final;
void DoFXAA(GSTexture* sTex, GSTexture* dTex) final; void DoFXAA(GSTexture* sTex, GSTexture* dTex) final;
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float params[4]) final; void DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float params[4]) final;
#ifndef PCSX2_CORE
void DoExternalFX(GSTexture* sTex, GSTexture* dTex) final;
#endif
bool CreateCASShaders(); bool CreateCASShaders();
bool DoCAS(GSTexture* sTex, GSTexture* dTex, bool sharpen_only, const std::array<u32, NUM_CAS_CONSTANTS>& constants) final; bool DoCAS(GSTexture* sTex, GSTexture* dTex, bool sharpen_only, const std::array<u32, NUM_CAS_CONSTANTS>& constants) final;
@ -194,12 +191,6 @@ private:
wil::com_ptr_nothrow<ID3D11Buffer> cb; wil::com_ptr_nothrow<ID3D11Buffer> cb;
} m_interlace; } m_interlace;
struct
{
wil::com_ptr_nothrow<ID3D11PixelShader> ps;
wil::com_ptr_nothrow<ID3D11Buffer> cb;
} m_shaderfx;
wil::com_ptr_nothrow<ID3D11PixelShader> m_fxaa_ps; wil::com_ptr_nothrow<ID3D11PixelShader> m_fxaa_ps;
struct struct

View File

@ -352,10 +352,6 @@ public:
void DoFXAA(GSTexture* sTex, GSTexture* dTex) override; void DoFXAA(GSTexture* sTex, GSTexture* dTex) override;
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float params[4]) override; void DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float params[4]) override;
#ifndef PCSX2_CORE
void DoExternalFX(GSTexture* sTex, GSTexture* dTex) override;
#endif
bool DoCAS(GSTexture* sTex, GSTexture* dTex, bool sharpen_only, const std::array<u32, NUM_CAS_CONSTANTS>& constants) override; bool DoCAS(GSTexture* sTex, GSTexture* dTex, bool sharpen_only, const std::array<u32, NUM_CAS_CONSTANTS>& constants) override;
MRCOwned<id<MTLFunction>> LoadShader(NSString* name); MRCOwned<id<MTLFunction>> LoadShader(NSString* name);

View File

@ -618,15 +618,6 @@ void GSDeviceMTL::DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float par
RenderCopy(sTex, m_shadeboost_pipeline, GSVector4i(0, 0, dTex->GetSize().x, dTex->GetSize().y)); RenderCopy(sTex, m_shadeboost_pipeline, GSVector4i(0, 0, dTex->GetSize().x, dTex->GetSize().y));
} }
#ifndef PCSX2_CORE
void GSDeviceMTL::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
{
// TODO: Implement
}
#endif
bool GSDeviceMTL::DoCAS(GSTexture* sTex, GSTexture* dTex, bool sharpen_only, const std::array<u32, NUM_CAS_CONSTANTS>& constants) bool GSDeviceMTL::DoCAS(GSTexture* sTex, GSTexture* dTex, bool sharpen_only, const std::array<u32, NUM_CAS_CONSTANTS>& constants)
{ @autoreleasepool { { @autoreleasepool {
static constexpr int threadGroupWorkRegionDim = 16; static constexpr int threadGroupWorkRegionDim = 16;

View File

@ -1432,66 +1432,6 @@ void GSDeviceOGL::DoFXAA(GSTexture* sTex, GSTexture* dTex)
StretchRect(sTex, sRect, dTex, dRect, m_fxaa.ps, true); StretchRect(sTex, sRect, dTex, dRect, m_fxaa.ps, true);
} }
#ifndef PCSX2_CORE
void GSDeviceOGL::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
{
// Lazy compile
if (!m_shaderfx.ps.IsValid())
{
if (!GLLoader::found_GL_ARB_gpu_shader5) // GL4.0 extension
{
return;
}
std::string config_name(theApp.GetConfigS("shaderfx_conf"));
std::ifstream fconfig(config_name);
std::stringstream config;
config << "#extension GL_ARB_gpu_shader5 : require\n";
if (fconfig.good())
config << fconfig.rdbuf();
else
fprintf(stderr, "GS: External shader config '%s' not loaded.\n", config_name.c_str());
std::string shader_name(theApp.GetConfigS("shaderfx_glsl"));
std::ifstream fshader(shader_name);
std::stringstream shader;
if (!fshader.good())
{
fprintf(stderr, "GS: External shader '%s' not loaded and will be disabled!\n", shader_name.c_str());
return;
}
shader << fshader.rdbuf();
const std::string ps(GetShaderSource("ps_main", GL_FRAGMENT_SHADER, m_shader_common_header, shader.str(), config.str()));
if (!m_shaderfx.ps.Compile(m_convert.vs, {}, ps) || !m_shaderfx.ps.Link())
return;
m_shaderfx.ps.RegisterUniform("_xyFrame");
m_shaderfx.ps.RegisterUniform("_rcpFrame");
m_shaderfx.ps.RegisterUniform("_rcpFrameOpt");
}
GL_PUSH("DoExternalFX");
OMSetColorMaskState();
const GSVector2i s = dTex->GetSize();
const GSVector4 sRect(0, 0, 1, 1);
const GSVector4 dRect(0, 0, s.x, s.y);
m_shaderfx.ps.Bind();
m_shaderfx.ps.Uniform2f(0, (float)s.x, (float)s.y);
m_shaderfx.ps.Uniform4f(1, 1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
m_shaderfx.ps.Uniform4f(2, 0.0f, 0.0f, 0.0f, 0.0f);
StretchRect(sTex, sRect, dTex, dRect, m_shaderfx.ps, true);
}
#endif
void GSDeviceOGL::DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float params[4]) void GSDeviceOGL::DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float params[4])
{ {
GL_PUSH("DoShadeBoost"); GL_PUSH("DoShadeBoost");

View File

@ -257,13 +257,6 @@ private:
GL::Program ps; GL::Program ps;
} m_fxaa; } m_fxaa;
#ifndef PCSX2_CORE
struct
{
GL::Program ps;
} m_shaderfx;
#endif
struct struct
{ {
GSDepthStencilOGL* dss = nullptr; GSDepthStencilOGL* dss = nullptr;
@ -307,9 +300,6 @@ private:
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0, int bufIdx = 0) final; void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0, int bufIdx = 0) final;
void DoFXAA(GSTexture* sTex, GSTexture* dTex) final; void DoFXAA(GSTexture* sTex, GSTexture* dTex) final;
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float params[4]) final; void DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float params[4]) final;
#ifndef PCSX2_CORE
void DoExternalFX(GSTexture* sTex, GSTexture* dTex) final;
#endif
bool CreateCASPrograms(); bool CreateCASPrograms();
bool DoCAS(GSTexture* sTex, GSTexture* dTex, bool sharpen_only, const std::array<u32, NUM_CAS_CONSTANTS>& constants) final; bool DoCAS(GSTexture* sTex, GSTexture* dTex, bool sharpen_only, const std::array<u32, NUM_CAS_CONSTANTS>& constants) final;