From 1604863c0784b618f6a443299babc8a8ba01f178 Mon Sep 17 00:00:00 2001 From: MooglyGuy Date: Wed, 10 Jul 2019 20:07:45 +0200 Subject: -core: Removed TEXFORMAT_PALETTEA16. [Ryan Holtz] --- src/devices/machine/laserdsc.cpp | 26 +-- src/devices/machine/laserdsc.h | 24 +-- src/emu/render.cpp | 6 +- src/emu/rendersw.hxx | 100 --------- src/emu/screen.h | 3 +- src/mame/drivers/alg.cpp | 2 - src/mame/drivers/deco_ld.cpp | 71 +++---- src/mame/drivers/dlair.cpp | 9 +- src/mame/drivers/esh.cpp | 6 +- src/mame/drivers/firefox.cpp | 26 +-- src/mame/drivers/gottlieb.cpp | 2 - src/mame/drivers/gpworld.cpp | 1 - src/mame/drivers/istellar.cpp | 14 +- src/mame/drivers/konblands.cpp | 12 +- src/mame/drivers/lgp.cpp | 13 +- src/mame/drivers/segald.cpp | 25 +-- src/mame/drivers/superdq.cpp | 1 - .../render/bgfx/shaders/chains/lottes/fs.sc | 236 +++++++++++++++++++++ .../render/bgfx/shaders/chains/lottes/fs_vert.sc | 236 +++++++++++++++++++++ .../bgfx/shaders/chains/lottes/varying.def.sc | 9 + .../render/bgfx/shaders/chains/lottes/vs.sc | 26 +++ .../render/bgfx/shaders/chains/lottes/vs_vert.sc | 26 +++ src/osd/modules/render/bgfxutil.cpp | 3 - src/osd/modules/render/copyutil.h | 9 - src/osd/modules/render/d3d/d3dcomm.h | 1 - src/osd/modules/render/draw13.cpp | 3 - src/osd/modules/render/drawd3d.cpp | 21 +- src/osd/modules/render/drawogl.cpp | 31 --- 28 files changed, 618 insertions(+), 324 deletions(-) create mode 100644 src/osd/modules/render/bgfx/shaders/chains/lottes/fs.sc create mode 100644 src/osd/modules/render/bgfx/shaders/chains/lottes/fs_vert.sc create mode 100644 src/osd/modules/render/bgfx/shaders/chains/lottes/varying.def.sc create mode 100644 src/osd/modules/render/bgfx/shaders/chains/lottes/vs.sc create mode 100644 src/osd/modules/render/bgfx/shaders/chains/lottes/vs_vert.sc diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp index 7794ebb026e..436a238fe88 100644 --- a/src/devices/machine/laserdsc.cpp +++ b/src/devices/machine/laserdsc.cpp @@ -92,8 +92,7 @@ laserdisc_device::laserdisc_device(const machine_config &mconfig, device_type ty m_videopalette(nullptr), m_overenable(false), m_overindex(0), - m_overtex(nullptr), - m_overlay_palette(*this, finder_base::DUMMY_TAG) + m_overtex(nullptr) { // initialize overlay_config m_orig_config.m_overposx = m_orig_config.m_overposy = 0.0f; @@ -157,7 +156,7 @@ uint32_t laserdisc_device::screen_update(screen_device &screen, bitmap_rgb32 &bi { // handle the overlay if present screen_bitmap &overbitmap = m_overbitmap[m_overindex]; - if (overbitmap.valid() && (!m_overupdate_ind16.isnull() || !m_overupdate_rgb32.isnull())) + if (overbitmap.valid() && !m_overupdate_rgb32.isnull()) { // scale the cliprect to the overlay size rectangle clip(m_overclip); @@ -167,10 +166,7 @@ uint32_t laserdisc_device::screen_update(screen_device &screen, bitmap_rgb32 &bi clip.max_y = (cliprect.max_y + 1) * overbitmap.height() / bitmap.height() - 1; // call the update callback - if (!m_overupdate_ind16.isnull()) - m_overupdate_ind16(screen, overbitmap.as_ind16(), clip); - else - m_overupdate_rgb32(screen, overbitmap.as_rgb32(), clip); + m_overupdate_rgb32(screen, overbitmap.as_rgb32(), clip); } // if this is the last update, do the rendering @@ -218,10 +214,6 @@ uint32_t laserdisc_device::screen_update(screen_device &screen, bitmap_rgb32 &bi void laserdisc_device::device_start() { - // if we have a palette and it's not started, wait for it - if (m_overlay_palette != nullptr && !m_overlay_palette->started()) - throw device_missing_dependencies(); - // initialize the various pieces init_disc(); init_video(); @@ -278,9 +270,6 @@ void laserdisc_device::device_reset() void laserdisc_device::device_validity_check(validity_checker &valid) const { - texture_format texformat = !m_overupdate_ind16.isnull() ? TEXFORMAT_PALETTE16 : TEXFORMAT_RGB32; - if (m_overlay_palette == nullptr && texformat == TEXFORMAT_PALETTE16) - osd_printf_error("Overlay screen does not have palette defined\n"); } //------------------------------------------------- @@ -741,19 +730,12 @@ void laserdisc_device::init_video() if (m_overenable) { // bind our handlers - m_overupdate_ind16.bind_relative_to(*owner()); m_overupdate_rgb32.bind_relative_to(*owner()); - // configure bitmap formats - bitmap_format format = !m_overupdate_ind16.isnull() ? BITMAP_FORMAT_IND16 : BITMAP_FORMAT_RGB32; - texture_format texformat = !m_overupdate_ind16.isnull() ? TEXFORMAT_PALETTEA16 : TEXFORMAT_ARGB32; - // allocate overlay bitmaps for (auto & elem : m_overbitmap) { - elem.set_format(format, texformat); - if (format==BITMAP_FORMAT_IND16) - elem.set_palette(m_overlay_palette->palette()); + elem.set_format(BITMAP_FORMAT_RGB32, TEXFORMAT_ARGB32); elem.resize(m_overwidth, m_overheight); } diff --git a/src/devices/machine/laserdsc.h b/src/devices/machine/laserdsc.h index 510d22366ec..78f4ad2702a 100644 --- a/src/devices/machine/laserdsc.h +++ b/src/devices/machine/laserdsc.h @@ -117,48 +117,29 @@ public: uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); // configuration - bool overlay_configured() const { return (m_overwidth > 0 && m_overheight > 0 && (!m_overupdate_ind16.isnull() || !m_overupdate_rgb32.isnull())); } + bool overlay_configured() const { return (m_overwidth > 0 && m_overheight > 0 && (!m_overupdate_rgb32.isnull())); } void get_overlay_config(laserdisc_overlay_config &config) { config = static_cast(*this); } void set_overlay_config(const laserdisc_overlay_config &config) { static_cast(*this) = config; } // configuration helpers template void set_get_disc(T &&... args) { m_getdisc_callback = get_disc_delegate(std::forward(args)...); } template void set_audio(T &&... args) { m_audio_callback = audio_delegate(std::forward(args)...); } - template // FIXME: these should be aware of current device for resolving the tag - void set_overlay(uint32_t width, uint32_t height, u32 (FunctionClass::*callback)(screen_device &, bitmap_ind16 &, const rectangle &), const char *name) - { - set_overlay(width, height, screen_update_ind16_delegate(callback, name, nullptr, static_cast(nullptr))); - } template void set_overlay(uint32_t width, uint32_t height, u32 (FunctionClass::*callback)(screen_device &, bitmap_rgb32 &, const rectangle &), const char *name) { set_overlay(width, height, screen_update_rgb32_delegate(callback, name, nullptr, static_cast(nullptr))); } template - void set_overlay(uint32_t width, uint32_t height, const char *devname, u32 (FunctionClass::*callback)(screen_device &, bitmap_ind16 &, const rectangle &), const char *name) - { - set_overlay(width, height, screen_update_ind16_delegate(callback, name, devname, static_cast(nullptr))); - } - template void set_overlay(uint32_t width, uint32_t height, const char *devname, u32 (FunctionClass::*callback)(screen_device &, bitmap_rgb32 &, const rectangle &), const char *name) { set_overlay(width, height, screen_update_rgb32_delegate(callback, name, devname, static_cast(nullptr))); } - void set_overlay(uint32_t width, uint32_t height, screen_update_ind16_delegate &&update) - { - m_overwidth = width; - m_overheight = height; - m_overclip.set(0, width - 1, 0, height - 1); - m_overupdate_ind16 = std::move(update); - m_overupdate_rgb32 = screen_update_rgb32_delegate(); - } void set_overlay(uint32_t width, uint32_t height, screen_update_rgb32_delegate &&update) { m_overwidth = width; m_overheight = height; m_overclip.set(0, width - 1, 0, height - 1); - m_overupdate_ind16 = screen_update_ind16_delegate(); m_overupdate_rgb32 = std::move(update); } void set_overlay_clip(int32_t minx, int32_t maxx, int32_t miny, int32_t maxy) { m_overclip.set(minx, maxx, miny, maxy); } @@ -172,7 +153,6 @@ public: m_orig_config.m_overscalex = m_overscalex = scalex; m_orig_config.m_overscaley = m_overscaley = scaley; } - template void set_overlay_palette(T &&tag) { m_overlay_palette.set_tag(std::forward(tag)); } protected: // timer IDs @@ -297,7 +277,6 @@ private: uint32_t m_overwidth; // overlay screen width uint32_t m_overheight; // overlay screen height rectangle m_overclip; // overlay visarea - screen_update_ind16_delegate m_overupdate_ind16; // overlay update delegate screen_update_rgb32_delegate m_overupdate_rgb32; // overlay update delegate // disc parameters @@ -351,7 +330,6 @@ private: screen_bitmap m_overbitmap[2]; // overlay bitmaps int m_overindex; // index of the overlay bitmap render_texture * m_overtex; // texture for the overlay - optional_device m_overlay_palette; // overlay screen palette }; // iterator - interface iterator works for subclasses too diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 34d29285162..e896c3748f1 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -361,7 +361,7 @@ void render_texture::set_bitmap(bitmap_t &bitmap, const rectangle &sbounds, text assert(bitmap.cliprect().contains(sbounds)); // ensure we have a valid palette for palettized modes - if (format == TEXFORMAT_PALETTE16 || format == TEXFORMAT_PALETTEA16) + if (format == TEXFORMAT_PALETTE16) assert(bitmap.palette() != nullptr); // invalidate references to the old bitmap @@ -501,7 +501,6 @@ const rgb_t *render_texture::get_adjusted_palette(render_container &container) switch (m_format) { case TEXFORMAT_PALETTE16: - case TEXFORMAT_PALETTEA16: assert(m_bitmap->palette() != nullptr); @@ -684,7 +683,6 @@ const rgb_t *render_container::bcg_lookup_table(int texformat, palette_t *palett switch (texformat) { case TEXFORMAT_PALETTE16: - case TEXFORMAT_PALETTEA16: if (m_palclient == nullptr) // if adjusted palette hasn't been created yet, create it { m_palclient = std::make_unique(*palette); @@ -2866,7 +2864,7 @@ void render_target::add_clear_and_optimize_primitive_list(render_primitive_list case render_primitive::QUAD: { // stop when we hit an alpha texture - if (PRIMFLAG_GET_TEXFORMAT(prim.flags) == TEXFORMAT_ARGB32 || PRIMFLAG_GET_TEXFORMAT(prim.flags) == TEXFORMAT_PALETTEA16) + if (PRIMFLAG_GET_TEXFORMAT(prim.flags) == TEXFORMAT_ARGB32) goto done; // if this quad can't be cleanly removed from the extents list, we're done diff --git a/src/emu/rendersw.hxx b/src/emu/rendersw.hxx index 32df8b833ff..8dbf28b35b3 100644 --- a/src/emu/rendersw.hxx +++ b/src/emu/rendersw.hxx @@ -795,102 +795,6 @@ private: - //************************************************************************** - // 16-BIT ALPHA PALETTE RASTERIZERS - //************************************************************************** - - //------------------------------------------------- - // draw_quad_palettea16_alpha - perform - // rasterization using standard alpha blending - //------------------------------------------------- - - static void draw_quad_palettea16_alpha(const render_primitive &prim, _PixelType *dstdata, u32 pitch, quad_setup_data &setup) - { - s32 dudx = setup.dudx; - s32 dvdx = setup.dvdx; - s32 endx = setup.endx; - - // ensure all parameters are valid - assert(prim.texture.palette != nullptr); - - // fast case: no coloring, no alpha - if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) - { - // loop over rows - for (s32 y = setup.starty; y < setup.endy; y++) - { - _PixelType *dest = dstdata + y * pitch + setup.startx; - s32 curu = setup.startu + (y - setup.starty) * setup.dudy; - s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; - - // loop over cols - for (s32 x = setup.startx; x < endx; x++) - { - u32 pix = get_texel_palette16a(prim.texture, curu, curv); - u32 ta = pix >> 24; - if (ta != 0) - { - u32 dpix = _NoDestRead ? 0 : *dest; - u32 invta = 0x100 - ta; - u32 r = (source32_r(pix) * ta + dest_r(dpix) * invta) >> 8; - u32 g = (source32_g(pix) * ta + dest_g(dpix) * invta) >> 8; - u32 b = (source32_b(pix) * ta + dest_b(dpix) * invta) >> 8; - - *dest = dest_assemble_rgb(r, g, b); - } - dest++; - curu += dudx; - curv += dvdx; - } - } - } - - // alpha and/or coloring case - else - { - u32 sr = u32(256.0f * prim.color.r); - u32 sg = u32(256.0f * prim.color.g); - u32 sb = u32(256.0f * prim.color.b); - u32 sa = u32(256.0f * prim.color.a); - - // clamp R,G,B and inverse A to 0-256 range - if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } - if (sa > 0x100) { if (s32(sa) < 0) sa = 0; else sa = 0x100; } - - // loop over rows - for (s32 y = setup.starty; y < setup.endy; y++) - { - _PixelType *dest = dstdata + y * pitch + setup.startx; - s32 curu = setup.startu + (y - setup.starty) * setup.dudy; - s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; - - // loop over cols - for (s32 x = setup.startx; x < endx; x++) - { - u32 pix = get_texel_palette16a(prim.texture, curu, curv); - u32 ta = (pix >> 24) * sa; - if (ta != 0) - { - u32 dpix = _NoDestRead ? 0 : *dest; - u32 invsta = (0x10000 - ta) << 8; - u32 r = (source32_r(pix) * sr * ta + dest_r(dpix) * invsta) >> 24; - u32 g = (source32_g(pix) * sg * ta + dest_g(dpix) * invsta) >> 24; - u32 b = (source32_b(pix) * sb * ta + dest_b(dpix) * invsta) >> 24; - - *dest = dest_assemble_rgb(r, g, b); - } - dest++; - curu += dudx; - curv += dvdx; - } - } - } - } - - - //************************************************************************** // 16-BIT YUY RASTERIZERS //************************************************************************** @@ -1884,10 +1788,6 @@ private: draw_quad_palette16_add(prim, dstdata, pitch, setup); break; - case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTEA16) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA): - draw_quad_palettea16_alpha(prim, dstdata, pitch, setup); - break; - case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16) | PRIMFLAG_BLENDMODE(BLENDMODE_NONE): case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA): draw_quad_yuy16_none(prim, dstdata, pitch, setup); diff --git a/src/emu/screen.h b/src/emu/screen.h index a2b0b5eb0a4..98d049be8ae 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -33,8 +33,7 @@ enum screen_type_enum enum texture_format { TEXFORMAT_UNDEFINED = 0, // require a format to be specified - TEXFORMAT_PALETTE16, // 16bpp palettized, alpha ignored - TEXFORMAT_PALETTEA16, // 16bpp palettized, alpha respected + TEXFORMAT_PALETTE16, // 16bpp palettized, no alpha TEXFORMAT_RGB32, // 32bpp 8-8-8 RGB TEXFORMAT_ARGB32, // 32bpp 8-8-8-8 ARGB TEXFORMAT_YUY16 // 16bpp 8-8 Y/Cb, Y/Cr in sequence diff --git a/src/mame/drivers/alg.cpp b/src/mame/drivers/alg.cpp index e341d5dc1af..2cb251611c7 100644 --- a/src/mame/drivers/alg.cpp +++ b/src/mame/drivers/alg.cpp @@ -322,8 +322,6 @@ void alg_state::alg_r1(machine_config &config) m_laserdisc->set_screen("screen"); m_laserdisc->set_overlay(512*2, 262, FUNC(amiga_state::screen_update_amiga)); m_laserdisc->set_overlay_clip((129-8)*2, (449+8-1)*2, 44-8, 244+8-1); - m_laserdisc->set_overlay_palette(m_palette); - PALETTE(config, m_palette, FUNC(alg_state::amiga_palette), 4097); diff --git a/src/mame/drivers/deco_ld.cpp b/src/mame/drivers/deco_ld.cpp index 04f2dced8be..553b43ece79 100644 --- a/src/mame/drivers/deco_ld.cpp +++ b/src/mame/drivers/deco_ld.cpp @@ -163,17 +163,16 @@ private: DECLARE_READ8_MEMBER(sound_status_r); DECLARE_WRITE8_MEMBER(decold_sound_cmd_w); virtual void machine_start() override; - uint32_t screen_update_rblaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_rblaster(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(sound_interrupt); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *spriteram, uint16_t tile_bank ); + void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t *spriteram, uint16_t tile_bank ); void rblaster_map(address_map &map); void rblaster_sound_map(address_map &map); }; -void deco_ld_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *spriteram, uint16_t tile_bank ) +void deco_ld_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t *spriteram, uint16_t tile_bank ) { gfx_element *gfx = m_gfxdecode->gfx(1); - int i,spr_offs,x,y,col,fx,fy; /* [+0] ---- -x-- flip X @@ -184,68 +183,67 @@ void deco_ld_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect [+3] x coord */ - for(i=0;i<0x20;i+=4) + for (int i = 0; i < 0x20; i += 4) { - if(~spriteram[i+0] & 1) + if (~spriteram[i] & 1) continue; - spr_offs = spriteram[i+1]|tile_bank; - x = spriteram[i+3]; - y = spriteram[i+2]; - col = 6; /* TODO */ - fx = (spriteram[i+0] & 0x04) ? 1 : 0; - fy = (spriteram[i+0] & 0x02) ? 1 : 0; + int spr_offs = spriteram[i + 1] | tile_bank; + int x = spriteram[i + 3]; + int y = spriteram[i + 2]; + int col = 6; /* TODO */ + int fx = (spriteram[i] & 0x04) ? 1 : 0; + int fy = (spriteram[i] & 0x02) ? 1 : 0; - gfx->transpen(bitmap,cliprect,spr_offs,col,fx,fy,x,y,0); + gfx->transpen(bitmap, cliprect, spr_offs, col, fx, fy, x, y, 0); } - for(i=0x3e0;i<0x400;i+=4) + for (int i = 0x3e0; i < 0x400; i += 4) { - if(~spriteram[i+0] & 1) + if (~spriteram[i] & 1) continue; - spr_offs = spriteram[i+1]|tile_bank; - x = spriteram[i+3]; - y = spriteram[i+2]; - col = 6; /* TODO */ - fx = (spriteram[i+0] & 0x04) ? 1 : 0; - fy = (spriteram[i+0] & 0x02) ? 1 : 0; + int spr_offs = spriteram[i + 1] | tile_bank; + int x = spriteram[i + 3]; + int y = spriteram[i + 2]; + int col = 6; /* TODO */ + int fx = (spriteram[i] & 0x04) ? 1 : 0; + int fy = (spriteram[i] & 0x02) ? 1 : 0; - gfx->transpen(bitmap,cliprect,spr_offs,col,fx,fy,x,y,0); + gfx->transpen(bitmap, cliprect, spr_offs, col, fx, fy, x, y, 0); } } -uint32_t deco_ld_state::screen_update_rblaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t deco_ld_state::screen_update_rblaster(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { gfx_element *gfx = m_gfxdecode->gfx(0); - int y,x; bitmap.fill(0, cliprect); - draw_sprites(bitmap,cliprect,m_vram1,0x000); - draw_sprites(bitmap,cliprect,m_vram0,0x100); + draw_sprites(bitmap, cliprect, m_vram1, 0x000); + draw_sprites(bitmap, cliprect, m_vram0, 0x100); - for (y=0;y<32;y++) + for (int y = 0; y < 32; y++) { - for (x=0;x<32;x++) + for (int x = 0; x < 32; x++) { - int attr = m_attr0[x+y*32]; - int tile = m_vram0[x+y*32] | ((attr & 3) << 8); + int attr = m_attr0[x + y * 32]; + int tile = m_vram0[x + y * 32] | ((attr & 3) << 8); int colour = (6 & 0x7); /* TODO */ - gfx->transpen(bitmap,cliprect,tile|0x400,colour,0,0,x*8,y*8,0); + gfx->transpen(bitmap, cliprect, tile | 0x400, colour, 0, 0, x * 8, y * 8, 0); } } - for (y=0;y<32;y++) + for (int y = 0; y < 32; y++) { - for (x=0;x<32;x++) + for (int x = 0; x < 32; x++) { - int attr = m_attr1[x+y*32]; - int tile = m_vram1[x+y*32] | ((attr & 3) << 8); + int attr = m_attr1[x + y * 32]; + int tile = m_vram1[x + y * 32] | ((attr & 3) << 8); int colour = (6 & 0x7); /* TODO */ - gfx->transpen(bitmap,cliprect,tile,colour,0,0,x*8,y*8,0); + gfx->transpen(bitmap, cliprect, tile, colour, 0, 0, x * 8, y * 8, 0); } } @@ -478,7 +476,6 @@ void deco_ld_state::rblaster(machine_config &config) SONY_LDP1000(config, m_laserdisc, 0); m_laserdisc->set_overlay(256, 256, FUNC(deco_ld_state::screen_update_rblaster)); //m_laserdisc->set_overlay_clip(0, 256-1, 8, 240-1); - m_laserdisc->set_overlay_palette(m_palette); m_laserdisc->add_route(0, "lspeaker", 1.0); m_laserdisc->add_route(1, "rspeaker", 1.0); diff --git a/src/mame/drivers/dlair.cpp b/src/mame/drivers/dlair.cpp index c14042dd9ce..4c2ef3c9511 100644 --- a/src/mame/drivers/dlair.cpp +++ b/src/mame/drivers/dlair.cpp @@ -128,7 +128,7 @@ private: virtual void machine_start() override; virtual void machine_reset() override; void dleuro_palette(palette_device &palette) const; - uint32_t screen_update_dleuro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_dleuro(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(write_speaker); void dleuro_io_map(address_map &map); @@ -220,16 +220,18 @@ void dlair_state::dleuro_palette(palette_device &palette) const * *************************************/ -uint32_t dlair_state::screen_update_dleuro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t dlair_state::screen_update_dleuro(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { // redraw the overlay for (int y = 0; y < 32; y++) + { for (int x = 0; x < 32; x++) { uint8_t const *const base = &m_videoram[y * 64 + x * 2 + 1]; // TODO: opaque? - m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, base[0], base[1], 0, 0, 10 * x, 16 * y); + m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, base[0], base[1], 0, 0, 10 * x, 16 * y); } + } return 0; } @@ -782,7 +784,6 @@ void dlair_state::dleuro(machine_config &config) PHILIPS_22VP932(config, m_22vp932, 0); m_22vp932->set_overlay(256, 256, FUNC(dlair_state::screen_update_dleuro)); - m_22vp932->set_overlay_palette(m_palette); m_22vp932->add_route(0, "lspeaker", 1.0); m_22vp932->add_route(1, "rspeaker", 1.0); diff --git a/src/mame/drivers/esh.cpp b/src/mame/drivers/esh.cpp index ad1335700c0..38a52dcf039 100644 --- a/src/mame/drivers/esh.cpp +++ b/src/mame/drivers/esh.cpp @@ -90,7 +90,6 @@ private: /* VIDEO GOODS */ uint32_t esh_state::screen_update_esh(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int charx, chary; const uint8_t pal_bank = m_ld_video_visible == true ? 0x10 : 0x00; const uint32_t trans_mask = m_ld_video_visible == true ? 0 : -1; gfx_element *gfx;// = m_gfxdecode->gfx(0); @@ -100,9 +99,9 @@ uint32_t esh_state::screen_update_esh(screen_device &screen, bitmap_rgb32 &bitma /* Draw tiles */ - for (charx = 0; charx < 32; charx++) + for (int charx = 0; charx < 32; charx++) { - for (chary = 0; chary < 32; chary++) + for (int chary = 0; chary < 32; chary++) { int current_screen_character = (chary*32) + charx; @@ -372,7 +371,6 @@ void esh_state::esh(machine_config &config) PIONEER_LDV1000(config, m_laserdisc, 0); m_laserdisc->command_strobe_callback().set(FUNC(esh_state::ld_command_strobe_cb)); m_laserdisc->set_overlay(256, 256, FUNC(esh_state::screen_update_esh)); - m_laserdisc->set_overlay_palette(m_palette); m_laserdisc->add_route(0, "lspeaker", 1.0); m_laserdisc->add_route(1, "rspeaker", 1.0); diff --git a/src/mame/drivers/firefox.cpp b/src/mame/drivers/firefox.cpp index 60f32448ccb..a2bd450efd6 100644 --- a/src/mame/drivers/firefox.cpp +++ b/src/mame/drivers/firefox.cpp @@ -257,35 +257,32 @@ void firefox_state::video_start() uint32_t firefox_state::screen_update_firefox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int sprite; int gfxtop = screen.visible_area().top(); bitmap.fill(m_palette->pen_color(256), cliprect); - for( sprite = 0; sprite < 32; sprite++ ) + for (int sprite = 0; sprite < 32; sprite++) { - uint8_t *sprite_data = m_spriteram + ( 0x200 * m_sprite_bank ) + ( sprite * 16 ); - int flags = sprite_data[ 0 ]; - int y = sprite_data[ 1 ] + ( 256 * ( ( flags >> 0 ) & 1 ) ); - int x = sprite_data[ 2 ] + ( 256 * ( ( flags >> 1 ) & 1 ) ); + uint8_t *sprite_data = m_spriteram + (0x200 * m_sprite_bank) + (sprite * 16); + int flags = sprite_data[0]; + int y = sprite_data[1] + (256 * ((flags >> 0) & 1)); + int x = sprite_data[2] + (256 * ((flags >> 1) & 1)); - if( x != 0 ) + if (x != 0) { - int row; - - for( row = 0; row < 8; row++ ) + for (int row = 0; row < 8; row++) { - int color = ( flags >> 2 ) & 0x03; + int color = (flags >> 2) & 0x03; int flipy = flags & 0x10; int flipx = flags & 0x20; - int code = sprite_data[ 15 - row ] + ( 256 * ( ( flags >> 6 ) & 3 ) ); + int code = sprite_data[15 - row] + (256 * ((flags >> 6) & 3)); - m_gfxdecode->gfx( 1 )->transpen(bitmap,cliprect, code, color, flipx, flipy, x + 8, gfxtop + 500 - y - ( row * 16 ), 0 ); + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, code, color, flipx, flipy, x + 8, gfxtop + 500 - y - (row * 16), 0); } } } - m_bgtiles->draw(screen, bitmap, cliprect, 0, 0 ); + m_bgtiles->draw(screen, bitmap, cliprect, 0, 0); return 0; } @@ -693,7 +690,6 @@ void firefox_state::firefox(machine_config &config) PHILIPS_22VP931(config, m_laserdisc, 0); m_laserdisc->set_overlay(64*8, 525, FUNC(firefox_state::screen_update_firefox)); m_laserdisc->set_overlay_clip(7*8, 53*8-1, 44, 480+44); - m_laserdisc->set_overlay_palette(m_palette); m_laserdisc->add_route(0, "lspeaker", 0.50); m_laserdisc->add_route(1, "rspeaker", 0.50); m_laserdisc->add_ntsc_screen(config, "screen"); diff --git a/src/mame/drivers/gottlieb.cpp b/src/mame/drivers/gottlieb.cpp index ba5f2b9f230..25c0bdb61d5 100644 --- a/src/mame/drivers/gottlieb.cpp +++ b/src/mame/drivers/gottlieb.cpp @@ -1802,7 +1802,6 @@ void gottlieb_state::g2laser(machine_config &config) m_laserdisc->set_audio(FUNC(gottlieb_state::laserdisc_audio_process), this); m_laserdisc->set_overlay(GOTTLIEB_VIDEO_HCOUNT, GOTTLIEB_VIDEO_VCOUNT, FUNC(gottlieb_state::screen_update)); m_laserdisc->set_overlay_clip(0, GOTTLIEB_VIDEO_HBLANK-1, 0, GOTTLIEB_VIDEO_VBLANK-8); - m_laserdisc->set_overlay_palette("palette"); m_laserdisc->add_route(0, "speaker", 1.0); m_laserdisc->set_screen(m_screen); /* right channel is processed as data */ @@ -1868,7 +1867,6 @@ void gottlieb_state::cobram3(machine_config &config) m_laserdisc->set_audio(FUNC(gottlieb_state::laserdisc_audio_process), this); m_laserdisc->set_overlay(GOTTLIEB_VIDEO_HCOUNT, GOTTLIEB_VIDEO_VCOUNT, FUNC(gottlieb_state::screen_update)); m_laserdisc->set_overlay_clip(0, GOTTLIEB_VIDEO_HBLANK-1, 0, GOTTLIEB_VIDEO_VBLANK-8); - m_laserdisc->set_overlay_palette("palette"); m_laserdisc->add_route(0, "speaker", 1.0); m_laserdisc->set_screen(m_screen); /* right channel is processed as data */ diff --git a/src/mame/drivers/gpworld.cpp b/src/mame/drivers/gpworld.cpp index 90147b8dcdf..df0edef9ad1 100644 --- a/src/mame/drivers/gpworld.cpp +++ b/src/mame/drivers/gpworld.cpp @@ -508,7 +508,6 @@ void gpworld_state::gpworld(machine_config &config) PIONEER_LDV1000(config, m_laserdisc, 0); m_laserdisc->set_overlay(512, 256, FUNC(gpworld_state::screen_update)); - m_laserdisc->set_overlay_palette(m_palette); m_laserdisc->add_route(0, "lspeaker", 1.0); m_laserdisc->add_route(1, "rspeaker", 1.0); diff --git a/src/mame/drivers/istellar.cpp b/src/mame/drivers/istellar.cpp index f31809d82d2..a9d4bd4166d 100644 --- a/src/mame/drivers/istellar.cpp +++ b/src/mame/drivers/istellar.cpp @@ -77,24 +77,21 @@ private: /* VIDEO GOODS */ uint32_t istellar_state::screen_update_istellar(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - /* clear */ bitmap.fill(0, cliprect); /* Draw tiles */ - for (y = 0; y < 32; y++) + for (int y = 0; y < 32; y++) { - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { - int tile = m_tile_ram[x+y*32]; - int attr = m_tile_control_ram[x+y*32]; + int tile = m_tile_ram[x + y * 32]; + int attr = m_tile_control_ram[x + y * 32]; - m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,tile,attr & 0x0f,0, 0, x*8, y*8, 0); + m_gfxdecode->gfx(0)->transpen(bitmap, cliprect, tile, attr & 0x0f, 0, 0, x * 8, y * 8, 0); } } - /* Draw sprites */ return 0; @@ -298,7 +295,6 @@ void istellar_state::istellar(machine_config &config) PIONEER_LDV1000(config, m_laserdisc, 0); m_laserdisc->set_overlay(256, 256, FUNC(istellar_state::screen_update_istellar)); - m_laserdisc->set_overlay_palette(m_palette); m_laserdisc->add_route(0, "lspeaker", 1.0); m_laserdisc->add_route(1, "rspeaker", 1.0); diff --git a/src/mame/drivers/konblands.cpp b/src/mame/drivers/konblands.cpp index 6078b275cb5..b7ad79ff59b 100644 --- a/src/mame/drivers/konblands.cpp +++ b/src/mame/drivers/konblands.cpp @@ -45,7 +45,7 @@ public: private: // screen updates - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void konblands_palette(palette_device &palette) const; DECLARE_READ8_MEMBER(ldp_r); DECLARE_WRITE8_MEMBER(ldp_w); @@ -102,19 +102,18 @@ void konblands_state::video_start() { } -uint32_t konblands_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) +uint32_t konblands_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { gfx_element *gfx = m_gfxdecode->gfx(0); - int y,x; int count = 0; - for (y=0;y<32;y++) + for (int y = 0; y < 32; y++) { - for (x=0;x<64;x++) + for (int x = 0; x < 64; x++) { uint8_t tile = m_vram[count]; - gfx->opaque(bitmap,cliprect,tile,0,0,0,x*8,y*8); + gfx->opaque(bitmap, cliprect, tile, 0, 0, 0, x * 8, y * 8); count++; } @@ -289,7 +288,6 @@ void konblands_state::konblands(machine_config &config) m_laserdisc->command_strobe_callback().set(FUNC(konblands_state::ld_command_strobe_cb)); // TODO: might be different m_laserdisc->set_overlay(512, 256, FUNC(konblands_state::screen_update)); - m_laserdisc->set_overlay_palette("palette"); /* video hardware */ m_laserdisc->add_ntsc_screen(config, "screen"); diff --git a/src/mame/drivers/lgp.cpp b/src/mame/drivers/lgp.cpp index f2f4fc4d76d..76b21aa9428 100644 --- a/src/mame/drivers/lgp.cpp +++ b/src/mame/drivers/lgp.cpp @@ -124,8 +124,6 @@ private: /* VIDEO GOODS */ uint32_t lgp_state::screen_update_lgp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int charx, chary; - /* make color 0 transparent */ m_palette->set_pen_color(0, rgb_t(0,0,0,0)); @@ -133,18 +131,18 @@ uint32_t lgp_state::screen_update_lgp(screen_device &screen, bitmap_rgb32 &bitma bitmap.fill(0, cliprect); /* Draw tiles */ - for (charx = 0; charx < 32; charx++) + for (int charx = 0; charx < 32; charx++) { - for (chary = 0; chary < 32; chary++) + for (int chary = 0; chary < 32; chary++) { - int current_screen_character = (chary*32) + charx; + int current_screen_character = (chary * 32) + charx; /* Somewhere there's a flag that offsets the tilemap by 0x100*x */ /* Palette is likely set somewhere as well (tile_control_ram?) */ - m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, + m_gfxdecode->gfx(0)->transpen(bitmap, cliprect, m_tile_ram[current_screen_character], 0, - 0, 0, charx*8, chary*8, 0); + 0, 0, charx * 8, chary * 8, 0); } } @@ -426,7 +424,6 @@ void lgp_state::lgp(machine_config &config) PIONEER_LDV1000(config, m_laserdisc, 0); m_laserdisc->command_strobe_callback().set(FUNC(lgp_state::ld_command_strobe_cb)); m_laserdisc->set_overlay(256, 256, FUNC(lgp_state::screen_update_lgp)); - m_laserdisc->set_overlay_palette(m_palette); m_laserdisc->add_route(0, "lspeaker", 1.0); m_laserdisc->add_route(1, "rspeaker", 1.0); diff --git a/src/mame/drivers/segald.cpp b/src/mame/drivers/segald.cpp index 8f5f3de8a64..24d4ca2866c 100644 --- a/src/mame/drivers/segald.cpp +++ b/src/mame/drivers/segald.cpp @@ -82,15 +82,13 @@ private: /* VIDEO GOODS */ void segald_state::astron_draw_characters(bitmap_rgb32 &bitmap,const rectangle &cliprect) { - uint8_t characterX, characterY; - - for (characterX = 0; characterX < 32; characterX++) + for (uint8_t character_x = 0; character_x < 32; character_x++) { - for (characterY = 0; characterY < 32; characterY++) + for (uint8_t character_y = 0; character_y < 32; character_y++) { - int current_screen_character = (characterY*32) + characterX; - m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, m_fix_ram[current_screen_character], - 1, 0, 0, characterX*8, characterY*8, 0); + int current_screen_character = (character_y * 32) + character_x; + m_gfxdecode->gfx(0)->transpen(bitmap, cliprect, m_fix_ram[current_screen_character], + 1, 0, 0, character_x * 8, character_y * 8, 0); } } } @@ -107,15 +105,11 @@ void segald_state::astron_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cl /* const uint8_t SPR_GFXOFS_LO = 6;*/ /* const uint8_t SPR_GFXOFS_HI = 7;*/ - int sx,sy; - int spr_number; - int spr_base; - - for (spr_number = 0; spr_number < 32; spr_number++) + for (int spr_number = 0; spr_number < 32; spr_number++) { - spr_base = 0x10 * spr_number; - sy = m_obj_ram[spr_base + SPR_Y_TOP]; - sx = m_obj_ram[spr_base + SPR_X_LO]; + int spr_base = 0x10 * spr_number; + int sy = m_obj_ram[spr_base + SPR_Y_TOP]; + int sx = m_obj_ram[spr_base + SPR_X_LO]; if (sx != 0 || sy != 0) logerror("Hey! A sprite's not at 0,0 : %d %d", sx, sy); @@ -387,7 +381,6 @@ void segald_state::astron(machine_config &config) PIONEER_LDV1000(config, m_laserdisc, 0); m_laserdisc->set_overlay(256, 256, FUNC(segald_state::screen_update_astron)); - m_laserdisc->set_overlay_palette(m_palette); m_laserdisc->add_route(0, "lspeaker", 1.0); m_laserdisc->add_route(1, "rspeaker", 1.0); diff --git a/src/mame/drivers/superdq.cpp b/src/mame/drivers/superdq.cpp index 3cc3a1267bf..5bc30815604 100644 --- a/src/mame/drivers/superdq.cpp +++ b/src/mame/drivers/superdq.cpp @@ -346,7 +346,6 @@ void superdq_state::superdq(machine_config &config) PIONEER_LDV1000(config, m_laserdisc, 0); m_laserdisc->set_overlay(256, 256, FUNC(superdq_state::screen_update_superdq)); - m_laserdisc->set_overlay_palette(m_palette); m_laserdisc->add_route(0, "lspeaker", 1.0); m_laserdisc->add_route(1, "rspeaker", 1.0); diff --git a/src/osd/modules/render/bgfx/shaders/chains/lottes/fs.sc b/src/osd/modules/render/bgfx/shaders/chains/lottes/fs.sc new file mode 100644 index 00000000000..d7cb93c9124 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/lottes/fs.sc @@ -0,0 +1,236 @@ +// +// PUBLIC DOMAIN CRT STYLED SCAN-LINE SHADER +// +// by Timothy Lottes +// +// This is more along the style of a really good CGA arcade monitor. +// With RGB inputs instead of NTSC. +// The shadow mask example has the mask rotated 90 degrees for less chromatic aberration. +// +// Left it unoptimized to show the theory behind the algorithm. +// +// It is an example what I personally would want as a display option for pixel art games. +// Please take and use, change, or whatever. + +//Comment these out to disable the corresponding effect. +//#define VERTICAL //rotates shadow mask effect to fix vertical games on landscape monitors +//#define CURVATURE //Screen curvature effect. +#define YUV //Tint and Saturation adjustments. You adjust the settings in Lottes_CRT.vsh now... +#define GAMMA_CONTRAST_BOOST //Expands contrast and makes image brighter but causes clipping. +#define BLOOM //enables a bloom effect +//#define MASK_APERTURE_GRILL //Only uncomment one of the MASK patterns at a time... +#define MASK_TV +//#define MASK_VGA +//#define ORIGINAL_SCANLINES //Enable to use the original scanlines. +//#define ORIGINAL_HARDPIX //Enable to use the original hardPix calculation. + +//Normal MAME GLSL Uniforms +uniform sampler2D color_texture; +uniform vec2 color_texture_sz; // size of color_texture +uniform vec2 color_texture_pow2_sz; // size of color texture rounded up to power of 2 +uniform vec2 screen_texture_sz; // size of output resolution +uniform vec2 screen_texture_pow2_sz; // size of output resolution rounded up to power of 2 + +//CRT Filter Variables +const float hardScan=-20.0; //-8,-12,-16, etc to make scalines more prominent. +const vec2 warp=vec2(1.0/64.0,1.0/48.0); //adjusts the warp filter (curvature). +const float maskDark=0.4; //Sets how dark a "dark subpixel" is in the aperture pattern. +const float maskLight=1.5; //Sets how dark a "bright subpixel" is in the aperture pattern. +const float hardPix=-6.0; //-1,-2,-4, etc to make the upscaling sharper. +const float hardBloomScan=-2.5; +const float hardBloomPix=-1.75; +const float bloomAmount=1.0/12.0; //Lower this if there is too much bloom! +const float blackClip = 0.02; +const float brightMult = 1.2; +const float maskStrength = 0.6; //This sets the strength of the shadow mask effect +const vec3 gammaBoost = vec3(1.0/1.15, 1.0/1.15, 1.0/1.15); +varying vec3 YUVr; +varying vec3 YUVg; +varying vec3 YUVb; + +//CRT Filter Functions + +// sRGB to Linear. +// Assuing using sRGB typed textures this should not be needed. +float ToLinear1(float c){return(c<=0.04045)?c/12.92:pow((c+0.055)/1.055,2.4);} +vec3 ToLinear(vec3 c){return vec3(ToLinear1(c.r),ToLinear1(c.g),ToLinear1(c.b));} + +// Linear to sRGB. +// Assuing using sRGB typed textures this should not be needed. +float ToSrgb1(float c){return(c<0.0031308?c*12.92:1.055*pow(c,0.41666)-0.055);} +vec3 ToSrgb(vec3 c){return vec3(ToSrgb1(c.r),ToSrgb1(c.g),ToSrgb1(c.b));} + +// Nearest emulated sample given floating point position and texel offset. +// Also zero's off screen. +vec3 Fetch(vec2 pos,vec2 off){ + pos=(floor(pos*color_texture_pow2_sz+off)+0.5)/color_texture_pow2_sz; + //if(max(abs(pos.x-0.5),abs(pos.y-0.5))>0.5)return vec3(0.0,0.0,0.0); + return ToLinear(texture2D(color_texture,pos.xy).rgb);} + +// Distance in emulated pixels to nearest texel. +vec2 Dist(vec2 pos){pos=pos*color_texture_pow2_sz;return -((pos-floor(pos))-vec2(0.5));} + +// 1D Gaussian. +float Gaus(float pos,float scale){return exp2(scale*pos*pos);} + +// 3-tap Gaussian filter along horz line. +vec3 Horz3(vec2 pos,float off){ + vec3 b=Fetch(pos,vec2(-1.0,off)); + vec3 c=Fetch(pos,vec2( 0.0,off)); + vec3 d=Fetch(pos,vec2( 1.0,off)); + float dst=Dist(pos).x; + // Convert distance to weight. +#ifdef ORIGINAL_HARDPIX + float scale=hardPix; +#else + float scale=hardPix * max(0.2, 1.5-color_texture_sz.x/512.0); +#endif + float wb=Gaus(dst-1.0,scale); + float wc=Gaus(dst+0.0,scale); + float wd=Gaus(dst+1.0,scale); + // Return filtered sample. + return (b*wb+c*wc+d*wd)/(wb+wc+wd);} + +// 5-tap Gaussian filter along horz line. +vec3 Horz5(vec2 pos,float off){ + vec3 a=Fetch(pos,vec2(-2.0,off)); + vec3 b=Fetch(pos,vec2(-1.0,off)); + vec3 c=Fetch(pos,vec2( 0.0,off)); + vec3 d=Fetch(pos,vec2( 1.0,off)); + vec3 e=Fetch(pos,vec2( 2.0,off)); + float dst=Dist(pos).x; + // Convert distance to weight. +#ifdef ORIGINAL_HARDPIX + float scale=hardPix; +#else + float scale=hardPix * max(0.2, 1.5-color_texture_sz.x/512.0); +#endif + float wa=Gaus(dst-2.0,scale); + float wb=Gaus(dst-1.0,scale); + float wc=Gaus(dst+0.0,scale); + float wd=Gaus(dst+1.0,scale); + float we=Gaus(dst+2.0,scale); + // Return filtered sample. + return (a*wa+b*wb+c*wc+d*wd+e*we)/(wa+wb+wc+wd+we);} + +vec3 Horz7(vec2 pos,float off){ + vec3 a=Fetch(pos,vec2(-3.0,off)); + vec3 b=Fetch(pos,vec2(-2.0,off)); + vec3 c=Fetch(pos,vec2(-1.0,off)); + vec3 d=Fetch(pos,vec2( 0.0,off)); + vec3 e=Fetch(pos,vec2( 1.0,off)); + vec3 f=Fetch(pos,vec2( 2.0,off)); + vec3 g=Fetch(pos,vec2( 3.0,off)); + float dst=Dist(pos).x; + // Convert distance to weight. + float scale=hardBloomPix* max(0.5, 1.5-color_texture_sz.x/512.0); + float wa=Gaus(dst-3.0,scale); + float wb=Gaus(dst-2.0,scale); + float wc=Gaus(dst-1.0,scale); + float wd=Gaus(dst+0.0,scale); + float we=Gaus(dst+1.0,scale); + float wf=Gaus(dst+2.0,scale); + float wg=Gaus(dst+3.0,scale); + // Return filtered sample. + return (a*wa+b*wb+c*wc+d*wd+e*we+f*wf+g*wg)/(wa+wb+wc+wd+we+wf+wg);} + +// Return scanline weight. +float Scan(vec2 pos,float off){ + float dst=Dist(pos).y; +#ifdef ORIGINAL_SCANLINES + return Gaus(dst+off,hardScan);} +#else + vec3 col=Fetch(pos,vec2(0.0)); + return Gaus(dst+off,hardScan/(dot(col,col)*0.25+1.0));} //Modified to make scanline respond to pixel brightness +#endif + +// Return scanline weight for bloom. +float BloomScan(vec2 pos,float off){ + float dst=Dist(pos).y; + return Gaus(dst+off,hardBloomScan);} + +// Allow nearest three lines to effect pixel. +vec3 Tri(vec2 pos){ + vec3 a=Horz3(pos,-1.0); + vec3 b=Horz5(pos, 0.0); + vec3 c=Horz3(pos, 1.0); + float wa=Scan(pos,-1.0); + float wb=Scan(pos, 0.0); + float wc=Scan(pos, 1.0); + return a*wa+b*wb+c*wc;} + +// Small bloom. +vec3 Bloom(vec2 pos){ + vec3 a=Horz5(pos,-2.0); + vec3 b=Horz7(pos,-1.0); + vec3 c=Horz7(pos, 0.0); + vec3 d=Horz7(pos, 1.0); + vec3 e=Horz5(pos, 2.0); + float wa=BloomScan(pos,-2.0); + float wb=BloomScan(pos,-1.0); + float wc=BloomScan(pos, 0.0); + float wd=BloomScan(pos, 1.0); + float we=BloomScan(pos, 2.0); + return a*wa+b*wb+c*wc+d*wd+e*we;} + +// Distortion of scanlines, and end of screen alpha. +vec2 Warp(vec2 pos){ + pos=pos*2.0-1.0; + pos*=vec2(1.0+(pos.y*pos.y)*warp.x,1.0+(pos.x*pos.x)*warp.y); + return pos*0.5+0.5;} + +// Shadow mask. + +vec3 Mask(vec2 pos){ +#ifdef VERTICAL +pos.xy=pos.yx; +#endif +#ifdef MASK_VGA + pos.x+=pos.y*3.0; + vec3 mask=vec3(maskDark,maskDark,maskDark); + pos.x=fract(pos.x/6.0); + if(pos.x<0.333)mask.r=maskLight; + else if(pos.x<0.666)mask.g=maskLight; + else mask.b=maskLight; +#endif +#ifdef MASK_TV + float line=maskLight; + float odd=0.0; + if(fract(pos.x/6.0)<0.5)odd=1.0; + if(fract((pos.y+odd)/2.0)<0.5)line=maskDark; + pos.x=fract(pos.x/3.0); + vec3 mask=vec3(maskDark,maskDark,maskDark); + if(pos.x<0.333)mask.r=maskLight; + else if(pos.x<0.666)mask.g=maskLight; + else mask.b=maskLight; + mask*=line; +#endif +#ifdef MASK_APERTURE_GRILL + pos.x=fract(pos.x/3.0); + vec3 mask=vec3(maskDark,maskDark,maskDark); + if(pos.x<0.333)mask.r=maskLight; + else if(pos.x<0.666)mask.g=maskLight; + else mask.b=maskLight; +#endif + return mask;} + +void main(void){ +#ifdef CURVATURE + vec2 pos=Warp(gl_TexCoord[0].xy); +#else + vec2 pos=gl_TexCoord[0].xy; +#endif + gl_FragColor.a=texture2D(color_texture,pos.xy).a; + gl_FragColor.rgb=Tri(pos)*mix(vec3(1.0),Mask(gl_FragCoord.xy),maskStrength); +#ifdef BLOOM + gl_FragColor.rgb+=Bloom(pos)*bloomAmount; +#endif +#ifdef YUV + gl_FragColor.rgb = vec3(dot(YUVr,gl_FragColor.rgb),dot(YUVg,gl_FragColor.rgb),dot(YUVb,gl_FragColor.rgb)); + gl_FragColor.rgb=clamp(gl_FragColor.rgb,0.0,1.0); +#endif +#ifdef GAMMA_CONTRAST_BOOST + gl_FragColor.rgb=brightMult*pow(gl_FragColor.rgb,gammaBoost )-vec3(blackClip); +#endif + gl_FragColor.rgb=clamp(ToSrgb(gl_FragColor.rgb),0.0,1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/lottes/fs_vert.sc b/src/osd/modules/render/bgfx/shaders/chains/lottes/fs_vert.sc new file mode 100644 index 00000000000..f8fc2450203 --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/lottes/fs_vert.sc @@ -0,0 +1,236 @@ +// +// PUBLIC DOMAIN CRT STYLED SCAN-LINE SHADER +// +// by Timothy Lottes +// +// This is more along the style of a really good CGA arcade monitor. +// With RGB inputs instead of NTSC. +// The shadow mask example has the mask rotated 90 degrees for less chromatic aberration. +// +// Left it unoptimized to show the theory behind the algorithm. +// +// It is an example what I personally would want as a display option for pixel art games. +// Please take and use, change, or whatever. + +//Comment these out to disable the corresponding effect. +#define VERTICAL //rotates shadow mask effect to fix vertical games on landscape monitors +#define CURVATURE //Screen curvature effect. +#define YUV //Tint and Saturation adjustments. You adjust the settings in Lottes_CRT.vsh now... +#define GAMMA_CONTRAST_BOOST //Expands contrast and makes image brighter but causes clipping. +#define BLOOM //enables a bloom effect +//#define MASK_APERTURE_GRILL //Only uncomment one of the MASK patterns at a time... +#define MASK_TV +//#define MASK_VGA +//#define ORIGINAL_SCANLINES //Enable to use the original scanlines. +//#define ORIGINAL_HARDPIX //Enable to use the original hardPix calculation. + +//Normal MAME GLSL Uniforms +uniform sampler2D color_texture; +uniform vec2 color_texture_sz; // size of color_texture +uniform vec2 color_texture_pow2_sz; // size of color texture rounded up to power of 2 +uniform vec2 screen_texture_sz; // size of output resolution +uniform vec2 screen_texture_pow2_sz; // size of output resolution rounded up to power of 2 + +//CRT Filter Variables +const float hardScan=-20.0; //-8,-12,-16, etc to make scalines more prominent. +const vec2 warp=vec2(1.0/64.0,1.0/48.0); //adjusts the warp filter (curvature). +const float maskDark=0.4; //Sets how dark a "dark subpixel" is in the aperture pattern. +const float maskLight=1.5; //Sets how dark a "bright subpixel" is in the aperture pattern. +const float hardPix=-5.0; //-1,-2,-4, etc to make the upscaling sharper. +const float hardBloomScan=-2.5; +const float hardBloomPix=-1.75; +const float bloomAmount=1.0/12.0; //Lower this if there is too much bloom! +const float blackClip = 0.02; +const float brightMult = 1.2; +const float maskStrength = 0.6; //This sets the strength of the shadow mask effect +const vec3 gammaBoost = vec3(1.0/1.15, 1.0/1.15, 1.0/1.15); +varying vec3 YUVr; +varying vec3 YUVg; +varying vec3 YUVb; + +//CRT Filter Functions + +// sRGB to Linear. +// Assuing using sRGB typed textures this should not be needed. +float ToLinear1(float c){return(c<=0.04045)?c/12.92:pow((c+0.055)/1.055,2.4);} +vec3 ToLinear(vec3 c){return vec3(ToLinear1(c.r),ToLinear1(c.g),ToLinear1(c.b));} + +// Linear to sRGB. +// Assuing using sRGB typed textures this should not be needed. +float ToSrgb1(float c){return(c<0.0031308?c*12.92:1.055*pow(c,0.41666)-0.055);} +vec3 ToSrgb(vec3 c){return vec3(ToSrgb1(c.r),ToSrgb1(c.g),ToSrgb1(c.b));} + +// Nearest emulated sample given floating point position and texel offset. +// Also zero's off screen. +vec3 Fetch(vec2 pos,vec2 off){ + pos=(floor(pos*color_texture_pow2_sz+off)+0.5)/color_texture_pow2_sz; + //if(max(abs(pos.x-0.5),abs(pos.y-0.5))>0.5)return vec3(0.0,0.0,0.0); + return ToLinear(texture2D(color_texture,pos.xy).rgb);} + +// Distance in emulated pixels to nearest texel. +vec2 Dist(vec2 pos){pos=pos*color_texture_pow2_sz;return -((pos-floor(pos))-vec2(0.5));} + +// 1D Gaussian. +float Gaus(float pos,float scale){return exp2(scale*pos*pos);} + +// 3-tap Gaussian filter along horz line. +vec3 Horz3(vec2 pos,float off){ + vec3 b=Fetch(pos,vec2(-1.0,off)); + vec3 c=Fetch(pos,vec2( 0.0,off)); + vec3 d=Fetch(pos,vec2( 1.0,off)); + float dst=Dist(pos).x; + // Convert distance to weight. +#ifdef ORIGINAL_HARDPIX + float scale=hardPix; +#else + float scale=hardPix * max(0.2, 1.5-color_texture_sz.x/512.0); +#endif + float wb=Gaus(dst-1.0,scale); + float wc=Gaus(dst+0.0,scale); + float wd=Gaus(dst+1.0,scale); + // Return filtered sample. + return (b*wb+c*wc+d*wd)/(wb+wc+wd);} + +// 5-tap Gaussian filter along horz line. +vec3 Horz5(vec2 pos,float off){ + vec3 a=Fetch(pos,vec2(-2.0,off)); + vec3 b=Fetch(pos,vec2(-1.0,off)); + vec3 c=Fetch(pos,vec2( 0.0,off)); + vec3 d=Fetch(pos,vec2( 1.0,off)); + vec3 e=Fetch(pos,vec2( 2.0,off)); + float dst=Dist(pos).x; + // Convert distance to weight. +#ifdef ORIGINAL_HARDPIX + float scale=hardPix; +#else + float scale=hardPix * max(0.2, 1.5-color_texture_sz.x/512.0); +#endif + float wa=Gaus(dst-2.0,scale); + float wb=Gaus(dst-1.0,scale); + float wc=Gaus(dst+0.0,scale); + float wd=Gaus(dst+1.0,scale); + float we=Gaus(dst+2.0,scale); + // Return filtered sample. + return (a*wa+b*wb+c*wc+d*wd+e*we)/(wa+wb+wc+wd+we);} + +vec3 Horz7(vec2 pos,float off){ + vec3 a=Fetch(pos,vec2(-3.0,off)); + vec3 b=Fetch(pos,vec2(-2.0,off)); + vec3 c=Fetch(pos,vec2(-1.0,off)); + vec3 d=Fetch(pos,vec2( 0.0,off)); + vec3 e=Fetch(pos,vec2( 1.0,off)); + vec3 f=Fetch(pos,vec2( 2.0,off)); + vec3 g=Fetch(pos,vec2( 3.0,off)); + float dst=Dist(pos).x; + // Convert distance to weight. + float scale=hardBloomPix* max(0.5, 1.5-color_texture_sz.x/512.0); + float wa=Gaus(dst-3.0,scale); + float wb=Gaus(dst-2.0,scale); + float wc=Gaus(dst-1.0,scale); + float wd=Gaus(dst+0.0,scale); + float we=Gaus(dst+1.0,scale); + float wf=Gaus(dst+2.0,scale); + float wg=Gaus(dst+3.0,scale); + // Return filtered sample. + return (a*wa+b*wb+c*wc+d*wd+e*we+f*wf+g*wg)/(wa+wb+wc+wd+we+wf+wg);} + +// Return scanline weight. +float Scan(vec2 pos,float off){ + float dst=Dist(pos).y; +#ifdef ORIGINAL_SCANLINES + return Gaus(dst+off,hardScan);} +#else + vec3 col=Fetch(pos,vec2(0.0)); + return Gaus(dst+off,hardScan/(dot(col,col)*0.25+1.0));} //Modified to make scanline respond to pixel brightness +#endif + +// Return scanline weight for bloom. +float BloomScan(vec2 pos,float off){ + float dst=Dist(pos).y; + return Gaus(dst+off,hardBloomScan);} + +// Allow nearest three lines to effect pixel. +vec3 Tri(vec2 pos){ + vec3 a=Horz3(pos,-1.0); + vec3 b=Horz5(pos, 0.0); + vec3 c=Horz3(pos, 1.0); + float wa=Scan(pos,-1.0); + float wb=Scan(pos, 0.0); + float wc=Scan(pos, 1.0); + return a*wa+b*wb+c*wc;} + +// Small bloom. +vec3 Bloom(vec2 pos){ + vec3 a=Horz5(pos,-2.0); + vec3 b=Horz7(pos,-1.0); + vec3 c=Horz7(pos, 0.0); + vec3 d=Horz7(pos, 1.0); + vec3 e=Horz5(pos, 2.0); + float wa=BloomScan(pos,-2.0); + float wb=BloomScan(pos,-1.0); + float wc=BloomScan(pos, 0.0); + float wd=BloomScan(pos, 1.0); + float we=BloomScan(pos, 2.0); + return a*wa+b*wb+c*wc+d*wd+e*we;} + +// Distortion of scanlines, and end of screen alpha. +vec2 Warp(vec2 pos){ + pos=pos*2.0-1.0; + pos*=vec2(1.0+(pos.y*pos.y)*warp.x,1.0+(pos.x*pos.x)*warp.y); + return pos*0.5+0.5;} + +// Shadow mask. + +vec3 Mask(vec2 pos){ +#ifdef VERTICAL +pos.xy=pos.yx; +#endif +#ifdef MASK_VGA + pos.x+=pos.y*3.0; + vec3 mask=vec3(maskDark,maskDark,maskDark); + pos.x=fract(pos.x/6.0); + if(pos.x<0.333)mask.r=maskLight; + else if(pos.x<0.666)mask.g=maskLight; + else mask.b=maskLight; +#endif +#ifdef MASK_TV + float line=maskLight; + float odd=0.0; + if(fract(pos.x/6.0)<0.5)odd=1.0; + if(fract((pos.y+odd)/2.0)<0.5)line=maskDark; + pos.x=fract(pos.x/3.0); + vec3 mask=vec3(maskDark,maskDark,maskDark); + if(pos.x<0.333)mask.r=maskLight; + else if(pos.x<0.666)mask.g=maskLight; + else mask.b=maskLight; + mask*=line; +#endif +#ifdef MASK_APERTURE_GRILL + pos.x=fract(pos.x/3.0); + vec3 mask=vec3(maskDark,maskDark,maskDark); + if(pos.x<0.333)mask.r=maskLight; + else if(pos.x<0.666)mask.g=maskLight; + else mask.b=maskLight; +#endif + return mask;} + +void main(void){ +#ifdef CURVATURE + vec2 pos=Warp(gl_TexCoord[0].xy); +#else + vec2 pos=gl_TexCoord[0].xy; +#endif + gl_FragColor.a=texture2D(color_texture,pos.xy).a; + gl_FragColor.rgb=Tri(pos)*mix(vec3(1.0),Mask(gl_FragCoord.xy),maskStrength); +#ifdef BLOOM + gl_FragColor.rgb+=Bloom(pos)*bloomAmount; +#endif +#ifdef YUV + gl_FragColor.rgb = vec3(dot(YUVr,gl_FragColor.rgb),dot(YUVg,gl_FragColor.rgb),dot(YUVb,gl_FragColor.rgb)); + gl_FragColor.rgb=clamp(gl_FragColor.rgb,0.0,1.0); +#endif +#ifdef GAMMA_CONTRAST_BOOST + gl_FragColor.rgb=brightMult*pow(gl_FragColor.rgb,gammaBoost )-vec3(blackClip); +#endif + gl_FragColor.rgb=clamp(ToSrgb(gl_FragColor.rgb),0.0,1.0); +} \ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shaders/chains/lottes/varying.def.sc b/src/osd/modules/render/bgfx/shaders/chains/lottes/varying.def.sc new file mode 100644 index 00000000000..53fe40d0b8a --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/lottes/varying.def.sc @@ -0,0 +1,9 @@ +vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0); +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec2 v_texcoord1 : TEXCOORD1 = vec2(0.0, 0.0); +vec2 v_texcoord2 : TEXCOORD2 = vec2(0.0, 0.0); +vec2 v_texcoord3 : TEXCOORD3 = vec2(0.0, 0.0); + +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +vec2 a_texcoord0 : TEXCOORD0; diff --git a/src/osd/modules/render/bgfx/shaders/chains/lottes/vs.sc b/src/osd/modules/render/bgfx/shaders/chains/lottes/vs.sc new file mode 100644 index 00000000000..21e0eeb35ac --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/lottes/vs.sc @@ -0,0 +1,26 @@ +varying float saturation; +varying float tint; +varying float U; //U and W are for the tint/saturation calculations +varying float W; +varying vec3 YUVr; +varying vec3 YUVg; +varying vec3 YUVb; +#define PI 3.141592653589 + +void main() +{ + //gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_Position = ftransform(); + + //Had to move the YUV calculations to the vertex shader for space + saturation = 1.1; // 1.0 is normal saturation. Increase as needed. + tint = 0.0; //0.0 is 0.0 degrees of Tint. Adjust as needed. + U = cos(tint*PI/180.0); + W = sin(tint*PI/180.0); + YUVr=vec3(0.701*saturation*U+0.16774*saturation*W+0.299,0.587-0.32931*saturation*W-0.587*saturation*U,-0.497*saturation*W-0.114*saturation*U+0.114); + YUVg=vec3(-0.3281*saturation*W-0.299*saturation*U+0.299,0.413*saturation*U+0.03547*saturation*W+0.587,0.114+0.29265*saturation*W-0.114*saturation*U); + YUVb=vec3(0.299+1.24955*saturation*W-0.299*saturation*U,-1.04634*saturation*W-0.587*saturation*U+0.587,0.886*saturation*U-0.20321*saturation*W+0.114); +} + + diff --git a/src/osd/modules/render/bgfx/shaders/chains/lottes/vs_vert.sc b/src/osd/modules/render/bgfx/shaders/chains/lottes/vs_vert.sc new file mode 100644 index 00000000000..21e0eeb35ac --- /dev/null +++ b/src/osd/modules/render/bgfx/shaders/chains/lottes/vs_vert.sc @@ -0,0 +1,26 @@ +varying float saturation; +varying float tint; +varying float U; //U and W are for the tint/saturation calculations +varying float W; +varying vec3 YUVr; +varying vec3 YUVg; +varying vec3 YUVb; +#define PI 3.141592653589 + +void main() +{ + //gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_Position = ftransform(); + + //Had to move the YUV calculations to the vertex shader for space + saturation = 1.1; // 1.0 is normal saturation. Increase as needed. + tint = 0.0; //0.0 is 0.0 degrees of Tint. Adjust as needed. + U = cos(tint*PI/180.0); + W = sin(tint*PI/180.0); + YUVr=vec3(0.701*saturation*U+0.16774*saturation*W+0.299,0.587-0.32931*saturation*W-0.587*saturation*U,-0.497*saturation*W-0.114*saturation*U+0.114); + YUVg=vec3(-0.3281*saturation*W-0.299*saturation*U+0.299,0.413*saturation*U+0.03547*saturation*W+0.587,0.114+0.29265*saturation*W-0.114*saturation*U); + YUVb=vec3(0.299+1.24955*saturation*W-0.299*saturation*U,-1.04634*saturation*W-0.587*saturation*U+0.587,0.886*saturation*U-0.20321*saturation*W+0.114); +} + + diff --git a/src/osd/modules/render/bgfxutil.cpp b/src/osd/modules/render/bgfxutil.cpp index cbf2428d61f..5ba76cbd2a1 100644 --- a/src/osd/modules/render/bgfxutil.cpp +++ b/src/osd/modules/render/bgfxutil.cpp @@ -31,9 +31,6 @@ const bgfx::Memory* bgfx_util::mame_texture_data_to_bgfx_texture_data(uint32_t f case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16): copy_util::copyline_palette16(dst_line, src_line16, width, palette); break; - case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTEA16): - copy_util::copyline_palettea16(dst_line, src_line16, width, palette); - break; case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16): copy_util::copyline_yuy16_to_argb(dst_line, src_line16, width, palette, 1); break; diff --git a/src/osd/modules/render/copyutil.h b/src/osd/modules/render/copyutil.h index 81a880555cd..715fcba0dca 100644 --- a/src/osd/modules/render/copyutil.h +++ b/src/osd/modules/render/copyutil.h @@ -24,15 +24,6 @@ public: } } - static inline void copyline_palettea16(uint32_t *dst, const uint16_t *src, int width, const rgb_t *palette) - { - for (int x = 0; x < width; x++) - { - rgb_t srcpixel = palette[*src++]; - *dst++ = (srcpixel.a() << 24) | (srcpixel.b() << 16) | (srcpixel.g() << 8) | srcpixel.r(); - } - } - static inline void copyline_rgb32(uint32_t *dst, const uint32_t *src, int width, const rgb_t *palette) { int x; diff --git a/src/osd/modules/render/d3d/d3dcomm.h b/src/osd/modules/render/d3d/d3dcomm.h index 95dcac48ca7..d576c5e7d0c 100644 --- a/src/osd/modules/render/d3d/d3dcomm.h +++ b/src/osd/modules/render/d3d/d3dcomm.h @@ -144,7 +144,6 @@ private: void compute_size_subroutine(int texwidth, int texheight, int* p_width, int* p_height); inline void copyline_palette16(uint32_t *dst, const uint16_t *src, int width, const rgb_t *palette, int xborderpix); - inline void copyline_palettea16(uint32_t *dst, const uint16_t *src, int width, const rgb_t *palette, int xborderpix); inline void copyline_rgb32(uint32_t *dst, const uint32_t *src, int width, const rgb_t *palette, int xborderpix); inline void copyline_argb32(uint32_t *dst, const uint32_t *src, int width, const rgb_t *palette, int xborderpix); inline void copyline_yuy16_to_yuy2(uint16_t *dst, const uint16_t *src, int width, const rgb_t *palette); diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp index 9282c35e9b4..f99ebf70601 100644 --- a/src/osd/modules/render/draw13.cpp +++ b/src/osd/modules/render/draw13.cpp @@ -705,9 +705,6 @@ texture_info::texture_info(renderer_sdl2 *renderer, const render_texinfo &texsou case TEXFORMAT_PALETTE16: m_format = SDL_TEXFORMAT_PALETTE16; break; - case TEXFORMAT_PALETTEA16: - m_format = SDL_TEXFORMAT_PALETTE16A; - break; case TEXFORMAT_YUY16: m_format = texsource.palette ? SDL_TEXFORMAT_YUY16_PALETTED : SDL_TEXFORMAT_YUY16; break; diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp index dceac6ef412..fd1331c47eb 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -2011,7 +2011,7 @@ texture_info::texture_info(d3d_texture_manager *manager, const render_texinfo* t { format = m_texture_manager->get_yuv_format(); } - else if (PRIMFLAG_GET_TEXFORMAT(flags) == TEXFORMAT_ARGB32 || PRIMFLAG_GET_TEXFORMAT(flags) == TEXFORMAT_PALETTEA16) + else if (PRIMFLAG_GET_TEXFORMAT(flags) == TEXFORMAT_ARGB32) { format = D3DFMT_A8R8G8B8; } @@ -2229,21 +2229,6 @@ inline void texture_info::copyline_palette16(uint32_t *dst, const uint16_t *src, } -//============================================================ -// copyline_palettea16 -//============================================================ - -inline void texture_info::copyline_palettea16(uint32_t *dst, const uint16_t *src, int width, const rgb_t *palette, int xborderpix) -{ - if (xborderpix) - *dst++ = palette[*src]; - for (int x = 0; x < width; x++) - *dst++ = palette[*src++]; - if (xborderpix) - *dst++ = palette[*--src]; -} - - //============================================================ // copyline_rgb32 //============================================================ @@ -2457,10 +2442,6 @@ void texture_info::set_data(const render_texinfo *texsource, uint32_t flags) copyline_palette16((uint32_t *)dst, (uint16_t *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, m_xborderpix); break; - case TEXFORMAT_PALETTEA16: - copyline_palettea16((uint32_t *)dst, (uint16_t *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, m_xborderpix); - break; - case TEXFORMAT_RGB32: copyline_rgb32((uint32_t *)dst, (uint32_t *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, m_xborderpix); break; diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index 95345878cfd..6c1cb405316 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -1908,9 +1908,6 @@ ogl_texture_info *renderer_ogl::texture_create(const render_texinfo *texsource, case TEXFORMAT_PALETTE16: texture->format = SDL_TEXFORMAT_PALETTE16; break; - case TEXFORMAT_PALETTEA16: - texture->format = SDL_TEXFORMAT_PALETTE16A; - break; case TEXFORMAT_YUY16: if (texsource->palette != nullptr) texture->format = SDL_TEXFORMAT_YUY16_PALETTED; @@ -2066,30 +2063,6 @@ static inline void copyline_palette16(uint32_t *dst, const uint16_t *src, int wi -//============================================================ -// copyline_palettea16 -//============================================================ - -static inline void copyline_palettea16(uint32_t *dst, const uint16_t *src, int width, const rgb_t *palette, int xborderpix, int xprescale) -{ - int x; - - assert(xborderpix == 0 || xborderpix == 1); - if (xborderpix) - *dst++ = palette[*src]; - for (x = 0; x < width; x++) - { - int srcpix = *src++; - uint32_t dstval = palette[srcpix]; - for (int x2 = 0; x2 < xprescale; x2++) - *dst++ = dstval; - } - if (xborderpix) - *dst++ = palette[*--src]; -} - - - //============================================================ // copyline_rgb32 //============================================================ @@ -2359,10 +2332,6 @@ static void texture_set_data(ogl_texture_info *texture, const render_texinfo *te copyline_palette16((uint32_t *)dst, (uint16_t *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale); break; - case TEXFORMAT_PALETTEA16: - copyline_palettea16((uint32_t *)dst, (uint16_t *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale); - break; - case TEXFORMAT_RGB32: copyline_rgb32((uint32_t *)dst, (uint32_t *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale); break; -- cgit v1.2.3