diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 5cf53f9077e..f696c9fe984 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -1388,6 +1388,18 @@ u_reduced_prim(enum mesa_prim prim) } } +static inline bool +mesa_prim_has_adjacency(enum mesa_prim prim) +{ + static_assert(MESA_PRIM_LINE_STRIP_ADJACENCY == MESA_PRIM_LINES_ADJACENCY + 1, ""); + static_assert(MESA_PRIM_TRIANGLES_ADJACENCY == MESA_PRIM_LINES_ADJACENCY + 2, ""); + static_assert(MESA_PRIM_TRIANGLE_STRIP_ADJACENCY == MESA_PRIM_LINES_ADJACENCY + 3, ""); + + /* Adjacency primitives are together so we can do a simple comparison */ + return prim >= MESA_PRIM_LINES_ADJACENCY && + prim <= MESA_PRIM_TRIANGLE_STRIP_ADJACENCY; +} + /** * A compare function enum for use in compiler lowering passes. This is in * the same order as GL's compare functions (shifted down by GL_NEVER), and is