summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_sampler.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-01-10 11:35:57 -0700
committerBrian Paul <[email protected]>2012-01-10 12:37:38 -0700
commit2e87660ca6deba9ba866a8012cf82f41374b5adb (patch)
tree11bbffc83023ff97e947af33381a2e2ae30ea293 /src/gallium/auxiliary/util/u_sampler.c
parent6bf5daf331f13ec9503615a2578247e72b7d2cbb (diff)
util: use memset() to initialize surface, sampler_view templates
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. v2: fix surf pointer mix-up: "&surf" -> "surf" Jakob Bornecrantz <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_sampler.c')
-rw-r--r--src/gallium/auxiliary/util/u_sampler.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_sampler.c b/src/gallium/auxiliary/util/u_sampler.c
index bb26099b7e1..227641bdafc 100644
--- a/src/gallium/auxiliary/util/u_sampler.c
+++ b/src/gallium/auxiliary/util/u_sampler.c
@@ -30,12 +30,18 @@
#include "u_sampler.h"
+/**
+ * Initialize a pipe_sampler_view. 'view' is considered to have
+ * uninitialized contents.
+ */
static void
default_template(struct pipe_sampler_view *view,
const struct pipe_resource *texture,
enum pipe_format format,
unsigned expand_green_blue)
{
+ memset(view, 0, sizeof(*view));
+
/* XXX: Check if format is compatible with texture->format.
*/