program_object_provider.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2016 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 #pragma once
30 
31 #include <vector>
32 
33 namespace clan
34 {
37 
38  class ShaderObject;
39  class UniformBuffer;
40 
43  {
44  public:
45  virtual ~ProgramObjectProvider() { }
46 
48  virtual unsigned int get_handle() const = 0;
49 
51  virtual bool get_link_status() const = 0;
52 
54  virtual bool get_validate_status() const = 0;
55 
57  virtual std::string get_info_log() const = 0;
58 
60  virtual std::vector<ShaderObject> get_shaders() const = 0;
61 
63  virtual int get_attribute_location(const std::string &name) const = 0;
64 
66  virtual int get_uniform_location(const std::string &name) const = 0;
67 
69  virtual int get_uniform_buffer_size(int block_index) const = 0;
70 
74  virtual int get_uniform_buffer_index(const std::string &block_name) const = 0;
75 
79  virtual int get_storage_buffer_index(const std::string &name) const = 0;
80 
82  virtual void attach(const ShaderObject &obj) = 0;
83 
85  virtual void detach(const ShaderObject &obj) = 0;
86 
88 
89  virtual void bind_attribute_location(int index, const std::string &name) = 0;
90 
92 
93  virtual void bind_frag_data_location(int color_number, const std::string &name) = 0;
94 
96 
98  virtual void link() = 0;
99 
101 
103  virtual void validate() = 0;
104 
106  virtual void set_uniform1i(int location, int value_a) = 0;
107  virtual void set_uniform2i(int location, int value_a, int value_b) = 0;
108  virtual void set_uniform3i(int location, int value_a, int value_b, int value_c) = 0;
109  virtual void set_uniform4i(int location, int value_a, int value_b, int value_c, int value_d) = 0;
110  virtual void set_uniformiv(int location, int size, int count, const int *data) = 0;
111  virtual void set_uniform1f(int location, float value_a) = 0;
112  virtual void set_uniform2f(int location, float value_a, float value_b) = 0;
113  virtual void set_uniform3f(int location, float value_a, float value_b, float value_c) = 0;
114  virtual void set_uniform4f(int location, float value_a, float value_b, float value_c, float value_d) = 0;
115  virtual void set_uniformfv(int location, int size, int count, const float *data) = 0;
116  virtual void set_uniform_matrix(int location, int size, int count, bool transpose, const float *data) = 0;
117 
118  virtual void set_uniform_buffer_index(int block_index, int bind_index) = 0;
119 
120  virtual void set_storage_buffer_index(int buffer_index, int bind_unit_index) = 0;
121  };
122 
124 }
virtual std::vector< ShaderObject > get_shaders() const =0
Returns the shaders used in this program.
Shader Object.
Definition: shader_object.h:67
Definition: clanapp.h:35
virtual void set_uniformfv(int location, int size, int count, const float *data)=0
virtual void set_uniform4i(int location, int value_a, int value_b, int value_c, int value_d)=0
virtual int get_uniform_buffer_size(int block_index) const =0
Get the uniform block size.
virtual int get_attribute_location(const std::string &name) const =0
Returns the location of a named active attribute.
Program Object provider.
Definition: program_object_provider.h:42
virtual void set_uniform3f(int location, float value_a, float value_b, float value_c)=0
virtual void attach(const ShaderObject &obj)=0
Add shader to program object.
virtual void set_uniform_buffer_index(int block_index, int bind_index)=0
virtual std::string get_info_log() const =0
Returns the current info log for the program object.
virtual void link()=0
Link program.
virtual bool get_validate_status() const =0
Returns true if validation succeeded.
virtual void set_uniform2f(int location, float value_a, float value_b)=0
virtual int get_uniform_location(const std::string &name) const =0
Returns the location of a named uniform variable.
virtual void set_uniform_matrix(int location, int size, int count, bool transpose, const float *data)=0
virtual void set_storage_buffer_index(int buffer_index, int bind_unit_index)=0
virtual void set_uniformiv(int location, int size, int count, const int *data)=0
virtual bool get_link_status() const =0
Returns true if the link succeeded.
virtual void set_uniform3i(int location, int value_a, int value_b, int value_c)=0
virtual int get_storage_buffer_index(const std::string &name) const =0
Get the storage block index.
virtual unsigned int get_handle() const =0
Returns the OpenGL program object handle.
virtual void detach(const ShaderObject &obj)=0
Remove shader from program object.
virtual void set_uniform1f(int location, float value_a)=0
virtual int get_uniform_buffer_index(const std::string &block_name) const =0
Get the uniform block index.
virtual void set_uniform1i(int location, int value_a)=0
Set uniform variable(s).
virtual void bind_frag_data_location(int color_number, const std::string &name)=0
Bind shader out variable a specific color buffer location.
virtual void bind_attribute_location(int index, const std::string &name)=0
Bind attribute to specific location.
virtual void set_uniform2i(int location, int value_a, int value_b)=0
virtual ~ProgramObjectProvider()
Definition: program_object_provider.h:45
virtual void validate()=0
Validate program.
virtual void set_uniform4f(int location, float value_a, float value_b, float value_c, float value_d)=0