Handle VideoSoftware's present fallback better

Not a good idea to abuse bSupportsPostProcessing
This commit is contained in:
Scott Mansell 2023-01-28 16:23:30 +13:00
parent 26e00c3bb4
commit f158ff300b
6 changed files with 23 additions and 6 deletions

View File

@ -29,6 +29,11 @@ bool NullGfx::IsHeadless() const
return true; return true;
} }
bool NullGfx::SupportsUtilityDrawing() const
{
return false;
}
std::unique_ptr<AbstractTexture> NullGfx::CreateTexture(const TextureConfig& config, std::unique_ptr<AbstractTexture> NullGfx::CreateTexture(const TextureConfig& config,
[[maybe_unused]] std::string_view name) [[maybe_unused]] std::string_view name)
{ {

View File

@ -15,6 +15,7 @@ public:
~NullGfx() override; ~NullGfx() override;
bool IsHeadless() const override; bool IsHeadless() const override;
virtual bool SupportsUtilityDrawing() const override;
std::unique_ptr<AbstractTexture> CreateTexture(const TextureConfig& config, std::unique_ptr<AbstractTexture> CreateTexture(const TextureConfig& config,
std::string_view name) override; std::string_view name) override;

View File

@ -27,6 +27,11 @@ bool SWGfx::IsHeadless() const
return m_window->IsHeadless(); return m_window->IsHeadless();
} }
bool SWGfx::SupportsUtilityDrawing() const
{
return false;
}
std::unique_ptr<AbstractTexture> SWGfx::CreateTexture(const TextureConfig& config, std::unique_ptr<AbstractTexture> SWGfx::CreateTexture(const TextureConfig& config,
[[maybe_unused]] std::string_view name) [[maybe_unused]] std::string_view name)
{ {

View File

@ -15,6 +15,7 @@ public:
SWGfx(std::unique_ptr<SWOGLWindow> window); SWGfx(std::unique_ptr<SWOGLWindow> window);
bool IsHeadless() const override; bool IsHeadless() const override;
virtual bool SupportsUtilityDrawing() const override;
std::unique_ptr<AbstractTexture> CreateTexture(const TextureConfig& config, std::unique_ptr<AbstractTexture> CreateTexture(const TextureConfig& config,
std::string_view name) override; std::string_view name) override;

View File

@ -59,6 +59,9 @@ public:
virtual bool IsHeadless() const = 0; virtual bool IsHeadless() const = 0;
// Does the backend support drawing a UI or doing post-processing
virtual bool SupportsUtilityDrawing() const { return true; }
virtual void SetPipeline(const AbstractPipeline* pipeline) {} virtual void SetPipeline(const AbstractPipeline* pipeline) {}
virtual void SetScissorRect(const MathUtil::Rectangle<int>& rc) {} virtual void SetScissorRect(const MathUtil::Rectangle<int>& rc) {}
virtual void SetTexture(u32 index, const AbstractTexture* texture) {} virtual void SetTexture(u32 index, const AbstractTexture* texture) {}

View File

@ -393,12 +393,6 @@ void Presenter::RenderXFBToScreen(const MathUtil::Rectangle<int>& target_rc,
const AbstractTexture* source_texture, const AbstractTexture* source_texture,
const MathUtil::Rectangle<int>& source_rc) const MathUtil::Rectangle<int>& source_rc)
{ {
if (!g_ActiveConfig.backend_info.bSupportsPostProcessing)
{
g_gfx->ShowImage(source_texture, source_rc);
return;
}
if (g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer && if (g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer &&
g_ActiveConfig.backend_info.bUsesExplictQuadBuffering) g_ActiveConfig.backend_info.bUsesExplictQuadBuffering)
{ {
@ -463,6 +457,14 @@ void Presenter::Present()
{ {
m_last_xfb_id = m_xfb_entry->id; m_last_xfb_id = m_xfb_entry->id;
if (!g_gfx->SupportsUtilityDrawing())
{
// Video Software doesn't support Drawing a UI or doing post-processing
// So just Show the XFB
g_gfx->ShowImage(m_xfb_entry->texture.get(), m_xfb_rect);
return;
}
// Since we use the common pipelines here and draw vertices if a batch is currently being // Since we use the common pipelines here and draw vertices if a batch is currently being
// built by the vertex loader, we end up trampling over its pointer, as we share the buffer // built by the vertex loader, we end up trampling over its pointer, as we share the buffer
// with the loader, and it has not been unmapped yet. Force a pipeline flush to avoid this. // with the loader, and it has not been unmapped yet. Force a pipeline flush to avoid this.