[Mesa-dev] [PATCH 10/56] glsl: Pull operator_strs out to its own file

Ian Romanick idr at freedesktop.org
Tue Jul 19 19:24:29 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

No change except to the copyright symbol.  The next patch will generate
this file with Python, and Unicode + Python = pure rage.

v2: Massive rebase.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/compiler/Makefile.sources                      |   1 +
 src/compiler/glsl/ir.cpp                           | 116 +----------------
 .../glsl/ir_expression_operation_strings.h         | 138 +++++++++++++++++++++
 3 files changed, 140 insertions(+), 115 deletions(-)
 create mode 100644 src/compiler/glsl/ir_expression_operation_strings.h

diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index f645173..ce42df2 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -39,6 +39,7 @@ LIBGLSL_FILES = \
 	glsl/ir_equals.cpp \
 	glsl/ir_expression_flattening.cpp \
 	glsl/ir_expression_flattening.h \
+	glsl/ir_expression_operation_strings.h \
 	glsl/ir_function_can_inline.cpp \
 	glsl/ir_function_detect_recursion.cpp \
 	glsl/ir_function_inlining.h \
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index b049fda..62061d6 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -498,121 +498,7 @@ ir_expression::get_num_operands(ir_expression_operation op)
    return 0;
 }
 
-static const char *const operator_strs[] = {
-   "~",
-   "!",
-   "neg",
-   "abs",
-   "sign",
-   "rcp",
-   "rsq",
-   "sqrt",
-   "exp",
-   "log",
-   "exp2",
-   "log2",
-   "f2i",
-   "f2u",
-   "i2f",
-   "f2b",
-   "b2f",
-   "i2b",
-   "b2i",
-   "u2f",
-   "i2u",
-   "u2i",
-   "d2f",
-   "f2d",
-   "d2i",
-   "i2d",
-   "d2u",
-   "u2d",
-   "d2b",
-   "bitcast_i2f",
-   "bitcast_f2i",
-   "bitcast_u2f",
-   "bitcast_f2u",
-   "trunc",
-   "ceil",
-   "floor",
-   "fract",
-   "round_even",
-   "sin",
-   "cos",
-   "dFdx",
-   "dFdxCoarse",
-   "dFdxFine",
-   "dFdy",
-   "dFdyCoarse",
-   "dFdyFine",
-   "packSnorm2x16",
-   "packSnorm4x8",
-   "packUnorm2x16",
-   "packUnorm4x8",
-   "packHalf2x16",
-   "unpackSnorm2x16",
-   "unpackSnorm4x8",
-   "unpackUnorm2x16",
-   "unpackUnorm4x8",
-   "unpackHalf2x16",
-   "bitfield_reverse",
-   "bit_count",
-   "find_msb",
-   "find_lsb",
-   "sat",
-   "packDouble2x32",
-   "unpackDouble2x32",
-   "frexp_sig",
-   "frexp_exp",
-   "noise",
-   "subroutine_to_int",
-   "interpolate_at_centroid",
-   "get_buffer_size",
-   "ssbo_unsized_array_length",
-   "vote_any",
-   "vote_all",
-   "vote_eq",
-   "+",
-   "-",
-   "*",
-   "imul_high",
-   "/",
-   "carry",
-   "borrow",
-   "%",
-   "<",
-   ">",
-   "<=",
-   ">=",
-   "==",
-   "!=",
-   "all_equal",
-   "any_nequal",
-   "<<",
-   ">>",
-   "&",
-   "^",
-   "|",
-   "&&",
-   "^^",
-   "||",
-   "dot",
-   "min",
-   "max",
-   "pow",
-   "ubo_load",
-   "ldexp",
-   "vector_extract",
-   "interpolate_at_offset",
-   "interpolate_at_sample",
-   "fma",
-   "lrp",
-   "csel",
-   "bitfield_extract",
-   "vector_insert",
-   "bitfield_insert",
-   "vector",
-};
+#include "ir_expression_operation_strings.h"
 
 const char *ir_expression::operator_string(ir_expression_operation op)
 {
diff --git a/src/compiler/glsl/ir_expression_operation_strings.h b/src/compiler/glsl/ir_expression_operation_strings.h
new file mode 100644
index 0000000..3fbbae9
--- /dev/null
+++ b/src/compiler/glsl/ir_expression_operation_strings.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2010 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 (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.
+ */
+
+static const char *const operator_strs[] = {
+   "~",
+   "!",
+   "neg",
+   "abs",
+   "sign",
+   "rcp",
+   "rsq",
+   "sqrt",
+   "exp",
+   "log",
+   "exp2",
+   "log2",
+   "f2i",
+   "f2u",
+   "i2f",
+   "f2b",
+   "b2f",
+   "i2b",
+   "b2i",
+   "u2f",
+   "i2u",
+   "u2i",
+   "d2f",
+   "f2d",
+   "d2i",
+   "i2d",
+   "d2u",
+   "u2d",
+   "d2b",
+   "bitcast_i2f",
+   "bitcast_f2i",
+   "bitcast_u2f",
+   "bitcast_f2u",
+   "trunc",
+   "ceil",
+   "floor",
+   "fract",
+   "round_even",
+   "sin",
+   "cos",
+   "dFdx",
+   "dFdxCoarse",
+   "dFdxFine",
+   "dFdy",
+   "dFdyCoarse",
+   "dFdyFine",
+   "packSnorm2x16",
+   "packSnorm4x8",
+   "packUnorm2x16",
+   "packUnorm4x8",
+   "packHalf2x16",
+   "unpackSnorm2x16",
+   "unpackSnorm4x8",
+   "unpackUnorm2x16",
+   "unpackUnorm4x8",
+   "unpackHalf2x16",
+   "bitfield_reverse",
+   "bit_count",
+   "find_msb",
+   "find_lsb",
+   "sat",
+   "packDouble2x32",
+   "unpackDouble2x32",
+   "frexp_sig",
+   "frexp_exp",
+   "noise",
+   "subroutine_to_int",
+   "interpolate_at_centroid",
+   "get_buffer_size",
+   "ssbo_unsized_array_length",
+   "vote_any",
+   "vote_all",
+   "vote_eq",
+   "+",
+   "-",
+   "*",
+   "imul_high",
+   "/",
+   "carry",
+   "borrow",
+   "%",
+   "<",
+   ">",
+   "<=",
+   ">=",
+   "==",
+   "!=",
+   "all_equal",
+   "any_nequal",
+   "<<",
+   ">>",
+   "&",
+   "^",
+   "|",
+   "&&",
+   "^^",
+   "||",
+   "dot",
+   "min",
+   "max",
+   "pow",
+   "ubo_load",
+   "ldexp",
+   "vector_extract",
+   "interpolate_at_offset",
+   "interpolate_at_sample",
+   "fma",
+   "lrp",
+   "csel",
+   "bitfield_extract",
+   "vector_insert",
+   "bitfield_insert",
+   "vector",
+};
-- 
2.5.5



More information about the mesa-dev mailing list