Re: [Mesa-dev] [PATCH 27/28] i965/blorp: Refactor coordinate munging

2016-05-13 Thread Pohjolainen, Topi
On Tue, May 10, 2016 at 04:16:47PM -0700, Jason Ekstrand wrote:
> The original code-flow tried to map original blorp.  This puts things more
> where they belong and simplifies some of the logic.

Nice, this was one of the things that gave me a headache in the original.
It was troublesome to check which combination of branches was possible to be
taken.

Reviewed-by: Topi Pohjolainen 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 27/28] i965/blorp: Refactor coordinate munging

2016-05-10 Thread Jason Ekstrand
The original code-flow tried to map original blorp.  This puts things more
where they belong and simplifies some of the logic.
---
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 59 ++--
 1 file changed, 29 insertions(+), 30 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp 
b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index c4d80a7..d1c39b0 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -1317,12 +1317,6 @@ brw_blorp_build_nir_shader(struct brw_context *brw,
 
src_pos = blorp_blit_apply_transform(, nir_i2f(, dst_pos), );
 
-   if (key->blit_scaled && key->blend) {
-   } else if (!key->bilinear_filter) {
-  /* We're going to use a texelFetch, so we need integers */
-  src_pos = nir_f2i(, src_pos);
-   }
-
/* If the source image is not multisampled, then we want to fetch sample
 * number 0, because that's the only sample there is.
 */
@@ -1334,6 +1328,9 @@ brw_blorp_build_nir_shader(struct brw_context *brw,
 * irrelevant, because we are going to fetch all samples.
 */
if (key->blend && !key->blit_scaled) {
+  /* Resolves (effecively) use texelFetch, so we need integers */
+  src_pos = nir_f2i(, src_pos);
+
   if (brw->gen == 6) {
  /* When looking up samples in an MSAA texture using the SAMPLE
   * message, Gen6 requires the texture coordinates to be odd integers
@@ -1354,33 +1351,35 @@ brw_blorp_build_nir_shader(struct brw_context *brw,
} else if (key->blend && key->blit_scaled) {
   color = blorp_nir_manual_blend_bilinear(, src_pos, key->src_samples, 
key, );
} else {
-  /* We aren't blending, which means we just want to fetch a single sample
-   * from the source surface.  The address that we want to fetch from is
-   * related to the X, Y and S values according to the formula:
-   *
-   * (X, Y, S) = decode_msaa(src_samples, detile(src_tiling, offset)).
-   *
-   * If the actual tiling and sample count of the source surface are not
-   * the same as the configuration of the texture, then we need to adjust
-   * the coordinates to compensate for the difference.
-   */
-  if ((tex_tiled_w != key->src_tiled_w ||
-   key->tex_samples != key->src_samples ||
-   key->tex_layout != key->src_layout) &&
-  !key->bilinear_filter) {
- src_pos = blorp_nir_encode_msaa(, src_pos, key->src_samples,
- key->src_layout);
- /* Now (X, Y, S) = detile(src_tiling, offset) */
- if (tex_tiled_w != key->src_tiled_w)
-src_pos = blorp_nir_retile_w_to_y(, src_pos);
- /* Now (X, Y, S) = detile(tex_tiling, offset) */
- src_pos = blorp_nir_decode_msaa(, src_pos, key->tex_samples,
- key->tex_layout);
-  }
-
   if (key->bilinear_filter) {
  color = blorp_nir_tex(, src_pos, key->texture_data_type);
   } else {
+ /* We're going to use texelFetch, so we need integers */
+ src_pos = nir_f2i(, src_pos);
+
+ /* We aren't blending, which means we just want to fetch a single
+  * sample from the source surface.  The address that we want to fetch
+  * from is related to the X, Y and S values according to the formula:
+  *
+  * (X, Y, S) = decode_msaa(src_samples, detile(src_tiling, offset)).
+  *
+  * If the actual tiling and sample count of the source surface are
+  * not the same as the configuration of the texture, then we need to
+  * adjust the coordinates to compensate for the difference.
+  */
+ if (tex_tiled_w != key->src_tiled_w ||
+ key->tex_samples != key->src_samples ||
+ key->tex_layout != key->src_layout) {
+src_pos = blorp_nir_encode_msaa(, src_pos, key->src_samples,
+key->src_layout);
+/* Now (X, Y, S) = detile(src_tiling, offset) */
+if (tex_tiled_w != key->src_tiled_w)
+   src_pos = blorp_nir_retile_w_to_y(, src_pos);
+/* Now (X, Y, S) = detile(tex_tiling, offset) */
+src_pos = blorp_nir_decode_msaa(, src_pos, key->tex_samples,
+key->tex_layout);
+ }
+
  /* Now (X, Y, S) = decode_msaa(tex_samples, detile(tex_tiling, 
offset)).
   *
   * In other words: X, Y, and S now contain values which, when passed 
to
-- 
2.5.0.400.gff86faf

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev