gallivm/nir: add subpass sampler type support
authorDave Airlie <airlied@redhat.com>
Fri, 19 Jun 2020 06:50:55 +0000 (16:50 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 31 Aug 2020 03:20:11 +0000 (13:20 +1000)
Fixes:
dEQP-VK.renderpass.dedicated_allocation.attachment_allocation.input_output.*
dEQP-VK.renderpass.dedicated_allocation.formats*input*

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6381>

src/gallium/auxiliary/gallivm/lp_bld_nir.c

index d4d35a1159413640c4cc713da2722bcdec7febfc..9a60452479b4b88abc0162236b918272f49fb1f2 100644 (file)
@@ -111,12 +111,14 @@ static unsigned glsl_sampler_to_pipe(int sampler_dim, bool is_array)
       pipe_target = is_array ? PIPE_TEXTURE_1D_ARRAY : PIPE_TEXTURE_1D;
       break;
    case GLSL_SAMPLER_DIM_2D:
+   case GLSL_SAMPLER_DIM_SUBPASS:
       pipe_target = is_array ? PIPE_TEXTURE_2D_ARRAY : PIPE_TEXTURE_2D;
       break;
    case GLSL_SAMPLER_DIM_3D:
       pipe_target = PIPE_TEXTURE_3D;
       break;
    case GLSL_SAMPLER_DIM_MS:
+   case GLSL_SAMPLER_DIM_SUBPASS_MS:
       pipe_target = is_array ? PIPE_TEXTURE_2D_ARRAY : PIPE_TEXTURE_2D;
       break;
    case GLSL_SAMPLER_DIM_CUBE:
@@ -1121,8 +1123,8 @@ static void visit_load_image(struct lp_build_nir_context *bld_base,
    params.coords = coords;
    params.outdata = result;
    params.img_op = LP_IMG_LOAD;
-   if (glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_MS)
-      params.ms_index = get_src(bld_base, instr->src[2]);
+   if (glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_MS || glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_SUBPASS_MS)
+      params.ms_index = cast_type(bld_base, get_src(bld_base, instr->src[2]), nir_type_uint, 32);
    params.image_index = var->data.binding + (indir_index ? 0 : const_index);
    params.image_index_offset = indir_index;
    bld_base->image_op(bld_base, &params);