Skip to content

Commit

Permalink
VideoShaders: Fix video filter selection bug
Browse files Browse the repository at this point in the history
  • Loading branch information
VelocityRa authored and garbear committed Aug 30, 2017
1 parent beebab3 commit d645390
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ using namespace RETRO;
CRPBaseRenderer::CRPBaseRenderer()
: m_shaderPreset(nullptr)
, m_shadersNeedUpdate(true)
, m_useShaderPreset(true)
, m_bUseShaderPreset(true)
{
m_oldDestRect.SetRect(0.0f, 0.0f, 0.0f, 0.0f);

Expand Down Expand Up @@ -536,7 +536,7 @@ void CRPBaseRenderer::UpdateVideoShaders()

// We need to set this here because m_sourceRect isn't valid on init/pre-init
m_shaderPreset->SetVideoSize(sourceWidth, sourceHeight);
m_useShaderPreset = m_shaderPreset->SetShaderPreset(m_shaderPresetPath);
m_bUseShaderPreset = m_shaderPreset->SetShaderPreset(m_shaderPresetPath);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ namespace RETRO

std::string m_shaderPresetPath;
bool m_shadersNeedUpdate;
bool m_useShaderPreset;
bool m_bUseShaderPreset;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ bool CRPWinRenderer::UploadTexture()
void CRPWinRenderer::Render(CD3DTexture *target)
{
// Are we using video shaders?
if (m_useShaderPreset)
if (m_bUseShaderPreset)
{
// select destination rectangle
CPoint destPoints[4];
Expand All @@ -244,7 +244,7 @@ void CRPWinRenderer::Render(CD3DTexture *target)
if (!m_shaderPreset->RenderUpdate(destPoints, m_intermediateTarget.get(), &m_targetTexture))
{
m_shadersNeedUpdate = false;
m_useShaderPreset = false;
m_bUseShaderPreset = false;
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,12 @@ bool CVideoShaderPresetDX::Update()

if (m_bPresetNeedsUpdate && !HasPathFailed(m_presetPath))
{
if (m_presetPath.empty())
return updateFailed("Preset path is empty");

DisposeVideoShaders();

if (m_presetPath.empty())
// No preset should load, just return false, we shouldn't add "" to the failed paths
return false;

if (!ReadPresetFile(m_presetPath))
{
CLog::Log(LOGERROR, "%s - couldn't load shader preset %s or the shaders it references", __FUNCTION__, m_presetPath.c_str());
Expand Down Expand Up @@ -461,13 +462,9 @@ void CVideoShaderPresetDX::DisposeVideoShaders()

bool CVideoShaderPresetDX::SetShaderPreset(const std::string& shaderPresetPath)
{
if (shaderPresetPath != m_presetPath)
{
m_bPresetNeedsUpdate = true;
m_presetPath = shaderPresetPath;
return Update();
}
return false;
m_bPresetNeedsUpdate = true;
m_presetPath = shaderPresetPath;
return Update();
}

const std::string& CVideoShaderPresetDX::GetShaderPreset() const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class CVideoShaderPresetDX : public IVideoShaderPreset
bool HasPathFailed(const std::string& path) const;

// Relative path of the currently loaded shader preset
// If empty, it means that a preset is not currently loaded
std::string m_presetPath;

// VideoShaders for the shader passes
Expand Down Expand Up @@ -121,6 +122,7 @@ class CVideoShaderPresetDX : public IVideoShaderPreset
ID3D11SamplerState* m_pSampLinear = nullptr;

// Set of paths of presets that are known to not load correctly
// Should not contain "" (empty path) because this signifies that a preset is not loaded
std::set<std::string> m_failedPaths;

// Array of vertices that comprise the full viewport
Expand Down

0 comments on commit d645390

Please sign in to comment.