<p dir="ltr"><br>
On May 10, 2016 11:53 PM, "Pohjolainen, Topi" <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>> wrote:<br>
><br>
> On Tue, May 10, 2016 at 04:16:35PM -0700, Jason Ekstrand wrote:<br>
> > This array allows the push constants to be re-arranged on upload. The<br>
> > actual arrangement will, eventually, come from the back-end compiler.<br>
> > ---<br>
> > src/mesa/drivers/dri/i965/brw_blorp.c | 4 ++++<br>
> > src/mesa/drivers/dri/i965/brw_blorp.h | 6 ++++++<br>
> > src/mesa/drivers/dri/i965/gen6_blorp.c | 12 +++++++-----<br>
> > 3 files changed, 17 insertions(+), 5 deletions(-)<br>
> ><br>
> > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> > index 4bbe45f..1379804 100644<br>
> > --- a/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> > +++ b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> > @@ -139,6 +139,10 @@ brw_blorp_prog_data_init(struct brw_blorp_prog_data *prog_data)<br>
> > {<br>
> > prog_data->first_curbe_grf = 0;<br>
> > prog_data->persample_msaa_dispatch = false;<br>
> > +<br>
> > + prog_data->nr_params = BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS;<br>
> > + for (unsigned i = 0; i < BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS; i++)<br>
> > + prog_data->param[i] = i;<br>
> > }<br>
> ><br>
> ><br>
> > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> > index 4a0e46e..c2f33a1 100644<br>
> > --- a/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> > +++ b/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> > @@ -199,6 +199,9 @@ struct brw_blorp_wm_push_constants<br>
> > uint32_t pad[5];<br>
> > };<br>
> ><br>
> > +#define BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS \<br>
> > + (sizeof(struct brw_blorp_wm_push_constants) / 4)<br>
> > +<br>
> > /* Every 32 bytes of push constant data constitutes one GEN register. */<br>
> > static const unsigned int BRW_BLORP_NUM_PUSH_CONST_REGS =<br>
> > sizeof(struct brw_blorp_wm_push_constants) / 32;<br>
> > @@ -212,6 +215,9 @@ struct brw_blorp_prog_data<br>
> > * than one sample per pixel.<br>
> > */<br>
> > bool persample_msaa_dispatch;<br>
> > +<br>
> > + uint8_t nr_params;<br>
> > + uint8_t param[BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS];<br>
><br>
> Do I read this correctly: this corresponds to push_contant_loc in the scalar<br>
> backend?</p>
<p dir="ltr">Sort-of. The mapping actually goes in the other direction: From location to uniform number.</p>
<p dir="ltr">> > };<br>
> ><br>
> > void brw_blorp_prog_data_init(struct brw_blorp_prog_data *prog_data);<br>
> > diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.c b/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
> > index 1955811..950e2b9 100644<br>
> > --- a/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
> > +++ b/src/mesa/drivers/dri/i965/gen6_blorp.c<br>
> > @@ -308,11 +308,13 @@ gen6_blorp_emit_wm_constants(struct brw_context *brw,<br>
> > {<br>
> > uint32_t wm_push_const_offset;<br>
> ><br>
> > - void *constants = brw_state_batch(brw, AUB_TRACE_WM_CONSTANTS,<br>
> > - sizeof(params->wm_push_consts),<br>
> > - 32, &wm_push_const_offset);<br>
> > - memcpy(constants, ¶ms->wm_push_consts,<br>
> > - sizeof(params->wm_push_consts));<br>
> > + uint32_t *constants = brw_state_batch(brw, AUB_TRACE_WM_CONSTANTS,<br>
> > + sizeof(params->wm_push_consts),<br>
> > + 32, &wm_push_const_offset);<br>
> > +<br>
> > + uint32_t *push_consts = (uint32_t *)¶ms->wm_push_consts;<br>
> > + for (unsigned i = 0; i < params->wm_prog_data->nr_params; i++)<br>
> > + constants[i] = push_consts[params->wm_prog_data->param[i]];<br>
> ><br>
> > return wm_push_const_offset;<br>
> > }<br>
> > --<br>
> > 2.5.0.400.gff86faf<br>
> ><br>
> > _______________________________________________<br>
> > mesa-dev mailing list<br>
> > <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> > <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>