[Mesa-dev] [PATCH 14/32] glsl: Add a predicate to determine whether a variable is an interface block
Paul Berry
stereotype441 at gmail.com
Wed Jan 23 19:17:54 PST 2013
On 22 January 2013 00:52, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> For the first declaration below, there will be an ir_variable named
> "instance" whose type and whose instance_type will be the same
> glsl_type. For the second declaration, there will be an ir_variable
> named "f" whose type is float and whose instance_type is B2.
>
> "instance" is an interface instance variable, but "f" is not.
>
> uniform B1 {
> float f;
> } instance;
>
> uniform B2 {
> float f;
> };
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> src/glsl/ir.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/src/glsl/ir.h b/src/glsl/ir.h
> index 49c5f8d..a776f49 100644
> --- a/src/glsl/ir.h
> +++ b/src/glsl/ir.h
> @@ -355,6 +355,14 @@ public:
> return this->mode == ir_var_uniform && this->interface_type != NULL;
> }
>
> + inline bool is_interface_instance() const
> + {
> + const glsl_type *const t = this->type;
> +
> + return (t == this->interface_type)
> + || (t->is_array() && t->fields.array == this->interface_type);
> + }
> +
>
Not wanting to sound like a broken record here, but I could really use a
comment above this function explaining what it means for a variable to be
an "interface instance", and as in patch 12/32, I think the text that you
have in the commit message would be perfect.
With that change, this patch is:
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
> /**
> * Declared type of the variable
> */
> --
> 1.7.11.7
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130123/07c19ece/attachment.html>
More information about the mesa-dev
mailing list