summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
authorGravatarGravatar MooglyGuy <therealmogminer@gmail.com>2019-11-24 15:40:14 +0100
committerGravatarGravatar Vas Crabb <vas@vastheman.com>2019-11-25 01:43:21 +1100
commitaf2860f6f19d53982fdee10f12716c391732df98 (patch)
tree746054ba2da28cb60839e8fe329f9c2a819dc83a /src/osd
parent5b483a2f44daf3a9f4e2c7ea7d3782db48dfe2d5 (diff)
-bgfx: Fixed Github issues #5830 and #5956. [Ryan Holtz]
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/modules/render/bgfx/chain.cpp7
-rw-r--r--src/osd/modules/render/bgfx/chain.h7
-rw-r--r--src/osd/modules/render/bgfx/chainentry.cpp30
-rw-r--r--src/osd/modules/render/bgfx/chainentry.h5
-rw-r--r--src/osd/modules/render/bgfx/chainentryreader.cpp7
-rw-r--r--src/osd/modules/render/bgfx/chainmanager.cpp65
-rw-r--r--src/osd/modules/render/bgfx/chainmanager.h1
-rw-r--r--src/osd/modules/render/bgfx/inputpair.cpp4
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/misc/fs_blit_bcg.sc24
-rw-r--r--src/osd/modules/render/bgfx/statereader.h6
-rw-r--r--src/osd/modules/render/bgfx/writereader.h8
-rw-r--r--src/osd/modules/render/bgfxutil.cpp2
12 files changed, 119 insertions, 47 deletions
diff --git a/src/osd/modules/render/bgfx/chain.cpp b/src/osd/modules/render/bgfx/chain.cpp
index 940bf85d81d..a8f8e895b7b 100644
--- a/src/osd/modules/render/bgfx/chain.cpp
+++ b/src/osd/modules/render/bgfx/chain.cpp
@@ -143,14 +143,14 @@ uint32_t bgfx_chain::applicable_passes()
return applicable_passes;
}
-void bgfx_chain::prepend_converter(bgfx_effect *effect, chain_manager &chains)
+void bgfx_chain::insert_effect(uint32_t index, bgfx_effect *effect, std::string name, std::string source, chain_manager &chains)
{
clear_state *clear = new clear_state(BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, 0, 1.0f, 0);
std::vector<bgfx_suppressor*> suppressors;
std::vector<bgfx_input_pair*> inputs;
std::vector<std::string> available_textures;
- inputs.push_back(new bgfx_input_pair(0, "s_tex", "source", available_textures, "", chains, m_screen_index));
+ inputs.push_back(new bgfx_input_pair(0, "s_tex", source, available_textures, "", chains, m_screen_index));
inputs.push_back(new bgfx_input_pair(1, "s_pal", "palette", available_textures, "", chains, m_screen_index));
std::vector<bgfx_entry_uniform*> uniforms;
@@ -163,8 +163,7 @@ void bgfx_chain::prepend_converter(bgfx_effect *effect, chain_manager &chains)
uniforms.push_back(new bgfx_value_uniform(new bgfx_uniform("u_inv_tex_size0", bgfx::UniformType::Vec4), values, 4));
uniforms.push_back(new bgfx_value_uniform(new bgfx_uniform("u_inv_tex_size1", bgfx::UniformType::Vec4), values, 4));
- m_entries.insert(m_entries.begin(), new bgfx_chain_entry("XXconvert", effect, clear, suppressors, inputs, uniforms, m_targets, "screen"));
- m_has_converter = true;
+ m_entries.insert(m_entries.begin() + index, new bgfx_chain_entry(name, effect, clear, suppressors, inputs, uniforms, m_targets, "screen", false));
const uint32_t screen_width = chains.targets().width(TARGET_STYLE_GUEST, m_screen_index);
const uint32_t screen_height = chains.targets().height(TARGET_STYLE_GUEST, m_screen_index);
diff --git a/src/osd/modules/render/bgfx/chain.h b/src/osd/modules/render/bgfx/chain.h
index 856e9ae1fa3..6faf8634e8b 100644
--- a/src/osd/modules/render/bgfx/chain.h
+++ b/src/osd/modules/render/bgfx/chain.h
@@ -39,8 +39,12 @@ public:
uint32_t applicable_passes();
bool transform() const { return m_transform; }
bool has_converter() const { return m_has_converter; }
+ bool has_adjuster() const { return m_has_adjuster; }
- void prepend_converter(bgfx_effect *effect, chain_manager &chains);
+ // Setters
+ void set_has_converter(bool has_converter) { m_has_converter = has_converter; }
+ void set_has_adjuster(bool has_adjuster) { m_has_adjuster = has_adjuster; }
+ void insert_effect(uint32_t index, bgfx_effect *effect, std::string name, std::string source, chain_manager &chains);
private:
std::string m_name;
@@ -56,6 +60,7 @@ private:
int64_t m_current_time;
uint32_t m_screen_index;
bool m_has_converter;
+ bool m_has_adjuster;
};
#endif // __DRAWBGFX_CHAIN__
diff --git a/src/osd/modules/render/bgfx/chainentry.cpp b/src/osd/modules/render/bgfx/chainentry.cpp
index 7d25785ab64..8f8eedc1214 100644
--- a/src/osd/modules/render/bgfx/chainentry.cpp
+++ b/src/osd/modules/render/bgfx/chainentry.cpp
@@ -13,6 +13,7 @@
#include <bgfx/bgfx.h>
#include <bx/math.h>
+#include <cmath>
#include "chainmanager.h"
#include "chainentry.h"
@@ -29,7 +30,7 @@
#include "render.h"
-bgfx_chain_entry::bgfx_chain_entry(std::string name, bgfx_effect* effect, clear_state* clear, std::vector<bgfx_suppressor*> suppressors, std::vector<bgfx_input_pair*> inputs, std::vector<bgfx_entry_uniform*> uniforms, target_manager& targets, std::string output)
+bgfx_chain_entry::bgfx_chain_entry(std::string name, bgfx_effect* effect, clear_state* clear, std::vector<bgfx_suppressor*> suppressors, std::vector<bgfx_input_pair*> inputs, std::vector<bgfx_entry_uniform*> uniforms, target_manager& targets, std::string output, bool apply_tint)
: m_name(name)
, m_effect(effect)
, m_clear(clear)
@@ -38,6 +39,7 @@ bgfx_chain_entry::bgfx_chain_entry(std::string name, bgfx_effect* effect, clear_
, m_uniforms(uniforms)
, m_targets(targets)
, m_output(output)
+ , m_apply_tint(apply_tint)
{
}
@@ -68,8 +70,18 @@ void bgfx_chain_entry::submit(int view, chain_manager::screen_prim &prim, textur
input->bind(m_effect, screen);
}
+ uint32_t tint = 0xffffffff;
+ if (m_apply_tint)
+ {
+ const uint8_t a = (uint8_t)std::round(prim.m_prim->color.a * 255);
+ const uint8_t r = (uint8_t)std::round(prim.m_prim->color.r * 255);
+ const uint8_t g = (uint8_t)std::round(prim.m_prim->color.g * 255);
+ const uint8_t b = (uint8_t)std::round(prim.m_prim->color.b * 255);
+ tint = (a << 24) | (r << 16) | (g << 8) | b;
+ }
+
bgfx::TransientVertexBuffer buffer;
- put_screen_buffer(prim.m_screen_width, prim.m_screen_height, &buffer);
+ put_screen_buffer(prim.m_screen_width, prim.m_screen_height, tint, &buffer);
bgfx::setVertexBuffer(0, &buffer);
setup_auto_uniforms(prim, textures, screen_count, screen_width, screen_height, screen_scale_x, screen_scale_y, screen_offset_x, screen_offset_y, rotation_type, swap_xy, screen);
@@ -268,7 +280,7 @@ bool bgfx_chain_entry::setup_view(int view, uint16_t screen_width, uint16_t scre
return true;
}
-void bgfx_chain_entry::put_screen_buffer(uint16_t screen_width, uint16_t screen_height, bgfx::TransientVertexBuffer* buffer) const
+void bgfx_chain_entry::put_screen_buffer(uint16_t screen_width, uint16_t screen_height, uint32_t screen_tint, bgfx::TransientVertexBuffer* buffer) const
{
if (6 == bgfx::getAvailTransientVertexBuffer(6, ScreenVertex::ms_decl))
{
@@ -304,42 +316,42 @@ void bgfx_chain_entry::put_screen_buffer(uint16_t screen_width, uint16_t screen_
vertex[0].m_x = x[0];
vertex[0].m_y = y[0];
vertex[0].m_z = 0;
- vertex[0].m_rgba = 0xffffffff;
+ vertex[0].m_rgba = screen_tint;
vertex[0].m_u = u[0];
vertex[0].m_v = v[0];
vertex[1].m_x = x[1];
vertex[1].m_y = y[1];
vertex[1].m_z = 0;
- vertex[1].m_rgba = 0xffffffff;
+ vertex[1].m_rgba = screen_tint;
vertex[1].m_u = u[1];
vertex[1].m_v = v[1];
vertex[2].m_x = x[3];
vertex[2].m_y = y[3];
vertex[2].m_z = 0;
- vertex[2].m_rgba = 0xffffffff;
+ vertex[2].m_rgba = screen_tint;
vertex[2].m_u = u[3];
vertex[2].m_v = v[3];
vertex[3].m_x = x[3];
vertex[3].m_y = y[3];
vertex[3].m_z = 0;
- vertex[3].m_rgba = 0xffffffff;
+ vertex[3].m_rgba = screen_tint;
vertex[3].m_u = u[3];
vertex[3].m_v = v[3];
vertex[4].m_x = x[2];
vertex[4].m_y = y[2];
vertex[4].m_z = 0;
- vertex[4].m_rgba = 0xffffffff;
+ vertex[4].m_rgba = screen_tint;
vertex[4].m_u = u[2];
vertex[4].m_v = v[2];
vertex[5].m_x = x[0];
vertex[5].m_y = y[0];
vertex[5].m_z = 0;
- vertex[5].m_rgba = 0xffffffff;
+ vertex[5].m_rgba = screen_tint;
vertex[5].m_u = u[0];
vertex[5].m_v = v[0];
}
diff --git a/src/osd/modules/render/bgfx/chainentry.h b/src/osd/modules/render/bgfx/chainentry.h
index d9408531476..56c34653266 100644
--- a/src/osd/modules/render/bgfx/chainentry.h
+++ b/src/osd/modules/render/bgfx/chainentry.h
@@ -34,7 +34,7 @@ class target_manager;
class bgfx_chain_entry
{
public:
- bgfx_chain_entry(std::string name, bgfx_effect* effect, clear_state* clear, std::vector<bgfx_suppressor*> suppressors, std::vector<bgfx_input_pair*> inputs, std::vector<bgfx_entry_uniform*> uniforms, target_manager& targets, std::string output);
+ bgfx_chain_entry(std::string name, bgfx_effect* effect, clear_state* clear, std::vector<bgfx_suppressor*> suppressors, std::vector<bgfx_input_pair*> inputs, std::vector<bgfx_entry_uniform*> uniforms, target_manager& targets, std::string output, bool apply_tint);
~bgfx_chain_entry();
void submit(int view, chain_manager::screen_prim &prim, texture_manager& textures, uint16_t screen_count, uint16_t screen_width, uint16_t screen_height, float screen_scale_x, float screen_scale_y, float screen_offset_x, float screen_offset_y, uint32_t rotation_type, bool swap_xy, uint64_t blend, int32_t screen);
@@ -59,7 +59,7 @@ private:
void setup_screenindex_uniform(int32_t screen) const;
bool setup_view(int view, uint16_t screen_width, uint16_t screen_height, int32_t screen) const;
- void put_screen_buffer(uint16_t screen_width, uint16_t screen_height, bgfx::TransientVertexBuffer* buffer) const;
+ void put_screen_buffer(uint16_t screen_width, uint16_t screen_height, uint32_t screen_tint, bgfx::TransientVertexBuffer* buffer) const;
std::string m_name;
bgfx_effect* m_effect;
@@ -69,6 +69,7 @@ private:
std::vector<bgfx_entry_uniform*> m_uniforms;
target_manager& m_targets;
std::string m_output;
+ bool m_apply_tint;
};
#endif // __DRAWBGFX_CHAIN_ENTRY__
diff --git a/src/osd/modules/render/bgfx/chainentryreader.cpp b/src/osd/modules/render/bgfx/chainentryreader.cpp
index d48b214f83d..f14d9d76f64 100644
--- a/src/osd/modules/render/bgfx/chainentryreader.cpp
+++ b/src/osd/modules/render/bgfx/chainentryreader.cpp
@@ -183,6 +183,10 @@ bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, std::s
}
}
+ // Parse whether or not to apply screen tint in this pass
+ bool applytint = get_bool(value, "applytint", false);
+
+ // Parse uniforms
std::vector<bgfx_entry_uniform*> uniforms;
if (value.HasMember("uniforms"))
{
@@ -228,7 +232,7 @@ bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, std::s
}
std::string output = value["output"].GetString();
- return new bgfx_chain_entry(name, effect, clear, suppressors, inputs, uniforms, chains.targets(), output);
+ return new bgfx_chain_entry(name, effect, clear, suppressors, inputs, uniforms, chains.targets(), output, applytint);
}
bool chain_entry_reader::validate_parameters(const Value& value, std::string prefix)
@@ -242,5 +246,6 @@ bool chain_entry_reader::validate_parameters(const Value& value, std::string pre
if (!READER_CHECK(!value.HasMember("input") || value["input"].IsArray(), (prefix + "Value 'input' must be an array\n").c_str())) return false;
if (!READER_CHECK(!value.HasMember("uniforms") || value["uniforms"].IsArray(), (prefix + "Value 'uniforms' must be an array\n").c_str())) return false;
if (!READER_CHECK(!value.HasMember("disablewhen") || value["disablewhen"].IsArray(), (prefix + "Value 'disablewhen' must be an array\n").c_str())) return false;
+ if (!READER_CHECK(!value.HasMember("applytint") || value["applytint"].IsBool(), (prefix + "Value 'applytint' must be a bool\n").c_str())) return false;
return true;
}
diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp
index 313c78f3623..c2eea4c9a8b 100644
--- a/src/osd/modules/render/bgfx/chainmanager.cpp
+++ b/src/osd/modules/render/bgfx/chainmanager.cpp
@@ -64,6 +64,7 @@ void chain_manager::init_texture_converters()
m_converters.push_back(m_effects.effect("misc/texconv_rgb32"));
m_converters.push_back(nullptr);
m_converters.push_back(m_effects.effect("misc/texconv_yuy16"));
+ m_adjuster = m_effects.effect("misc/bcg_adjust");
}
void chain_manager::refresh_available_chains()
@@ -156,7 +157,7 @@ bgfx_chain* chain_manager::load_chain(std::string name, uint32_t screen_index)
bx::FileReader reader;
if (!bx::open(&reader, path.c_str()))
{
- printf("Unable to open chain file %s, falling back to no post processing\n", path.c_str());
+ osd_printf_warning("Unable to open chain file %s, falling back to no post processing\n", path.c_str());
return nullptr;
}
@@ -175,8 +176,8 @@ bgfx_chain* chain_manager::load_chain(std::string name, uint32_t screen_index)
if (document.HasParseError())
{
std::string error(GetParseError_En(document.GetParseError()));
- printf("Unable to parse chain %s. Errors returned:\n", path.c_str());
- printf("%s\n", error.c_str());
+ osd_printf_warning("Unable to parse chain %s. Errors returned:\n", path.c_str());
+ osd_printf_warning("%s\n", error.c_str());
return nullptr;
}
@@ -184,7 +185,7 @@ bgfx_chain* chain_manager::load_chain(std::string name, uint32_t screen_index)
if (chain == nullptr)
{
- printf("Unable to load chain %s, falling back to no post processing\n", path.c_str());
+ osd_printf_warning("Unable to load chain %s, falling back to no post processing\n", path.c_str());
return nullptr;
}
@@ -443,11 +444,12 @@ uint32_t chain_manager::update_screen_textures(uint32_t view, render_primitive *
const uint32_t src_format = (prim.m_flags & PRIMFLAG_TEXFORMAT_MASK) >> PRIMFLAG_TEXFORMAT_SHIFT;
const bool needs_conversion = m_converters[src_format] != nullptr;
+ const bool needs_adjust = prim.m_prim->texture.palette != nullptr && src_format != TEXFORMAT_PALETTE16;
std::string screen_index = std::to_string(screen);
std::string source_name = "source" + screen_index;
std::string screen_name = "screen" + screen_index;
std::string palette_name = "palette" + screen_index;
- std::string full_name = needs_conversion ? source_name : screen_name;
+ std::string full_name = (needs_conversion || needs_adjust) ? source_name : screen_name;
if (texture && (texture->width() != tex_width || texture->height() != tex_height))
{
m_textures.add_provider(full_name, nullptr);
@@ -483,21 +485,19 @@ uint32_t chain_manager::update_screen_textures(uint32_t view, render_primitive *
m_textures.add_provider(palette_name, palette);
}
- if (screen >= m_screen_textures.size())
+ while (screen >= m_screen_textures.size())
{
- m_screen_textures.push_back(texture);
- if (palette)
- {
- m_screen_palettes.push_back(palette);
- }
+ m_screen_textures.push_back(nullptr);
}
- else
+ m_screen_textures[screen] = texture;
+
+ while (screen >= m_screen_palettes.size())
{
- m_screen_textures[screen] = texture;
- if (palette)
- {
- m_screen_palettes[screen] = palette;
- }
+ m_screen_palettes.push_back(nullptr);
+ }
+ if (palette)
+ {
+ m_screen_palettes[screen] = palette;
}
}
else
@@ -506,17 +506,40 @@ uint32_t chain_manager::update_screen_textures(uint32_t view, render_primitive *
if (prim.m_prim->texture.palette)
{
- m_palette_temp.resize(palette->width() * palette->height() * 4);
+ uint16_t palette_width = (uint16_t)std::min(prim.m_palette_length, 256U);
+ uint16_t palette_height = (uint16_t)std::max((prim.m_palette_length + 255) / 256, 1U);
+ const uint32_t palette_size = palette_width * palette_height * 4;
+ m_palette_temp.resize(palette_size);
memcpy(&m_palette_temp[0], prim.m_prim->texture.palette, prim.m_palette_length * 4);
- const bgfx::Memory *palmem = bgfx::copy(&m_palette_temp[0], palette->width() * palette->height() * 4);
- palette->update(palmem);
+ const bgfx::Memory *palmem = bgfx::copy(&m_palette_temp[0], palette_size);
+
+ if (palette)
+ {
+ palette->update(palmem);
+ }
+ else
+ {
+ palette = new bgfx_texture(palette_name, bgfx::TextureFormat::BGRA8, palette_width, palette_height, palmem, BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT, palette_width * 4);
+ m_textures.add_provider(palette_name, palette);
+ while (screen >= m_screen_palettes.size())
+ {
+ m_screen_palettes.push_back(nullptr);
+ }
+ m_screen_palettes[screen] = palette;
+ }
}
}
bgfx_chain* chain = screen_chain(screen);
+ if (chain && needs_adjust && !chain->has_adjuster())
+ {
+ chain->insert_effect(chain->has_converter() ? 1 : 0, m_adjuster, "XXadjust", needs_conversion ? "screen" : "source", *this);
+ chain->set_has_adjuster(true);
+ }
if (chain && needs_conversion && !chain->has_converter())
{
- chain->prepend_converter(m_converters[src_format], *this);
+ chain->insert_effect(0, m_converters[src_format], "XXconvert", "source", *this);
+ chain->set_has_converter(true);
}
}
diff --git a/src/osd/modules/render/bgfx/chainmanager.h b/src/osd/modules/render/bgfx/chainmanager.h
index 36a6847455f..2786714bb98 100644
--- a/src/osd/modules/render/bgfx/chainmanager.h
+++ b/src/osd/modules/render/bgfx/chainmanager.h
@@ -147,6 +147,7 @@ private:
std::vector<bgfx_texture*> m_screen_textures;
std::vector<bgfx_texture*> m_screen_palettes;
std::vector<bgfx_effect*> m_converters;
+ bgfx_effect * m_adjuster;
std::vector<screen_prim> m_screen_prims;
std::vector<uint8_t> m_palette_temp;
diff --git a/src/osd/modules/render/bgfx/inputpair.cpp b/src/osd/modules/render/bgfx/inputpair.cpp
index f6e695a9992..9fd2b0e6855 100644
--- a/src/osd/modules/render/bgfx/inputpair.cpp
+++ b/src/osd/modules/render/bgfx/inputpair.cpp
@@ -46,7 +46,9 @@ bgfx_input_pair::~bgfx_input_pair()
void bgfx_input_pair::bind(bgfx_effect *effect, const int32_t screen) const
{
- assert(effect->uniform(m_sampler) != nullptr);
+ if (effect->uniform(m_sampler) == nullptr)
+ return;
+
std::string name = m_texture + std::to_string(screen);
bgfx_texture_handle_provider* provider = chains().textures().provider(name);
diff --git a/src/osd/modules/render/bgfx/shaders/chains/misc/fs_blit_bcg.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_blit_bcg.sc
new file mode 100644
index 00000000000..37d64462c51
--- /dev/null
+++ b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_blit_bcg.sc
@@ -0,0 +1,24 @@
+$input v_color0, v_texcoord0
+
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+
+#include "common.sh"
+
+// Samplers
+SAMPLER2D(s_tex, 0);
+SAMPLER2D(s_pal, 1);
+
+uniform vec4 u_inv_tex_size1;
+
+void main()
+{
+ vec4 src = texture2D(s_tex, v_texcoord0);
+ vec2 blu_uv = vec2(src.b * 256.0, 0.0) * u_inv_tex_size1.xy;
+ vec2 grn_uv = vec2(src.g * 256.0, 1.0) * u_inv_tex_size1.xy;
+ vec2 red_uv = vec2(src.r * 256.0, 2.0) * u_inv_tex_size1.xy;
+ float blu = texture2D(s_pal, blu_uv).b;
+ float grn = texture2D(s_pal, grn_uv).g;
+ float red = texture2D(s_pal, red_uv).r;
+ gl_FragColor = vec4(red, grn, blu, src.a) * v_color0;
+}
diff --git a/src/osd/modules/render/bgfx/statereader.h b/src/osd/modules/render/bgfx/statereader.h
index 8026b4b07d0..d725eb792ee 100644
--- a/src/osd/modules/render/bgfx/statereader.h
+++ b/src/osd/modules/render/bgfx/statereader.h
@@ -9,8 +9,8 @@
#pragma once
-#ifndef __DRAWBGFX_STATE_READER__
-#define __DRAWBGFX_STATE_READER__
+#ifndef DRAWBGFX_STATE_READER
+#define DRAWBGFX_STATE_READER
#include <rapidjson/document.h>
@@ -63,4 +63,4 @@ private:
static void get_vec_values(const Value& value_array, float* data, const unsigned int count);
};
-#endif // __DRAWBGFX_STATE_READER__
+#endif // DRAWBGFX_STATE_READER
diff --git a/src/osd/modules/render/bgfx/writereader.h b/src/osd/modules/render/bgfx/writereader.h
index 7dcd1ac16c9..9f60efd846a 100644
--- a/src/osd/modules/render/bgfx/writereader.h
+++ b/src/osd/modules/render/bgfx/writereader.h
@@ -2,14 +2,14 @@
// copyright-holders:Ryan Holtz
//============================================================
//
-// cullreader.h - BGFX alpha/color write state JSON reader
+// writereader.h - BGFX alpha/color write state JSON reader
//
//============================================================
#pragma once
-#ifndef __DRAWBGFX_WRITE_READER__
-#define __DRAWBGFX_WRITE_READER__
+#ifndef DRAWBGFX_WRITE_READER
+#define DRAWBGFX_WRITE_READER
#include "statereader.h"
@@ -18,4 +18,4 @@ public:
static uint64_t read_from_value(const Value& value);
};
-#endif // __DRAWBGFX_WRITE_READER__
+#endif // DRAWBGFX_WRITE_READER
diff --git a/src/osd/modules/render/bgfxutil.cpp b/src/osd/modules/render/bgfxutil.cpp
index b82b0742ebb..1ce3c244ba4 100644
--- a/src/osd/modules/render/bgfxutil.cpp
+++ b/src/osd/modules/render/bgfxutil.cpp
@@ -78,7 +78,7 @@ uint64_t bgfx_util::get_blend_state(uint32_t blend)
case BLENDMODE_ALPHA:
return BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA);
case BLENDMODE_RGB_MULTIPLY:
- return BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO);
+ return BGFX_STATE_BLEND_FUNC_SEPARATE(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO, BGFX_STATE_BLEND_DST_ALPHA, BGFX_STATE_BLEND_ZERO);
case BLENDMODE_ADD:
return BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_ONE);
default: