<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, May 11, 2017 at 10:13 AM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><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 Tue, May 02, 2017 at 05:23:49PM -0700, Jason Ekstrand wrote:<br>
> On Tue, May 2, 2017 at 4:37 PM, Nanley Chery <<a href="mailto:nanleychery@gmail.com">nanleychery@gmail.com</a>> wrote:<br>
><br>
> > On Tue, May 02, 2017 at 04:25:42PM -0700, Jason Ekstrand wrote:<br>
> > > On Thu, Apr 27, 2017 at 11:32 AM, Nanley Chery <<a href="mailto:nanleychery@gmail.com">nanleychery@gmail.com</a>><br>
> > > wrote:<br>
> > ><br>
> > > > Signed-off-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
> > > > ---<br>
> > > >  src/intel/vulkan/genX_cmd_<wbr>buffer.c | 18 +++++++++++++++---<br>
> > > >  1 file changed, 15 insertions(+), 3 deletions(-)<br>
> > > ><br>
> > > > diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > > > b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > > > index 0ea378fde2..a981b00f67 100644<br>
> > > > --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > > > +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > > > @@ -216,7 +216,7 @@ color_is_zero_one(<wbr>VkClearColorValue value, enum<br>
> > > > isl_format format)<br>
> > > >  }<br>
> > > ><br>
> > > >  static void<br>
> > > > -color_attachment_compute_aux_<wbr>usage(struct anv_device *device,<br>
> > > > +color_attachment_compute_aux_<wbr>usage(struct anv_cmd_buffer * const<br>
> > > > cmd_buffer,<br>
> > > ><br>
> > ><br>
> > > I t may be better to just pass in the framebuffer and attachment index<br>
> > > rather than the whole command buffer.  Slso, I think you're getting a bit<br>
> > > over-excited with the constness. :-)<br>
> > ><br>
> > ><br>
> ><br>
> > The command buffer is used to look up the render pass in the next patch.<br>
> > If you'd like me to pass in the render pass and framebuffer I could do<br>
> > that alternatively.<br>
> ><br>
><br>
> Yeah, that seems better.<br>
><br>
><br>
<br>
</div></div>The final result will be:<br>
        color_attachment_compute_aux_<wbr>usage(struct anv_device * device,<br>
                                           struct anv_framebuffer * framebuffer,<br>
                                           struct anv_render_pass * pass,<br>
                                           struct anv_attachment_state *att_state,<br>
                                           const uint32_t att, VkRect2D render_area,<br>
                                           union isl_color_value *fast_clear_color)<br></blockquote><div><br></div><div>That's not a problem.  Function arguments are cheap.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Is that okay? Looks like I should pass in the cmd_state instead of the<br>
framebuffer and render_pass.<br>
<span class=""><br>
> > At one point I considered creating a keyboard shortcut to make typing<br>
> > 'const' easier :). I'm open to hearing your thoughts about our use of it<br>
> > though.<br>
> ><br>
><br>
> Mostly, every time I see a "struct foo * const thing", I mentally trip over<br>
> C pointer constness syntax trying to figure out what it means.  To me, the<br>
> mental cost is high enough that it's not worth it for the tiny bit of extra<br>
> safety.  It's also more typing.  In general, I tend to disagree with the<br>
> philosophy of "anything that can be const should be."  I think constness is<br>
> useful for communicating whether or not a function modifies a pointer and<br>
> if you're doing complicated calculations with piles of variables and you<br>
> want to make it clear (and compile-checked!) that you don't overwrite one<br>
> of them.  Outside of that, I'd rather just drop the clutter.  There have<br>
> been very few times when I've actually found a bug that would have been<br>
> solved by const when it hasn't been one of those two cases.<br>
><br>
> --Jason<br>
<br>
</span>Gotcha.<br>
</blockquote></div><br></div></div>