[Mesa-dev] [PATCH 1/4] glsl: Only set ir_variable::constant_value for const-decorated variables
Lofstedt, Marta
marta.lofstedt at intel.com
Thu Oct 8 03:19:06 PDT 2015
Reviewed-by: Marta Lofstedt <marta.lofstedt at intel.com>
> -----Original Message-----
> From: mesa-dev [mailto:mesa-dev-bounces at lists.freedesktop.org] On
> Behalf Of Ian Romanick
> Sent: Wednesday, October 7, 2015 11:34 PM
> To: mesa-dev at lists.freedesktop.org
> Cc: Romanick, Ian D
> Subject: [Mesa-dev] [PATCH 1/4] glsl: Only set ir_variable::constant_value
> for const-decorated variables
>
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Right now we're also setting for uniforms, and that doesn't seem to hurt
> things. The next patch will make general global variables in GLSL ES, and
> those definitely should not have constant_value set!
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> src/glsl/ast_to_hir.cpp | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index
> 9511440..e3d4c44 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -3238,17 +3238,20 @@ process_initializer(ir_variable *var,
> ast_declaration *decl,
> decl->identifier);
> if (var->type->is_numeric()) {
> /* Reduce cascading errors. */
> - var->constant_value = ir_constant::zero(state, var->type);
> + var->constant_value = type->qualifier.flags.q.constant
> + ? ir_constant::zero(state, var->type) : NULL;
> }
> }
> } else {
> rhs = constant_value;
> - var->constant_value = constant_value;
> + var->constant_value = type->qualifier.flags.q.constant
> + ? constant_value : NULL;
> }
> } else {
> if (var->type->is_numeric()) {
> /* Reduce cascading errors. */
> - var->constant_value = ir_constant::zero(state, var->type);
> + var->constant_value = type->qualifier.flags.q.constant
> + ? ir_constant::zero(state, var->type) : NULL;
> }
> }
> }
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list