summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/bgfx/uniform.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/render/bgfx/uniform.h')
-rw-r--r--src/osd/modules/render/bgfx/uniform.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/osd/modules/render/bgfx/uniform.h b/src/osd/modules/render/bgfx/uniform.h
new file mode 100644
index 00000000000..5ff8f6fb3d8
--- /dev/null
+++ b/src/osd/modules/render/bgfx/uniform.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#ifndef __DRAWBGFX_UNIFORM__
+#define __DRAWBGFX_UNIFORM__
+
+#include <bgfx/bgfx.h>
+
+#include <string>
+
+class bgfx_uniform
+{
+public:
+ bgfx_uniform(std::string name, bgfx::UniformType::Enum type);
+ virtual ~bgfx_uniform();
+
+ virtual void upload();
+
+ // Getters
+ std::string name() { return m_name; }
+ bgfx::UniformType::Enum type() const { return m_type; }
+ bgfx::UniformHandle handle() const { return m_handle; }
+
+ // Setters
+ bgfx_uniform* set(float* value);
+ bgfx_uniform* set_int(int value);
+ bgfx_uniform* set_mat3(float* value);
+ bgfx_uniform* set_mat4(float* value);
+ bgfx_uniform* set(void* data, size_t size);
+
+ static size_t get_size_for_type(bgfx::UniformType::Enum type);
+
+protected:
+ bgfx::UniformHandle m_handle;
+ std::string m_name;
+ bgfx::UniformType::Enum m_type;
+ uint8_t* m_data;
+ size_t m_data_size;
+};
+
+#endif // __DRAWBGFX_UNIFORM__ \ No newline at end of file