FastUIDraw
Public Member Functions | Friends | List of all members
fastuidraw::gl::Program::block_info Class Reference

A block_info represents an object from which one can query the members of a uniform or shader storage block. More...

#include <gl_program.hpp>

Public Member Functions

 block_info (void)
 
GLint block_index (void) const
 
GLint buffer_size (void) const
 
GLint initial_buffer_binding (void) const
 
c_string name (void) const
 
unsigned int number_variables (void) const
 
 operator bool () const
 
bool operator< (block_info rhs) const
 
enum shader_variable_src_t shader_variable_src (void) const
 
shader_variable_info variable (unsigned int I)
 
shader_variable_info variable (c_string name, unsigned int *out_array_index=nullptr, unsigned int *out_leading_array_index=nullptr)
 

Friends

class Program
 

Detailed Description

A block_info represents an object from which one can query the members of a uniform or shader storage block.

Definition at line 825 of file gl_program.hpp.

Constructor & Destructor Documentation

◆ block_info()

fastuidraw::gl::Program::block_info::block_info ( void  )

Ctor

Member Function Documentation

◆ block_index()

GLint fastuidraw::gl::Program::block_info::block_index ( void  ) const

GL API index for the parameter. The value of block_index() is used in calls to GL to query and set properties of the block. The default uniform block will have this value as -1. The value of block_index() is the same value as shader_variable_info::ubo_index() for shader variables on a uniform block, for shader variables on a shader storage buffer block and it is the same value as shader_variable_info::shader_storage_buffer_index(void). Lastly, block_index() is the value to feed to Program::uniform_block() for uniform blocks and the value to feed to Program::shader_storage_block() for shader storage blocks.

◆ buffer_size()

GLint fastuidraw::gl::Program::block_info::buffer_size ( void  ) const

Returns the size in bytes of the block (i.e.the size needed for a buffer object to correctly back the block). The default uniform block will have the size as 0.

◆ initial_buffer_binding()

GLint fastuidraw::gl::Program::block_info::initial_buffer_binding ( void  ) const

Returns the buffer binding point of the block when the GLSL program was -FIRST- created. If that binding point has been changed (for instance for UBO's by calling glUniformBlockBinding, or for SSBO's by calling glShaderStorageBlockBinding), then the return value is not suitable to be used to compute the binding point. Note that GLES3 does not allow for the binding point of an SSBO to change (because glShaderStorageBlockBinding is not part of its API).

◆ name()

c_string fastuidraw::gl::Program::block_info::name ( void  ) const

Name of the block within the GL API.

◆ number_variables()

unsigned int fastuidraw::gl::Program::block_info::number_variables ( void  ) const

Returns the number of active variables of the block. Note that an array of is classified as a single variable.

◆ operator bool()

fastuidraw::gl::Program::block_info::operator bool ( ) const
inline

Implicit cast operator to bool. If returns false, indicates that the block_info is null, and thus name() returns an empty string, block_index() returns -1, buffer_size() returns 0 and so on.

Definition at line 840 of file gl_program.hpp.

◆ operator<()

bool fastuidraw::gl::Program::block_info::operator< ( block_info  rhs) const
inline

Comparison operation for sorting. Comparison is done by internal pointer value of object not the values of the object.

Parameters
rhsblock_info to which to compare.

Definition at line 943 of file gl_program.hpp.

◆ shader_variable_src()

enum shader_variable_src_t fastuidraw::gl::Program::block_info::shader_variable_src ( void  ) const

Returns the backing type of the block.

◆ variable() [1/2]

shader_variable_info fastuidraw::gl::Program::block_info::variable ( unsigned int  I)

Returns the ID'd variable. The values are sorted in alphabetical order of shader_variable_info::name(). The variable list is for those variables of this block.

Parameters
I-ID- (not location) of variable, if I is not less than number_variables(), returns a shader_variable_info indicating no value (i.e. shader_variable_info::name() is an empty string and shader_variable_info::index() is -1).

◆ variable() [2/2]

shader_variable_info fastuidraw::gl::Program::block_info::variable ( c_string  name,
unsigned int *  out_array_index = nullptr,
unsigned int *  out_leading_array_index = nullptr 
)

Find a shader variable in the block from the a name. The search handles the case where looking for an element of an array and also, in the case of a shader storage block variable where shader_variable_info::shader_storage_buffer_top_level_array_size() being not negative one, giving the leading index into the top level array as well. The values can be used in the methods shader_variable_info::location() and shader_variable_info::buffer_offset() to get the location and buffer offset of the element of the shader variable.

Parameters
namevariable name to look for
*out_array_indexlocation to which to write the array index value; if nullptr, value is not written
*out_leading_array_indexlocation to which to write the leading array index value; if nullptr, value is not written

The documentation for this class was generated from the following file: