A ShaderSource represents the source code to a GLSL shader, specifying blocks of source code and macros to use.
More...
#include <shader_source.hpp>
|
| ShaderSource (void) |
|
| ShaderSource (const ShaderSource &obj) |
|
ShaderSource & | add_macro (c_string macro_name, c_string macro_value="", enum add_location_t loc=push_back) |
|
ShaderSource & | add_macro (c_string macro_name, uint32_t macro_value, enum add_location_t loc=push_back) |
|
ShaderSource & | add_macro (c_string macro_name, int32_t macro_value, enum add_location_t loc=push_back) |
|
ShaderSource & | add_macro (c_string macro_name, float macro_value, enum add_location_t loc=push_back) |
|
template<typename T > |
ShaderSource & | add_macro_float (c_string macro_name, T macro_value) |
|
template<typename T > |
ShaderSource & | add_macro_i32 (c_string macro_name, T macro_value) |
|
template<typename T > |
ShaderSource & | add_macro_u32 (c_string macro_name, T macro_value) |
|
ShaderSource & | add_macros (const MacroSet ¯os, enum add_location_t loc=push_back) |
|
ShaderSource & | add_source (c_string str, enum source_t tp=from_file, enum add_location_t loc=push_back) |
|
ShaderSource & | add_source (const ShaderSource &obj) |
|
c_string | assembled_code (bool code_only=false) const |
|
ShaderSource & | operator= (const ShaderSource &obj) |
|
ShaderSource & | remove_macro (c_string macro_name, enum add_location_t loc=push_back) |
|
ShaderSource & | remove_macros (const MacroSet ¯os, enum add_location_t loc=push_back) |
|
ShaderSource & | specify_extension (c_string ext_name, enum extension_enable_t tp=enable_extension) |
|
ShaderSource & | specify_extensions (const ShaderSource &obj) |
|
ShaderSource & | specify_version (c_string v) |
|
void | swap (ShaderSource &obj) |
|
c_string | version (void) const |
|
A ShaderSource represents the source code to a GLSL shader, specifying blocks of source code and macros to use.
Definition at line 39 of file shader_source.hpp.
◆ add_location_t
Enumeration to determine if source code or a macro.
Enumerator |
---|
push_back | add the source code or macro to the back.
|
push_front | add the source code or macro to the front.
|
Definition at line 73 of file shader_source.hpp.
◆ extension_enable_t
Enumeration to indicate extension enable flags.
Enumerator |
---|
require_extension | Requires the named GLSL extension, i.e. will add "#extension extension_name: require" to GLSL source code.
|
enable_extension | Enables the named GLSL extension, i.e. will add "#extension extension_name: enable" to GLSL source code.
|
warn_extension | Enables the named GLSL extension, but request that the GLSL compiler issues warning when the extension is used, i.e. will add "#extension extension_name: warn" to GLSL source code.
|
disable_extension | Disables the named GLSL extension, i.e. will add "#extension extension_name: disable" to GLSL source code.
|
Definition at line 93 of file shader_source.hpp.
◆ source_t
Enumeration to indiciate the source for a shader.
Enumerator |
---|
from_file | Shader source code is taken from the file whose name is the passed string.
|
from_string | The passed string is the shader source code.
|
from_resource | The passed string is label for a string of text fetched with fastuidraw::fetch_static_resource(). The resource will be IGNORED if the last byte of resource is not 0 (which indicates end-of-string).
|
Definition at line 46 of file shader_source.hpp.
◆ ShaderSource() [1/2]
fastuidraw::glsl::ShaderSource::ShaderSource |
( |
void |
| ) |
|
◆ ShaderSource() [2/2]
fastuidraw::glsl::ShaderSource::ShaderSource |
( |
const ShaderSource & |
obj | ) |
|
Copy ctor.
- Parameters
-
obj | value from which to copy |
◆ add_macro() [1/4]
Add a macro to this ShaderSource. Functionally, will insert #define macro_name macro_value in the GLSL source code.
- Parameters
-
macro_name | name of macro |
macro_value | value to which macro is given |
loc | location to add macro within code |
◆ add_macro() [2/4]
Add a macro to this ShaderSource. Functionally, will insert #define macro_name macro_value in the GLSL source code.
- Parameters
-
macro_name | name of macro |
macro_value | value to which macro is given |
loc | location to add macro within code |
◆ add_macro() [3/4]
Add a macro to this ShaderSource. Functionally, will insert #define macro_name macro_value in the GLSL source code.
- Parameters
-
macro_name | name of macro |
macro_value | value to which macro is given |
loc | location to add macro within code |
◆ add_macro() [4/4]
Add a macro to this ShaderSource. Functionally, will insert #define macro_name macro_value in the GLSL source code.
- Parameters
-
macro_name | name of macro |
macro_value | value to which macro is given |
loc | location to add macro within code |
◆ add_macro_float()
template<typename T >
ShaderSource& fastuidraw::glsl::ShaderSource::add_macro_float |
( |
c_string |
macro_name, |
|
|
T |
macro_value |
|
) |
| |
|
inline |
Add a macro to this MacroSet for casted to float
- Parameters
-
macro_name | name of macro |
macro_value | value to which macro is given |
Definition at line 379 of file shader_source.hpp.
◆ add_macro_i32()
Add a macro to this MacroSet for casted to int32_t
- Parameters
-
macro_name | name of macro |
macro_value | value to which macro is given |
Definition at line 366 of file shader_source.hpp.
◆ add_macro_u32()
Add a macro to this MacroSet for casted to uint32_t
- Parameters
-
macro_name | name of macro |
macro_value | value to which macro is given |
Definition at line 353 of file shader_source.hpp.
◆ add_macros()
Add macros of a MacroSet to this ShaderSource. Functionally, will insert #define macro_name macro_value in the GLSL source code for each macro in the MacroSet.
- Parameters
-
macros | set of macros to add |
loc | location to add macro within code |
◆ add_source() [1/2]
Add shader source code to this ShaderSource.
- Parameters
-
str | string that is a filename, GLSL source or a resource name |
tp | interpretation of str, i.e. determines if str is a filename, raw GLSL source or a resource |
loc | location to add source |
◆ add_source() [2/2]
Add the sources from another ShaderSource object.
- Parameters
-
◆ assembled_code()
c_string fastuidraw::glsl::ShaderSource::assembled_code |
( |
bool |
code_only = false | ) |
const |
Returns the GLSL code assembled. The returned string is only gauranteed to be valid up until the ShaderSource object is modified.
- Parameters
-
code_only | if true only, return the GLSL code without the additions of version, extension and FastUIDraw convenience functions and macros. |
◆ operator=()
Assignment operator.
- Parameters
-
obj | value from which to copy |
◆ remove_macro()
Functionally, will insert #undef macro_name in the GLSL source code.
- Parameters
-
macro_name | name of macro |
loc | location to add macro within code |
◆ remove_macros()
Remove macros of a MacroSet to this ShaderSource. Functionally, will insert #undef macro_name in the GLSL source code for each macro in the MacroSet.
- Parameters
-
macros | set of macros to remove |
loc | location to add macro within code |
◆ specify_extension()
Specifiy an extension and usage.
- Parameters
-
ext_name | name of GL extension |
tp | usage of extension |
◆ specify_extensions()
Add all the extension specifacation from another ShaderSource object to this ShaderSource objects. Extension already set in this ShaderSource that are specified in obj are overwritten to the values specified in obj.
- Parameters
-
◆ specify_version()
Specifies the version of GLSL to which to declare the shader. An empty string indicates to not have a "#version" directive in the shader. String is -copied-.
◆ swap()
void fastuidraw::glsl::ShaderSource::swap |
( |
ShaderSource & |
obj | ) |
|
Swap operation
- Parameters
-
obj | object with which to swap |
◆ version()
c_string fastuidraw::glsl::ShaderSource::version |
( |
void |
| ) |
const |
The documentation for this class was generated from the following file: