radeonsi: fix GLSL imageSamples()
authorMarek Olšák <marek.olsak@amd.com>
Mon, 16 Sep 2019 23:37:36 +0000 (19:37 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 9 Oct 2019 21:12:28 +0000 (17:12 -0400)
We haven't supported MSAA images, so it doesn't matter much.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c

index 709ada50ea0e76563ace4b53165a19a4cb7e10b7..a0f66d38c7c5d40fd09212a3af69231c5069ef2a 100644 (file)
@@ -1015,6 +1015,19 @@ static void resq_emit(
 
        emit_data->output[emit_data->chan] =
                fix_resinfo(ctx, target, ac_build_image_opcode(&ctx->ac, &args));
+
+       if (inst->Instruction.Opcode == TGSI_OPCODE_RESQ &&
+           (target == TGSI_TEXTURE_2D_MSAA ||
+            target == TGSI_TEXTURE_2D_ARRAY_MSAA)) {
+               LLVMValueRef samples =
+                       ac_build_image_get_sample_count(&ctx->ac, args.resource);
+
+               emit_data->output[emit_data->chan] =
+                       LLVMBuildInsertElement(ctx->ac.builder,
+                                              emit_data->output[emit_data->chan],
+                                              samples,
+                                              LLVMConstInt(ctx->i32, 3, 0), "");
+       }
 }
 
 /**