aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2020-02-17 16:21:21 +1000
committerDave Airlie <[email protected]>2020-02-28 18:33:34 +1000
commit7898e37fb4201b4b8c761a6d131d2bdd7b7ef119 (patch)
tree2bb8e57d62d920a69aff21518b2f8fd0cd709eb3 /src/gallium/auxiliary/gallivm
parentc632d806cb5702cae5bedfcb64294aca36978136 (diff)
gallivm/nir: add support for tess system values
hooks up the tessellation specific system values in the NIR paths Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3841>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_nir.c4
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c21
2 files changed, 24 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
index 5e47aaaadca..b8d804e827f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
@@ -1316,6 +1316,10 @@ static void visit_intrinsic(struct lp_build_nir_context *bld_base,
case nir_intrinsic_load_draw_id:
case nir_intrinsic_load_local_group_size:
case nir_intrinsic_load_work_dim:
+ case nir_intrinsic_load_tess_coord:
+ case nir_intrinsic_load_tess_level_outer:
+ case nir_intrinsic_load_tess_level_inner:
+ case nir_intrinsic_load_patch_vertices_in:
bld_base->sysval_intrin(bld_base, instr, result);
break;
case nir_intrinsic_discard_if:
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
index 9d79358b33b..637ec36ba50 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
@@ -1193,7 +1193,10 @@ static void emit_sysval_intrin(struct lp_build_nir_context *bld_base,
result[i] = lp_build_broadcast_scalar(&bld_base->uint_bld, LLVMBuildExtractElement(gallivm->builder, bld->system_values.grid_size, lp_build_const_int32(gallivm, i), ""));
break;
case nir_intrinsic_load_invocation_id:
- result[0] = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.invocation_id);
+ if (bld_base->shader->info.stage == MESA_SHADER_TESS_CTRL)
+ result[0] = bld->system_values.invocation_id;
+ else
+ result[0] = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.invocation_id);
break;
case nir_intrinsic_load_front_face:
result[0] = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.front_facing);
@@ -1210,6 +1213,22 @@ static void emit_sysval_intrin(struct lp_build_nir_context *bld_base,
case nir_intrinsic_load_work_dim:
result[0] = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.work_dim);
break;
+ case nir_intrinsic_load_tess_coord:
+ for (unsigned i = 0; i < 3; i++) {
+ result[i] = LLVMBuildExtractValue(gallivm->builder, bld->system_values.tess_coord, i, "");
+ }
+ break;
+ case nir_intrinsic_load_tess_level_outer:
+ for (unsigned i = 0; i < 4; i++)
+ result[i] = lp_build_broadcast_scalar(&bld_base->base, LLVMBuildExtractValue(gallivm->builder, bld->system_values.tess_outer, i, ""));
+ break;
+ case nir_intrinsic_load_tess_level_inner:
+ for (unsigned i = 0; i < 2; i++)
+ result[i] = lp_build_broadcast_scalar(&bld_base->base, LLVMBuildExtractValue(gallivm->builder, bld->system_values.tess_inner, i, ""));
+ break;
+ case nir_intrinsic_load_patch_vertices_in:
+ result[0] = bld->system_values.vertices_in;
+ break;
}
}