Re: [Mesa-dev] [PATCH v2] glsl: Add blob.c---a simple interface for serializing data

2014-12-12 Thread Carl Worth
On Fri, Dec 12 2014, Ian Romanick wrote: > In addition to the (mostly) nits below, this seems ripe for some unit > tests. Especially for the overrun cases and the data alignment cases. Thanks for the review, Ian. Testing makes sense. I'll cook something up. And thanks for the nit-picking. I've c

Re: [Mesa-dev] [PATCH v2] glsl: Add blob.c---a simple interface for serializing data

2014-12-12 Thread Ian Romanick
In addition to the (mostly) nits below, this seems ripe for some unit tests. Especially for the overrun cases and the data alignment cases. On 12/12/2014 02:43 PM, Carl Worth wrote: > This new interface allows for writing a series of objects to a chunk > of memory (a "blob").. The allocated memor

Re: [Mesa-dev] [PATCH v2] glsl: Add blob.c---a simple interface for serializing data

2014-12-12 Thread Carl Worth
On Fri, Dec 12 2014, Jason Ekstrand wrote: > Should be MAX2(blob->allocated * 2, blob->size + additional) Yikes! Yes. That's really embarrassing. > Something to tuck in the back of your brain in case you have a need to grow > this datastructure: The above write functions could be generated with t

Re: [Mesa-dev] [PATCH v2] glsl: Add blob.c---a simple interface for serializing data

2014-12-12 Thread Jason Ekstrand
On Fri, Dec 12, 2014 at 2:43 PM, Carl Worth wrote: > > This new interface allows for writing a series of objects to a chunk > of memory (a "blob").. The allocated memory is maintained within the > blob itself, (and re-allocated by doubling when necessary). > > There are also functions for reading

Re: [Mesa-dev] [PATCH v2] glsl: Add blob.c---a simple interface for serializing data

2014-12-12 Thread Matt Turner
On Fri, Dec 12, 2014 at 2:43 PM, Carl Worth wrote: > diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources > index 676fa0d..875e4bf 100644 > --- a/src/glsl/Makefile.sources > +++ b/src/glsl/Makefile.sources > @@ -105,7 +105,8 @@ LIBGLSL_FILES = \ > $(GLSL_SRCDIR)/opt_swizzle_s

[Mesa-dev] [PATCH v2] glsl: Add blob.c---a simple interface for serializing data

2014-12-12 Thread Carl Worth
This new interface allows for writing a series of objects to a chunk of memory (a "blob").. The allocated memory is maintained within the blob itself, (and re-allocated by doubling when necessary). There are also functions for reading objects from a blob as well. If code attempts to read beyond th