summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/bgfxutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/render/bgfxutil.cpp')
-rw-r--r--src/osd/modules/render/bgfxutil.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/osd/modules/render/bgfxutil.cpp b/src/osd/modules/render/bgfxutil.cpp
index f0d01e4fa86..88d2fbf399a 100644
--- a/src/osd/modules/render/bgfxutil.cpp
+++ b/src/osd/modules/render/bgfxutil.cpp
@@ -17,23 +17,50 @@
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;
+ const bgfx::Memory *data = nullptr;
+
switch (src_format)
{
- case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16):
case PRIMFLAG_TEXFORMAT(TEXFORMAT_YUY16):
dst_format = bgfx::TextureFormat::BGRA8;
convert_stride = 2;
out_pitch = rowpixels * 2;
+ bgfx::calcTextureSize(info, rowpixels / convert_stride, height, 1, false, false, 1, dst_format);
+
+ data = bgfx::copy(base, info.storageSize);
+ break;
+ case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16):
+ {
+ dst_format = bgfx::TextureFormat::BGRA8;
+ convert_stride = 1;
+ out_pitch = rowpixels * 4;
+ bgfx::calcTextureSize(info, rowpixels / convert_stride, height, 1, false, false, 1, dst_format);
+
+ uint16_t *src = (uint16_t *)base;
+ uint16_t *dst_data = new uint16_t[rowpixels * 2 * height];
+ uint16_t *dst = dst_data;
+ for (int i = 0; i < rowpixels * height; i++, src++)
+ {
+ *dst++ = *src;
+ *dst++ = 0;
+ }
+
+ data = bgfx::copy(dst_data, info.storageSize);
+ delete [] dst_data;
break;
+ }
case PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32):
case PRIMFLAG_TEXFORMAT(TEXFORMAT_RGB32):
dst_format = bgfx::TextureFormat::BGRA8;
convert_stride = 1;
out_pitch = rowpixels * 4;
+ bgfx::calcTextureSize(info, rowpixels / convert_stride, height, 1, false, false, 1, dst_format);
+
+ data = bgfx::copy(base, info.storageSize);
break;
}
- bgfx::calcTextureSize(info, rowpixels / convert_stride, height, 1, false, false, 1, dst_format);
- return bgfx::copy(base, info.storageSize);
+
+ return data;
}
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)