summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/glcpp/meson.build56
-rw-r--r--src/compiler/glsl/meson.build229
-rw-r--r--src/compiler/glsl/tests/meson.build76
-rw-r--r--src/compiler/meson.build12
4 files changed, 366 insertions, 7 deletions
diff --git a/src/compiler/glsl/glcpp/meson.build b/src/compiler/glsl/glcpp/meson.build
new file mode 100644
index 00000000000..17ee1a242cd
--- /dev/null
+++ b/src/compiler/glsl/glcpp/meson.build
@@ -0,0 +1,56 @@
+# Copyright © 2017 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.
+
+glcpp_parse = custom_target(
+ 'glcpp-parse.[ch]',
+ input : 'glcpp-parse.y',
+ output : ['glcpp-parse.c', 'glcpp-parse.h'],
+ command : [prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
+ '--defines=@OUTPUT1@', '@INPUT@'],
+)
+
+glcpp_lex = custom_target(
+ 'glcpp-lex.c',
+ input : 'glcpp-lex.l',
+ output : 'glcpp-lex.c',
+ command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'],
+)
+
+libglcpp = static_library(
+ 'glcpp',
+ [glcpp_lex, glcpp_parse, files('glcpp.h', 'pp.c')],
+ link_with : libmesa_util,
+ include_directories : [inc_common],
+ c_args : [c_vis_args, no_override_init_args, c_msvc_compat_args],
+ cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+ build_by_default : false,
+)
+
+glcpp = executable(
+ 'glcpp',
+ 'glcpp.c',
+ dependencies : [dep_m],
+ include_directories : [inc_common],
+ link_with : [libglcpp, libglsl_util],
+ c_args : [c_vis_args, no_override_init_args, c_msvc_compat_args],
+ build_by_default : false,
+)
+
+# TODO: figure out how to make all of these tests work.
diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build
index 0a2537d4981..f712d524a40 100644
--- a/src/compiler/glsl/meson.build
+++ b/src/compiler/glsl/meson.build
@@ -18,12 +18,231 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
-# TODO: the rest of this file
+subdir('glcpp')
-ir_expression_operation_h = custom_target(
- 'ir_expression_operation.h',
+glsl_parser = custom_target(
+ 'glsl_parser',
+ input : 'glsl_parser.yy',
+ output : ['glsl_parser.cpp', 'glsl_parser.h'],
+ command : [prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_',
+ '--defines=@OUTPUT1@', '@INPUT@'],
+)
+
+glsl_lexer_cpp = custom_target(
+ 'glsl_lexer_cpp',
+ input : 'glsl_lexer.ll',
+ output : 'glsl_lexer.cpp',
+ command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'],
+)
+
+ir_expression_operation_constant_h = custom_target(
+ 'ir_expression_operation_constant.h',
input : 'ir_expression_operation.py',
- output : 'ir_expression_operation.h',
- command : [prog_python2, '@INPUT@', 'enum'],
+ output : 'ir_expression_operation_constant.h',
+ command : [prog_python2, '@INPUT@', 'constant'],
capture : true,
)
+
+ir_expression_operation_strings_h = custom_target(
+ 'ir_expression_operation_strings.h',
+ input : 'ir_expression_operation.py',
+ output : 'ir_expression_operation_strings.h',
+ command : [prog_python2, '@INPUT@', 'strings'],
+ capture : true,
+)
+
+files_libglsl = files(
+ 'ast.h',
+ 'ast_array_index.cpp',
+ 'ast_expr.cpp',
+ 'ast_function.cpp',
+ 'ast_to_hir.cpp',
+ 'ast_type.cpp',
+ 'blob.c',
+ 'blob.h',
+ 'builtin_functions.cpp',
+ 'builtin_functions.h',
+ 'builtin_int64.h',
+ 'builtin_types.cpp',
+ 'builtin_variables.cpp',
+ 'generate_ir.cpp',
+ 'glsl_parser_extras.cpp',
+ 'glsl_parser_extras.h',
+ 'glsl_symbol_table.cpp',
+ 'glsl_symbol_table.h',
+ 'glsl_to_nir.cpp',
+ 'glsl_to_nir.h',
+ 'hir_field_selection.cpp',
+ 'ir_array_refcount.cpp',
+ 'ir_array_refcount.h',
+ 'ir_basic_block.cpp',
+ 'ir_basic_block.h',
+ 'ir_builder.cpp',
+ 'ir_builder.h',
+ 'ir_clone.cpp',
+ 'ir_constant_expression.cpp',
+ 'ir.cpp',
+ 'ir.h',
+ 'ir_equals.cpp',
+ 'ir_expression_flattening.cpp',
+ 'ir_expression_flattening.h',
+ 'ir_function_can_inline.cpp',
+ 'ir_function_detect_recursion.cpp',
+ 'ir_function_inlining.h',
+ 'ir_function.cpp',
+ 'ir_hierarchical_visitor.cpp',
+ 'ir_hierarchical_visitor.h',
+ 'ir_hv_accept.cpp',
+ 'ir_optimization.h',
+ 'ir_print_visitor.cpp',
+ 'ir_print_visitor.h',
+ 'ir_reader.cpp',
+ 'ir_reader.h',
+ 'ir_rvalue_visitor.cpp',
+ 'ir_rvalue_visitor.h',
+ 'ir_set_program_inouts.cpp',
+ 'ir_uniform.h',
+ 'ir_validate.cpp',
+ 'ir_variable_refcount.cpp',
+ 'ir_variable_refcount.h',
+ 'ir_visitor.h',
+ 'linker.cpp',
+ 'linker.h',
+ 'link_atomics.cpp',
+ 'link_functions.cpp',
+ 'link_interface_blocks.cpp',
+ 'link_uniforms.cpp',
+ 'link_uniform_initializers.cpp',
+ 'link_uniform_block_active_visitor.cpp',
+ 'link_uniform_block_active_visitor.h',
+ 'link_uniform_blocks.cpp',
+ 'link_varyings.cpp',
+ 'link_varyings.h',
+ 'list.h',
+ 'loop_analysis.cpp',
+ 'loop_analysis.h',
+ 'loop_unroll.cpp',
+ 'lower_blend_equation_advanced.cpp',
+ 'lower_buffer_access.cpp',
+ 'lower_buffer_access.h',
+ 'lower_const_arrays_to_uniforms.cpp',
+ 'lower_discard.cpp',
+ 'lower_discard_flow.cpp',
+ 'lower_distance.cpp',
+ 'lower_if_to_cond_assign.cpp',
+ 'lower_instructions.cpp',
+ 'lower_int64.cpp',
+ 'lower_jumps.cpp',
+ 'lower_mat_op_to_vec.cpp',
+ 'lower_noise.cpp',
+ 'lower_offset_array.cpp',
+ 'lower_packed_varyings.cpp',
+ 'lower_named_interface_blocks.cpp',
+ 'lower_packing_builtins.cpp',
+ 'lower_subroutine.cpp',
+ 'lower_tess_level.cpp',
+ 'lower_texture_projection.cpp',
+ 'lower_variable_index_to_cond_assign.cpp',
+ 'lower_vec_index_to_cond_assign.cpp',
+ 'lower_vec_index_to_swizzle.cpp',
+ 'lower_vector.cpp',
+ 'lower_vector_derefs.cpp',
+ 'lower_vector_insert.cpp',
+ 'lower_vertex_id.cpp',
+ 'lower_output_reads.cpp',
+ 'lower_shared_reference.cpp',
+ 'lower_ubo_reference.cpp',
+ 'opt_algebraic.cpp',
+ 'opt_array_splitting.cpp',
+ 'opt_conditional_discard.cpp',
+ 'opt_constant_folding.cpp',
+ 'opt_constant_propagation.cpp',
+ 'opt_constant_variable.cpp',
+ 'opt_copy_propagation.cpp',
+ 'opt_copy_propagation_elements.cpp',
+ 'opt_dead_builtin_variables.cpp',
+ 'opt_dead_builtin_varyings.cpp',
+ 'opt_dead_code.cpp',
+ 'opt_dead_code_local.cpp',
+ 'opt_dead_functions.cpp',
+ 'opt_flatten_nested_if_blocks.cpp',
+ 'opt_flip_matrices.cpp',
+ 'opt_function_inlining.cpp',
+ 'opt_if_simplification.cpp',
+ 'opt_minmax.cpp',
+ 'opt_noop_swizzle.cpp',
+ 'opt_rebalance_tree.cpp',
+ 'opt_redundant_jumps.cpp',
+ 'opt_structure_splitting.cpp',
+ 'opt_swizzle_swizzle.cpp',
+ 'opt_tree_grafting.cpp',
+ 'opt_vectorize.cpp',
+ 'program.h',
+ 'propagate_invariance.cpp',
+ 's_expression.cpp',
+ 's_expression.h',
+ 'string_to_uint_map.cpp',
+ 'string_to_uint_map.h',
+ 'shader_cache.cpp',
+ 'shader_cache.h',
+)
+
+files_libglsl_standalone = files(
+ 'ir_builder_print_visitor.cpp',
+ 'ir_builder_print_visitor.h',
+ 'opt_add_neg_to_sub.h',
+ 'standalone_scaffolding.cpp',
+ 'standalone_scaffolding.h',
+ 'standalone.cpp',
+ 'standalone.h',
+)
+
+libglsl = static_library(
+ 'glsl',
+ [files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h,
+ ir_expression_operation_strings_h, ir_expression_operation_constant_h],
+ c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+ cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+ link_with : [libnir, libglcpp],
+ include_directories : [inc_common, inc_nir],
+ dependencies : [dep_valgrind],
+ build_by_default : false,
+)
+
+libglsl_standalone = static_library(
+ 'glsl_standalone',
+ [files_libglsl_standalone, ir_expression_operation_h],
+ c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+ cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+ include_directories : [inc_common],
+ link_with : [libglsl, libglsl_util, libmesa_util],
+ dependencies : [dep_thread],
+ build_by_default : false,
+)
+
+glsl_compiler = executable(
+ 'glsl_compiler',
+ 'main.cpp',
+ c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+ cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+ dependencies : [dep_clock],
+ include_directories : [inc_common],
+ link_with : [libglsl_standalone],
+ build_by_default : false,
+)
+
+glsl_test = executable(
+ 'glsl_test',
+ ['test.cpp', 'test_optpass.cpp', 'test_optpass.h',
+ ir_expression_operation_h],
+ c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+ cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+ include_directories : [inc_common],
+ dependencies : [dep_clock, dep_thread],
+ link_with : [libglsl, libglsl_standalone, libglsl_util],
+ build_by_default : false,
+)
+
+if with_tests
+ subdir('tests')
+endif
diff --git a/src/compiler/glsl/tests/meson.build b/src/compiler/glsl/tests/meson.build
new file mode 100644
index 00000000000..ae04743c5a0
--- /dev/null
+++ b/src/compiler/glsl/tests/meson.build
@@ -0,0 +1,76 @@
+# Copyright © 2017 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.
+
+glsl_blob_test = executable(
+ 'blob_test',
+ 'blob_test.c',
+ c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+ include_directories : [inc_common, inc_glsl],
+ link_with : [libglsl],
+)
+
+glsl_cache_test = executable(
+ 'cache_test',
+ 'cache_test.c',
+ c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+ include_directories : [inc_common, inc_glsl],
+ link_with : [libglsl],
+ dependencies : [dep_clock, dep_thread],
+)
+
+glsl_general_ir_test = executable(
+ 'general_ir_test',
+ ['array_refcount_test.cpp', 'builtin_variable_test.cpp',
+ 'invalidate_locations_test.cpp', 'general_ir_test.cpp',
+ 'lower_int64_test.cpp', 'opt_add_neg_to_sub_test.cpp', 'varyings_test.cpp',
+ ir_expression_operation_h],
+ cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+ include_directories : [inc_common, inc_glsl],
+ link_with : [libglsl, libglsl_standalone, libglsl_util],
+ dependencies : [dep_clock, dep_thread, idep_gtest],
+)
+
+glsl_uniform_initializer_test = executable(
+ 'uniform_initializer_test',
+ ['copy_constant_to_storage_tests.cpp', 'set_uniform_initializer_tests.cpp',
+ 'uniform_initializer_utils.cpp', 'uniform_initializer_utils.h',
+ ir_expression_operation_h],
+ cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+ include_directories : [inc_common, inc_glsl],
+ link_with : [libglsl, libglsl_util],
+ dependencies : [dep_thread, idep_gtest],
+)
+
+glsl_sampler_types_test = executable(
+ 'sampler_types_test',
+ ['sampler_types_test.cpp', ir_expression_operation_h],
+ cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+ include_directories : [inc_common, inc_glsl],
+ link_with : [libglsl, libglsl_util],
+ dependencies : [dep_thread, idep_gtest],
+)
+
+test('blob_test', glsl_blob_test)
+test('cache_test', glsl_cache_test)
+test('general_ir_test', glsl_general_ir_test)
+test('uniform_initializer_test', glsl_uniform_initializer_test)
+test('sampler_types_test', glsl_sampler_types_test)
+
+# TODO: figure out how to get the shell based tests to work?
diff --git a/src/compiler/meson.build b/src/compiler/meson.build
index 9a40e2e3a1a..58d52e4c6cb 100644
--- a/src/compiler/meson.build
+++ b/src/compiler/meson.build
@@ -22,8 +22,6 @@ inc_compiler = include_directories('.')
inc_nir = include_directories('nir')
inc_glsl = include_directories('glsl')
-subdir('glsl')
-
files_libcompiler = files(
'builtin_type_macros.h',
'glsl_types.cpp',
@@ -35,6 +33,14 @@ files_libcompiler = files(
'shader_info.h',
)
+ir_expression_operation_h = custom_target(
+ 'ir_expression_operation.h',
+ input : 'glsl/ir_expression_operation.py',
+ output : 'ir_expression_operation.h',
+ command : [prog_python2, '@INPUT@', 'enum'],
+ capture : true,
+)
+
libcompiler = static_library(
'compiler',
[files_libcompiler, ir_expression_operation_h],
@@ -55,3 +61,5 @@ spirv2nir = executable(
c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
build_by_default : false,
)
+
+subdir('glsl')