summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-05-05 14:27:23 -0700
committerJason Ekstrand <[email protected]>2016-05-14 13:34:53 -0700
commite503da61c6f0f7ba7f9500145ec44465cb3f87b7 (patch)
tree7bc4b99d1bfad2d4c9cc7785b3dfaa1d782cda4f /src
parent8636937dd674c89687f6b32440089b62bc52fd4e (diff)
i965/blorp: Refactor coordinate munging
The original code-flow tried to map original blorp. This puts things more where they belong and simplifies some of the logic. Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_blit.cpp59
1 files 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 f8064f3f811..3e5b073a434 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -1339,12 +1339,6 @@ brw_blorp_build_nir_shader(struct brw_context *brw,
src_pos = blorp_blit_apply_transform(&b, nir_i2f(&b, dst_pos), &v);
- 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(&b, 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.
*/
@@ -1356,6 +1350,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(&b, src_pos);
+
if (brw->gen == 6) {
/* Because gen6 only supports 4x interleved MSAA, we can do all the
* blending we need with a single linear-interpolated texture lookup
@@ -1377,33 +1374,35 @@ brw_blorp_build_nir_shader(struct brw_context *brw,
} else if (key->blend && key->blit_scaled) {
color = blorp_nir_manual_blend_bilinear(&b, src_pos, key->src_samples, key, &v);
} 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(&b, 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(&b, src_pos);
- /* Now (X, Y, S) = detile(tex_tiling, offset) */
- src_pos = blorp_nir_decode_msaa(&b, src_pos, key->tex_samples,
- key->tex_layout);
- }
-
if (key->bilinear_filter) {
color = blorp_nir_tex(&b, src_pos, key->texture_data_type);
} else {
+ /* We're going to use texelFetch, so we need integers */
+ src_pos = nir_f2i(&b, 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(&b, 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(&b, src_pos);
+ /* Now (X, Y, S) = detile(tex_tiling, offset) */
+ src_pos = blorp_nir_decode_msaa(&b, 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