Commit 94696a61 authored by Mike Blumenkrantz's avatar Mike Blumenkrantz 🏋
Browse files

zink: fix multisampled shader image load/store

need to actually pass the sample id here
parent 9cfbc000
Pipeline #287399 waiting for manual action with stages
...@@ -2746,12 +2746,13 @@ emit_intrinsic(struct ntv_context *ctx, nir_intrinsic_instr *intr) ...@@ -2746,12 +2746,13 @@ emit_intrinsic(struct ntv_context *ctx, nir_intrinsic_instr *intr)
SpvId img = spirv_builder_emit_load(&ctx->builder, img_type, img_var); SpvId img = spirv_builder_emit_load(&ctx->builder, img_type, img_var);
SpvId coord = get_image_coords(ctx, type, &intr->src[1]); SpvId coord = get_image_coords(ctx, type, &intr->src[1]);
SpvId texel = get_src(ctx, &intr->src[3]); SpvId texel = get_src(ctx, &intr->src[3]);
SpvId sample = glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_MS ? get_src(ctx, &intr->src[2]) : 0;
assert(nir_src_bit_size(intr->src[3]) == glsl_base_type_bit_size(glsl_get_sampler_result_type(type))); assert(nir_src_bit_size(intr->src[3]) == glsl_base_type_bit_size(glsl_get_sampler_result_type(type)));
/* texel type must match image type */ /* texel type must match image type */
texel = emit_bitcast(ctx, texel = emit_bitcast(ctx,
spirv_builder_type_vector(&ctx->builder, base_type, 4), spirv_builder_type_vector(&ctx->builder, base_type, 4),
texel); texel);
spirv_builder_emit_image_write(&ctx->builder, img, coord, texel, 0, 0, 0); spirv_builder_emit_image_write(&ctx->builder, img, coord, texel, 0, sample, 0);
break; break;
} }
case nir_intrinsic_image_deref_load: { case nir_intrinsic_image_deref_load: {
...@@ -2762,9 +2763,10 @@ emit_intrinsic(struct ntv_context *ctx, nir_intrinsic_instr *intr) ...@@ -2762,9 +2763,10 @@ emit_intrinsic(struct ntv_context *ctx, nir_intrinsic_instr *intr)
SpvId base_type = get_glsl_basetype(ctx, glsl_get_sampler_result_type(type)); SpvId base_type = get_glsl_basetype(ctx, glsl_get_sampler_result_type(type));
SpvId img = spirv_builder_emit_load(&ctx->builder, img_type, img_var); SpvId img = spirv_builder_emit_load(&ctx->builder, img_type, img_var);
SpvId coord = get_image_coords(ctx, type, &intr->src[1]); SpvId coord = get_image_coords(ctx, type, &intr->src[1]);
SpvId sample = glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_MS ? get_src(ctx, &intr->src[2]) : 0;
SpvId result = spirv_builder_emit_image_read(&ctx->builder, SpvId result = spirv_builder_emit_image_read(&ctx->builder,
spirv_builder_type_vector(&ctx->builder, base_type, nir_dest_num_components(intr->dest)), spirv_builder_type_vector(&ctx->builder, base_type, nir_dest_num_components(intr->dest)),
img, coord, 0, 0, 0); img, coord, 0, sample, 0);
store_dest(ctx, &intr->dest, result, nir_type_float); store_dest(ctx, &intr->dest, result, nir_type_float);
break; break;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment