summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_fs.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-09-14 10:04:47 -0700
committerJason Ekstrand <[email protected]>2016-09-15 13:31:27 -0700
commit114874b22beafb2d07006b197c62d717fc7f80cc (patch)
treeaa7fc0a4eb39c36a58afb72a9d83d873500e1006 /src/mesa/drivers/dri/i965/brw_fs.cpp
parent0d2eb8c14d8c791603cb60cb56ed468ee49543ad (diff)
i965/fs: Use sample interpolation for interpolateAtCentroid in persample mode
From the ARB_gpu_shader5 spec: The built-in functions interpolateAtCentroid() and interpolateAtSample() will sample variables as though they were declared with the "centroid" or "sample" qualifiers, respectively. When running with persample dispatch forced by the API, we interpolate anything that isn't flat as if it's qualified by "sample". In order to keep interpolateAtCentroid() consistent with the "centroid" qualifier, we need to make interpolateAtCentroid() do sample interpolation instead. Nothing in the GLSL spec guarantees that the result of interpolateAtCentroid is uniform across samples in any way, so this is a perfectly fine thing to do. Fixes 8 of the new dEQP-VK.pipeline.multisample_interpolation.* Vulkan CTS tests that specifically validate consistency between the "sample" qualifier and interpolateAtSample() Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index c858f449c8f..2283cffb83b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -6414,6 +6414,32 @@ brw_nir_set_default_interpolation(const struct gen_device_info *devinfo,
var->data.sample = false;
}
}
+
+ if (per_sample_interpolation) {
+ nir_foreach_block(block, nir_shader_get_entrypoint(nir)) {
+ nir_foreach_instr(instr, block) {
+ if (instr->type != nir_instr_type_intrinsic)
+ continue;
+
+ nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
+ if (intrin->intrinsic != nir_intrinsic_interp_var_at_centroid)
+ continue;
+
+ nir_variable *var = intrin->variables[0]->var;
+ if (var->data.interpolation == INTERP_MODE_FLAT)
+ continue;
+
+ /* The description of the interpolateAtCentroid intrinsic is that
+ * it interpolates the variable as if it had the "centroid"
+ * qualifier. When executing with per_sample_interpolation, this
+ * is equivalent to having the "sample" qualifier. Just convert
+ * it to a load_var instead.
+ */
+ assert(var->data.sample);
+ intrin->intrinsic = nir_intrinsic_load_var;
+ }
+ }
+ }
}
/**