glsl: Add new overload of program_resource_visitor::visit_field method

The outer-most record is passed into the visit_field method for
the first field.  In other words, in the following structure:

    struct S1 {
        vec4 v;
        float f;
    };

    struct S {
        S1 s1;
        S1 s2;
    };

    uniform Ubo {
        S s;
    };

s.s1.v would get record_type = S (because s1.v is the first non-record
field in S), and s.s2.v would get record_type = S1.  s.s1.f and s.s2.f
would get record_type = NULL becuase they aren't the first field of
anything.

This new overload isn't used yet, but the next patch will add several
uses.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Cc: "9.2 9.1" mesa-stable@lists.freedesktop.org
This commit is contained in:
Ian Romanick
2013-08-16 23:30:43 -07:00
parent d9bb8b7b56
commit 5ac884fd9f
2 changed files with 48 additions and 10 deletions

View File

@@ -120,6 +120,19 @@ public:
void process(const glsl_type *type, const char *name);
protected:
/**
* Method invoked for each leaf of the variable
*
* \param type Type of the field.
* \param name Fully qualified name of the field.
* \param row_major For a matrix type, is it stored row-major.
* \param record_type Type of the record containing the field.
*
* The default implementation just calls the other \c visit_field method.
*/
virtual void visit_field(const glsl_type *type, const char *name,
bool row_major, const glsl_type *record_type);
/**
* Method invoked for each leaf of the variable
*
@@ -146,7 +159,7 @@ private:
* terminating \c NUL character.
*/
void recursion(const glsl_type *t, char **name, size_t name_length,
bool row_major);
bool row_major, const glsl_type *record_type);
};
void