summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/bgfx/texture.cpp
diff options
context:
space:
mode:
author MooglyGuy <therealmogminer@gmail.com>2019-10-13 20:55:11 +0200
committer MooglyGuy <therealmogminer@gmail.com>2019-10-13 20:59:35 +0200
commit61b2a8afaf012e28ef14ad946ee0bb8319232aa6 (patch)
tree0aaf403f6258de9adbbeacaac92206fdf1c7aa27 /src/osd/modules/render/bgfx/texture.cpp
parentcd6b9ac9beb76e640f39227555ad6907a36d38f9 (diff)
-bgfx: Do texture format conversion via a full-screen GPU pass. [Ryan Holtz]
Diffstat (limited to 'src/osd/modules/render/bgfx/texture.cpp')
-rw-r--r--src/osd/modules/render/bgfx/texture.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/osd/modules/render/bgfx/texture.cpp b/src/osd/modules/render/bgfx/texture.cpp
index ecbf51121ab..7b6747e0c54 100644
--- a/src/osd/modules/render/bgfx/texture.cpp
+++ b/src/osd/modules/render/bgfx/texture.cpp
@@ -32,7 +32,7 @@ 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)
+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)
: m_name(name)
, m_format(format)
, m_width(width)
@@ -40,10 +40,16 @@ bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, u
{
bgfx::TextureInfo info;
bgfx::calcTextureSize(info, width, height, 1, false, false, 1, format);
- m_texture = bgfx::createTexture2D(width, height, false, 1, format, flags, data);
+ m_texture = bgfx::createTexture2D(width, height, false, 1, format, flags, nullptr);
+ bgfx::updateTexture2D(m_texture, 0, 0, 0, 0, width, height, data, pitch);
}
bgfx_texture::~bgfx_texture()
{
bgfx::destroy(m_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);
+}