From d8c8f4203f8bb18152af0d0c120f3582a93c07c2 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 5 Apr 2016 22:32:45 -0700 Subject: i965: Fix interpolateAtSample() on single sampled buffers. Fixes dEQP-GLES31.functional.shaders.multisample_interpolation tests: - interpolate_at_sample.non_multisample_buffer.sample_n_default_framebuffer - interpolate_at_sample.non_multisample_buffer.sample_n_singlesample_rbo - interpolate_at_sample.non_multisample_buffer.sample_n_singlesample_texture Signed-off-by: Kenneth Graunke Reviewed-by: Matt Turner --- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 492469b75e9..cf4f782aa28 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -2081,6 +2081,7 @@ fs_visitor::nir_emit_fs_intrinsic(const fs_builder &bld, assert(stage == MESA_SHADER_FRAGMENT); struct brw_wm_prog_data *wm_prog_data = (struct brw_wm_prog_data *) prog_data; + const struct brw_wm_prog_key *wm_key = (const struct brw_wm_prog_key *) key; fs_reg dest; if (nir_intrinsic_infos[instr->intrinsic].has_dest) @@ -2175,6 +2176,20 @@ fs_visitor::nir_emit_fs_intrinsic(const fs_builder &bld, break; case nir_intrinsic_interp_var_at_sample: { + if (!wm_key->multisample_fbo) { + /* From the ARB_gpu_shader5 specification: + * "If multisample buffers are not available, the input varying + * will be evaluated at the center of the pixel." + */ + emit_pixel_interpolater_send(bld, + FS_OPCODE_INTERPOLATE_AT_CENTROID, + dst_xy, + fs_reg(), /* src */ + brw_imm_ud(0u), + interpolation); + break; + } + nir_const_value *const_sample = nir_src_as_const_value(instr->src[0]); if (const_sample) { -- cgit v1.2.3