anv/lower_input_attachments: honor sample index parameter to subpassLoad()
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 25 Jan 2017 14:04:35 +0000 (15:04 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 26 Jan 2017 07:11:21 +0000 (08:11 +0100)
According to GL_KHR_vulkan_glsl, the signature of subpassLoad() is:

gvec4 subpassLoad(gsubpassInput   subpass);
gvec4 subpassLoad(gsubpassInputMS subpass, int sample);

So the multisampled case always receives an explicit sample index that we
should use. The current implementation was ignoring this parameter
and using gl_SampleID value instead.

Fixes:
dEQP-VK.pipeline.multisample_shader_builtin.sample_id.*

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
src/intel/vulkan/anv_nir_lower_input_attachments.c

index 1d6f727258a8df4574e095aa632dbe6a7c75cba9..244e7ff7ae1c3ec2a26ac73bf32a239c15ccc686 100644 (file)
@@ -100,11 +100,8 @@ try_lower_input_load(nir_function_impl *impl, nir_intrinsic_instr *load)
 
    if (image_dim == GLSL_SAMPLER_DIM_SUBPASS_MS) {
       tex->op = nir_texop_txf_ms;
-
-      nir_ssa_def *sample_id =
-         nir_load_system_value(&b, nir_intrinsic_load_sample_id, 0);
       tex->src[2].src_type = nir_tex_src_ms_index;
-      tex->src[2].src = nir_src_for_ssa(sample_id);
+      tex->src[2].src = load->src[1];
    }
 
    nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32, NULL);