summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/bgfx/uniform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/render/bgfx/uniform.cpp')
-rw-r--r--src/osd/modules/render/bgfx/uniform.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/osd/modules/render/bgfx/uniform.cpp b/src/osd/modules/render/bgfx/uniform.cpp
index dc81475ad59..36f68b7a9c7 100644
--- a/src/osd/modules/render/bgfx/uniform.cpp
+++ b/src/osd/modules/render/bgfx/uniform.cpp
@@ -13,7 +13,7 @@ bgfx_uniform::bgfx_uniform(std::string name, bgfx::UniformType::Enum type)
: m_name(name)
, m_type(type)
{
- m_handle = bgfx::createUniform(m_name.c_str(), m_type);
+ m_handle = BGFX_INVALID_HANDLE;
m_data_size = get_size_for_type(type);
if (m_data_size > 0)
{
@@ -23,10 +23,18 @@ bgfx_uniform::bgfx_uniform(std::string name, bgfx::UniformType::Enum type)
bgfx_uniform::~bgfx_uniform()
{
- bgfx::destroy(m_handle);
+ if (m_handle.idx != bgfx::kInvalidHandle)
+ {
+ bgfx::destroy(m_handle);
+ }
delete [] m_data;
}
+void bgfx_uniform::create()
+{
+ m_handle = bgfx::createUniform(m_name.c_str(), m_type);
+}
+
void bgfx_uniform::upload()
{
if (m_type != bgfx::UniformType::Sampler)