program_object_provider.h Source File - ClanLib SDK
Description: program_object_provider.h Source File

program_object_provider.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 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
33namespace clan
34{
37
38 class ShaderObject;
39 class UniformBuffer;
40
42 class ProgramObjectProvider
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}
clan::ProgramObjectProvider
Program Object provider.
Definition program_object_provider.h:43
clan::ProgramObjectProvider::set_uniformfv
virtual void set_uniformfv(int location, int size, int count, const float *data)=0
clan::ProgramObjectProvider::set_uniform2f
virtual void set_uniform2f(int location, float value_a, float value_b)=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::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_uniform_buffer_index
virtual int get_uniform_buffer_index(const std::string &block_name) const =0
Get the uniform block index.
clan::ProgramObjectProvider::get_shaders
virtual std::vector< ShaderObject > get_shaders() const =0
Returns the shaders used in this program.
clan::ProgramObjectProvider::set_uniformiv
virtual void set_uniformiv(int location, int size, int count, const int *data)=0
clan::ProgramObjectProvider::set_uniform_buffer_index
virtual void set_uniform_buffer_index(int block_index, int bind_index)=0
clan::ProgramObjectProvider::get_validate_status
virtual bool get_validate_status() const =0
Returns true if validation succeeded.
clan::ProgramObjectProvider::detach
virtual void detach(const ShaderObject &obj)=0
Remove shader from program object.
clan::ProgramObjectProvider::set_uniform1i
virtual void set_uniform1i(int location, int value_a)=0
Set uniform variable(s).
clan::ProgramObjectProvider::~ProgramObjectProvider
virtual ~ProgramObjectProvider()
Definition program_object_provider.h:45
clan::ProgramObjectProvider::set_uniform3i
virtual void set_uniform3i(int location, int value_a, int value_b, int value_c)=0
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_uniform3f
virtual void set_uniform3f(int location, float value_a, float value_b, float value_c)=0
clan::ProgramObjectProvider::bind_attribute_location
virtual void bind_attribute_location(int index, const std::string &name)=0
Bind attribute to specific location.
clan::ProgramObjectProvider::set_uniform_matrix
virtual void set_uniform_matrix(int location, int size, int count, bool transpose, const float *data)=0
clan::ProgramObjectProvider::get_uniform_buffer_size
virtual int get_uniform_buffer_size(int block_index) const =0
Get the uniform block size.
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::set_uniform4i
virtual void set_uniform4i(int location, int value_a, int value_b, int value_c, int value_d)=0
clan::ProgramObjectProvider::get_link_status
virtual bool get_link_status() const =0
Returns true if the link succeeded.
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::attach
virtual void attach(const ShaderObject &obj)=0
Add shader to program object.
clan::ProgramObjectProvider::set_uniform2i
virtual void set_uniform2i(int location, int value_a, int value_b)=0
clan::ProgramObjectProvider::get_handle
virtual unsigned int get_handle() const =0
Returns the OpenGL program object handle.
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::validate
virtual void validate()=0
Validate program.
clan::ProgramObjectProvider::set_uniform1f
virtual void set_uniform1f(int location, float value_a)=0
clan::ProgramObjectProvider::set_storage_buffer_index
virtual void set_storage_buffer_index(int buffer_index, int bind_unit_index)=0
clan::ShaderObject
Shader Object.
Definition shader_object.h:68
clan::UniformBuffer
Uniform Buffer.
Definition uniform_buffer.h:47
clan
Definition clanapp.h:36