diff options
Diffstat (limited to 'mesalib/src')
27 files changed, 204 insertions, 188 deletions
diff --git a/mesalib/src/.gitignore b/mesalib/src/.gitignore new file mode 100644 index 000000000..5fc607b9e --- /dev/null +++ b/mesalib/src/.gitignore @@ -0,0 +1 @@ +/Makefile diff --git a/mesalib/src/Makefile b/mesalib/src/Makefile deleted file mode 100644 index 4f65da0e3..000000000 --- a/mesalib/src/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# src/Makefile - -TOP = .. - -include $(TOP)/configs/current - -SUBDIRS = $(SRC_DIRS) - - -default: message $(TOP)/$(LIB_DIR) subdirs - - -message: - @echo "Making sources for" $(CONFIG_NAME) - - -subdirs: - @for dir in $(SUBDIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE)) || exit 1; \ - fi \ - done - -install: $(TOP)/$(LIB_DIR) - @for dir in $(SUBDIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE) install) || exit 1 ; \ - fi \ - done - -$(TOP)/$(LIB_DIR): - -@test -d $(TOP)/$(LIB_DIR) || mkdir -p $(TOP)/$(LIB_DIR) - - -clean: - -@for dir in $(SUBDIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE) clean) ; \ - fi \ - done diff --git a/mesalib/src/Makefile.am b/mesalib/src/Makefile.am new file mode 100644 index 000000000..d6a7946ef --- /dev/null +++ b/mesalib/src/Makefile.am @@ -0,0 +1,4 @@ +SUBDIRS=$(SRC_DIRS) + +all-local: + $(MKDIR_P) $(top_builddir)/$(LIB_DIR) diff --git a/mesalib/src/glsl/Android.mk b/mesalib/src/glsl/Android.mk index cf793d65e..66c8bec32 100644 --- a/mesalib/src/glsl/Android.mk +++ b/mesalib/src/glsl/Android.mk @@ -25,6 +25,7 @@ LOCAL_PATH := $(call my-dir) +GLSL_SRCDIR = . include $(LOCAL_PATH)/Makefile.sources # --------------------------------------- diff --git a/mesalib/src/glsl/Makefile b/mesalib/src/glsl/Makefile index 7c80c95d8..3cf9fc962 100644 --- a/mesalib/src/glsl/Makefile +++ b/mesalib/src/glsl/Makefile @@ -7,6 +7,7 @@ include $(TOP)/configs/current LIBNAME = glsl +GLSL_SRCDIR=. include Makefile.sources GLCPP_SOURCES = \ @@ -67,9 +68,6 @@ OBJECTS = \ $(C_SOURCES:.c=.o) \ $(CXX_SOURCES:.cpp=.o) -DRICORE_OBJ_DIR = obj-visible -OBJECTS_DRICORE = $(addprefix $(DRICORE_OBJ_DIR)/,$(OBJECTS)) - INCLUDES = \ -I. \ -I../mesa \ @@ -87,13 +85,7 @@ ALL_SOURCES = \ ##### TARGETS ##### -default: depend lib$(LIBNAME).a $(APPS) $(DRICORE_GLSL_LIBS) - -$(TOP)/$(LIB_DIR)/libglsl.so: $(OBJECTS_DRICORE) builtin_function.o Makefile $(TOP)/src/glsl/Makefile.template - $(MKLIB) -o $@ -linker '$(CXX)' -ldflags '$(LDFLAGS)' \ - -cplusplus -noprefix \ - -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/$@.dylib \ - $(OBJECTS_DRICORE) builtin_function.o +default: depend lib$(LIBNAME).a $(APPS) lib$(LIBNAME).a: $(OBJECTS) builtin_function.o Makefile $(TOP)/src/glsl/Makefile.template $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS) builtin_function.o @@ -102,28 +94,16 @@ depend: $(ALL_SOURCES) Makefile rm -f depend touch depend $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null - $(MKDEP) $(MKDEP_OPTIONS) -a -p $(DRICORE_OBJ_DIR)/ $(INCLUDES) $(ALL_SOURCES) 2> /dev/null # Remove .o and backup files -clean: clean-dricore +clean: rm -f $(GLCPP_OBJECTS) $(GLSL2_OBJECTS) $(TEST_OBJECTS) $(OBJECTS) lib$(LIBNAME).a depend depend.bak builtin_function.cpp builtin_function.o builtin_stubs.o builtin_compiler -rm -f $(APPS) -clean-dricore: - -rm -f $(OBJECTS_DRICORE) $(TOP)/$(LIB_DIR)/libglsl.so libglsl.so - -ifneq (,$(DRICORE_GLSL_LIBS)) -DRICORE_INSTALL_TARGET = install-dricore -endif - # Dummy target -install: $(DRICORE_INSTALL_TARGET) +install: @echo -n "" -install-dricore: default - $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) - $(INSTALL) -m 755 $(DRICORE_GLSL_LIBS) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) - ##### RULES ##### glsl_compiler: $(GLSL2_OBJECTS) libglsl.a @@ -142,14 +122,6 @@ glcpp/glcpp: $(GLCPP_OBJECTS) .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ -$(DRICORE_OBJ_DIR)/%.o : %.cpp - @mkdir -p $(dir $@) - $(CXX) -c $(INCLUDES) $(DRI_CXXFLAGS) $(DEFINES) $< -o $@ - -$(DRICORE_OBJ_DIR)/%.o : %.c - @mkdir -p $(dir $@) - $(CC) -c $(INCLUDES) $(DRI_CFLAGS) $(DEFINES) $< -o $@ - glsl_lexer.cpp: glsl_lexer.ll $(FLEX) --nounistd -o$@ $< diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources index caa8ad590..0425fa33e 100644 --- a/mesalib/src/glsl/Makefile.sources +++ b/mesalib/src/glsl/Makefile.sources @@ -1,93 +1,95 @@ # shared source lists for Makefile, SConscript, and Android.mk +GLSL_SRCDIR ?= . + # libglcpp -LIBGLCPP_FILES := \ - glcpp/pp.c +LIBGLCPP_FILES = \ + $(GLSL_SRCDIR)/glcpp/pp.c -LIBGLCPP_GENERATED_FILES := \ - glcpp/glcpp-lex.c \ - glcpp/glcpp-parse.c +LIBGLCPP_GENERATED_FILES = \ + $(GLSL_SRCDIR)/glcpp/glcpp-lex.c \ + $(GLSL_SRCDIR)/glcpp/glcpp-parse.c # libglsl -LIBGLSL_FILES := \ - strtod.c \ - ralloc.c +LIBGLSL_FILES = \ + $(GLSL_SRCDIR)/strtod.c \ + $(GLSL_SRCDIR)/ralloc.c -LIBGLSL_CXX_FILES := \ - ast_expr.cpp \ - ast_function.cpp \ - ast_to_hir.cpp \ - ast_type.cpp \ - builtin_variables.cpp \ - glsl_parser_extras.cpp \ - glsl_types.cpp \ - glsl_symbol_table.cpp \ - hir_field_selection.cpp \ - ir_basic_block.cpp \ - ir_builder.cpp \ - ir_clone.cpp \ - ir_constant_expression.cpp \ - ir.cpp \ - ir_expression_flattening.cpp \ - ir_function_can_inline.cpp \ - ir_function_detect_recursion.cpp \ - ir_function.cpp \ - ir_hierarchical_visitor.cpp \ - ir_hv_accept.cpp \ - ir_import_prototypes.cpp \ - ir_print_visitor.cpp \ - ir_reader.cpp \ - ir_rvalue_visitor.cpp \ - ir_set_program_inouts.cpp \ - ir_validate.cpp \ - ir_variable_refcount.cpp \ - linker.cpp \ - link_functions.cpp \ - link_uniforms.cpp \ - link_uniform_initializers.cpp \ - loop_analysis.cpp \ - loop_controls.cpp \ - loop_unroll.cpp \ - lower_clip_distance.cpp \ - lower_discard.cpp \ - lower_discard_flow.cpp \ - lower_if_to_cond_assign.cpp \ - lower_instructions.cpp \ - lower_jumps.cpp \ - lower_mat_op_to_vec.cpp \ - lower_noise.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_output_reads.cpp \ - opt_algebraic.cpp \ - opt_array_splitting.cpp \ - opt_constant_folding.cpp \ - opt_constant_propagation.cpp \ - opt_constant_variable.cpp \ - opt_copy_propagation.cpp \ - opt_copy_propagation_elements.cpp \ - opt_dead_code.cpp \ - opt_dead_code_local.cpp \ - opt_dead_functions.cpp \ - opt_function_inlining.cpp \ - opt_if_simplification.cpp \ - opt_noop_swizzle.cpp \ - opt_redundant_jumps.cpp \ - opt_structure_splitting.cpp \ - opt_swizzle_swizzle.cpp \ - opt_tree_grafting.cpp \ - s_expression.cpp +LIBGLSL_CXX_FILES = \ + $(GLSL_SRCDIR)/ast_expr.cpp \ + $(GLSL_SRCDIR)/ast_function.cpp \ + $(GLSL_SRCDIR)/ast_to_hir.cpp \ + $(GLSL_SRCDIR)/ast_type.cpp \ + $(GLSL_SRCDIR)/builtin_variables.cpp \ + $(GLSL_SRCDIR)/glsl_parser_extras.cpp \ + $(GLSL_SRCDIR)/glsl_types.cpp \ + $(GLSL_SRCDIR)/glsl_symbol_table.cpp \ + $(GLSL_SRCDIR)/hir_field_selection.cpp \ + $(GLSL_SRCDIR)/ir_basic_block.cpp \ + $(GLSL_SRCDIR)/ir_builder.cpp \ + $(GLSL_SRCDIR)/ir_clone.cpp \ + $(GLSL_SRCDIR)/ir_constant_expression.cpp \ + $(GLSL_SRCDIR)/ir.cpp \ + $(GLSL_SRCDIR)/ir_expression_flattening.cpp \ + $(GLSL_SRCDIR)/ir_function_can_inline.cpp \ + $(GLSL_SRCDIR)/ir_function_detect_recursion.cpp \ + $(GLSL_SRCDIR)/ir_function.cpp \ + $(GLSL_SRCDIR)/ir_hierarchical_visitor.cpp \ + $(GLSL_SRCDIR)/ir_hv_accept.cpp \ + $(GLSL_SRCDIR)/ir_import_prototypes.cpp \ + $(GLSL_SRCDIR)/ir_print_visitor.cpp \ + $(GLSL_SRCDIR)/ir_reader.cpp \ + $(GLSL_SRCDIR)/ir_rvalue_visitor.cpp \ + $(GLSL_SRCDIR)/ir_set_program_inouts.cpp \ + $(GLSL_SRCDIR)/ir_validate.cpp \ + $(GLSL_SRCDIR)/ir_variable_refcount.cpp \ + $(GLSL_SRCDIR)/linker.cpp \ + $(GLSL_SRCDIR)/link_functions.cpp \ + $(GLSL_SRCDIR)/link_uniforms.cpp \ + $(GLSL_SRCDIR)/link_uniform_initializers.cpp \ + $(GLSL_SRCDIR)/loop_analysis.cpp \ + $(GLSL_SRCDIR)/loop_controls.cpp \ + $(GLSL_SRCDIR)/loop_unroll.cpp \ + $(GLSL_SRCDIR)/lower_clip_distance.cpp \ + $(GLSL_SRCDIR)/lower_discard.cpp \ + $(GLSL_SRCDIR)/lower_discard_flow.cpp \ + $(GLSL_SRCDIR)/lower_if_to_cond_assign.cpp \ + $(GLSL_SRCDIR)/lower_instructions.cpp \ + $(GLSL_SRCDIR)/lower_jumps.cpp \ + $(GLSL_SRCDIR)/lower_mat_op_to_vec.cpp \ + $(GLSL_SRCDIR)/lower_noise.cpp \ + $(GLSL_SRCDIR)/lower_texture_projection.cpp \ + $(GLSL_SRCDIR)/lower_variable_index_to_cond_assign.cpp \ + $(GLSL_SRCDIR)/lower_vec_index_to_cond_assign.cpp \ + $(GLSL_SRCDIR)/lower_vec_index_to_swizzle.cpp \ + $(GLSL_SRCDIR)/lower_vector.cpp \ + $(GLSL_SRCDIR)/lower_output_reads.cpp \ + $(GLSL_SRCDIR)/opt_algebraic.cpp \ + $(GLSL_SRCDIR)/opt_array_splitting.cpp \ + $(GLSL_SRCDIR)/opt_constant_folding.cpp \ + $(GLSL_SRCDIR)/opt_constant_propagation.cpp \ + $(GLSL_SRCDIR)/opt_constant_variable.cpp \ + $(GLSL_SRCDIR)/opt_copy_propagation.cpp \ + $(GLSL_SRCDIR)/opt_copy_propagation_elements.cpp \ + $(GLSL_SRCDIR)/opt_dead_code.cpp \ + $(GLSL_SRCDIR)/opt_dead_code_local.cpp \ + $(GLSL_SRCDIR)/opt_dead_functions.cpp \ + $(GLSL_SRCDIR)/opt_function_inlining.cpp \ + $(GLSL_SRCDIR)/opt_if_simplification.cpp \ + $(GLSL_SRCDIR)/opt_noop_swizzle.cpp \ + $(GLSL_SRCDIR)/opt_redundant_jumps.cpp \ + $(GLSL_SRCDIR)/opt_structure_splitting.cpp \ + $(GLSL_SRCDIR)/opt_swizzle_swizzle.cpp \ + $(GLSL_SRCDIR)/opt_tree_grafting.cpp \ + $(GLSL_SRCDIR)/s_expression.cpp # glsl_compiler -GLSL_COMPILER_CXX_FILES := \ - standalone_scaffolding.cpp \ - main.cpp +GLSL_COMPILER_CXX_FILES = \ + $(GLSL_SRCDIR)/standalone_scaffolding.cpp \ + $(GLSL_SRCDIR)/main.cpp # builtin_compiler # @@ -95,14 +97,14 @@ GLSL_COMPILER_CXX_FILES := \ # For this to work, a dummy version of builtin_function.cpp, # builtin_stubs.cpp, is used. -BUILTIN_COMPILER_CXX_FILES := \ - builtin_stubs.cpp +BUILTIN_COMPILER_CXX_FILES = \ + $(GLSL_SRCDIR)/builtin_stubs.cpp -BUILTIN_COMPILER_GENERATED_CXX_FILES := \ - glsl_lexer.cpp \ - glsl_parser.cpp +BUILTIN_COMPILER_GENERATED_CXX_FILES = \ + $(GLSL_SRCDIR)/glsl_lexer.cpp \ + $(GLSL_SRCDIR)/glsl_parser.cpp # libglsl generated sources -LIBGLSL_GENERATED_CXX_FILES := \ - $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \ - builtin_function.cpp +LIBGLSL_GENERATED_CXX_FILES = \ + $(GLSL_SRCDIR)/$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \ + $(GLSL_SRCDIR)/builtin_function.cpp diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp index cade9611d..d39761260 100644 --- a/mesalib/src/glsl/opt_algebraic.cpp +++ b/mesalib/src/glsl/opt_algebraic.cpp @@ -34,6 +34,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +namespace { + /** * Visitor class for replacing expressions with ir_constant values. */ @@ -68,6 +70,8 @@ public: bool progress; }; +} /* unnamed namespace */ + static inline bool is_vec_zero(ir_constant *ir) { diff --git a/mesalib/src/glsl/opt_constant_folding.cpp b/mesalib/src/glsl/opt_constant_folding.cpp index dcad59997..7d94d481c 100644 --- a/mesalib/src/glsl/opt_constant_folding.cpp +++ b/mesalib/src/glsl/opt_constant_folding.cpp @@ -32,6 +32,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +namespace { + /** * Visitor class for replacing expressions with ir_constant values. */ @@ -56,6 +58,8 @@ public: bool progress; }; +} /* unnamed namespace */ + void ir_constant_folding_visitor::handle_rvalue(ir_rvalue **rvalue) { diff --git a/mesalib/src/glsl/opt_constant_propagation.cpp b/mesalib/src/glsl/opt_constant_propagation.cpp index 2601b52f6..c5ae36b69 100644 --- a/mesalib/src/glsl/opt_constant_propagation.cpp +++ b/mesalib/src/glsl/opt_constant_propagation.cpp @@ -41,6 +41,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +namespace { + class acp_entry : public exec_node { public: @@ -450,6 +452,8 @@ ir_constant_propagation_visitor::add_constant(ir_assignment *ir) this->acp->push_tail(entry); } +} /* unnamed namespace */ + /** * Does a constant propagation pass on the code present in the instruction stream. */ diff --git a/mesalib/src/glsl/opt_constant_variable.cpp b/mesalib/src/glsl/opt_constant_variable.cpp index f3bc8675e..1bbaf8e47 100644 --- a/mesalib/src/glsl/opt_constant_variable.cpp +++ b/mesalib/src/glsl/opt_constant_variable.cpp @@ -37,6 +37,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +namespace { + struct assignment_entry { exec_node link; int assignment_count; @@ -55,6 +57,8 @@ public: exec_list list; }; +} /* unnamed namespace */ + static struct assignment_entry * get_assignment_entry(ir_variable *var, exec_list *list) { diff --git a/mesalib/src/glsl/opt_copy_propagation.cpp b/mesalib/src/glsl/opt_copy_propagation.cpp index 923619db4..2952ce594 100644 --- a/mesalib/src/glsl/opt_copy_propagation.cpp +++ b/mesalib/src/glsl/opt_copy_propagation.cpp @@ -38,6 +38,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +namespace { + class acp_entry : public exec_node { public: @@ -107,6 +109,8 @@ public: void *mem_ctx; }; +} /* unnamed namespace */ + ir_visitor_status ir_copy_propagation_visitor::visit_enter(ir_function_signature *ir) { diff --git a/mesalib/src/glsl/opt_copy_propagation_elements.cpp b/mesalib/src/glsl/opt_copy_propagation_elements.cpp index 11d9d7baf..de9f4ef6f 100644 --- a/mesalib/src/glsl/opt_copy_propagation_elements.cpp +++ b/mesalib/src/glsl/opt_copy_propagation_elements.cpp @@ -49,6 +49,8 @@ static bool debug = false; +namespace { + class acp_entry : public exec_node { public: @@ -135,6 +137,8 @@ public: void *shader_mem_ctx; }; +} /* unnamed namespace */ + ir_visitor_status ir_copy_propagation_elements_visitor::visit_enter(ir_function_signature *ir) { diff --git a/mesalib/src/glsl/opt_dead_code_local.cpp b/mesalib/src/glsl/opt_dead_code_local.cpp index 4af78a72c..8c31802a6 100644 --- a/mesalib/src/glsl/opt_dead_code_local.cpp +++ b/mesalib/src/glsl/opt_dead_code_local.cpp @@ -40,6 +40,8 @@ static bool debug = false; +namespace { + class assignment_entry : public exec_node { public: @@ -138,6 +140,7 @@ public: ir_hierarchical_visitor *visitor; }; +} /* unnamed namespace */ /** * Adds an entry to the available copy list if it's a plain assignment diff --git a/mesalib/src/glsl/opt_dead_functions.cpp b/mesalib/src/glsl/opt_dead_functions.cpp index f50349395..cd3b2c12e 100644 --- a/mesalib/src/glsl/opt_dead_functions.cpp +++ b/mesalib/src/glsl/opt_dead_functions.cpp @@ -32,6 +32,8 @@ #include "ir_expression_flattening.h" #include "glsl_types.h" +namespace { + class signature_entry : public exec_node { public: @@ -67,6 +69,7 @@ public: void *mem_ctx; }; +} /* unnamed namespace */ signature_entry * ir_dead_functions_visitor::get_signature_entry(ir_function_signature *sig) diff --git a/mesalib/src/glsl/opt_function_inlining.cpp b/mesalib/src/glsl/opt_function_inlining.cpp index 4ff4d97d9..f9f5bd442 100644 --- a/mesalib/src/glsl/opt_function_inlining.cpp +++ b/mesalib/src/glsl/opt_function_inlining.cpp @@ -39,6 +39,8 @@ do_sampler_replacement(exec_list *instructions, ir_variable *sampler, ir_dereference *deref); +namespace { + class ir_function_inlining_visitor : public ir_hierarchical_visitor { public: ir_function_inlining_visitor() @@ -60,6 +62,7 @@ public: bool progress; }; +} /* unnamed namespace */ bool do_function_inlining(exec_list *instructions) diff --git a/mesalib/src/glsl/opt_if_simplification.cpp b/mesalib/src/glsl/opt_if_simplification.cpp index 7e88208f7..e1a23d94a 100644 --- a/mesalib/src/glsl/opt_if_simplification.cpp +++ b/mesalib/src/glsl/opt_if_simplification.cpp @@ -30,6 +30,8 @@ #include "ir.h" +namespace { + class ir_if_simplification_visitor : public ir_hierarchical_visitor { public: ir_if_simplification_visitor() @@ -43,6 +45,8 @@ public: bool made_progress; }; +} /* unnamed namespace */ + /* We only care about the top level "if" instructions, so don't * descend into expressions. */ diff --git a/mesalib/src/glsl/opt_noop_swizzle.cpp b/mesalib/src/glsl/opt_noop_swizzle.cpp index 0a906aaf1..693719e3d 100644 --- a/mesalib/src/glsl/opt_noop_swizzle.cpp +++ b/mesalib/src/glsl/opt_noop_swizzle.cpp @@ -35,6 +35,8 @@ #include "ir_print_visitor.h" #include "glsl_types.h" +namespace { + class ir_noop_swizzle_visitor : public ir_rvalue_visitor { public: ir_noop_swizzle_visitor() @@ -46,6 +48,8 @@ public: bool progress; }; +} /* unnamed namespace */ + void ir_noop_swizzle_visitor::handle_rvalue(ir_rvalue **rvalue) { diff --git a/mesalib/src/glsl/opt_redundant_jumps.cpp b/mesalib/src/glsl/opt_redundant_jumps.cpp index f350fa947..8606dcbb7 100644 --- a/mesalib/src/glsl/opt_redundant_jumps.cpp +++ b/mesalib/src/glsl/opt_redundant_jumps.cpp @@ -28,6 +28,8 @@ #include "ir.h" +namespace { + class redundant_jumps_visitor : public ir_hierarchical_visitor { public: redundant_jumps_visitor() @@ -42,6 +44,8 @@ public: bool progress; }; +} /* unnamed namespace */ + /* We only care about the top level instructions, so don't descend * into expressions. */ diff --git a/mesalib/src/glsl/opt_structure_splitting.cpp b/mesalib/src/glsl/opt_structure_splitting.cpp index a21238dd0..60eec53b7 100644 --- a/mesalib/src/glsl/opt_structure_splitting.cpp +++ b/mesalib/src/glsl/opt_structure_splitting.cpp @@ -38,6 +38,8 @@ #include "ir_rvalue_visitor.h" #include "glsl_types.h" +namespace { + static bool debug = false; // XXX using variable_entry2 here to avoid collision (MSVC multiply-defined @@ -307,6 +309,8 @@ ir_structure_splitting_visitor::visit_leave(ir_assignment *ir) return visit_continue; } +} /* unnamed namespace */ + bool do_structure_splitting(exec_list *instructions) { diff --git a/mesalib/src/glsl/opt_swizzle_swizzle.cpp b/mesalib/src/glsl/opt_swizzle_swizzle.cpp index bc442fa86..7564c6b3b 100644 --- a/mesalib/src/glsl/opt_swizzle_swizzle.cpp +++ b/mesalib/src/glsl/opt_swizzle_swizzle.cpp @@ -32,6 +32,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +namespace { + class ir_swizzle_swizzle_visitor : public ir_hierarchical_visitor { public: ir_swizzle_swizzle_visitor() @@ -44,6 +46,8 @@ public: bool progress; }; +} /* unnamed namespace */ + ir_visitor_status ir_swizzle_swizzle_visitor::visit_enter(ir_swizzle *ir) { diff --git a/mesalib/src/glsl/opt_tree_grafting.cpp b/mesalib/src/glsl/opt_tree_grafting.cpp index d86eab80e..25b18ea94 100644 --- a/mesalib/src/glsl/opt_tree_grafting.cpp +++ b/mesalib/src/glsl/opt_tree_grafting.cpp @@ -54,6 +54,8 @@ #include "ir_optimization.h" #include "glsl_types.h" +namespace { + static bool debug = false; class ir_tree_grafting_visitor : public ir_hierarchical_visitor { @@ -369,6 +371,8 @@ tree_grafting_basic_block(ir_instruction *bb_first, } } +} /* unnamed namespace */ + /** * Does a copy propagation pass on the code present in the instruction stream. */ diff --git a/mesalib/src/mapi/glapi/gen/Makefile b/mesalib/src/mapi/glapi/gen/Makefile index 5ca7050a9..75dbb1446 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile +++ b/mesalib/src/mapi/glapi/gen/Makefile @@ -121,7 +121,7 @@ COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py ###################################################################### -all: mesa +default: mesa install: mesa mesa: $(MESA_OUTPUTS) diff --git a/mesalib/src/mesa/Android.gen.mk b/mesalib/src/mesa/Android.gen.mk index 2a08184ae..2ea8cc433 100644 --- a/mesalib/src/mesa/Android.gen.mk +++ b/mesalib/src/mesa/Android.gen.mk @@ -28,16 +28,13 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES endif intermediates := $(call local-intermediates-dir) +mydir := $(call my-dir) sources := \ - main/api_exec_es1.c \ main/api_exec_es1_dispatch.h \ main/api_exec_es1_remap_helper.h \ - main/api_exec_es2.c \ main/api_exec_es2_dispatch.h \ - main/api_exec_es2_remap_helper.h \ - program/lex.yy.c \ - program/program_parse.tab.c + main/api_exec_es2_remap_helper.h LOCAL_SRC_FILES := $(filter-out $(sources), $(LOCAL_SRC_FILES)) @@ -53,6 +50,7 @@ endif sources += main/git_sha1.h sources := $(addprefix $(intermediates)/, $(sources)) + LOCAL_GENERATED_SOURCES += $(sources) glapi := $(MESA_TOP)/src/mapi/glapi/gen @@ -73,43 +71,31 @@ define es-gen $(hide) $(PRIVATE_SCRIPT) $(1) $(PRIVATE_XML) > $@ endef -define local-l-to-c - @mkdir -p $(dir $@) - @echo "Mesa Lex: $(PRIVATE_MODULE) <= $<" - $(hide) $(LEX) -o$@ $< -endef - -define local-y-to-c-and-h - @mkdir -p $(dir $@) - @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<" - $(hide) $(YACC) -o $@ $< +define generate-local + @echo "generate local sources" + $(hide) $(MESA_PYTHON2) $(glapi)/gl_enums.py -f $(glapi)/gl_and_es_API.xml > $(mydir)/main/enums.c + $(hide) $(MESA_PYTHON2) $(glapi)/gl_table.py -m remap_table -f $(glapi)/gl_and_es_API.xml > $(mydir)/main/dispatch.h + $(hide) $(MESA_PYTHON2) $(glapi)/remap_helper.py -f $(glapi)/gl_API.xml > $(mydir)/main/remap_helper.h + $(hide) $(MESA_PYTHON2) $(mydir)/main/es_generator.py -V GLES1.1 -S $(mydir)/main/APIspec.xml > $(mydir)/main/api_exec_es1.c + $(hide) $(MESA_PYTHON2) $(mydir)/main/es_generator.py -V GLES2.0 -S $(mydir)/main/APIspec.xml > $(mydir)/main/api_exec_es2.c + + @echo "Mesa Lex : $(PRIVATE_MODULE)" + $(hide) $(LEX) -o $(mydir)/program/lex.yy.c $(mydir)/program/program_lexer.l + @echo "Mesa Yacc: $(PRIVATE_MODULE)" + $(hide) $(YACC) -d -o $(mydir)/program/program_parse.tab.c $(mydir)/program/program_parse.y endef -$(intermediates)/main/api_exec_%.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(LOCAL_PATH)/main/es_generator.py -$(intermediates)/main/api_exec_%.c: PRIVATE_XML := -S $(LOCAL_PATH)/main/APIspec.xml $(intermediates)/main/api_exec_%_dispatch.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/gl_table.py $(intermediates)/main/api_exec_%_dispatch.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml $(intermediates)/main/api_exec_%_remap_helper.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/remap_helper.py $(intermediates)/main/api_exec_%_remap_helper.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml -$(intermediates)/main/api_exec_es1.c: $(es_src_deps) - $(call es-gen,-V GLES1.1) - -$(intermediates)/main/api_exec_es2.c: $(es_src_deps) - $(call es-gen,-V GLES2.0) - $(intermediates)/main/api_exec_%_dispatch.h: $(es_hdr_deps) $(call es-gen, -c $* -m remap_table) $(intermediates)/main/api_exec_%_remap_helper.h: $(es_hdr_deps) $(call es-gen, -c $*) -$(intermediates)/program/program_parse.tab.c: $(LOCAL_PATH)/program/program_parse.y - $(local-y-to-c-and-h) - -$(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program/program_lexer.l - $(local-l-to-c) - $(intermediates)/main/git_sha1.h: @mkdir -p $(dir $@) @echo "GIT-SHA1: $(PRIVATE_MODULE) <= git" @@ -129,3 +115,4 @@ $(intermediates)/x86/matypes.h: $(matypes_deps) @mkdir -p $(dir $@) @echo "MATYPES: $(PRIVATE_MODULE) <= $(notdir $@)" $(hide) $< > $@ + $(call generate-local) diff --git a/mesalib/src/mesa/Makefile b/mesalib/src/mesa/Makefile index 05aea8d93..845b524e6 100644 --- a/mesalib/src/mesa/Makefile +++ b/mesalib/src/mesa/Makefile @@ -36,6 +36,23 @@ MESA_CXXFLAGS := $(LLVM_CFLAGS) $(CXXFLAGS) # then convenience libs (.a) and finally the device drivers: default: $(DEPENDS) asm_subdirs $(MESA_LIBS) driver_subdirs +.PHONY: main/git_sha1.h.tmp +main/git_sha1.h.tmp: + @touch main/git_sha1.h.tmp + @if test -d ../../.git; then \ + if which git > /dev/null; then \ + git log -n 1 --oneline | \ + sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \ + > main/git_sha1.h.tmp ; \ + fi \ + fi + +main/git_sha1.h: main/git_sha1.h.tmp + @echo "updating main/git_sha1.h" + @if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \ + mv main/git_sha1.h.tmp main/git_sha1.h ;\ + fi + # include glapi_gen.mk for generating glapi headers for GLES GLAPI := $(TOP)/src/mapi/glapi/gen include $(GLAPI)/glapi_gen.mk diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index 541566509..332af3d36 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -848,6 +848,10 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) _mesa_BindBufferARB( GL_PIXEL_UNPACK_BUFFER_EXT, 0 ); } + if (ctx->Texture.BufferObject == bufObj) { + _mesa_BindBufferARB( GL_TEXTURE_BUFFER, 0 ); + } + /* The ID is immediately freed for re-use */ _mesa_HashRemove(ctx->Shared->BufferObjects, ids[i]); /* Make sure we do not run into the classic ABA problem on bind. @@ -1360,6 +1364,12 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget, return; } + if (size < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyBufferSubData(writeOffset = %d)", (int) size); + return; + } + if (readOffset + size > src->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyBufferSubData(readOffset + size = %d)", diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c index c1c65ea25..e04f7ae6b 100644 --- a/mesalib/src/mesa/main/dlist.c +++ b/mesalib/src/mesa/main/dlist.c @@ -10445,6 +10445,9 @@ _mesa_create_save_table(void) /* GL_ARB_debug_output (no dlist support) */ _mesa_init_errors_dispatch(table); + /* GL_NV_primitive_restart */ + SET_PrimitiveRestartIndexNV(table, _mesa_PrimitiveRestartIndex); + return table; } diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak index 63fbf58c6..608aa79ab 100644 --- a/mesalib/src/mesa/sources.mak +++ b/mesalib/src/mesa/sources.mak @@ -1,5 +1,7 @@ ### Lists of source files, included by Makefiles +SRCDIR ?= . + # this is part of MAIN_FILES MAIN_ES_FILES = \ $(SRCDIR)/main/api_exec_es1.c \ |