[Mesa-dev] Mesa (master): glsl: Move _mesa_shader_stage_to_string/ abbrev to shader_enums.c
Brian Paul
brianp at vmware.com
Fri Jan 8 15:38:06 PST 2016
Hi Kristian,
This change seems to have broken the scons build.
I'm looking at it, but I don't know what's wrong yet.
You can try it yourself with "scons dri=no libgl-xlib build=debug"
-Brian
On 01/08/2016 03:31 PM, Kristian Høgsberg wrote:
> Module: Mesa
> Branch: master
> Commit: 82ad571abf2fa2d85047451690f6a335f66d25fa
> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=82ad571abf2fa2d85047451690f6a335f66d25fa
>
> Author: Kristian Høgsberg Kristensen <kristian.h.kristensen at intel.com>
> Date: Fri Jan 8 12:35:48 2016 -0800
>
> glsl: Move _mesa_shader_stage_to_string/abbrev to shader_enums.c
>
> These are used by code that doesn't necessarily link to libglsl.la. Move
> them to shader_enums.[ch] where we keep similar helpers.
>
> Reviewed-by: Matt Turner <mattst88 at gmail.com>
>
> ---
>
> src/glsl/glsl_parser_extras.cpp | 38 ----------------------
> src/glsl/glsl_parser_extras.h | 10 ------
> src/glsl/nir/shader_enums.c | 36 ++++++++++++++++++++
> src/glsl/nir/shader_enums.h | 20 ++++++++++++
> src/mesa/drivers/dri/i965/brw_link.cpp | 1 -
> src/mesa/drivers/dri/i965/brw_shader.cpp | 1 -
> src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 1 -
> src/mesa/drivers/dri/i965/gen6_vs_state.c | 1 -
> 8 files changed, 56 insertions(+), 52 deletions(-)
>
> diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
> index 8c46f14..1d74db5 100644
> --- a/src/glsl/glsl_parser_extras.cpp
> +++ b/src/glsl/glsl_parser_extras.cpp
> @@ -412,44 +412,6 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
> }
>
>
> -/**
> - * Translate a gl_shader_stage to a short shader stage name for debug
> - * printouts and error messages.
> - */
> -const char *
> -_mesa_shader_stage_to_string(unsigned stage)
> -{
> - switch (stage) {
> - case MESA_SHADER_VERTEX: return "vertex";
> - case MESA_SHADER_FRAGMENT: return "fragment";
> - case MESA_SHADER_GEOMETRY: return "geometry";
> - case MESA_SHADER_COMPUTE: return "compute";
> - case MESA_SHADER_TESS_CTRL: return "tess ctrl";
> - case MESA_SHADER_TESS_EVAL: return "tess eval";
> - }
> -
> - unreachable("Unknown shader stage.");
> -}
> -
> -/**
> - * Translate a gl_shader_stage to a shader stage abbreviation (VS, GS, FS)
> - * for debug printouts and error messages.
> - */
> -const char *
> -_mesa_shader_stage_to_abbrev(unsigned stage)
> -{
> - switch (stage) {
> - case MESA_SHADER_VERTEX: return "VS";
> - case MESA_SHADER_FRAGMENT: return "FS";
> - case MESA_SHADER_GEOMETRY: return "GS";
> - case MESA_SHADER_COMPUTE: return "CS";
> - case MESA_SHADER_TESS_CTRL: return "TCS";
> - case MESA_SHADER_TESS_EVAL: return "TES";
> - }
> -
> - unreachable("Unknown shader stage.");
> -}
> -
> /* This helper function will append the given message to the shader's
> info log and report it via GL_ARB_debug_output. Per that extension,
> 'type' is one of the enum values classifying the message, and
> diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
> index afb99af..ecc2992 100644
> --- a/src/glsl/glsl_parser_extras.h
> +++ b/src/glsl/glsl_parser_extras.h
> @@ -731,16 +731,6 @@ extern bool _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
> extern "C" {
> #endif
>
> -/**
> - * Get the textual name of the specified shader stage (which is a
> - * gl_shader_stage).
> - */
> -extern const char *
> -_mesa_shader_stage_to_string(unsigned stage);
> -
> -extern const char *
> -_mesa_shader_stage_to_abbrev(unsigned stage);
> -
> extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log,
> const struct gl_extensions *extensions, struct gl_context *gl_ctx);
>
> diff --git a/src/glsl/nir/shader_enums.c b/src/glsl/nir/shader_enums.c
> index 66a25e7..10f546a 100644
> --- a/src/glsl/nir/shader_enums.c
> +++ b/src/glsl/nir/shader_enums.c
> @@ -47,6 +47,42 @@ const char * gl_shader_stage_name(gl_shader_stage stage)
> return NAME(stage);
> }
>
> +/**
> + * Translate a gl_shader_stage to a short shader stage name for debug
> + * printouts and error messages.
> + */
> +const char * _mesa_shader_stage_to_string(unsigned stage)
> +{
> + switch (stage) {
> + case MESA_SHADER_VERTEX: return "vertex";
> + case MESA_SHADER_FRAGMENT: return "fragment";
> + case MESA_SHADER_GEOMETRY: return "geometry";
> + case MESA_SHADER_COMPUTE: return "compute";
> + case MESA_SHADER_TESS_CTRL: return "tess ctrl";
> + case MESA_SHADER_TESS_EVAL: return "tess eval";
> + }
> +
> + unreachable("Unknown shader stage.");
> +}
> +
> +/**
> + * Translate a gl_shader_stage to a shader stage abbreviation (VS, GS, FS)
> + * for debug printouts and error messages.
> + */
> +const char * _mesa_shader_stage_to_abbrev(unsigned stage)
> +{
> + switch (stage) {
> + case MESA_SHADER_VERTEX: return "VS";
> + case MESA_SHADER_FRAGMENT: return "FS";
> + case MESA_SHADER_GEOMETRY: return "GS";
> + case MESA_SHADER_COMPUTE: return "CS";
> + case MESA_SHADER_TESS_CTRL: return "TCS";
> + case MESA_SHADER_TESS_EVAL: return "TES";
> + }
> +
> + unreachable("Unknown shader stage.");
> +}
> +
> const char * gl_vert_attrib_name(gl_vert_attrib attrib)
> {
> static const char *names[] = {
> diff --git a/src/glsl/nir/shader_enums.h b/src/glsl/nir/shader_enums.h
> index 8a2a81a..c747464 100644
> --- a/src/glsl/nir/shader_enums.h
> +++ b/src/glsl/nir/shader_enums.h
> @@ -26,6 +26,10 @@
> #ifndef SHADER_ENUMS_H
> #define SHADER_ENUMS_H
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> /**
> * Shader stages. Note that these will become 5 with tessellation.
> *
> @@ -45,6 +49,18 @@ typedef enum
>
> const char * gl_shader_stage_name(gl_shader_stage stage);
>
> +/**
> + * Translate a gl_shader_stage to a short shader stage name for debug
> + * printouts and error messages.
> + */
> +const char * _mesa_shader_stage_to_string(unsigned stage);
> +
> +/**
> + * Translate a gl_shader_stage to a shader stage abbreviation (VS, GS, FS)
> + * for debug printouts and error messages.
> + */
> +const char * _mesa_shader_stage_to_abbrev(unsigned stage);
> +
> #define MESA_SHADER_STAGES (MESA_SHADER_COMPUTE + 1)
>
>
> @@ -519,4 +535,8 @@ enum gl_frag_depth_layout
> FRAG_DEPTH_LAYOUT_UNCHANGED
> };
>
> +#ifdef __cplusplus
> +} /* extern "C" */
> +#endif
> +
> #endif /* SHADER_ENUMS_H */
> diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
> index 7cdc830..766c57f 100644
> --- a/src/mesa/drivers/dri/i965/brw_link.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_link.cpp
> @@ -27,7 +27,6 @@
> #include "brw_nir.h"
> #include "brw_program.h"
> #include "glsl/ir_optimization.h"
> -#include "glsl/glsl_parser_extras.h"
> #include "program/program.h"
> #include "main/shaderapi.h"
> #include "main/uniforms.h"
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
> index 49ff835..efc24f9 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
> @@ -27,7 +27,6 @@
> #include "brw_fs.h"
> #include "brw_nir.h"
> #include "brw_vec4_tes.h"
> -#include "glsl/glsl_parser_extras.h"
> #include "main/shaderobj.h"
> #include "main/uniforms.h"
> #include "util/debug.h"
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> index 6b03a1c..8173202 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
> @@ -20,7 +20,6 @@
> * IN THE SOFTWARE.
> */
>
> -#include "glsl/glsl_parser_extras.h"
> #include "brw_vec4.h"
> #include "brw_cfg.h"
> #include "brw_eu.h"
> diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
> index da3b4cd..4bc0a85 100644
> --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c
> +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
> @@ -32,7 +32,6 @@
> #include "program/prog_parameter.h"
> #include "program/prog_statevars.h"
> #include "intel_batchbuffer.h"
> -#include "glsl/glsl_parser_extras.h"
>
> /**
> * Creates a streamed BO containing the push constants for the VS or GS on
>
> _______________________________________________
> mesa-commit mailing list
> mesa-commit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-commit
>
More information about the mesa-dev
mailing list