gallivm/nir: add helper invocation support
authorDave Airlie <airlied@redhat.com>
Fri, 27 Mar 2020 05:27:26 +0000 (15:27 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 27 Apr 2020 02:35:21 +0000 (12:35 +1000)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4574>

.gitlab-ci/deqp-virgl-fails.txt
src/gallium/auxiliary/gallivm/lp_bld_nir.c
src/gallium/auxiliary/gallivm/lp_bld_nir.h
src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c

index 3f1c534fbf0935108061640470a2390905b82acd..463ab89eeeadc7124440faaa672d926c0e5ab668 100644 (file)
@@ -449,10 +449,6 @@ dEQP-GLES31.functional.shaders.builtin_functions.uniform.findLSBMinusOne.mediump
 dEQP-GLES31.functional.shaders.builtin_functions.uniform.findMSBMinusOne.highp_tess_eval
 dEQP-GLES31.functional.shaders.builtin_functions.uniform.findMSBZero.lowp_tess_eval
 dEQP-GLES31.functional.shaders.builtin_var.compute.global_invocation_id
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.points_max_samples_fwidth
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.triangles_max_samples_dfdy
-dEQP-GLES31.functional.shaders.helper_invocation.derivate.wide_lines_dfdx
-dEQP-GLES31.functional.shaders.helper_invocation.value.lines_max_samples
 dEQP-GLES31.functional.shaders.linkage.es31.tessellation.uniform.types.int
 dEQP-GLES31.functional.shaders.linkage.es31.tessellation.uniform.types.vec4
 dEQP-GLES31.functional.shaders.linkage.es31.tessellation.varying.rules.internal_superfluous_declaration
index 8336d7b2c992f9b00f38787694dafef473314a08..218d46036e910471efc9e9255660003a6a0c95c1 100644 (file)
@@ -1333,6 +1333,9 @@ static void visit_intrinsic(struct lp_build_nir_context *bld_base,
    case nir_intrinsic_load_patch_vertices_in:
       bld_base->sysval_intrin(bld_base, instr, result);
       break;
+   case nir_intrinsic_load_helper_invocation:
+      bld_base->helper_invocation(bld_base, &result[0]);
+      break;
    case nir_intrinsic_discard_if:
    case nir_intrinsic_discard:
       visit_discard(bld_base, instr);
index ad0055196825425ddd51db8e06bff731352d6b3b..c84ee99546f33ab7969094a4870de37a0d676818 100644 (file)
@@ -174,6 +174,7 @@ struct lp_build_nir_context
    void (*end_primitive)(struct lp_build_nir_context *bld_base, uint32_t stream_id);
 
    void (*vote)(struct lp_build_nir_context *bld_base, LLVMValueRef src, nir_intrinsic_instr *instr, LLVMValueRef dst[4]);
+   void (*helper_invocation)(struct lp_build_nir_context *bld_base, LLVMValueRef *dst);
 //   LLVMValueRef main_function
 };
 
index c54df7e98a3a1d88cfb3483558955a78923f9b5a..e5bc1c75f2cdb7e7ddad1b22553e1e19181b521f 100644 (file)
@@ -1378,6 +1378,14 @@ static void emit_sysval_intrin(struct lp_build_nir_context *bld_base,
    }
 }
 
+static void emit_helper_invocation(struct lp_build_nir_context *bld_base,
+                                   LLVMValueRef *dst)
+{
+   struct gallivm_state *gallivm = bld_base->base.gallivm;
+   struct lp_build_context *uint_bld = &bld_base->uint_bld;
+   *dst = lp_build_cmp(uint_bld, PIPE_FUNC_NOTEQUAL, mask_vec(bld_base), lp_build_const_int_vec(gallivm, uint_bld->type, -1));
+}
+
 static void bgnloop(struct lp_build_nir_context *bld_base)
 {
    struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
@@ -1729,6 +1737,7 @@ void lp_build_nir_soa(struct gallivm_state *gallivm,
    bld.bld_base.image_op = emit_image_op;
    bld.bld_base.image_size = emit_image_size;
    bld.bld_base.vote = emit_vote;
+   bld.bld_base.helper_invocation = emit_helper_invocation;
 
    bld.mask = params->mask;
    bld.inputs = params->inputs;