[Mesa-dev] [PATCH 1/7] glsl: Set initial values for uniforms in the linker

Eric Anholt eric at anholt.net
Mon Apr 16 13:27:47 PDT 2012


On Thu, 12 Apr 2012 17:25:37 -0700, "Ian Romanick" <idr at freedesktop.org> wrote:
> +   if (val->type->is_array()) {
> +      const enum glsl_base_type base_type =
> +	 val->array_elements[0]->type->base_type;
> +      const unsigned int elements = val->array_elements[0]->type->components();
> +      unsigned int idx = 0;
> +
> +      assert(val->type->length >= storage->array_elements);
> +      for (unsigned int i = 0; i < storage->array_elements; i++) {
> +	 copy_constant_to_storage(& storage->storage[idx],
> +				  val->array_elements[i],
> +				  base_type,
> +				  elements);
> +
> +	 idx += elements;
> +      }

Wouldn't an array of structures with a uniform initializer fail?  I
think you can have those.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120416/be3637cc/attachment.pgp>


More information about the mesa-dev mailing list