glsl: Rename uniform_field_visitor to program_resource_visitor.

There's actually nothing uniform-specific in uniform_field_visitor.
It is potentially useful for all kinds of program resources (in
particular, future patches will use it for transform feedback
varyings).

This patch renames it to program_resource_visitor, and clarifies
several comments, to reflect the fact that it is useful for more than
just uniforms.

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Paul Berry
2013-01-28 14:43:03 -08:00
parent b92900d26a
commit b4db34cc4c
4 changed files with 34 additions and 33 deletions

View File

@@ -61,38 +61,39 @@ link_uniform_blocks(void *mem_ctx,
struct gl_uniform_block **blocks_ret);
/**
* Class for processing all of the leaf fields of an uniform
* Class for processing all of the leaf fields of a variable that corresponds
* to a program resource.
*
* Leaves are, roughly speaking, the parts of the uniform that the application
* could query with \c glGetUniformLocation (or that could be returned by
* \c glGetActiveUniforms).
* The leaf fields are all the parts of the variable that the application
* could query using \c glGetProgramResourceIndex (or that could be returned
* by \c glGetProgramResourceName).
*
* Classes my derive from this class to implement specific functionality.
* This class only provides the mechanism to iterate over the leaves. Derived
* classes must implement \c ::visit_field and may override \c ::process.
*/
class uniform_field_visitor {
class program_resource_visitor {
public:
/**
* Begin processing a uniform
* Begin processing a variable
*
* Classes that overload this function should call \c ::process from the
* base class to start the recursive processing of the uniform.
* base class to start the recursive processing of the variable.
*
* \param var The uniform variable that is to be processed
* \param var The variable that is to be processed
*
* Calls \c ::visit_field for each leaf of the uniform.
* Calls \c ::visit_field for each leaf of the variable.
*
* \warning
* This entry should only be used with uniform blocks in cases where the
* row / column ordering of matrices in the block does not matter. For
* example, enumerating the names of members of the block, but not for
* determining the offsets of members.
* When processing a uniform block, this entry should only be used in cases
* where the row / column ordering of matrices in the block does not
* matter. For example, enumerating the names of members of the block, but
* not for determining the offsets of members.
*/
void process(ir_variable *var);
/**
* Begin processing a uniform of a structured type.
* Begin processing a variable of a structured type.
*
* This flavor of \c process should be used to handle structured types
* (i.e., structures, interfaces, or arrays there of) that need special
@@ -100,7 +101,7 @@ public:
* (instead of the instance name) is used for an interface block.
*
* \param type Type that is to be processed, associated with \c name
* \param name Base name of the structured uniform being processed
* \param name Base name of the structured variable being processed
*
* \note
* \c type must be \c GLSL_TYPE_RECORD, \c GLSL_TYPE_INTERFACE, or an array
@@ -110,7 +111,7 @@ public:
protected:
/**
* Method invoked for each leaf of the uniform
* Method invoked for each leaf of the variable
*
* \param type Type of the field.
* \param name Fully qualified name of the field.