[Mesa-dev] [PATCH 1/2] util: use memset() to initialize surface, sampler_view templates
Brian Paul
brianp at vmware.com
Tue Jan 10 10:51:54 PST 2012
On 01/10/2012 11:48 AM, Jakob Bornecrantz wrote:
> ----- Original Message -----
>> These initialization functions weren't initializing all the fields so
>> some had undefined values. The callers of these functions sometimes
>> use a structure assignment to initialize new objects from these
>> templates so we'd just propagate the undefined values. That made for
>> some confusing info when debugging, plus it could lead to bugs.
>
> Hmm, in theory doing "struct my_struct strct = { 0 };" should work but
> as I noticed earlier at least gcc doesn't seem to do what we want in
> this case.
>
> Maybe we should try and standardize on one way to do struct
> initialization in Gallium/Mesa?
Well, in this specific case, we're initializing the template object
with a number of non-constant values coming from other objects.
> struct my_struct strct = MY_STRUCT_STATIC_INIT;
There's probably some other places where that would make sense.
> Seems to be used by both pthreads and the kernel.
>
> The change in of itself is good and have my RB, just wanted to take up
> the discussion.
>
> Cheers, Jakob.
-Brian
More information about the mesa-dev
mailing list