OSDN Git Service

blorp: Use normalized coordinates on Gen6
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 6 Jun 2017 00:34:38 +0000 (17:34 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 26 Jun 2017 20:41:11 +0000 (13:41 -0700)
Apparently, the sampler has some sort of precision issues for
non-normalized texture coordinates with linear filtering.  This caused
some small precision issues in scaled blits.  Work around this by using
normalized coordinates.  There is some extra work necessary because Gen6
uses TEX (instead of TXF) for some multisample resolve blits.

Fixes piglit.spec.arb_framebuffer_object.fbo-blit-stretch on SNB.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68365
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
src/intel/blorp/blorp_blit.c
src/intel/blorp/blorp_genX_exec.h

index f552302..0850473 100644 (file)
@@ -1195,9 +1195,10 @@ brw_blorp_build_nir_shader(struct blorp_context *blorp, void *mem_ctx,
           * representing the four samples that maxe up a pixel.  So we need
           * to multiply our X and Y coordinates each by 2 and then add 1.
           */
-         src_pos = nir_ishl(&b, src_pos, nir_imm_int(&b, 1));
-         src_pos = nir_iadd(&b, src_pos, nir_imm_int(&b, 1));
-         src_pos = nir_i2f32(&b, src_pos);
+         assert(key->src_coords_normalized);
+         src_pos = nir_fadd(&b,
+                            nir_i2f32(&b, src_pos),
+                            nir_imm_float(&b, 0.5f));
          color = blorp_nir_tex(&b, &v, key, src_pos);
       } else {
          /* Gen7+ hardware doesn't automaticaly blend. */
@@ -1825,7 +1826,9 @@ try_blorp_blit(struct blorp_batch *batch,
 
    params->num_samples = params->dst.surf.samples;
 
-   if (wm_prog_key->bilinear_filter && batch->blorp->isl_dev->info->gen < 6) {
+   if ((wm_prog_key->bilinear_filter ||
+        (wm_prog_key->blend && !wm_prog_key->blit_scaled)) &&
+       batch->blorp->isl_dev->info->gen <= 6) {
       /* Gen4-5 don't support non-normalized texture coordinates */
       wm_prog_key->src_coords_normalized = true;
       params->wm_inputs.src_inv_size[0] =
index 1d77877..91c0756 100644 (file)
@@ -535,7 +535,7 @@ blorp_emit_sampler_state(struct blorp_batch *batch,
       sampler.VAddressMagFilterRoundingEnable = true;
       sampler.UAddressMinFilterRoundingEnable = true;
       sampler.UAddressMagFilterRoundingEnable = true;
-#if GEN_GEN >= 6
+#if GEN_GEN > 6
       sampler.NonnormalizedCoordinateEnable = true;
 #endif
    }