gallivm: add mask api to force mask
For per-sample shading the mask needs to be forced for each
iteration of the fragment shader.
Just adds the API for now.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c
index 3bd24b4..d5d903f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c
@@ -200,6 +200,16 @@
LLVMBuildStore(mask->skip.gallivm->builder, value, mask->var);
}
+/*
+ * Update boolean mask with given value.
+ * Used for per-sample shading to force per-sample execution masks.
+ */
+void
+lp_build_mask_force(struct lp_build_mask_context *mask,
+ LLVMValueRef value)
+{
+ LLVMBuildStore(mask->skip.gallivm->builder, value, mask->var);
+}
/**
* End section of code which is predicated on a mask.
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h
index ddb3fdf..c4ffa833 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h
@@ -95,6 +95,10 @@
LLVMValueRef value);
void
+lp_build_mask_force(struct lp_build_mask_context *mask,
+ LLVMValueRef value);
+
+void
lp_build_mask_check(struct lp_build_mask_context *mask);
LLVMValueRef