summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/compiler/Makefile.glsl.am8
-rw-r--r--src/compiler/Makefile.sources2
-rw-r--r--src/compiler/SConscript4
-rw-r--r--src/compiler/SConscript.glsl9
-rw-r--r--src/compiler/SConscript.nir1
-rw-r--r--src/compiler/glsl/.gitignore1
-rw-r--r--src/compiler/glsl/ir_expression_operation.h340
-rw-r--r--src/compiler/glsl/ir_expression_operation.py384
-rw-r--r--src/mesa/Makefile.sources1
-rw-r--r--src/mesa/SConscript1
-rw-r--r--src/mesa/drivers/dri/i965/Makefile.am1
11 files changed, 411 insertions, 341 deletions
diff --git a/src/compiler/Makefile.glsl.am b/src/compiler/Makefile.glsl.am
index bfb3161..0dba618 100644
--- a/src/compiler/Makefile.glsl.am
+++ b/src/compiler/Makefile.glsl.am
@@ -25,6 +25,7 @@ EXTRA_DIST += glsl/tests glsl/glcpp/tests glsl/README \
glsl/TODO glsl/glcpp/README \
glsl/glsl_lexer.ll \
glsl/glsl_parser.yy \
+ glsl/ir_expression_operation.py \
glsl/glcpp/glcpp-lex.l \
glsl/glcpp/glcpp-parse.y \
SConscript.glsl
@@ -178,6 +179,7 @@ am__v_YACC_1 =
YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
glsl/glsl_parser.cpp glsl/glsl_parser.h: glsl/glsl_parser.yy
$(MKDIR_GEN)
@@ -195,6 +197,10 @@ glsl/glcpp/glcpp-lex.c: glsl/glcpp/glcpp-lex.l
$(MKDIR_GEN)
$(LEX_GEN) -o $@ $(srcdir)/glsl/glcpp/glcpp-lex.l
+glsl/ir_expression_operation.h: glsl/ir_expression_operation.py
+ $(MKDIR_GEN)
+ $(PYTHON_GEN) $(srcdir)/glsl/ir_expression_operation.py > $@ || ($(RM) $@; false)
+
# Only the parsers (specifically the header files generated at the same time)
# need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
# called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
@@ -204,6 +210,7 @@ glsl/glcpp/glcpp-lex.c: glsl/glcpp/glcpp-lex.l
BUILT_SOURCES += \
glsl/glsl_parser.cpp \
glsl/glsl_lexer.cpp \
+ glsl/ir_expression_operation.h \
glsl/glcpp/glcpp-parse.c \
glsl/glcpp/glcpp-lex.c
CLEANFILES += \
@@ -211,6 +218,7 @@ CLEANFILES += \
glsl/glsl_parser.h \
glsl/glsl_parser.cpp \
glsl/glsl_lexer.cpp \
+ glsl/ir_expression_operation.h \
glsl/glcpp/glcpp-parse.c \
glsl/glcpp/glcpp-lex.c
diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index edd683a..e0036c1 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -39,7 +39,6 @@ LIBGLSL_FILES = \
glsl/ir_equals.cpp \
glsl/ir_expression_flattening.cpp \
glsl/ir_expression_flattening.h \
- glsl/ir_expression_operation.h \
glsl/ir_function_can_inline.cpp \
glsl/ir_function_detect_recursion.cpp \
glsl/ir_function_inlining.h \
@@ -147,6 +146,7 @@ GLSL_COMPILER_CXX_FILES = \
# libglsl generated sources
LIBGLSL_GENERATED_FILES = \
+ glsl/ir_expression_operation.h \
glsl/glsl_lexer.cpp \
glsl/glsl_parser.cpp \
glsl/glsl_parser.h
diff --git a/src/compiler/SConscript b/src/compiler/SConscript
index 10c79c4..44509a9 100644
--- a/src/compiler/SConscript
+++ b/src/compiler/SConscript
@@ -13,6 +13,10 @@ env.Prepend(CPPPATH = [
'#src/gallium/auxiliary',
])
+# Make generated headers reachable from the include path.
+env.Prepend(CPPPATH = [Dir('.').abspath, Dir('glsl').abspath])
+env.Prepend(CPPPATH = [Dir('.').abspath, Dir('nir').abspath])
+
sources = env.ParseSourceList('Makefile.sources', 'LIBCOMPILER_FILES')
compiler = env.ConvenienceLibrary(
diff --git a/src/compiler/SConscript.glsl b/src/compiler/SConscript.glsl
index 31d8f6d..3d28d99 100644
--- a/src/compiler/SConscript.glsl
+++ b/src/compiler/SConscript.glsl
@@ -116,6 +116,15 @@ env.Prepend(LIBS = [compiler, glsl])
compiler_objs += env.StaticObject("glsl/main.cpp")
+# GLSL generated sources
+
+env.CodeGenerate(
+ target = 'glsl/ir_expression_operation.h',
+ script = 'glsl/ir_expression_operation.py',
+ source = [],
+ command = python_cmd + ' $SCRIPT > $TARGET'
+)
+
glsl_compiler = env.Program(
target = 'glsl_compiler',
source = compiler_objs,
diff --git a/src/compiler/SConscript.nir b/src/compiler/SConscript.nir
index 51cc0d4..3c685a2 100644
--- a/src/compiler/SConscript.nir
+++ b/src/compiler/SConscript.nir
@@ -19,6 +19,7 @@ env.Prepend(CPPPATH = [
])
# Make generated headers reachable from the include path.
+env.Prepend(CPPPATH = [Dir('.').abspath, Dir('glsl').abspath])
env.Prepend(CPPPATH = [Dir('.').abspath, Dir('nir').abspath])
# nir generated sources
diff --git a/src/compiler/glsl/.gitignore b/src/compiler/glsl/.gitignore
index 09951ba..30f4bca 100644
--- a/src/compiler/glsl/.gitignore
+++ b/src/compiler/glsl/.gitignore
@@ -3,6 +3,7 @@ glsl_parser.cpp
glsl_parser.h
glsl_parser.output
glsl_test
+ir_expression_operation.h
subtest-cr/
subtest-lf/
subtest-cr-lf/
diff --git a/src/compiler/glsl/ir_expression_operation.h b/src/compiler/glsl/ir_expression_operation.h
deleted file mode 100644
index a97ce84..0000000
--- a/src/compiler/glsl/ir_expression_operation.h
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * 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.
- */
-
-/* Update ir_expression::get_num_operands() and operator_strs when
- * updating this list.
- */
-enum ir_expression_operation {
- ir_unop_bit_not,
- ir_unop_logic_not,
- ir_unop_neg,
- ir_unop_abs,
- ir_unop_sign,
- ir_unop_rcp,
- ir_unop_rsq,
- ir_unop_sqrt,
- ir_unop_exp, /**< Log base e on gentype */
- ir_unop_log, /**< Natural log on gentype */
- ir_unop_exp2,
- ir_unop_log2,
- ir_unop_f2i, /**< Float-to-integer conversion. */
- ir_unop_f2u, /**< Float-to-unsigned conversion. */
- ir_unop_i2f, /**< Integer-to-float conversion. */
- ir_unop_f2b, /**< Float-to-boolean conversion */
- ir_unop_b2f, /**< Boolean-to-float conversion */
- ir_unop_i2b, /**< int-to-boolean conversion */
- ir_unop_b2i, /**< Boolean-to-int conversion */
- ir_unop_u2f, /**< Unsigned-to-float conversion. */
- ir_unop_i2u, /**< Integer-to-unsigned conversion. */
- ir_unop_u2i, /**< Unsigned-to-integer conversion. */
- ir_unop_d2f, /**< Double-to-float conversion. */
- ir_unop_f2d, /**< Float-to-double conversion. */
- ir_unop_d2i, /**< Double-to-integer conversion. */
- ir_unop_i2d, /**< Integer-to-double conversion. */
- ir_unop_d2u, /**< Double-to-unsigned conversion. */
- ir_unop_u2d, /**< Unsigned-to-double conversion. */
- ir_unop_d2b, /**< Double-to-boolean conversion. */
- ir_unop_bitcast_i2f, /**< Bit-identical int-to-float "conversion" */
- ir_unop_bitcast_f2i, /**< Bit-identical float-to-int "conversion" */
- ir_unop_bitcast_u2f, /**< Bit-identical uint-to-float "conversion" */
- ir_unop_bitcast_f2u, /**< Bit-identical float-to-uint "conversion" */
-
- /**
- * \name Unary floating-point rounding operations.
- */
- /*@{*/
- ir_unop_trunc,
- ir_unop_ceil,
- ir_unop_floor,
- ir_unop_fract,
- ir_unop_round_even,
- /*@}*/
-
- /**
- * \name Trigonometric operations.
- */
- /*@{*/
- ir_unop_sin,
- ir_unop_cos,
- /*@}*/
-
- /**
- * \name Partial derivatives.
- */
- /*@{*/
- ir_unop_dFdx,
- ir_unop_dFdx_coarse,
- ir_unop_dFdx_fine,
- ir_unop_dFdy,
- ir_unop_dFdy_coarse,
- ir_unop_dFdy_fine,
- /*@}*/
-
- /**
- * \name Floating point pack and unpack operations.
- */
- /*@{*/
- ir_unop_pack_snorm_2x16,
- ir_unop_pack_snorm_4x8,
- ir_unop_pack_unorm_2x16,
- ir_unop_pack_unorm_4x8,
- ir_unop_pack_half_2x16,
- ir_unop_unpack_snorm_2x16,
- ir_unop_unpack_snorm_4x8,
- ir_unop_unpack_unorm_2x16,
- ir_unop_unpack_unorm_4x8,
- ir_unop_unpack_half_2x16,
- /*@}*/
-
- /**
- * \name Bit operations, part of ARB_gpu_shader5.
- */
- /*@{*/
- ir_unop_bitfield_reverse,
- ir_unop_bit_count,
- ir_unop_find_msb,
- ir_unop_find_lsb,
- /*@}*/
-
- ir_unop_saturate,
-
- /**
- * \name Double packing, part of ARB_gpu_shader_fp64.
- */
- /*@{*/
- ir_unop_pack_double_2x32,
- ir_unop_unpack_double_2x32,
- /*@}*/
-
- ir_unop_frexp_sig,
- ir_unop_frexp_exp,
-
- ir_unop_noise,
-
- ir_unop_subroutine_to_int,
- /**
- * Interpolate fs input at centroid
- *
- * operand0 is the fs input.
- */
- ir_unop_interpolate_at_centroid,
-
- /**
- * Ask the driver for the total size of a buffer block.
- *
- * operand0 is the ir_constant buffer block index in the linked shader.
- */
- ir_unop_get_buffer_size,
-
- /**
- * Calculate length of an unsized array inside a buffer block.
- * This opcode is going to be replaced in a lowering pass inside
- * the linker.
- *
- * operand0 is the unsized array's ir_value for the calculation
- * of its length.
- */
- ir_unop_ssbo_unsized_array_length,
-
- /**
- * Vote among threads on the value of the boolean argument.
- */
- ir_unop_vote_any,
- ir_unop_vote_all,
- ir_unop_vote_eq,
-
- /**
- * A sentinel marking the last of the unary operations.
- */
- ir_last_unop = ir_unop_vote_eq,
-
- ir_binop_add,
- ir_binop_sub,
- ir_binop_mul, /**< Floating-point or low 32-bit integer multiply. */
- ir_binop_imul_high, /**< Calculates the high 32-bits of a 64-bit multiply. */
- ir_binop_div,
-
- /**
- * Returns the carry resulting from the addition of the two arguments.
- */
- /*@{*/
- ir_binop_carry,
- /*@}*/
-
- /**
- * Returns the borrow resulting from the subtraction of the second argument
- * from the first argument.
- */
- /*@{*/
- ir_binop_borrow,
- /*@}*/
-
- /**
- * Takes one of two combinations of arguments:
- *
- * - mod(vecN, vecN)
- * - mod(vecN, float)
- *
- * Does not take integer types.
- */
- ir_binop_mod,
-
- /**
- * \name Binary comparison operators which return a boolean vector.
- * The type of both operands must be equal.
- */
- /*@{*/
- ir_binop_less,
- ir_binop_greater,
- ir_binop_lequal,
- ir_binop_gequal,
- ir_binop_equal,
- ir_binop_nequal,
- /**
- * Returns single boolean for whether all components of operands[0]
- * equal the components of operands[1].
- */
- ir_binop_all_equal,
- /**
- * Returns single boolean for whether any component of operands[0]
- * is not equal to the corresponding component of operands[1].
- */
- ir_binop_any_nequal,
- /*@}*/
-
- /**
- * \name Bit-wise binary operations.
- */
- /*@{*/
- ir_binop_lshift,
- ir_binop_rshift,
- ir_binop_bit_and,
- ir_binop_bit_xor,
- ir_binop_bit_or,
- /*@}*/
-
- ir_binop_logic_and,
- ir_binop_logic_xor,
- ir_binop_logic_or,
-
- ir_binop_dot,
- ir_binop_min,
- ir_binop_max,
-
- ir_binop_pow,
-
- /**
- * Load a value the size of a given GLSL type from a uniform block.
- *
- * operand0 is the ir_constant uniform block index in the linked shader.
- * operand1 is a byte offset within the uniform block.
- */
- ir_binop_ubo_load,
-
- /**
- * \name Multiplies a number by two to a power, part of ARB_gpu_shader5.
- */
- /*@{*/
- ir_binop_ldexp,
- /*@}*/
-
- /**
- * Extract a scalar from a vector
- *
- * operand0 is the vector
- * operand1 is the index of the field to read from operand0
- */
- ir_binop_vector_extract,
-
- /**
- * Interpolate fs input at offset
- *
- * operand0 is the fs input
- * operand1 is the offset from the pixel center
- */
- ir_binop_interpolate_at_offset,
-
- /**
- * Interpolate fs input at sample position
- *
- * operand0 is the fs input
- * operand1 is the sample ID
- */
- ir_binop_interpolate_at_sample,
-
- /**
- * A sentinel marking the last of the binary operations.
- */
- ir_last_binop = ir_binop_interpolate_at_sample,
-
- /**
- * \name Fused floating-point multiply-add, part of ARB_gpu_shader5.
- */
- /*@{*/
- ir_triop_fma,
- /*@}*/
-
- ir_triop_lrp,
-
- /**
- * \name Conditional Select
- *
- * A vector conditional select instruction (like ?:, but operating per-
- * component on vectors).
- *
- * \see lower_instructions_visitor::ldexp_to_arith
- */
- /*@{*/
- ir_triop_csel,
- /*@}*/
-
- ir_triop_bitfield_extract,
-
- /**
- * Generate a value with one field of a vector changed
- *
- * operand0 is the vector
- * operand1 is the value to write into the vector result
- * operand2 is the index in operand0 to be modified
- */
- ir_triop_vector_insert,
-
- /**
- * A sentinel marking the last of the ternary operations.
- */
- ir_last_triop = ir_triop_vector_insert,
-
- ir_quadop_bitfield_insert,
-
- ir_quadop_vector,
-
- /**
- * A sentinel marking the last of the ternary operations.
- */
- ir_last_quadop = ir_quadop_vector,
-
- /**
- * A sentinel marking the last of all operations.
- */
- ir_last_opcode = ir_quadop_vector
-};
diff --git a/src/compiler/glsl/ir_expression_operation.py b/src/compiler/glsl/ir_expression_operation.py
new file mode 100644
index 0000000..35f1be6
--- /dev/null
+++ b/src/compiler/glsl/ir_expression_operation.py
@@ -0,0 +1,384 @@
+#! /usr/bin/env python
+#
+# 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 (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.
+
+import mako.template
+
+ir_expression_operation = [
+ # Name operands string comment
+ ("bit_not", 1, "~", None),
+ ("logic_not", 1, "!", None),
+ ("neg", 1, None, None),
+ ("abs", 1, None, None),
+ ("sign", 1, None, None),
+ ("rcp", 1, None, None),
+ ("rsq", 1, None, None),
+ ("sqrt", 1, None, None),
+ ("exp", 1, None, "Log base e on gentype"),
+ ("log", 1, None, "Natural log on gentype"),
+ ("exp2", 1, None, None),
+ ("log2", 1, None, None),
+ ("f2i", 1, None, "Float-to-integer conversion."),
+ ("f2u", 1, None, "Float-to-unsigned conversion."),
+ ("i2f", 1, None, "Integer-to-float conversion."),
+ ("f2b", 1, None, "Float-to-boolean conversion"),
+ ("b2f", 1, None, "Boolean-to-float conversion"),
+ ("i2b", 1, None, "int-to-boolean conversion"),
+ ("b2i", 1, None, "Boolean-to-int conversion"),
+ ("u2f", 1, None, "Unsigned-to-float conversion."),
+ ("i2u", 1, None, "Integer-to-unsigned conversion."),
+ ("u2i", 1, None, "Unsigned-to-integer conversion."),
+ ("d2f", 1, None, "Double-to-float conversion."),
+ ("f2d", 1, None, "Float-to-double conversion."),
+ ("d2i", 1, None, "Double-to-integer conversion."),
+ ("i2d", 1, None, "Integer-to-double conversion."),
+ ("d2u", 1, None, "Double-to-unsigned conversion."),
+ ("u2d", 1, None, "Unsigned-to-double conversion."),
+ ("d2b", 1, None, "Double-to-boolean conversion."),
+ ("bitcast_i2f", 1, None, 'Bit-identical int-to-float "conversion"'),
+ ("bitcast_f2i", 1, None, 'Bit-identical float-to-int "conversion"'),
+ ("bitcast_u2f", 1, None, 'Bit-identical uint-to-float "conversion"'),
+ ("bitcast_f2u", 1, None, 'Bit-identical float-to-uint "conversion"'),
+"""
+ /**
+ * \\name Unary floating-point rounding operations.
+ */
+ /*@{*/""",
+ ("trunc", 1, None, None),
+ ("ceil", 1, None, None),
+ ("floor", 1, None, None),
+ ("fract", 1, None, None),
+ ("round_even", 1, None, None),
+""" /*@}*/
+
+ /**
+ * \\name Trigonometric operations.
+ */
+ /*@{*/""",
+ ("sin", 1, None, None),
+ ("cos", 1, None, None),
+""" /*@}*/
+
+ /**
+ * \\name Partial derivatives.
+ */
+ /*@{*/""",
+ ("dFdx", 1, None, None),
+ ("dFdx_coarse", 1, "dFdxCoarse", None),
+ ("dFdx_fine", 1, "dFdxFine", None),
+ ("dFdy", 1, None, None),
+ ("dFdy_coarse", 1, "dFdyCoarse", None),
+ ("dFdy_fine", 1, "dFdyFine", None),
+""" /*@}*/
+
+ /**
+ * \\name Floating point pack and unpack operations.
+ */
+ /*@{*/""",
+ ("pack_snorm_2x16", 1, "packSnorm2x16", None),
+ ("pack_snorm_4x8", 1, "packSnorm4x8", None),
+ ("pack_unorm_2x16", 1, "packUnorm2x16", None),
+ ("pack_unorm_4x8", 1, "packUnorm4x8", None),
+ ("pack_half_2x16", 1, "packHalf2x16", None),
+ ("unpack_snorm_2x16", 1, "unpackSnorm2x16", None),
+ ("unpack_snorm_4x8", 1, "unpackSnorm4x8", None),
+ ("unpack_unorm_2x16", 1, "unpackUnorm2x16", None),
+ ("unpack_unorm_4x8", 1, "unpackUnorm4x8", None),
+ ("unpack_half_2x16", 1, "unpackHalf2x16", None),
+""" /*@}*/
+
+ /**
+ * \\name Bit operations, part of ARB_gpu_shader5.
+ */
+ /*@{*/""",
+ ("bitfield_reverse", 1, None, None),
+ ("bit_count", 1, None, None),
+ ("find_msb", 1, None, None),
+ ("find_lsb", 1, None, None),
+""" /*@}*/
+""",
+ ("saturate", 1, "sat", None),
+"""
+ /**
+ * \\name Double packing, part of ARB_gpu_shader_fp64.
+ */
+ /*@{*/""",
+ ("pack_double_2x32", 1, "packDouble2x32", None),
+ ("unpack_double_2x32", 1, "unpackDouble2x32", None),
+""" /*@}*/
+""",
+ ("frexp_sig", 1, None, None),
+ ("frexp_exp", 1, None, None),
+ "",
+ ("noise", 1, None, None),
+ "",
+ ("subroutine_to_int", 1, None, None),
+""" /**
+ * Interpolate fs input at centroid
+ *
+ * operand0 is the fs input.
+ */""",
+ ("interpolate_at_centroid", 1, None, None),
+"""
+ /**
+ * Ask the driver for the total size of a buffer block.
+ *
+ * operand0 is the ir_constant buffer block index in the linked shader.
+ */""",
+ ("get_buffer_size", 1, None, None),
+"""
+ /**
+ * Calculate length of an unsized array inside a buffer block.
+ * This opcode is going to be replaced in a lowering pass inside
+ * the linker.
+ *
+ * operand0 is the unsized array's ir_value for the calculation
+ * of its length.
+ */""",
+ ("ssbo_unsized_array_length", 1, None, None),
+"""
+ /**
+ * Vote among threads on the value of the boolean argument.
+ */""",
+ ("vote_any", 1, None, None),
+ ("vote_all", 1, None, None),
+ ("vote_eq", 1, None, None),
+
+"""
+ /**
+ * A sentinel marking the last of the unary operations.
+ */
+ ir_last_unop = ir_unop_vote_eq,
+""",
+ ("add", 2, "+", None),
+ ("sub", 2, "-", None),
+ ("mul", 2, "*", "Floating-point or low 32-bit integer multiply."),
+ ("imul_high", 2, None, "Calculates the high 32-bits of a 64-bit multiply."),
+ ("div", 2, "/", None),
+"""
+ /**
+ * Returns the carry resulting from the addition of the two arguments.
+ */
+ /*@{*/""",
+ ("carry", 2, None, None),
+""" /*@}*/
+
+ /**
+ * Returns the borrow resulting from the subtraction of the second argument
+ * from the first argument.
+ */
+ /*@{*/""",
+ ("borrow", 2, None, None),
+""" /*@}*/
+
+ /**
+ * Takes one of two combinations of arguments:
+ *
+ * - mod(vecN, vecN)
+ * - mod(vecN, float)
+ *
+ * Does not take integer types.
+ */""",
+ ("mod", 2, "%", None),
+"""
+ /**
+ * \\name Binary comparison operators which return a boolean vector.
+ * The type of both operands must be equal.
+ */
+ /*@{*/""",
+ ("less", 2, "<", None),
+ ("greater", 2, ">", None),
+ ("lequal", 2, "<=", None),
+ ("gequal", 2, ">=", None),
+ ("equal", 2, "==", None),
+ ("nequal", 2, "!=", None),
+""" /**
+ * Returns single boolean for whether all components of operands[0]
+ * equal the components of operands[1].
+ */""",
+ ("all_equal", 2, None, None),
+""" /**
+ * Returns single boolean for whether any component of operands[0]
+ * is not equal to the corresponding component of operands[1].
+ */""",
+ ("any_nequal", 2, None, None),
+""" /*@}*/
+
+ /**
+ * \\name Bit-wise binary operations.
+ */
+ /*@{*/""",
+ ("lshift", 2, "<<", None),
+ ("rshift", 2, ">>", None),
+ ("bit_and", 2, "&", None),
+ ("bit_xor", 2, "^", None),
+ ("bit_or", 2, "|", None),
+""" /*@}*/
+""",
+ ("logic_and", 2, "&&", None),
+ ("logic_xor", 2, "^^", None),
+ ("logic_or", 2, "||", None),
+ "",
+ ("dot", 2, None, None),
+ ("min", 2, None, None),
+ ("max", 2, None, None),
+ "",
+ ("pow", 2, None, None),
+"""
+ /**
+ * Load a value the size of a given GLSL type from a uniform block.
+ *
+ * operand0 is the ir_constant uniform block index in the linked shader.
+ * operand1 is a byte offset within the uniform block.
+ */""",
+ ("ubo_load", 2, None, None),
+"""
+ /**
+ * \\name Multiplies a number by two to a power, part of ARB_gpu_shader5.
+ */
+ /*@{*/""",
+ ("ldexp", 2, None, None),
+""" /*@}*/
+
+ /**
+ * Extract a scalar from a vector
+ *
+ * operand0 is the vector
+ * operand1 is the index of the field to read from operand0
+ */""",
+ ("vector_extract", 2, None, None),
+"""
+ /**
+ * Interpolate fs input at offset
+ *
+ * operand0 is the fs input
+ * operand1 is the offset from the pixel center
+ */""",
+ ("interpolate_at_offset", 2, None, None),
+"""
+ /**
+ * Interpolate fs input at sample position
+ *
+ * operand0 is the fs input
+ * operand1 is the sample ID
+ */""",
+ ("interpolate_at_sample", 2, None, None),
+"""
+ /**
+ * A sentinel marking the last of the binary operations.
+ */
+ ir_last_binop = ir_binop_interpolate_at_sample,
+
+ /**
+ * \\name Fused floating-point multiply-add, part of ARB_gpu_shader5.
+ */
+ /*@{*/""",
+ ("fma", 3, None, None),
+""" /*@}*/
+""",
+ ("lrp", 3, None, None),
+"""
+ /**
+ * \\name Conditional Select
+ *
+ * A vector conditional select instruction (like ?:, but operating per-
+ * component on vectors).
+ *
+ * \\see lower_instructions_visitor::ldexp_to_arith
+ */
+ /*@{*/""",
+ ("csel", 3, None, None),
+""" /*@}*/
+""",
+ ("bitfield_extract", 3, None, None),
+"""
+ /**
+ * Generate a value with one field of a vector changed
+ *
+ * operand0 is the vector
+ * operand1 is the value to write into the vector result
+ * operand2 is the index in operand0 to be modified
+ */""",
+ ("vector_insert", 3, None, None),
+"""
+ /**
+ * A sentinel marking the last of the ternary operations.
+ */
+ ir_last_triop = ir_triop_vector_insert,
+""",
+ ("bitfield_insert", 4, None, None),
+ "",
+ ("vector", 4, None, None),
+"""
+ /**
+ * A sentinel marking the last of the ternary operations.
+ */
+ ir_last_quadop = ir_quadop_vector,
+
+ /**
+ * A sentinel marking the last of all operations.
+ */
+ ir_last_opcode = ir_quadop_vector""",
+]
+
+def name_from_item(item):
+ return "ir_{}op_{}".format(("un", "bin", "tri", "quad")[item[1]-1], item[0])
+
+if __name__ == "__main__":
+ enum_template = mako.template.Template("""/*
+ * 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.
+ */
+
+/* Update ir_expression::get_num_operands() and operator_strs when
+ * updating this list.
+ */
+enum ir_expression_operation {
+% for item in values:
+% if isinstance(item, str):
+${item}
+% else:
+ ${name_from_item(item)},${"" if item[3] is None else " /**< {} */".format(item[3])}
+% endif
+% endfor
+};""")
+
+ print(enum_template.render(values=ir_expression_operation,
+ name_from_item=name_from_item))
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 3622760..f941c96 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -650,6 +650,7 @@ INCLUDE_DIRS = \
-I$(top_srcdir)/include \
-I$(top_builddir)/src \
-I$(top_srcdir)/src \
+ -I$(top_builddir)/src/compiler/glsl \
-I$(top_builddir)/src/compiler/nir \
-I$(top_builddir)/src/mesa \
-I$(top_srcdir)/src/mesa \
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 13a2e6a..e375de6 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -11,6 +11,7 @@ env.MSVC2013Compat()
env.Append(CPPPATH = [
'../compiler/nir', # for generated nir_opcodes.h, etc
+ '../compiler/glsl', # for generated headers
'#/src',
Dir('../mapi'), # src/mapi build path
'#/src/mapi',
diff --git a/src/mesa/drivers/dri/i965/Makefile.am b/src/mesa/drivers/dri/i965/Makefile.am
index 14dbb9c..91559c5 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -35,6 +35,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/gtest/include \
-I$(top_srcdir)/src/compiler/nir \
-I$(top_srcdir)/src/intel \
+ -I$(top_builddir)/src/compiler/glsl \
-I$(top_builddir)/src/compiler/nir \
-I$(top_builddir)/src/intel \
-I$(top_builddir)/src/mesa/drivers/dri/common \