* [PATCH] for mesa: Fill the padding between entrys in the sampler key
@ 2010-04-25 19:56 Pierre Willenbrock
2010-04-25 20:03 ` Pierre Willenbrock
0 siblings, 1 reply; 2+ messages in thread
From: Pierre Willenbrock @ 2010-04-25 19:56 UTC (permalink / raw)
To: intel-gfx@lists.freedesktop.org
[-- 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] for mesa: Fill the padding between entrys in the sampler key
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
0 siblings, 0 replies; 2+ messages in thread
From: Pierre Willenbrock @ 2010-04-25 20:03 UTC (permalink / raw)
To: intel-gfx@lists.freedesktop.org
[-- 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-25 20:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.