llvmpipe/jit: pass fragment sample mask via jit context.
authorDave Airlie <airlied@redhat.com>
Tue, 10 Mar 2020 03:06:30 +0000 (13:06 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 May 2020 06:20:37 +0000 (06:20 +0000)
The incoming sample mask for the fragment shader can be passed
via the jit context

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

src/gallium/drivers/llvmpipe/lp_jit.c
src/gallium/drivers/llvmpipe/lp_jit.h

index 4ec83480c05921946732f2dca5dadc041d8c30ef..3786c50e99030e59cd25e448cc3c041b0caf7d86 100644 (file)
@@ -226,6 +226,7 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
       elem_types[LP_JIT_CTX_IMAGES] = LLVMArrayType(image_type,
                                                     PIPE_MAX_SHADER_IMAGES);
       elem_types[LP_JIT_CTX_ALPHA_REF] = LLVMFloatTypeInContext(lc);
+      elem_types[LP_JIT_CTX_SAMPLE_MASK] =
       elem_types[LP_JIT_CTX_STENCIL_REF_FRONT] =
       elem_types[LP_JIT_CTX_STENCIL_REF_BACK] = LLVMInt32TypeInContext(lc);
       elem_types[LP_JIT_CTX_U8_BLEND_COLOR] = LLVMPointerType(LLVMInt8TypeInContext(lc), 0);
@@ -277,6 +278,9 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, num_ssbos,
                              gallivm->target, context_type,
                              LP_JIT_CTX_NUM_SSBOS);
+      LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, sample_mask,
+                             gallivm->target, context_type,
+                             LP_JIT_CTX_SAMPLE_MASK);
       LP_CHECK_STRUCT_SIZE(struct lp_jit_context,
                            gallivm->target, context_type);
 
index d7960e21d30fde9dd12961e4834366ced5149a56..fbf33116e1c3ec7763f3069fb9b45ac82fb33917 100644 (file)
@@ -166,6 +166,8 @@ struct lp_jit_context
 
    const uint32_t *ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
    int num_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
+
+   uint32_t sample_mask;
 };
 
 
@@ -187,6 +189,7 @@ enum {
    LP_JIT_CTX_VIEWPORTS,
    LP_JIT_CTX_SSBOS,
    LP_JIT_CTX_NUM_SSBOS,
+   LP_JIT_CTX_SAMPLE_MASK,
    LP_JIT_CTX_COUNT
 };
 
@@ -230,6 +233,9 @@ enum {
 #define lp_jit_context_num_ssbos(_gallivm, _ptr) \
    lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_NUM_SSBOS, "num_ssbos")
 
+#define lp_jit_context_sample_mask(_gallivm, _ptr) \
+   lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_SAMPLE_MASK, "sample_mask")
+
 struct lp_jit_thread_data
 {
    struct lp_build_format_cache *cache;