summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--bgfx/chains/hlsl.json2
-rw-r--r--src/osd/modules/render/bgfx/chain.cpp20
-rw-r--r--src/osd/modules/render/bgfx/chain.h4
-rw-r--r--src/osd/modules/render/bgfx/chainmanager.cpp19
-rw-r--r--src/osd/modules/render/bgfx/chainmanager.h16
-rw-r--r--src/osd/modules/render/bgfx/targetmanager.cpp7
-rw-r--r--src/osd/modules/render/bgfx/targetmanager.h2
7 files changed, 50 insertions, 20 deletions
diff --git a/bgfx/chains/hlsl.json b/bgfx/chains/hlsl.json
index d3007eb285b..ea94200dfc3 100644
--- a/bgfx/chains/hlsl.json
+++ b/bgfx/chains/hlsl.json
@@ -93,7 +93,7 @@
{ "type": "float", "name": "scanline_height", "text": "Individual Scanline Scale", "default": 1.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
{ "type": "float", "name": "scanline_variation", "text": "Scanline Variation", "default": 1.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
{ "type": "float", "name": "scanline_bright_scale", "text": "Scanline Brightness Scale", "default": 2.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
- { "type": "float", "name": "scanline_bright_offset", "text": "Scanline Brightness Offset", "default": 4.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
+ { "type": "float", "name": "scanline_bright_offset", "text": "Scanline Brightness Offset", "default": 1.50, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
{ "type": "float", "name": "scanline_jitter_amount", "text": "Scanline Jitter Amount", "default": 0.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
{ "type": "float", "name": "scanline_variation", "text": "Scanline Variation", "default": 1.00, "max": 4.00, "min": 0.0, "step": 0.01, "format": "%1.2f", "screen": "crt" },
diff --git a/src/osd/modules/render/bgfx/chain.cpp b/src/osd/modules/render/bgfx/chain.cpp
index 9e399fef255..b056037aba9 100644
--- a/src/osd/modules/render/bgfx/chain.cpp
+++ b/src/osd/modules/render/bgfx/chain.cpp
@@ -34,10 +34,11 @@ bgfx_chain::bgfx_chain(std::string name, std::string author, bool transform, tar
, m_current_time(0)
, m_screen_index(screen_index)
{
- for (bgfx_slider* slider : m_sliders)
- {
- m_slider_map[slider->name()] = slider;
- }
+ for (bgfx_target* target : m_target_list)
+ {
+ m_target_map[target->name()] = target;
+ m_target_names.push_back(target->name());
+ }
}
bgfx_chain::~bgfx_chain()
@@ -60,6 +61,17 @@ bgfx_chain::~bgfx_chain()
}
}
+void bgfx_chain::repopulate_targets()
+{
+ for (size_t i = 0; i < m_target_names.size(); i++)
+ {
+ bgfx_target* target = m_targets.target(m_screen_index, m_target_names[i]);
+ if (target != nullptr) {
+ m_target_list[i] = target;
+ }
+ }
+}
+
void bgfx_chain::process(render_primitive* prim, int view, int screen, texture_manager& textures, osd_window& window, uint64_t blend)
{
screen_device_iterator screen_iterator(window.machine().root_device());
diff --git a/src/osd/modules/render/bgfx/chain.h b/src/osd/modules/render/bgfx/chain.h
index eff50f2aedb..bddec2c9bc3 100644
--- a/src/osd/modules/render/bgfx/chain.h
+++ b/src/osd/modules/render/bgfx/chain.h
@@ -32,6 +32,7 @@ public:
~bgfx_chain();
void process(render_primitive* prim, int view, int screen, texture_manager& textures, osd_window &window, uint64_t blend = 0L);
+ void repopulate_targets();
// Getters
std::vector<bgfx_slider*>& sliders() { return m_sliders; }
@@ -48,7 +49,8 @@ private:
std::vector<bgfx_parameter*> m_params;
std::vector<bgfx_chain_entry*> m_entries;
std::vector<bgfx_target*> m_target_list;
- std::map<std::string, bgfx_slider*> m_slider_map;
+ std::vector<std::string> m_target_names;
+ std::map<std::string, bgfx_target*> m_target_map;
int64_t m_current_time;
uint32_t m_screen_index;
};
diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp
index 6160bb2ccd0..a5964afc502 100644
--- a/src/osd/modules/render/bgfx/chainmanager.cpp
+++ b/src/osd/modules/render/bgfx/chainmanager.cpp
@@ -295,7 +295,14 @@ void chain_manager::process_screen_quad(uint32_t view, uint32_t screen, render_p
bgfx_texture *texture = new bgfx_texture(full_name, bgfx::TextureFormat::RGBA8, tex_width, tex_height, mem, BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT);
m_textures.add_provider(full_name, texture);
- m_targets.update_target_sizes(screen, tex_width, tex_height, TARGET_STYLE_GUEST);
+ const bool any_targets_rebuilt = m_targets.update_target_sizes(screen, tex_width, tex_height, TARGET_STYLE_GUEST);
+ if (any_targets_rebuilt)
+ {
+ for (bgfx_chain* chain : m_screen_chains)
+ {
+ chain->repopulate_targets();
+ }
+ }
bgfx_chain* chain = screen_chain(screen);
chain->process(prim, view, screen, m_textures, window, bgfx_util::get_blend_state(PRIMFLAG_GET_BLENDMODE(prim->flags)));
@@ -440,8 +447,14 @@ uint32_t chain_manager::handle_screen_chains(uint32_t view, render_primitive *st
std::swap(screen_width, screen_height);
}
- m_targets.update_target_sizes(screen_index, screen_width, screen_height, TARGET_STYLE_NATIVE);
- process_screen_quad(view + used_views, screen_index, prim, window);
+ const bool any_targets_rebuilt = m_targets.update_target_sizes(screen_index, screen_width, screen_height, TARGET_STYLE_NATIVE);
+ if (any_targets_rebuilt) {
+ for (bgfx_chain* chain : m_screen_chains) {
+ chain->repopulate_targets();
+ }
+ }
+
+ process_screen_quad(view + used_views, screen_index, prim, window);
used_views += screen_chain(screen_index)->applicable_passes();
screen_index++;
diff --git a/src/osd/modules/render/bgfx/chainmanager.h b/src/osd/modules/render/bgfx/chainmanager.h
index 9d9714e7957..a2531fdbc8f 100644
--- a/src/osd/modules/render/bgfx/chainmanager.h
+++ b/src/osd/modules/render/bgfx/chainmanager.h
@@ -54,14 +54,14 @@ public:
int32_t chain_changed(int32_t index, std::string *str, int32_t newval);
// Getters
- running_machine& machine() { return m_machine; }
- osd_options& options() { return m_options; }
- texture_manager& textures() { return m_textures; }
- target_manager& targets() { return m_targets; }
- effect_manager& effects() { return m_effects; }
- slider_dirty_notifier& slider_notifier() { return m_slider_notifier; }
- uint32_t window_index() { return m_window_index; }
- uint32_t screen_count() { return m_screen_count; }
+ running_machine& machine() const { return m_machine; }
+ osd_options& options() const { return m_options; }
+ texture_manager& textures() const { return m_textures; }
+ target_manager& targets() const { return m_targets; }
+ effect_manager& effects() const { return m_effects; }
+ slider_dirty_notifier& slider_notifier() const { return m_slider_notifier; }
+ uint32_t window_index() const { return m_window_index; }
+ uint32_t screen_count() const { return m_screen_count; }
bgfx_chain* screen_chain(uint32_t screen);
bgfx_chain* load_chain(std::string name, uint32_t screen_index);
bool has_applicable_chain(uint32_t screen);
diff --git a/src/osd/modules/render/bgfx/targetmanager.cpp b/src/osd/modules/render/bgfx/targetmanager.cpp
index 4d56e33fc3e..7e8577b95b3 100644
--- a/src/osd/modules/render/bgfx/targetmanager.cpp
+++ b/src/osd/modules/render/bgfx/targetmanager.cpp
@@ -86,9 +86,9 @@ bgfx_target* target_manager::target(uint32_t screen, std::string name)
return target;
}
-void target_manager::update_target_sizes(uint32_t screen, uint16_t width, uint16_t height, uint32_t style)
+bool target_manager::update_target_sizes(uint32_t screen, uint16_t width, uint16_t height, uint32_t style)
{
- if (style == TARGET_STYLE_CUSTOM) return;
+ if (style == TARGET_STYLE_CUSTOM) return false;
std::vector<osd_dim>& sizes = style == TARGET_STYLE_GUEST ? m_guest_dims : m_native_dims;
@@ -102,7 +102,10 @@ void target_manager::update_target_sizes(uint32_t screen, uint16_t width, uint16
{
sizes[screen] = osd_dim(width, height);
rebuild_targets(screen, style);
+ return true;
}
+
+ return false;
}
void target_manager::rebuild_targets(uint32_t screen, uint32_t style)
diff --git a/src/osd/modules/render/bgfx/targetmanager.h b/src/osd/modules/render/bgfx/targetmanager.h
index 58007084080..fa44e2c1bd6 100644
--- a/src/osd/modules/render/bgfx/targetmanager.h
+++ b/src/osd/modules/render/bgfx/targetmanager.h
@@ -34,7 +34,7 @@ public:
void destroy_target(std::string name, uint32_t screen = -1);
bgfx_target* create_backbuffer(void *handle, uint16_t width, uint16_t height);
- void update_target_sizes(uint32_t screen, uint16_t width, uint16_t height, uint32_t style);
+ bool update_target_sizes(uint32_t screen, uint16_t width, uint16_t height, uint32_t style);
void update_screen_count(uint32_t count);
// Getters