From 23efd323aadaec5370aa9eedf3e8c76c5fe204f4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 27 Mar 2020 15:27:26 +1000 Subject: [PATCH] gallivm/nir: add helper invocation support Reviewed-by: Roland Scheidegger Part-of: --- .gitlab-ci/deqp-virgl-fails.txt | 4 ---- src/gallium/auxiliary/gallivm/lp_bld_nir.c | 3 +++ src/gallium/auxiliary/gallivm/lp_bld_nir.h | 1 + src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 9 +++++++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci/deqp-virgl-fails.txt b/.gitlab-ci/deqp-virgl-fails.txt index 3f1c534fbf0..463ab89eeea 100644 --- a/.gitlab-ci/deqp-virgl-fails.txt +++ b/.gitlab-ci/deqp-virgl-fails.txt @@ -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 diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c b/src/gallium/auxiliary/gallivm/lp_bld_nir.c index 8336d7b2c99..218d46036e9 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c @@ -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); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.h b/src/gallium/auxiliary/gallivm/lp_bld_nir.h index ad005519682..c84ee99546f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.h @@ -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 }; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c index c54df7e98a3..e5bc1c75f2c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c @@ -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; -- 2.30.2