From 9c7746ceaea94cf9d5496d4d4680ada92f1553b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 1 Aug 2019 14:38:40 -0400 Subject: [PATCH] compiler: add SYSTEM_VALUE_TESS_LEVEL_OUTER/INNER_DEFAULT TCS system values for internal passthru TCS, needed by radeonsi NIR support Reviewed-by: Connor Abbott --- src/compiler/nir/nir.c | 8 ++++++++ src/compiler/nir/nir_intrinsics.py | 2 ++ src/compiler/shader_enums.h | 2 ++ src/gallium/auxiliary/nir/tgsi_to_nir.c | 8 ++++++++ 4 files changed, 20 insertions(+) diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 1e6f15517f5..6547a295852 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -1986,6 +1986,10 @@ nir_intrinsic_from_system_value(gl_system_value val) return nir_intrinsic_load_tess_level_outer; case SYSTEM_VALUE_TESS_LEVEL_INNER: return nir_intrinsic_load_tess_level_inner; + case SYSTEM_VALUE_TESS_LEVEL_OUTER_DEFAULT: + return nir_intrinsic_load_tess_level_outer_default; + case SYSTEM_VALUE_TESS_LEVEL_INNER_DEFAULT: + return nir_intrinsic_load_tess_level_inner_default; case SYSTEM_VALUE_VERTICES_IN: return nir_intrinsic_load_patch_vertices_in; case SYSTEM_VALUE_HELPER_INVOCATION: @@ -2079,6 +2083,10 @@ nir_system_value_from_intrinsic(nir_intrinsic_op intrin) return SYSTEM_VALUE_TESS_LEVEL_OUTER; case nir_intrinsic_load_tess_level_inner: return SYSTEM_VALUE_TESS_LEVEL_INNER; + case nir_intrinsic_load_tess_level_outer_default: + return SYSTEM_VALUE_TESS_LEVEL_OUTER_DEFAULT; + case nir_intrinsic_load_tess_level_inner_default: + return SYSTEM_VALUE_TESS_LEVEL_INNER_DEFAULT; case nir_intrinsic_load_patch_vertices_in: return SYSTEM_VALUE_VERTICES_IN; case nir_intrinsic_load_helper_invocation: diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index f4ca623bb3d..e1b336c2f60 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -559,6 +559,8 @@ system_value("invocation_id", 1) system_value("tess_coord", 3) system_value("tess_level_outer", 4) system_value("tess_level_inner", 2) +system_value("tess_level_outer_default", 4) +system_value("tess_level_inner_default", 2) system_value("patch_vertices_in", 1) system_value("local_invocation_id", 3) system_value("local_invocation_index", 1) diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 20e62da5b11..1a0ec5fb12a 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -594,6 +594,8 @@ typedef enum SYSTEM_VALUE_PRIMITIVE_ID, SYSTEM_VALUE_TESS_LEVEL_OUTER, /**< TES input */ SYSTEM_VALUE_TESS_LEVEL_INNER, /**< TES input */ + SYSTEM_VALUE_TESS_LEVEL_OUTER_DEFAULT, /**< TCS input for passthru TCS */ + SYSTEM_VALUE_TESS_LEVEL_INNER_DEFAULT, /**< TCS input for passthru TCS */ /*@}*/ /** diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index 09d7f18881e..8c49acce60a 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -643,6 +643,14 @@ ttn_src_for_file_and_index(struct ttn_compile *c, unsigned file, unsigned index, op = nir_intrinsic_load_user_data_amd; load = nir_load_user_data_amd(b); break; + case TGSI_SEMANTIC_TESS_DEFAULT_INNER_LEVEL: + op = nir_intrinsic_load_tess_level_inner_default; + load = nir_load_tess_level_inner_default(b); + break; + case TGSI_SEMANTIC_TESS_DEFAULT_OUTER_LEVEL: + op = nir_intrinsic_load_tess_level_outer_default; + load = nir_load_tess_level_outer_default(b); + break; default: unreachable("bad system value"); } -- 2.30.2