summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
authorGravatarGravatar MooglyGuy <therealmogminer@gmail.com>2019-10-13 20:55:11 +0200
committerGravatarGravatar MooglyGuy <therealmogminer@gmail.com>2019-10-13 20:59:35 +0200
commit61b2a8afaf012e28ef14ad946ee0bb8319232aa6 (patch)
tree0aaf403f6258de9adbbeacaac92206fdf1c7aa27 /src/emu
parentcd6b9ac9beb76e640f39227555ad6907a36d38f9 (diff)
-bgfx: Do texture format conversion via a full-screen GPU pass. [Ryan Holtz]
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/render.cpp13
-rw-r--r--src/emu/render.h5
2 files changed, 11 insertions, 7 deletions
diff --git a/src/emu/render.cpp b/src/emu/render.cpp
index 58d2c2961c9..0c598345ea1 100644
--- a/src/emu/render.cpp
+++ b/src/emu/render.cpp
@@ -496,7 +496,7 @@ void render_texture::get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo
// palette for a texture
//-------------------------------------------------
-const rgb_t *render_texture::get_adjusted_palette(render_container &container)
+const rgb_t *render_texture::get_adjusted_palette(render_container &container, u32 &out_length)
{
// override the palette with our adjusted palette
switch (m_format)
@@ -506,7 +506,7 @@ const rgb_t *render_texture::get_adjusted_palette(render_container &container)
assert(m_bitmap->palette() != nullptr);
// return our adjusted palette
- return container.bcg_lookup_table(m_format, m_bitmap->palette());
+ return container.bcg_lookup_table(m_format, out_length, m_bitmap->palette());
case TEXFORMAT_RGB32:
case TEXFORMAT_ARGB32:
@@ -515,7 +515,7 @@ const rgb_t *render_texture::get_adjusted_palette(render_container &container)
// if no adjustment necessary, return nullptr
if (!container.has_brightness_contrast_gamma_changes())
return nullptr;
- return container.bcg_lookup_table(m_format);
+ return container.bcg_lookup_table(m_format, out_length);
default:
assert(false);
@@ -679,7 +679,7 @@ float render_container::apply_brightness_contrast_gamma_fp(float value)
// given texture mode
//-------------------------------------------------
-const rgb_t *render_container::bcg_lookup_table(int texformat, palette_t *palette)
+const rgb_t *render_container::bcg_lookup_table(int texformat, u32 &out_length, palette_t *palette)
{
switch (texformat)
{
@@ -691,14 +691,17 @@ const rgb_t *render_container::bcg_lookup_table(int texformat, palette_t *palett
recompute_lookups();
}
assert (palette == &m_palclient->palette());
+ out_length = palette->max_index();
return &m_bcglookup[0];
case TEXFORMAT_RGB32:
case TEXFORMAT_ARGB32:
case TEXFORMAT_YUY16:
+ out_length = 256;
return m_bcglookup256;
default:
+ out_length = 0;
return nullptr;
}
}
@@ -2267,7 +2270,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const
curitem.texture()->get_scaled(width, height, prim->texture, list, curitem.flags());
// set the palette
- prim->texture.palette = curitem.texture()->get_adjusted_palette(container);
+ prim->texture.palette = curitem.texture()->get_adjusted_palette(container, prim->texture.palette_length);
// determine UV coordinates
prim->texcoords = oriented_texcoords[finalorient];
diff --git a/src/emu/render.h b/src/emu/render.h
index 0d70dc7684b..b9706907aed 100644
--- a/src/emu/render.h
+++ b/src/emu/render.h
@@ -218,6 +218,7 @@ struct render_texinfo
u64 unique_id; // unique identifier to pass to osd
u64 old_id; // previously allocated id, if applicable
const rgb_t * palette; // palette for PALETTE16 textures, bcg lookup table for RGB32/YUY16
+ u32 palette_length;
};
@@ -436,7 +437,7 @@ public:
private:
// internal helpers
void get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, u32 flags = 0);
- const rgb_t *get_adjusted_palette(render_container &container);
+ const rgb_t *get_adjusted_palette(render_container &container, u32 &out_length);
static const int MAX_TEXTURE_SCALES = 16;
@@ -527,7 +528,7 @@ public:
bool has_brightness_contrast_gamma_changes() const { return (m_user.m_brightness != 1.0f || m_user.m_contrast != 1.0f || m_user.m_gamma != 1.0f); }
u8 apply_brightness_contrast_gamma(u8 value);
float apply_brightness_contrast_gamma_fp(float value);
- const rgb_t *bcg_lookup_table(int texformat, palette_t *palette = nullptr);
+ const rgb_t *bcg_lookup_table(int texformat, u32 &out_length, palette_t *palette = nullptr);
private:
// an item describes a high level primitive that is added to a container