<div dir="ltr">On 20 August 2013 01:20, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 08/18/2013 05:58 PM, Kenneth Graunke wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 08/15/2013 10:52 PM, Paul Berry wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 14 August 2013 18:55, Kenneth Graunke <<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a><br>
<mailto:<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>><u></u>> wrote:<br>
<br>
Now that we have the number of samplers available, we don't need to<br>
iterate over all 16. This should be particularly helpful for vertex<br>
shaders.<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a><br>
<mailto:<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>><u></u>><br>
---<br>
src/mesa/drivers/dri/i965/brw_<u></u>fs.cpp | 2 +-<br>
src/mesa/drivers/dri/i965/brw_<u></u>vs.c | 2 +-<br>
2 files changed, 2 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_fs.cpp<br>
b/src/mesa/drivers/dri/i965/<u></u>brw_fs.cpp<br>
index 69e544a..27263fd 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_fs.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_fs.cpp<br>
@@ -3143,7 +3143,7 @@ brw_fs_precompile(struct gl_context *ctx,<br>
struct gl_shader_program *prog)<br>
<br>
key.clamp_fragment_color = ctx->API == API_OPENGL_COMPAT;<br>
<br>
- for (int i = 0; i < MAX_SAMPLERS; i++) {<br>
+ for (unsigned i = 0; i < brw->wm.sampler_count; i++) {<br>
<br>
<br>
Precompile is called during link, before the program is made current.<br>
So brw->wm is some other program. I think you need to do this instead:<br>
_mesa_fls(fp->Base.<u></u>SamplersUsed).<br>
<br>
if (fp->Base.ShadowSamplers & (1 << i)) {<br>
/* Assume DEPTH_TEXTURE_MODE is the default: X, X, X, 1 */<br>
key.tex.swizzles[i] =<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_vs.c<br>
b/src/mesa/drivers/dri/i965/<u></u>brw_vs.c<br>
index 5b8173d..7df93c2 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_vs.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_vs.c<br>
@@ -544,7 +544,7 @@ brw_vs_precompile(struct gl_context *ctx, struct<br>
gl_shader_program *prog)<br>
key.base.program_string_id = bvp->id;<br>
key.base.clamp_vertex_color = ctx->API == API_OPENGL_COMPAT;<br>
<br>
- for (int i = 0; i < MAX_SAMPLERS; i++) {<br>
+ for (unsigned i = 0; i < brw->vs.sampler_count; i++) {<br>
<br>
<br>
Similarly, this should be _mesa_fls(vp->Base.<u></u>SamplersUsed).<br>
<br>
With those fixes, this patch is:<br>
<br>
Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a><br>
<mailto:<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.<u></u>com</a>>><br>
</blockquote>
<br>
Yikes, you're right. I think I'll just drop this patch - it's not worth<br>
the complexity, especially since I doubt there's any measureable benefit.<br>
<br>
--Ken<br>
</blockquote>
<br></div></div>
I take that back. Both patches need to land, or neither...otherwise precompile sets everything to XYZW, but the actual key setup sets them to 0, and we get pointless recompiles.<br></blockquote><div><br></div><div>Ouch! That detail completely eluded me. Thanks for checking :)<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I've gone ahead and pushed a corrected version of this patch so they match.<br>
</blockquote></div><br></div></div>