<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Aug 9, 2018 at 3:03 PM Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, Aug 8, 2018 at 11:31 AM Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>> wrote:<br>
><br>
> The Vulkan 1.1.82 spec flipped the order to better match D3D.<br>
><br>
> Cc: <a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop.org</a><br>
> ---<br>
> src/intel/blorp/blorp_blit.c | 11 ++++++++++-<br>
> src/intel/common/gen_sample_positions.h | 8 ++++----<br>
> src/mesa/drivers/dri/i965/brw_multisample_state.h | 8 ++++----<br>
> src/mesa/drivers/dri/i965/gen6_multisample_state.c | 4 ++--<br>
> 4 files changed, 20 insertions(+), 11 deletions(-)<br>
><br>
> diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c<br>
> index 561897894c3..013f7a14fa2 100644<br>
> --- a/src/intel/blorp/blorp_blit.c<br>
> +++ b/src/intel/blorp/blorp_blit.c<br>
> @@ -776,6 +776,13 @@ blorp_nir_manual_blend_bilinear(nir_builder *b, nir_ssa_def *pos,<br>
> * grid of samples with in a pixel. Sample number layout shows the<br>
> * rectangular grid of samples roughly corresponding to the real sample<br>
> * locations with in a pixel.<br>
> + *<br>
> + * In the case of 2x MSAA, the layout of sample indices is reversed from<br>
> + * the layout of sample numbers:<br>
It is not clear from this comment if below layout is for sample index or sample<br>
number. Adding "sample number layout:" on top of it will help.<br></blockquote><div><br></div><div>I've updated it to look more like the 8x case where we have two tables.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> + * ---------<br>
> + * | 1 | 0 |<br>
> + * ---------<br>
> + *<br>
> * In case of 4x MSAA, layout of sample indices matches the layout of<br>
> * sample numbers:<br>
> * ---------<br>
> @@ -819,7 +826,9 @@ blorp_nir_manual_blend_bilinear(nir_builder *b, nir_ssa_def *pos,<br>
> key->x_scale * key->y_scale));<br>
> sample = nir_f2i32(b, sample);<br>
><br>
> - if (tex_samples == 8) {<br>
> + if (tex_samples == 2) {<br>
> + sample = nir_isub(b, nir_imm_int(b, 1), sample);<br>
> + } else if (tex_samples == 8) {<br>
> sample = nir_iand(b, nir_ishr(b, nir_imm_int(b, 0x64210573),<br>
> nir_ishl(b, sample, nir_imm_int(b, 2))),<br>
> nir_imm_int(b, 0xf));<br>
> diff --git a/src/intel/common/gen_sample_positions.h b/src/intel/common/gen_sample_positions.h<br>
> index f0ce95dd1fb..da48dcb5ed0 100644<br>
> --- a/src/intel/common/gen_sample_positions.h<br>
> +++ b/src/intel/common/gen_sample_positions.h<br>
> @@ -42,10 +42,10 @@ prefix##0YOffset = 0.5;<br>
> * c 1<br>
> */<br>
> #define GEN_SAMPLE_POS_2X(prefix) \<br>
> -prefix##0XOffset = 0.25; \<br>
> -prefix##0YOffset = 0.25; \<br>
> -prefix##1XOffset = 0.75; \<br>
> -prefix##1YOffset = 0.75;<br>
> +prefix##0XOffset = 0.75; \<br>
> +prefix##0YOffset = 0.75; \<br>
> +prefix##1XOffset = 0.25; \<br>
> +prefix##1YOffset = 0.25;<br>
><br>
> /**<br>
> * Sample positions:<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_multisample_state.h b/src/mesa/drivers/dri/i965/brw_multisample_state.h<br>
> index 6cf324e561c..2142a17a484 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_multisample_state.h<br>
> +++ b/src/mesa/drivers/dri/i965/brw_multisample_state.h<br>
> @@ -38,13 +38,13 @@<br>
> /**<br>
> * 1x MSAA has a single sample at the center: (0.5, 0.5) -> (0x8, 0x8).<br>
> *<br>
> - * 2x MSAA sample positions are (0.25, 0.25) and (0.75, 0.75):<br>
> + * 2x MSAA sample positions are (0.75, 0.75) and (0.25, 0.25):<br>
> * 4 c<br>
> - * 4 0<br>
> - * c 1<br>
> + * 4 1<br>
> + * c 0<br>
> */<br>
> static const uint32_t<br>
> -brw_multisample_positions_1x_2x = 0x0088cc44;<br>
> +brw_multisample_positions_1x_2x = 0x008844cc;<br>
><br>
> /**<br>
> * Sample positions:<br>
> diff --git a/src/mesa/drivers/dri/i965/gen6_multisample_state.c b/src/mesa/drivers/dri/i965/gen6_multisample_state.c<br>
> index bfa84fb9b77..78ff3942075 100644<br>
> --- a/src/mesa/drivers/dri/i965/gen6_multisample_state.c<br>
> +++ b/src/mesa/drivers/dri/i965/gen6_multisample_state.c<br>
> @@ -70,7 +70,7 @@ gen6_get_sample_position(struct gl_context *ctx,<br>
> *<br>
> * 2X MSAA sample index / number layout<br>
You should update this comment matching it up with comment in blorp and<br>
add "sample number layout:" on top of below layout. I would leave it up to<br>
you if you also want to draw sample index layout here just for uniformity.<br></blockquote><div><br></div><div>Made the same change here.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> * ---------<br>
> - * | 0 | 1 |<br>
> + * | 1 | 0 |<br>
> * ---------<br>
> *<br>
> * 4X MSAA sample index / number layout<br>
> @@ -107,7 +107,7 @@ gen6_get_sample_position(struct gl_context *ctx,<br>
> void<br>
> gen6_set_sample_maps(struct gl_context *ctx)<br>
> {<br>
> - uint8_t map_2x[2] = {0, 1};<br>
> + uint8_t map_2x[2] = {1, 0};<br>
> uint8_t map_4x[4] = {0, 1, 2, 3};<br>
> uint8_t map_8x[8] = {3, 7, 5, 0, 1, 2, 4, 6};<br>
> uint8_t map_16x[16] = { 15, 10, 9, 7, 4, 1, 3, 13,<br>
> --<br>
> 2.17.1<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
<br>
With above changes<br>
Reviewed-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>><br></blockquote><div><br></div><div>Thanks! <br></div></div></div>