diff options
Diffstat (limited to 'src/osd/modules/render/bgfxutil.cpp')
-rw-r--r-- | src/osd/modules/render/bgfxutil.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/osd/modules/render/bgfxutil.cpp b/src/osd/modules/render/bgfxutil.cpp index 9d2bef27901..f0d01e4fa86 100644 --- a/src/osd/modules/render/bgfxutil.cpp +++ b/src/osd/modules/render/bgfxutil.cpp @@ -14,29 +14,29 @@ #include "render.h" -const bgfx::Memory* bgfx_util::mame_texture_data_to_bgfx_texture_data(bgfx::TextureFormat::Enum &dst_format, uint32_t src_format, int rowpixels, int height, const rgb_t *palette, void *base, uint16_t *out_pitch) +const bgfx::Memory* bgfx_util::mame_texture_data_to_bgfx_texture_data(bgfx::TextureFormat::Enum &dst_format, uint32_t src_format, int rowpixels, int height, const rgb_t *palette, void *base, uint16_t &out_pitch, int &convert_stride) { bgfx::TextureInfo info; switch (src_format) { case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16): case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16): - dst_format = bgfx::TextureFormat::RG8; - if (out_pitch) - *out_pitch = rowpixels * 2; + dst_format = bgfx::TextureFormat::BGRA8; + convert_stride = 2; + out_pitch = rowpixels * 2; break; case PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32): case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32): dst_format = bgfx::TextureFormat::BGRA8; - if (out_pitch) - *out_pitch = rowpixels * 4; + convert_stride = 1; + out_pitch = rowpixels * 4; break; } - bgfx::calcTextureSize(info, rowpixels, height, 1, false, false, 1, dst_format); + bgfx::calcTextureSize(info, rowpixels / convert_stride, height, 1, false, false, 1, dst_format); return bgfx::copy(base, info.storageSize); } -const bgfx::Memory* bgfx_util::mame_texture_data_to_argb32(uint32_t src_format, int width, int height, int rowpixels, const rgb_t *palette, void *base) +const bgfx::Memory* bgfx_util::mame_texture_data_to_bgra32(uint32_t src_format, int width, int height, int rowpixels, const rgb_t *palette, void *base) { const bgfx::Memory* mem = bgfx::alloc(rowpixels * height * 4); auto* dst = reinterpret_cast<uint32_t*>(mem->data); @@ -48,19 +48,19 @@ const bgfx::Memory* bgfx_util::mame_texture_data_to_argb32(uint32_t src_format, switch (src_format) { case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16): - copy_util::copyline_palette16(dst, src16, width, palette); + copy_util::copyline_palette16_to_bgra(dst, src16, width, palette); src16 += rowpixels; break; case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16): - copy_util::copyline_yuy16_to_argb(dst, src16, width, palette, 1); + copy_util::copyline_yuy16_to_bgra(dst, src16, width, palette, 1); src16 += rowpixels; break; case PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32): - copy_util::copyline_argb32(dst, src32, width, palette); + copy_util::copyline_argb32_to_bgra(dst, src32, width, palette); src32 += rowpixels; break; case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32): - copy_util::copyline_rgb32(dst, src32, width, palette); + copy_util::copyline_rgb32_to_bgra(dst, src32, width, palette); src32 += rowpixels; break; default: |