Unravel Engine C++ Reference
Loading...
Searching...
No Matches
shader.cpp
Go to the documentation of this file.
1#include "shader.h"
2
3namespace gfx
4{
5
9
14
15shader::shader(handle_type_t hndl)
16{
17 handle_ = hndl;
18
19 auto uniform_count = get_shader_uniforms(handle_);
20 if(uniform_count > 0)
21 {
22 std::vector<uniform::handle_type_t> uniforms_handles(uniform_count);
23 get_shader_uniforms(handle_, &uniforms_handles[0], uniform_count);
24 uniforms.reserve(uniform_count);
25 for(auto& uni : uniforms_handles)
26 {
27 auto uniform_var = std::make_shared<uniform>(uni);
28 uniforms.emplace_back(uniform_var);
29 }
30 }
31}
32} // namespace gfx
std::string name
Definition hub.cpp:27
renderer_type get_renderer_type()
Definition graphics.cpp:281
shader_handle create_embedded_shader(const embedded_shader *_es, renderer_type _type, const char *_name)
Definition graphics.cpp:245
shader_handle create_shader(const memory_view *_mem)
Definition graphics.cpp:447
uint16_t get_shader_uniforms(shader_handle _handle, uniform_handle *_uniforms, uint16_t _max)
Definition graphics.cpp:452
bgfx::EmbeddedShader embedded_shader
Definition graphics.h:53
bgfx::Memory memory_view
Definition graphics.h:23
std::vector< std::shared_ptr< uniform > > uniforms
Uniforms for this shader.
Definition shader.h:17
shader()=default