Skip to content

Commit

Permalink
plugin: add option to force software rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
JoepVanlier committed Feb 18, 2025
1 parent fff00df commit 02b72f3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions plugin/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct YsfxEditor::Impl {
bool m_mustResizeToGfx = true;
bool m_maintainState = false;
int m_keepUndoState{1};
int m_softwareRenderer{0};
float m_currentScaling{1.0f};
uint64_t m_sliderVisible[ysfx_max_slider_groups]{0};
bool m_visibleSlidersChanged{false};
Expand Down Expand Up @@ -164,6 +165,16 @@ YsfxEditor::YsfxEditor(YsfxProcessor &proc)
readTheme();
}

void YsfxEditor::parentHierarchyChanged()
{
if (m_impl->m_softwareRenderer) {
if (auto peer = getPeer())
{
peer->setCurrentRenderingEngine(0);
}
}
}

void writeThemeFile(juce::File file, std::map<std::string, std::array<uint8_t, 3>> colors, std::map<std::string, float> params)
{
juce::FileOutputStream stream(file);
Expand Down Expand Up @@ -916,6 +927,14 @@ void YsfxEditor::Impl::initializeProperties()
m_pluginProperties->setValue(key, 1);
m_pluginProperties->setNeedsToBeSaved(true);
}

auto sw_key = juce::String("ysfx_force_software_rendering");
if (m_pluginProperties->containsKey(sw_key)) {
m_softwareRenderer = m_pluginProperties->getIntValue(sw_key);
} else {
m_pluginProperties->setValue(sw_key, 0);
m_pluginProperties->setNeedsToBeSaved(true);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions plugin/editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class YsfxEditor : public juce::AudioProcessorEditor, public juce::FileDragAndDr
protected:
void resized() override;
void paint (juce::Graphics& g) override;
void parentHierarchyChanged() override;
bool isInterestedInFileDrag(const juce::StringArray &files) override;
void filesDropped(const juce::StringArray &files, int x, int y) override;

Expand Down

0 comments on commit 02b72f3

Please sign in to comment.