All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre Willenbrock <pierre@pirsoft.de>
To: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: [PATCH] for mesa: Fill the padding between entrys in the sampler key
Date: Sun, 25 Apr 2010 21:56:30 +0200	[thread overview]
Message-ID: <4BD49E6E.8050307@pirsoft.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 121 bytes --]

I thought i'd send this here first, in case someone has something to say
about it. Found by valgrind.

Regards,
  Pierre

[-- Attachment #2: fill-all-sampler-key.diff --]
[-- Type: text/plain, Size: 1162 bytes --]

commit 079d2ff410664a1c2c6dc4bf9982d84314734735
Author: Pierre Willenbrock <pierre@pirsoft.de>
Date:   Sun Apr 25 21:55:48 2010 +0200

    Fill the padding between entrys in the sampler key
    
    This struct is used to generate a hash, ignoring the entry boundaries.

diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index d7650af..6504aaf 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -228,6 +228,8 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
 {
    GLcontext *ctx = &brw->intel.ctx;
    int unit;
+   char *last_entry_end = ((char*)&key->sampler_count) + 
+      sizeof(key->sampler_count);
 
    key->sampler_count = 0;
 
@@ -240,7 +242,9 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
 	 struct gl_texture_image *firstImage =
 	    texObj->Image[0][intelObj->firstLevel];
 
-	 memset(entry, 0, sizeof(*entry));
+	 memset(last_entry_end, 0, 
+		(char*)entry - last_entry_end + sizeof(*entry));
+	 last_entry_end = ((char*)entry) + sizeof(*entry);
 
          entry->tex_target = texObj->Target;
 

[-- Attachment #3: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2010-04-25 20:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-25 19:56 Pierre Willenbrock [this message]
2010-04-25 20:03 ` [PATCH] for mesa: Fill the padding between entrys in the sampler key Pierre Willenbrock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BD49E6E.8050307@pirsoft.de \
    --to=pierre@pirsoft.de \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.