ac/nir: implement load_frag_coord intrinsic
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 4 Jul 2017 09:09:24 +0000 (11:09 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 31 Jul 2017 12:55:44 +0000 (14:55 +0200)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_nir_to_llvm.c

index 9d159649c386b1c61dbaa1b31e9c32ead6316f3a..c08f1020e354ec8fd3ae2a6b8857f82d0db93268 100644 (file)
@@ -4012,6 +4012,16 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
        case nir_intrinsic_load_sample_mask_in:
                result = ctx->abi->sample_coverage;
                break;
+       case nir_intrinsic_load_frag_coord: {
+               LLVMValueRef values[4] = {
+                       ctx->abi->frag_pos[0],
+                       ctx->abi->frag_pos[1],
+                       ctx->abi->frag_pos[2],
+                       ac_build_fdiv(&ctx->ac, ctx->ac.f32_1, ctx->abi->frag_pos[3])
+               };
+               result = ac_build_gather_values(&ctx->ac, values, 4);
+               break;
+       }
        case nir_intrinsic_load_front_face:
                result = ctx->abi->front_face;
                break;