From: Emil Velikov Date: Mon, 18 Jan 2016 08:47:13 +0000 (+0200) Subject: nir: move shader_enums.[ch] to compiler X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a882fd2ee84ae28a06cf07902dc4645d8ad4a6d;p=mesa.git nir: move shader_enums.[ch] to compiler This way one can reuse it in glsl, nir or other infrastructure without pulling nir as dependency. Signed-off-by: Emil Velikov Acked-by: Matt Turner Acked-by: Jose Fonseca --- diff --git a/Android.mk b/Android.mk index 1d765590010..908078a02ce 100644 --- a/Android.mk +++ b/Android.mk @@ -86,6 +86,7 @@ ifneq ($(strip $(MESA_GPU_DRIVERS)),) SUBDIRS := \ src/loader \ src/mapi \ + src/compiler \ src/glsl \ src/mesa \ src/util \ diff --git a/src/SConscript b/src/SConscript index 106b87d4251..8acf9b04ab6 100644 --- a/src/SConscript +++ b/src/SConscript @@ -5,6 +5,7 @@ if env['platform'] == 'windows': SConscript('getopt/SConscript') SConscript('util/SConscript') +SConscript('compiler/SConscript') SConscript('glsl/SConscript') if env['hostonly']: diff --git a/src/compiler/Android.mk b/src/compiler/Android.mk new file mode 100644 index 00000000000..8ebd49778ef --- /dev/null +++ b/src/compiler/Android.mk @@ -0,0 +1,44 @@ +# Mesa 3-D graphics library +# +# Copyright (C) 2015 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +LOCAL_PATH := $(call my-dir) + +include $(LOCAL_PATH)/Makefile.sources + +# --------------------------------------- +# Build libmesa_compiler +# --------------------------------------- + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := $(LIBCOMPILER_FILES) + +LOCAL_C_INCLUDES := \ + $(MESA_TOP)/src/mapi \ + $(MESA_TOP)/src/mesa \ + $(MESA_TOP)/src/gallium/include \ + $(MESA_TOP)/src/gallium/auxiliary + +LOCAL_MODULE := libmesa_compiler + +include $(MESA_COMMON_MK) +include $(BUILD_STATIC_LIBRARY) diff --git a/src/compiler/Makefile.am b/src/compiler/Makefile.am index 8ed8205fd73..fd1dd4b6d30 100644 --- a/src/compiler/Makefile.am +++ b/src/compiler/Makefile.am @@ -22,4 +22,25 @@ include Makefile.sources -EXTRA_DIST = $(LIBCOMPILER_FILES) +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/mapi \ + -I$(top_srcdir)/src/mesa/ \ + -I$(top_srcdir)/src/gallium/include \ + -I$(top_srcdir)/src/gallium/auxiliary \ + $(DEFINES) + +AM_CFLAGS = \ + $(VISIBILITY_CFLAGS) \ + $(MSVC2013_COMPAT_CFLAGS) + +AM_CXXFLAGS = \ + $(VISIBILITY_CXXFLAGS) \ + $(MSVC2013_COMPAT_CXXFLAGS) + +noinst_LTLIBRARIES = libcompiler.la + +libcompiler_la_SOURCES = $(LIBCOMPILER_FILES) + +EXTRA_DIST = SConscript diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index f154062d04c..73e1771c8a7 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -1,2 +1,4 @@ LIBCOMPILER_FILES = \ - builtin_type_macros.h + builtin_type_macros.h \ + shader_enums.c \ + shader_enums.h diff --git a/src/compiler/SConscript b/src/compiler/SConscript new file mode 100644 index 00000000000..412da0e62bd --- /dev/null +++ b/src/compiler/SConscript @@ -0,0 +1,22 @@ +Import('*') + +env = env.Clone() + +env.MSVC2013Compat() + +env.Prepend(CPPPATH = [ + '#include', + '#src', + '#src/mapi', + '#src/mesa', + '#src/gallium/include', + '#src/gallium/auxiliary', +]) + +sources = env.ParseSourceList('Makefile.sources', 'LIBCOMPILER_FILES') + +compiler = env.ConvenienceLibrary( + target = 'compiler', + source = sources +) +Export('compiler') diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c new file mode 100644 index 00000000000..942d152b129 --- /dev/null +++ b/src/compiler/shader_enums.c @@ -0,0 +1,257 @@ +/* + * Mesa 3-D graphics library + * + * Copyright © 2015 Red Hat + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Rob Clark + */ + +#include "shader_enums.h" +#include "util/macros.h" +#include "mesa/main/config.h" + +#define ENUM(x) [x] = #x +#define NAME(val) ((((val) < ARRAY_SIZE(names)) && names[(val)]) ? names[(val)] : "UNKNOWN") + +const char * +gl_shader_stage_name(gl_shader_stage stage) +{ + static const char *names[] = { + ENUM(MESA_SHADER_VERTEX), + ENUM(MESA_SHADER_TESS_CTRL), + ENUM(MESA_SHADER_TESS_EVAL), + ENUM(MESA_SHADER_GEOMETRY), + ENUM(MESA_SHADER_FRAGMENT), + ENUM(MESA_SHADER_COMPUTE), + }; + STATIC_ASSERT(ARRAY_SIZE(names) == MESA_SHADER_STAGES); + 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 "tessellation control"; + case MESA_SHADER_TESS_EVAL: return "tessellation evaluation"; + } + + 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[] = { + ENUM(VERT_ATTRIB_POS), + ENUM(VERT_ATTRIB_WEIGHT), + ENUM(VERT_ATTRIB_NORMAL), + ENUM(VERT_ATTRIB_COLOR0), + ENUM(VERT_ATTRIB_COLOR1), + ENUM(VERT_ATTRIB_FOG), + ENUM(VERT_ATTRIB_COLOR_INDEX), + ENUM(VERT_ATTRIB_EDGEFLAG), + ENUM(VERT_ATTRIB_TEX0), + ENUM(VERT_ATTRIB_TEX1), + ENUM(VERT_ATTRIB_TEX2), + ENUM(VERT_ATTRIB_TEX3), + ENUM(VERT_ATTRIB_TEX4), + ENUM(VERT_ATTRIB_TEX5), + ENUM(VERT_ATTRIB_TEX6), + ENUM(VERT_ATTRIB_TEX7), + ENUM(VERT_ATTRIB_POINT_SIZE), + ENUM(VERT_ATTRIB_GENERIC0), + ENUM(VERT_ATTRIB_GENERIC1), + ENUM(VERT_ATTRIB_GENERIC2), + ENUM(VERT_ATTRIB_GENERIC3), + ENUM(VERT_ATTRIB_GENERIC4), + ENUM(VERT_ATTRIB_GENERIC5), + ENUM(VERT_ATTRIB_GENERIC6), + ENUM(VERT_ATTRIB_GENERIC7), + ENUM(VERT_ATTRIB_GENERIC8), + ENUM(VERT_ATTRIB_GENERIC9), + ENUM(VERT_ATTRIB_GENERIC10), + ENUM(VERT_ATTRIB_GENERIC11), + ENUM(VERT_ATTRIB_GENERIC12), + ENUM(VERT_ATTRIB_GENERIC13), + ENUM(VERT_ATTRIB_GENERIC14), + ENUM(VERT_ATTRIB_GENERIC15), + }; + STATIC_ASSERT(ARRAY_SIZE(names) == VERT_ATTRIB_MAX); + return NAME(attrib); +} + +const char * +gl_varying_slot_name(gl_varying_slot slot) +{ + static const char *names[] = { + ENUM(VARYING_SLOT_POS), + ENUM(VARYING_SLOT_COL0), + ENUM(VARYING_SLOT_COL1), + ENUM(VARYING_SLOT_FOGC), + ENUM(VARYING_SLOT_TEX0), + ENUM(VARYING_SLOT_TEX1), + ENUM(VARYING_SLOT_TEX2), + ENUM(VARYING_SLOT_TEX3), + ENUM(VARYING_SLOT_TEX4), + ENUM(VARYING_SLOT_TEX5), + ENUM(VARYING_SLOT_TEX6), + ENUM(VARYING_SLOT_TEX7), + ENUM(VARYING_SLOT_PSIZ), + ENUM(VARYING_SLOT_BFC0), + ENUM(VARYING_SLOT_BFC1), + ENUM(VARYING_SLOT_EDGE), + ENUM(VARYING_SLOT_CLIP_VERTEX), + ENUM(VARYING_SLOT_CLIP_DIST0), + ENUM(VARYING_SLOT_CLIP_DIST1), + ENUM(VARYING_SLOT_PRIMITIVE_ID), + ENUM(VARYING_SLOT_LAYER), + ENUM(VARYING_SLOT_VIEWPORT), + ENUM(VARYING_SLOT_FACE), + ENUM(VARYING_SLOT_PNTC), + ENUM(VARYING_SLOT_TESS_LEVEL_OUTER), + ENUM(VARYING_SLOT_TESS_LEVEL_INNER), + ENUM(VARYING_SLOT_VAR0), + ENUM(VARYING_SLOT_VAR1), + ENUM(VARYING_SLOT_VAR2), + ENUM(VARYING_SLOT_VAR3), + ENUM(VARYING_SLOT_VAR4), + ENUM(VARYING_SLOT_VAR5), + ENUM(VARYING_SLOT_VAR6), + ENUM(VARYING_SLOT_VAR7), + ENUM(VARYING_SLOT_VAR8), + ENUM(VARYING_SLOT_VAR9), + ENUM(VARYING_SLOT_VAR10), + ENUM(VARYING_SLOT_VAR11), + ENUM(VARYING_SLOT_VAR12), + ENUM(VARYING_SLOT_VAR13), + ENUM(VARYING_SLOT_VAR14), + ENUM(VARYING_SLOT_VAR15), + ENUM(VARYING_SLOT_VAR16), + ENUM(VARYING_SLOT_VAR17), + ENUM(VARYING_SLOT_VAR18), + ENUM(VARYING_SLOT_VAR19), + ENUM(VARYING_SLOT_VAR20), + ENUM(VARYING_SLOT_VAR21), + ENUM(VARYING_SLOT_VAR22), + ENUM(VARYING_SLOT_VAR23), + ENUM(VARYING_SLOT_VAR24), + ENUM(VARYING_SLOT_VAR25), + ENUM(VARYING_SLOT_VAR26), + ENUM(VARYING_SLOT_VAR27), + ENUM(VARYING_SLOT_VAR28), + ENUM(VARYING_SLOT_VAR29), + ENUM(VARYING_SLOT_VAR30), + ENUM(VARYING_SLOT_VAR31), + }; + STATIC_ASSERT(ARRAY_SIZE(names) == VARYING_SLOT_MAX); + return NAME(slot); +} + +const char * +gl_system_value_name(gl_system_value sysval) +{ + static const char *names[] = { + ENUM(SYSTEM_VALUE_VERTEX_ID), + ENUM(SYSTEM_VALUE_INSTANCE_ID), + ENUM(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE), + ENUM(SYSTEM_VALUE_BASE_VERTEX), + ENUM(SYSTEM_VALUE_INVOCATION_ID), + ENUM(SYSTEM_VALUE_FRONT_FACE), + ENUM(SYSTEM_VALUE_SAMPLE_ID), + ENUM(SYSTEM_VALUE_SAMPLE_POS), + ENUM(SYSTEM_VALUE_SAMPLE_MASK_IN), + ENUM(SYSTEM_VALUE_TESS_COORD), + ENUM(SYSTEM_VALUE_VERTICES_IN), + ENUM(SYSTEM_VALUE_PRIMITIVE_ID), + ENUM(SYSTEM_VALUE_TESS_LEVEL_OUTER), + ENUM(SYSTEM_VALUE_TESS_LEVEL_INNER), + ENUM(SYSTEM_VALUE_LOCAL_INVOCATION_ID), + ENUM(SYSTEM_VALUE_WORK_GROUP_ID), + ENUM(SYSTEM_VALUE_NUM_WORK_GROUPS), + ENUM(SYSTEM_VALUE_VERTEX_CNT), + }; + STATIC_ASSERT(ARRAY_SIZE(names) == SYSTEM_VALUE_MAX); + return NAME(sysval); +} + +const char * +glsl_interp_qualifier_name(enum glsl_interp_qualifier qual) +{ + static const char *names[] = { + ENUM(INTERP_QUALIFIER_NONE), + ENUM(INTERP_QUALIFIER_SMOOTH), + ENUM(INTERP_QUALIFIER_FLAT), + ENUM(INTERP_QUALIFIER_NOPERSPECTIVE), + }; + STATIC_ASSERT(ARRAY_SIZE(names) == INTERP_QUALIFIER_COUNT); + return NAME(qual); +} + +const char * +gl_frag_result_name(gl_frag_result result) +{ + static const char *names[] = { + ENUM(FRAG_RESULT_DEPTH), + ENUM(FRAG_RESULT_STENCIL), + ENUM(FRAG_RESULT_COLOR), + ENUM(FRAG_RESULT_SAMPLE_MASK), + ENUM(FRAG_RESULT_DATA0), + ENUM(FRAG_RESULT_DATA1), + ENUM(FRAG_RESULT_DATA2), + ENUM(FRAG_RESULT_DATA3), + ENUM(FRAG_RESULT_DATA4), + ENUM(FRAG_RESULT_DATA5), + ENUM(FRAG_RESULT_DATA6), + ENUM(FRAG_RESULT_DATA7), + }; + STATIC_ASSERT(ARRAY_SIZE(names) == FRAG_RESULT_MAX); + return NAME(result); +} diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h new file mode 100644 index 00000000000..efc0b0d515e --- /dev/null +++ b/src/compiler/shader_enums.h @@ -0,0 +1,542 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef SHADER_ENUMS_H +#define SHADER_ENUMS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Shader stages. Note that these will become 5 with tessellation. + * + * The order must match how shaders are ordered in the pipeline. + * The GLSL linker assumes that if i #include "nir_opcodes.h" diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c index be9ca4e0f57..48ecb48a620 100644 --- a/src/glsl/nir/nir_print.c +++ b/src/glsl/nir/nir_print.c @@ -26,7 +26,7 @@ */ #include "nir.h" -#include "shader_enums.h" +#include "compiler/shader_enums.h" #include #include diff --git a/src/glsl/nir/shader_enums.c b/src/glsl/nir/shader_enums.c deleted file mode 100644 index 942d152b129..00000000000 --- a/src/glsl/nir/shader_enums.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright © 2015 Red Hat - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - * Rob Clark - */ - -#include "shader_enums.h" -#include "util/macros.h" -#include "mesa/main/config.h" - -#define ENUM(x) [x] = #x -#define NAME(val) ((((val) < ARRAY_SIZE(names)) && names[(val)]) ? names[(val)] : "UNKNOWN") - -const char * -gl_shader_stage_name(gl_shader_stage stage) -{ - static const char *names[] = { - ENUM(MESA_SHADER_VERTEX), - ENUM(MESA_SHADER_TESS_CTRL), - ENUM(MESA_SHADER_TESS_EVAL), - ENUM(MESA_SHADER_GEOMETRY), - ENUM(MESA_SHADER_FRAGMENT), - ENUM(MESA_SHADER_COMPUTE), - }; - STATIC_ASSERT(ARRAY_SIZE(names) == MESA_SHADER_STAGES); - 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 "tessellation control"; - case MESA_SHADER_TESS_EVAL: return "tessellation evaluation"; - } - - 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[] = { - ENUM(VERT_ATTRIB_POS), - ENUM(VERT_ATTRIB_WEIGHT), - ENUM(VERT_ATTRIB_NORMAL), - ENUM(VERT_ATTRIB_COLOR0), - ENUM(VERT_ATTRIB_COLOR1), - ENUM(VERT_ATTRIB_FOG), - ENUM(VERT_ATTRIB_COLOR_INDEX), - ENUM(VERT_ATTRIB_EDGEFLAG), - ENUM(VERT_ATTRIB_TEX0), - ENUM(VERT_ATTRIB_TEX1), - ENUM(VERT_ATTRIB_TEX2), - ENUM(VERT_ATTRIB_TEX3), - ENUM(VERT_ATTRIB_TEX4), - ENUM(VERT_ATTRIB_TEX5), - ENUM(VERT_ATTRIB_TEX6), - ENUM(VERT_ATTRIB_TEX7), - ENUM(VERT_ATTRIB_POINT_SIZE), - ENUM(VERT_ATTRIB_GENERIC0), - ENUM(VERT_ATTRIB_GENERIC1), - ENUM(VERT_ATTRIB_GENERIC2), - ENUM(VERT_ATTRIB_GENERIC3), - ENUM(VERT_ATTRIB_GENERIC4), - ENUM(VERT_ATTRIB_GENERIC5), - ENUM(VERT_ATTRIB_GENERIC6), - ENUM(VERT_ATTRIB_GENERIC7), - ENUM(VERT_ATTRIB_GENERIC8), - ENUM(VERT_ATTRIB_GENERIC9), - ENUM(VERT_ATTRIB_GENERIC10), - ENUM(VERT_ATTRIB_GENERIC11), - ENUM(VERT_ATTRIB_GENERIC12), - ENUM(VERT_ATTRIB_GENERIC13), - ENUM(VERT_ATTRIB_GENERIC14), - ENUM(VERT_ATTRIB_GENERIC15), - }; - STATIC_ASSERT(ARRAY_SIZE(names) == VERT_ATTRIB_MAX); - return NAME(attrib); -} - -const char * -gl_varying_slot_name(gl_varying_slot slot) -{ - static const char *names[] = { - ENUM(VARYING_SLOT_POS), - ENUM(VARYING_SLOT_COL0), - ENUM(VARYING_SLOT_COL1), - ENUM(VARYING_SLOT_FOGC), - ENUM(VARYING_SLOT_TEX0), - ENUM(VARYING_SLOT_TEX1), - ENUM(VARYING_SLOT_TEX2), - ENUM(VARYING_SLOT_TEX3), - ENUM(VARYING_SLOT_TEX4), - ENUM(VARYING_SLOT_TEX5), - ENUM(VARYING_SLOT_TEX6), - ENUM(VARYING_SLOT_TEX7), - ENUM(VARYING_SLOT_PSIZ), - ENUM(VARYING_SLOT_BFC0), - ENUM(VARYING_SLOT_BFC1), - ENUM(VARYING_SLOT_EDGE), - ENUM(VARYING_SLOT_CLIP_VERTEX), - ENUM(VARYING_SLOT_CLIP_DIST0), - ENUM(VARYING_SLOT_CLIP_DIST1), - ENUM(VARYING_SLOT_PRIMITIVE_ID), - ENUM(VARYING_SLOT_LAYER), - ENUM(VARYING_SLOT_VIEWPORT), - ENUM(VARYING_SLOT_FACE), - ENUM(VARYING_SLOT_PNTC), - ENUM(VARYING_SLOT_TESS_LEVEL_OUTER), - ENUM(VARYING_SLOT_TESS_LEVEL_INNER), - ENUM(VARYING_SLOT_VAR0), - ENUM(VARYING_SLOT_VAR1), - ENUM(VARYING_SLOT_VAR2), - ENUM(VARYING_SLOT_VAR3), - ENUM(VARYING_SLOT_VAR4), - ENUM(VARYING_SLOT_VAR5), - ENUM(VARYING_SLOT_VAR6), - ENUM(VARYING_SLOT_VAR7), - ENUM(VARYING_SLOT_VAR8), - ENUM(VARYING_SLOT_VAR9), - ENUM(VARYING_SLOT_VAR10), - ENUM(VARYING_SLOT_VAR11), - ENUM(VARYING_SLOT_VAR12), - ENUM(VARYING_SLOT_VAR13), - ENUM(VARYING_SLOT_VAR14), - ENUM(VARYING_SLOT_VAR15), - ENUM(VARYING_SLOT_VAR16), - ENUM(VARYING_SLOT_VAR17), - ENUM(VARYING_SLOT_VAR18), - ENUM(VARYING_SLOT_VAR19), - ENUM(VARYING_SLOT_VAR20), - ENUM(VARYING_SLOT_VAR21), - ENUM(VARYING_SLOT_VAR22), - ENUM(VARYING_SLOT_VAR23), - ENUM(VARYING_SLOT_VAR24), - ENUM(VARYING_SLOT_VAR25), - ENUM(VARYING_SLOT_VAR26), - ENUM(VARYING_SLOT_VAR27), - ENUM(VARYING_SLOT_VAR28), - ENUM(VARYING_SLOT_VAR29), - ENUM(VARYING_SLOT_VAR30), - ENUM(VARYING_SLOT_VAR31), - }; - STATIC_ASSERT(ARRAY_SIZE(names) == VARYING_SLOT_MAX); - return NAME(slot); -} - -const char * -gl_system_value_name(gl_system_value sysval) -{ - static const char *names[] = { - ENUM(SYSTEM_VALUE_VERTEX_ID), - ENUM(SYSTEM_VALUE_INSTANCE_ID), - ENUM(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE), - ENUM(SYSTEM_VALUE_BASE_VERTEX), - ENUM(SYSTEM_VALUE_INVOCATION_ID), - ENUM(SYSTEM_VALUE_FRONT_FACE), - ENUM(SYSTEM_VALUE_SAMPLE_ID), - ENUM(SYSTEM_VALUE_SAMPLE_POS), - ENUM(SYSTEM_VALUE_SAMPLE_MASK_IN), - ENUM(SYSTEM_VALUE_TESS_COORD), - ENUM(SYSTEM_VALUE_VERTICES_IN), - ENUM(SYSTEM_VALUE_PRIMITIVE_ID), - ENUM(SYSTEM_VALUE_TESS_LEVEL_OUTER), - ENUM(SYSTEM_VALUE_TESS_LEVEL_INNER), - ENUM(SYSTEM_VALUE_LOCAL_INVOCATION_ID), - ENUM(SYSTEM_VALUE_WORK_GROUP_ID), - ENUM(SYSTEM_VALUE_NUM_WORK_GROUPS), - ENUM(SYSTEM_VALUE_VERTEX_CNT), - }; - STATIC_ASSERT(ARRAY_SIZE(names) == SYSTEM_VALUE_MAX); - return NAME(sysval); -} - -const char * -glsl_interp_qualifier_name(enum glsl_interp_qualifier qual) -{ - static const char *names[] = { - ENUM(INTERP_QUALIFIER_NONE), - ENUM(INTERP_QUALIFIER_SMOOTH), - ENUM(INTERP_QUALIFIER_FLAT), - ENUM(INTERP_QUALIFIER_NOPERSPECTIVE), - }; - STATIC_ASSERT(ARRAY_SIZE(names) == INTERP_QUALIFIER_COUNT); - return NAME(qual); -} - -const char * -gl_frag_result_name(gl_frag_result result) -{ - static const char *names[] = { - ENUM(FRAG_RESULT_DEPTH), - ENUM(FRAG_RESULT_STENCIL), - ENUM(FRAG_RESULT_COLOR), - ENUM(FRAG_RESULT_SAMPLE_MASK), - ENUM(FRAG_RESULT_DATA0), - ENUM(FRAG_RESULT_DATA1), - ENUM(FRAG_RESULT_DATA2), - ENUM(FRAG_RESULT_DATA3), - ENUM(FRAG_RESULT_DATA4), - ENUM(FRAG_RESULT_DATA5), - ENUM(FRAG_RESULT_DATA6), - ENUM(FRAG_RESULT_DATA7), - }; - STATIC_ASSERT(ARRAY_SIZE(names) == FRAG_RESULT_MAX); - return NAME(result); -} diff --git a/src/glsl/nir/shader_enums.h b/src/glsl/nir/shader_enums.h deleted file mode 100644 index efc0b0d515e..00000000000 --- a/src/glsl/nir/shader_enums.h +++ /dev/null @@ -1,542 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SHADER_ENUMS_H -#define SHADER_ENUMS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Shader stages. Note that these will become 5 with tessellation. - * - * The order must match how shaders are ordered in the pipeline. - * The GLSL linker assumes that if i