[Mesa-dev] [PATCH v2 70/73] ac/nir: implement load_frag_coord intrinsic

Nicolai Hähnle nhaehnle at gmail.com
Wed Jul 5 10:48:54 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/amd/common/ac_nir_to_llvm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 9bb1904..5a972b7 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3979,20 +3979,30 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
 		break;
 	case nir_intrinsic_load_sample_id:
 		result = unpack_param(&ctx->ac, ctx->abi->ancillary, 8, 4);
 		break;
 	case nir_intrinsic_load_sample_pos:
 		result = load_sample_pos(ctx);
 		break;
 	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;
 	case nir_intrinsic_load_instance_id:
 		result = ctx->abi->instance_id;
 		break;
 	case nir_intrinsic_load_num_work_groups:
 		result = ctx->nctx->num_work_groups;
 		break;
 	case nir_intrinsic_load_local_invocation_index:
-- 
2.9.3



More information about the mesa-dev mailing list