OSDN Git Service

cso_cache: Ensure irrelevant state of the blend state is zeroed.
authorJosé Fonseca <jfonseca@vmware.com>
Sat, 24 Apr 2010 09:33:44 +0000 (10:33 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sat, 24 Apr 2010 10:39:09 +0000 (11:39 +0100)
Otherwise drivers that bake the full blend state in a key end up having
uninitialized memory in their key.

Courtesy of valgrind.

src/gallium/auxiliary/cso_cache/cso_context.c

index 6fd4bd3..6d0b420 100644 (file)
@@ -349,6 +349,7 @@ enum pipe_error cso_set_blend(struct cso_context *ctx,
       if (!cso)
          return PIPE_ERROR_OUT_OF_MEMORY;
 
+      memset(&cso->state, 0, sizeof cso->state);
       memcpy(&cso->state, templ, key_size);
       cso->data = ctx->pipe->create_blend_state(ctx->pipe, &cso->state);
       cso->delete_state = (cso_state_callback)ctx->pipe->delete_blend_state;