<div dir="ltr">looks good<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 24, 2017 at 12:06 AM, Jordan Justen <span dir="ltr"><<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2017-10-23 19:48:51, Jason Ekstrand wrote:<br>
><br>
> On Sun, Oct 22, 2017 at 1:01 PM, Jordan Justen <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>><br>
> wrote:<br>
><br>
</span><span class="">> > + #define SET_UPLOAD_PARAMS(sh, sh_caps, prog) \<br>
> > + do { \<br>
> > + prog_key.sh.program_string_id = prog->id; \<br>
> > + cache_id = BRW_CACHE_##sh_caps##_PROG; \<br>
> > + max_threads = devinfo->max_##sh##_threads; \<br>
> > + stage_state = &brw->sh.base; \<br>
> > + } while(0)<br>
> > +<br>
> > + switch (stage) {<br>
> > + case MESA_SHADER_VERTEX: {<br>
> > + struct brw_program *vp = (struct brw_program *) prog;<br>
> ><br>
><br>
> I think you can move the cast inside the macro. It's all brw_program as<br>
> far as I can see.<br>
><br>
><br>
> > + SET_UPLOAD_PARAMS(vs, VS, vp);<br>
> > + break;<br>
> > + }<br>
<br>
</span>Yeah, it looks like it can be simplified:<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_disk_cache.c b/src/mesa/drivers/dri/i965/<wbr>brw_disk_cache.c<br>
index 9b5e0c3e078..f3b2a6f9b51 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_disk_cache.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_disk_cache.c<br>
@@ -228,45 +228,33 @@ read_and_upload(struct brw_context *brw, struct disk_cache *cache,<br>
unsigned max_threads;<br>
struct brw_stage_state *stage_state;<br>
<br>
- #define SET_UPLOAD_PARAMS(sh, sh_caps, prog) \<br>
+ #define SET_UPLOAD_PARAMS(sh, sh_caps) \<br>
do { \<br>
- prog_key.sh.program_string_id = prog->id; \<br>
+ prog_key.sh.program_string_id = brw_program(prog)->id; \<br>
cache_id = BRW_CACHE_##sh_caps##_PROG; \<br>
max_threads = devinfo->max_##sh##_threads; \<br>
stage_state = &brw->sh.base; \<br>
} while(0)<br>
<br>
switch (stage) {<br>
- case MESA_SHADER_VERTEX: {<br>
- struct brw_program *vp = (struct brw_program *) prog;<br>
- SET_UPLOAD_PARAMS(vs, VS, vp);<br>
+ case MESA_SHADER_VERTEX:<br>
+ SET_UPLOAD_PARAMS(vs, VS);<br>
break;<br>
- }<br>
- case MESA_SHADER_TESS_CTRL: {<br>
- struct brw_program *tcp = (struct brw_program *) prog;<br>
- SET_UPLOAD_PARAMS(tcs, TCS, tcp);<br>
+ case MESA_SHADER_TESS_CTRL:<br>
+ SET_UPLOAD_PARAMS(tcs, TCS);<br>
break;<br>
- }<br>
- case MESA_SHADER_TESS_EVAL: {<br>
- struct brw_program *tep = (struct brw_program *) prog;<br>
- SET_UPLOAD_PARAMS(tes, TES, tep);<br>
+ case MESA_SHADER_TESS_EVAL:<br>
+ SET_UPLOAD_PARAMS(tes, TES);<br>
break;<br>
- }<br>
- case MESA_SHADER_GEOMETRY: {<br>
- struct brw_program *gp = (struct brw_program *) prog;<br>
- SET_UPLOAD_PARAMS(gs, GS, gp);<br>
+ case MESA_SHADER_GEOMETRY:<br>
+ SET_UPLOAD_PARAMS(gs, GS);<br>
break;<br>
- }<br>
- case MESA_SHADER_FRAGMENT: {<br>
- struct brw_program *wp = (struct brw_program *) prog;<br>
- SET_UPLOAD_PARAMS(wm, FS, wp);<br>
+ case MESA_SHADER_FRAGMENT:<br>
+ SET_UPLOAD_PARAMS(wm, FS);<br>
break;<br>
- }<br>
- case MESA_SHADER_COMPUTE: {<br>
- struct brw_program *cp = (struct brw_program *) prog;<br>
- SET_UPLOAD_PARAMS(cs, CS, cp);<br>
+ case MESA_SHADER_COMPUTE:<br>
+ SET_UPLOAD_PARAMS(cs, CS);<br>
break;<br>
- }<br>
default:<br>
unreachable("Unsupported stage!");<br>
}<br>
</blockquote></div><br></div>