[prev in list] [next in list] [prev in thread] [next in thread]
List: mesa3d-dev
Subject: Re: [Mesa-dev] [PATCH 1/5] Extend ir_constant::zero to handle more types.
From: Eric Anholt <eric () anholt ! net>
Date: 2012-04-30 18:31:52
Message-ID: 87wr4xvzon.fsf () eliezer ! anholt ! net
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
Content-Transfer-Encoding: quoted-printable
On Fri, 27 Apr 2012 10:28:00 +0200, Olivier Galibert <galibert@pobox.com> wrote:
> Signed-off-by: Olivier Galibert <galibert@pobox.com>
> ---
> src/glsl/ir.cpp | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
> index 1ba8751..fbbde20 100644
> --- a/src/glsl/ir.cpp
> +++ b/src/glsl/ir.cpp
> @@ -716,12 +716,27 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list)
> ir_constant *
> ir_constant::zero(void *mem_ctx, const glsl_type *type)
> {
> - assert(type->is_numeric() || type->is_boolean());
> + assert(type->is_scalar() || type->is_vector() || type->is_matrix()
> + || type->is_record() || type->is_array());
>
> ir_constant *c = new(mem_ctx) ir_constant;
> c->type = type;
> memset(&c->value, 0, sizeof(c->value));
>
> + if (type->is_array()) {
> + c->array_elements = ralloc_array(c, ir_constant *, type->length);
> +
> + for(unsigned i = 0; i != type->length; i++)
> + c->array_elements[i] = ir_constant::zero(c, type->element_type());
> + }
> +
> + if (type->is_record()) {
> + for(unsigned i = 0; i != type->length; i++) {
Our style would be "for (unsigned i = 0; i < type->length; i++) {"
(space between 'for' and '(', and < for length checks)
[Attachment #5 (application/pgp-signature)]
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic