program_object_provider.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Harry Storbacka
27 */
28
29
30 #pragma once
31
32 #include <vector>
33
34 namespace clan
35 {
38
39 class ShaderObject;
40 class UniformBuffer;
41
43 class ProgramObjectProvider
44 {
47 public:
48 virtual ~ProgramObjectProvider()
49 {
50 }
51
53
56 public:
58 virtual unsigned int get_handle() const=0;
59
61 virtual bool get_link_status() const=0;
62
64 virtual bool get_validate_status() const=0;
65
67 virtual std::string get_info_log() const=0;
68
70 virtual std::vector<ShaderObject> get_shaders() const=0;
71
73 virtual int get_attribute_location(const std::string &name) const=0;
74
76 virtual int get_uniform_location(const std::string &name) const=0;
77
79 virtual int get_uniform_buffer_size(int block_index) const = 0;
80
84 virtual int get_uniform_buffer_index(const std::string &block_name) const = 0;
85
89 virtual int get_storage_buffer_index(const std::string &name) const = 0;
91
94 public:
96 virtual void attach(const ShaderObject &obj)=0;
97
99 virtual void detach(const ShaderObject &obj)=0;
100
102
103 virtual void bind_attribute_location(int index, const std::string &name)=0;
104
106
107 virtual void bind_frag_data_location(int color_number, const std::string &name)=0;
108
110
112 virtual void link()=0;
113
115
117 virtual void validate()=0;
118
120 virtual void set_uniform1i(int location, int value_a)=0;
121 virtual void set_uniform2i(int location, int value_a, int value_b)=0;
122 virtual void set_uniform3i(int location, int value_a, int value_b, int value_c)=0;
123 virtual void set_uniform4i(int location, int value_a, int value_b, int value_c, int value_d)=0;
124 virtual void set_uniformiv(int location, int size, int count, const int *data)=0;
125 virtual void set_uniform1f(int location, float value_a)=0;
126 virtual void set_uniform2f(int location, float value_a, float value_b)=0;
127 virtual void set_uniform3f(int location, float value_a, float value_b, float value_c)=0;
128 virtual void set_uniform4f(int location, float value_a, float value_b, float value_c, float value_d)=0;
129 virtual void set_uniformfv(int location, int size, int count, const float *data)=0;
130 virtual void set_uniform_matrix(int location, int size, int count, bool transpose, const float *data)=0;
131
132 virtual void set_uniform_buffer_index(int block_index, int bind_index) = 0;
133
134 virtual void set_storage_buffer_index(int buffer_index, int bind_unit_index) = 0;
136
139 private:
141 };
142
143 }
144
clan::ShaderObject
Shader Object.
Definition: shader_object.h:68
clan
Definition: clanapp.h:35
clan::ProgramObjectProvider
Program Object provider.
Definition: program_object_provider.h:43
clan::ProgramObjectProvider::get_validate_status
virtual bool get_validate_status() const =0
Returns true if validation succeeded.
clan::ProgramObjectProvider::set_uniform2f
virtual void set_uniform2f(int location, float value_a, float value_b)=0
clan::ProgramObjectProvider::get_info_log
virtual std::string get_info_log() const =0
Returns the current info log for the program object.
clan::ProgramObjectProvider::link
virtual void link()=0
Link program.
clan::ProgramObjectProvider::get_handle
virtual unsigned int get_handle() const =0
Returns the OpenGL program object handle.
clan::ProgramObjectProvider::set_uniform3i
virtual void set_uniform3i(int location, int value_a, int value_b, int value_c)=0
clan::ProgramObjectProvider::set_uniform_buffer_index
virtual void set_uniform_buffer_index(int block_index, int bind_index)=0
clan::ProgramObjectProvider::set_uniformfv
virtual void set_uniformfv(int location, int size, int count, const float *data)=0
clan::ProgramObjectProvider::get_link_status
virtual bool get_link_status() const =0
Returns true if the link succeeded.
clan::ProgramObjectProvider::get_uniform_buffer_index
virtual int get_uniform_buffer_index(const std::string &block_name) const =0
Get the uniform block index.
clan::ProgramObjectProvider::bind_attribute_location
virtual void bind_attribute_location(int index, const std::string &name)=0
Bind attribute to specific location.
clan::ProgramObjectProvider::detach
virtual void detach(const ShaderObject &obj)=0
Remove shader from program object.
clan::StyleTokenType::string
@ keyword
clan::ProgramObjectProvider::get_uniform_location
virtual int get_uniform_location(const std::string &name) const =0
Returns the location of a named uniform variable.
clan::ProgramObjectProvider::set_uniform4i
virtual void set_uniform4i(int location, int value_a, int value_b, int value_c, int value_d)=0
clan::ProgramObjectProvider::set_uniform4f
virtual void set_uniform4f(int location, float value_a, float value_b, float value_c, float value_d)=0
clan::ProgramObjectProvider::set_uniform1f
virtual void set_uniform1f(int location, float value_a)=0
clan::ProgramObjectProvider::bind_frag_data_location
virtual void bind_frag_data_location(int color_number, const std::string &name)=0
Bind shader out variable a specific color buffer location.
clan::ProgramObjectProvider::set_uniform3f
virtual void set_uniform3f(int location, float value_a, float value_b, float value_c)=0
clan::ProgramObjectProvider::get_storage_buffer_index
virtual int get_storage_buffer_index(const std::string &name) const =0
Get the storage block index.
clan::ProgramObjectProvider::get_attribute_location
virtual int get_attribute_location(const std::string &name) const =0
Returns the location of a named active attribute.
clan::ProgramObjectProvider::set_uniform2i
virtual void set_uniform2i(int location, int value_a, int value_b)=0
clan::ProgramObjectProvider::~ProgramObjectProvider
virtual ~ProgramObjectProvider()
Definition: program_object_provider.h:48
clan::ProgramObjectProvider::attach
virtual void attach(const ShaderObject &obj)=0
Add shader to program object.
clan::ProgramObjectProvider::set_storage_buffer_index
virtual void set_storage_buffer_index(int buffer_index, int bind_unit_index)=0
clan::ProgramObjectProvider::set_uniform_matrix
virtual void set_uniform_matrix(int location, int size, int count, bool transpose, const float *data)=0
clan::ProgramObjectProvider::validate
virtual void validate()=0
Validate program.
clan::ProgramObjectProvider::set_uniformiv
virtual void set_uniformiv(int location, int size, int count, const int *data)=0
clan::ProgramObjectProvider::get_shaders
virtual std::vector< ShaderObject > get_shaders() const =0
Returns the shaders used in this program.
clan::ProgramObjectProvider::get_uniform_buffer_size
virtual int get_uniform_buffer_size(int block_index) const =0
Get the uniform block size.
clan::ProgramObjectProvider::set_uniform1i
virtual void set_uniform1i(int location, int value_a)=0
Set uniform variable(s).