OpenGLUniformLocationMap Class
Manages the mapping between OpenGL uniform semantics and their locations in an underlying OpenGL shader. More...
Declaration
Public Constructors Index
| OpenGLUniformLocationMap ()=default | |
|
Default constructor for a OpenGLUniformLocationMap. More... | |
Public Destructor Index
| ~OpenGLUniformLocationMap ()=default | |
Public Member Functions Index
| bool | set (const helios::rendering::shader::UniformSemantics uniformSemantics, const int position) noexcept |
|
Sets or updates the OpenGLUniform. If the semantics already exists in the map, it is updated with `position`. More... | |
| int | get (helios::rendering::shader::UniformSemantics uniformSemantics) const noexcept |
|
Returns the index of the uniform variable for the specified UniformSemantics as configured with this location map. This method returns -1 if the specified semantics is not configured with this map. More... | |
Private Member Attributes Index
| unsigned int | sentinel_ = 0 |
|
Bit mask serving as sentinel to keep track of set indices. Since position 0 is allowed for uniform locations, this bitmask keeps track of set indices in `map_`. More... | |
| std::array< int, std::to_underlying(helios::rendering::shader::UniformSemantics::size_)> | map_ = {} |
|
The internal map used for mapping uniform semantics to positions. More... | |
Private Static Attributes Index
| static const helios::util::log::Logger & | logger_ = ... |
|
Shared logger instance for all OpenGLUniformLocationMap objects. More... | |
Description
Manages the mapping between OpenGL uniform semantics and their locations in an underlying OpenGL shader.
This class should be used to store and retrieve the uniform locations, e.g. for a OpenGL render backend for easy access.
Definition at line 31 of file OpenGLUniformLocationMap.ixx.
Public Constructors
OpenGLUniformLocationMap()
| default |
Default constructor for a OpenGLUniformLocationMap.
Make sure the sentinel has enough bits to keep track of the entries of the UniformSemantics enum.
Definition at line 67 of file OpenGLUniformLocationMap.ixx.
Public Destructor
~OpenGLUniformLocationMap()
| default |
Definition at line 54 of file OpenGLUniformLocationMap.ixx.
Reference helios::rendering::shader::size_.
Public Member Functions
get()
| inline nodiscard noexcept |
Returns the index of the uniform variable for the specified UniformSemantics as configured with this location map. This method returns -1 if the specified semantics is not configured with this map.
- Parameters
-
uniformSemantics The UniformSemantics for which the location index should be returned.
- Returns
The index as previously set for the specified uniformSemantics, or -1 if not found.
- See Also
glGetUniformLocation
- See Also
[KSS17, 47]
Definition at line 107 of file OpenGLUniformLocationMap.ixx.
set()
| inline noexcept |
Sets or updates the OpenGLUniform. If the semantics already exists in the map, it is updated with `position`.
- Parameters
-
uniformSemantics The uniformSemantics to register with `position`
position A positive integer value as the location of the uniform represented by uniformSemantics.
- Returns
true if the position for the specified uniformSemantics was registered with this map, otherwise false (e.g. if position was < 0)
Definition at line 80 of file OpenGLUniformLocationMap.ixx.
Private Member Attributes
map_
|
The internal map used for mapping uniform semantics to positions.
Definition at line 44 of file OpenGLUniformLocationMap.ixx.
sentinel_
|
Bit mask serving as sentinel to keep track of set indices. Since position 0 is allowed for uniform locations, this bitmask keeps track of set indices in `map_`.
Definition at line 39 of file OpenGLUniformLocationMap.ixx.
Private Static Attributes
logger_
| static |
Shared logger instance for all OpenGLUniformLocationMap objects.
- Initialiser
Definition at line 49 of file OpenGLUniformLocationMap.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.