<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 2, 2017 at 4:37 PM, 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"><span class="">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>
</span>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></blockquote><div><br></div><div>Yeah, that seems better.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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>
</blockquote></div><br></div><div class="gmail_extra">Mostly, every time I see a "struct foo * const thing", I mentally trip over C pointer constness syntax trying to figure out what it means. To me, the mental cost is high enough that it's not worth it for the tiny bit of extra safety. It's also more typing. In general, I tend to disagree with the philosophy of "anything that can be const should be." I think constness is useful for communicating whether or not a function modifies a pointer and if you're doing complicated calculations with piles of variables and you want to make it clear (and compile-checked!) that you don't overwrite one of them. Outside of that, I'd rather just drop the clutter. There have been very few times when I've actually found a bug that would have been solved by const when it hasn't been one of those two cases.<br><br></div><div class="gmail_extra">--Jason<br></div></div>