diff options
Diffstat (limited to 'src/osd/modules/render/bgfx/texture.cpp')
-rw-r--r-- | src/osd/modules/render/bgfx/texture.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/osd/modules/render/bgfx/texture.cpp b/src/osd/modules/render/bgfx/texture.cpp index 85f1d3645fb..34efd738679 100644 --- a/src/osd/modules/render/bgfx/texture.cpp +++ b/src/osd/modules/render/bgfx/texture.cpp @@ -15,6 +15,8 @@ bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, u , m_format(format) , m_width(width) , m_height(height) + , m_rowpixels(width) + , m_convert_stride(1) { bgfx::TextureInfo info; bgfx::calcTextureSize(info, width, height, 1, false, false, 1, format); @@ -32,17 +34,18 @@ bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, u } } -bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, const bgfx::Memory* data, uint32_t flags, uint16_t pitch, uint16_t rowpixels) +bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, const bgfx::Memory* data, uint32_t flags, uint16_t pitch, uint16_t rowpixels, int convert_stride) : m_name(name) , m_format(format) , m_width(width) , m_height(height) , m_rowpixels(rowpixels ? rowpixels : width) + , m_convert_stride(convert_stride) { bgfx::TextureInfo info; - bgfx::calcTextureSize(info, m_rowpixels, height, 1, false, false, 1, format); - m_texture = bgfx::createTexture2D(m_rowpixels, height, false, 1, format, flags, nullptr); - bgfx::updateTexture2D(m_texture, 0, 0, 0, 0, m_rowpixels, height, data, pitch); + bgfx::calcTextureSize(info, m_rowpixels / m_convert_stride, height, 1, false, false, 1, format); + m_texture = bgfx::createTexture2D(m_rowpixels / m_convert_stride, height, false, 1, format, flags, nullptr); + bgfx::updateTexture2D(m_texture, 0, 0, 0, 0, m_rowpixels / m_convert_stride, height, data, pitch); } bgfx_texture::~bgfx_texture() @@ -52,5 +55,5 @@ bgfx_texture::~bgfx_texture() void bgfx_texture::update(const bgfx::Memory *data, uint16_t pitch) { - bgfx::updateTexture2D(m_texture, 0, 0, 0, 0, m_width, m_height, data, pitch); + bgfx::updateTexture2D(m_texture, 0, 0, 0, 0, m_rowpixels / m_convert_stride, m_height, data, pitch); } |