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: Re: [PATCH] for mesa: Fill the padding between entrys in the sampler key
Date: Sun, 25 Apr 2010 22:03:42 +0200	[thread overview]
Message-ID: <4BD4A01E.5010406@pirsoft.de> (raw)
In-Reply-To: <4BD49E6E.8050307@pirsoft.de>

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

Missed a few bits in the last one. Why is it that one finds these things
seconds after hitting the send button?

Pierre Willenbrock schrieb:
> 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: 1493 bytes --]

commit cb00b1c589933451414977fb7da974a6af8236a7
Author: Pierre Willenbrock <pierre@pirsoft.de>
Date:   Sun Apr 25 22:00:06 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..1582ff1 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;
 
@@ -280,6 +284,8 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
 	 key->sampler_count = unit + 1;
       }
    }
+   struct wm_sampler_entry *entry = &key->sampler[key->sampler_count];
+   memset(last_entry_end, 0, (char*)entry - last_entry_end);
 }
 
 /* All samplers must be uploaded in a single contiguous array, which

[-- 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:13 UTC|newest]

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

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=4BD4A01E.5010406@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.