From 78b9f1053faeb324d0f51588ddd12537d97c5b55 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 25 Sep 2023 10:04:24 +1000 Subject: [PATCH] glsl: move interpolation_string() to linker_util MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Moving it here allows us to use in in the NIR linker too. Reviewed-by: Alejandro Piñeiro Part-of: --- src/compiler/glsl/ast_to_hir.cpp | 1 + src/compiler/glsl/ir.cpp | 15 --------------- src/compiler/glsl/ir.h | 15 --------------- src/compiler/glsl/linker_util.cpp | 14 ++++++++++++++ src/compiler/glsl/linker_util.h | 14 ++++++++++++++ 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index b972160..7d125a1 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -59,6 +59,7 @@ #include "main/shaderobj.h" #include "ir.h" #include "ir_builder.h" +#include "linker_util.h" #include "builtin_functions.h" using namespace ir_builder; diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp index bfd5edb..56bef03 100644 --- a/src/compiler/glsl/ir.cpp +++ b/src/compiler/glsl/ir.cpp @@ -2084,21 +2084,6 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name, } } - -const char * -interpolation_string(unsigned interpolation) -{ - switch (interpolation) { - case INTERP_MODE_NONE: return "no"; - case INTERP_MODE_SMOOTH: return "smooth"; - case INTERP_MODE_FLAT: return "flat"; - case INTERP_MODE_NOPERSPECTIVE: return "noperspective"; - } - - assert(!"Should not get here."); - return ""; -} - const char *const ir_variable::warn_extension_table[] = { "", "GL_ARB_shader_stencil_export", diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h index eda5669..79b703b 100644 --- a/src/compiler/glsl/ir.h +++ b/src/compiler/glsl/ir.h @@ -398,21 +398,6 @@ struct ir_state_slot { }; -/** - * Get the string value for an interpolation qualifier - * - * \return The string that would be used in a shader to specify \c - * mode will be returned. - * - * This function is used to generate error messages of the form "shader - * uses %s interpolation qualifier", so in the case where there is no - * interpolation qualifier, it returns "no". - * - * This function should only be used on a shader input or output variable. - */ -const char *interpolation_string(unsigned interpolation); - - class ir_variable : public ir_instruction { public: ir_variable(const struct glsl_type *, const char *, ir_variable_mode); diff --git a/src/compiler/glsl/linker_util.cpp b/src/compiler/glsl/linker_util.cpp index 1a750d4..bd1ef11 100644 --- a/src/compiler/glsl/linker_util.cpp +++ b/src/compiler/glsl/linker_util.cpp @@ -438,3 +438,17 @@ link_util_mark_array_elements_referenced(const struct array_deref_range *dr, _mark_array_elements_referenced(dr, count, 1, 0, bits); } + +const char * +interpolation_string(unsigned interpolation) +{ + switch (interpolation) { + case INTERP_MODE_NONE: return "no"; + case INTERP_MODE_SMOOTH: return "smooth"; + case INTERP_MODE_FLAT: return "flat"; + case INTERP_MODE_NOPERSPECTIVE: return "noperspective"; + } + + assert(!"Should not get here."); + return ""; +} diff --git a/src/compiler/glsl/linker_util.h b/src/compiler/glsl/linker_util.h index 2d7b6cb..f89b4d1 100644 --- a/src/compiler/glsl/linker_util.h +++ b/src/compiler/glsl/linker_util.h @@ -111,6 +111,20 @@ link_util_mark_array_elements_referenced(const struct array_deref_range *dr, unsigned count, unsigned array_depth, BITSET_WORD *bits); +/** + * Get the string value for an interpolation qualifier + * + * \return The string that would be used in a shader to specify \c + * mode will be returned. + * + * This function is used to generate error messages of the form "shader + * uses %s interpolation qualifier", so in the case where there is no + * interpolation qualifier, it returns "no". + * + * This function should only be used on a shader input or output variable. + */ +const char *interpolation_string(unsigned interpolation); + #ifdef __cplusplus } #endif -- 2.7.4