svga: Ensure buffer size/alignment is not zero.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 14 Jan 2010 15:06:48 +0000 (15:06 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 19 Jan 2010 04:34:19 +0000 (20:34 -0800)
src/gallium/drivers/svga/svga_screen_buffer.c
src/gallium/drivers/svga/svga_swtnl_backend.c

index 1f8a88967238e9f3430a7fa15c7ca1f98a3ce6a7..c014f2ee203fce41e736f392a66b8e3df38d0b2a 100644 (file)
@@ -594,6 +594,9 @@ svga_buffer_create(struct pipe_screen *screen,
    struct svga_screen *ss = svga_screen(screen);
    struct svga_buffer *sbuf;
    
+   assert(size);
+   assert(alignment);
+
    sbuf = CALLOC_STRUCT(svga_buffer);
    if(!sbuf)
       goto error1;
index b4f757a47a9264cc365807cd3147e0e02b947350..3d82e4f88056e4baf006d1166f38b4f7b1fbc6cd 100644 (file)
@@ -87,13 +87,13 @@ svga_vbuf_render_allocate_vertices( struct vbuf_render *render,
    if (!svga_render->vbuf) {
       svga_render->vbuf_size = MAX2(size, svga_render->vbuf_alloc_size);
       svga_render->vbuf = pipe_buffer_create(screen,
-                                             0,
+                                             16,
                                              PIPE_BUFFER_USAGE_VERTEX,
                                              svga_render->vbuf_size);
       if(!svga_render->vbuf) {
          svga_context_flush(svga, NULL);
          svga_render->vbuf = pipe_buffer_create(screen,
-                                                0,
+                                                16,
                                                 PIPE_BUFFER_USAGE_VERTEX,
                                                 svga_render->vbuf_size);
          assert(svga_render->vbuf);
@@ -259,7 +259,7 @@ svga_vbuf_render_draw( struct vbuf_render *render,
    if (!svga_render->ibuf) {
       svga_render->ibuf_size = MAX2(size, svga_render->ibuf_alloc_size);
       svga_render->ibuf = pipe_buffer_create(screen,
-                                             0,
+                                             2,
                                              PIPE_BUFFER_USAGE_VERTEX,
                                              svga_render->ibuf_size);
       svga_render->ibuf_offset = 0;