[Mesa-dev] [RFC] intel/isl: Rewrite gen7_choose_image_alignment_el
Jason Ekstrand
jason at jlekstrand.net
Wed May 10 15:38:05 UTC 2017
On Wed, May 10, 2017 at 8:26 AM, Emil Velikov <emil.l.velikov at gmail.com>
wrote:
> Hi Jason,
>
> Humble unrelated question.
>
> On 9 May 2017 at 18:00, Jason Ekstrand <jason at jlekstrand.net> wrote:
>
> > + if (isl_surf_usage_is_depth(info->usage)) {
> > + if (info->format == ISL_FORMAT_R16_UNORM) {
> > + return isl_extent3d(8, 4, 1);
> > + } else {
> > + return isl_extent3d(4, 4, 1);
> > + }
> > + } else if (isl_surf_usage_is_stencil(info->usage)) {
> > + return isl_extent3d(8, 8, 1);
> > + } else if (isl_format_is_compressed(info->format)) {
> > + /* Compressed formats all have alignment equal to block size. */
> > + return isl_extent3d(1, 1, 1);
> > + }
>
> I've seen a handful of constructs like the above.. Is there any reason
> to keep the extra else/curly brackets?
> Something like the following reads a bit easier yet admittedly I'm not
> the person to set the coding style in isl.
>
Does it?
> if (isl_surf_usage_is_depth(info->usage)) {
> if (info->format == ISL_FORMAT_R16_UNORM)
> return isl_extent3d(8, 4, 1);
>
> return isl_extent3d(4, 4, 1);
>
Yeah, I definitely don't like this one. It really is an if-else so I'd
rather writ it that way.
> }
>
> if (isl_surf_usage_is_stencil(info->usage))
> return isl_extent3d(8, 8, 1);
>
> /* Compressed formats all have alignment equal to block size. */
> if (isl_format_is_compressed(info->format))
> return isl_extent3d(1, 1, 1);
>
Eh, I don't know if that's actually cleaner or not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170510/4d64fc93/attachment.html>
More information about the mesa-dev
mailing list