Re: [Mesa-dev] [PATCH 1/2] st/mesa: allow creating buffers of size = 0

2011-11-14 Thread Brian Paul
OK, handling this in the st_draw.c code is trivial. That'll take care of the piglit test. I'll have to follow-up later with other state tracker changes for other cases. -Brian On 11/14/2011 08:13 AM, Jose Fonseca wrote: Is it really necessary to bother pipe drivers with zero size buffers?

Re: [Mesa-dev] [PATCH 1/2] st/mesa: allow creating buffers of size = 0

2011-11-14 Thread Jose Fonseca
Is it really necessary to bother pipe drivers with zero size buffers? It looks like a useless corner case, which will cause all sort of implementations problems (e.g., malloc(0) may return NULL; kernel drivers will likely refuse 0 size buffers), so pipe drivers will need a lot of if (buffer-

[Mesa-dev] [PATCH 1/2] st/mesa: allow creating buffers of size = 0

2011-11-12 Thread Brian Paul
Calling glBufferData(size=0) is legal. Instead of no-oping it, go ahead and create a gallium buffer of size zero. This lets us avoid a bunch of NULL pointer checking elsewhere. In the case of a zero-sized VBO, the bounds checking we do later will prevent invalid memory accesses. --- src/mesa/st