From 02f6a2591ce81aa4a2df246ded5c8e7fe2439dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Mon, 25 Mar 2024 13:31:44 +0100 Subject: [PATCH] compiler: Add helper for counting tess level components. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Timur Kristóf Reviewed-by: Samuel Pitoiset Part-of: --- src/compiler/shader_enums.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 0b51f464539..7d8b34c836d 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -1174,6 +1174,27 @@ enum tess_primitive_mode TESS_PRIMITIVE_ISOLINES, }; +static inline void +mesa_count_tess_level_components(const enum tess_primitive_mode mode, + unsigned *outer, unsigned *inner) +{ + switch (mode) { + case TESS_PRIMITIVE_ISOLINES: + *outer = 2; + *inner = 0; + break; + case TESS_PRIMITIVE_TRIANGLES: + *outer = 3; + *inner = 1; + break; + case TESS_PRIMITIVE_QUADS: + default: + *outer = 4; + *inner = 2; + break; + } +} + /** * Mesa primitive types for both GL and Vulkan: */ @@ -1245,7 +1266,7 @@ mesa_vertices_per_prim(enum mesa_prim prim) * vertex count. * Parts of the pipline are invoked once for each triangle in * triangle strip, triangle fans and triangles and once - * for each line in line strip, line loop, lines. Also + * for each line in line strip, line loop, lines. Also * statistics depend on knowing the exact number of decomposed * primitives for a set of vertices. */