From 5d0b3b05a28b2e236d3d8aa7b6335b0be4f02eda Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Wed, 15 Mar 2017 11:58:10 -0500 Subject: [PATCH] swr: [rasterizer codegen] Fix generation of knobs Reviewed-by: Bruce Cherniak --- src/gallium/drivers/swr/Makefile.am | 10 +++++----- src/gallium/drivers/swr/SConscript | 4 ++-- .../drivers/swr/rasterizer/codegen/gen_backends.py | 2 ++ .../drivers/swr/rasterizer/codegen/gen_knobs.py | 2 ++ .../swr/rasterizer/codegen/gen_llvm_ir_macros.py | 2 ++ .../rasterizer/codegen/templates/backend_template.cpp | 3 +++ .../codegen/templates/gen_builder_template.hpp | 3 +++ .../templates/{knobs.template => knobs_template.cpp} | 5 ++++- 8 files changed, 23 insertions(+), 8 deletions(-) rename src/gallium/drivers/swr/rasterizer/codegen/templates/{knobs.template => knobs_template.cpp} (98%) diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am index f9fda31c086..771f1a82439 100644 --- a/src/gallium/drivers/swr/Makefile.am +++ b/src/gallium/drivers/swr/Makefile.am @@ -71,19 +71,19 @@ swr_context_llvm.h: rasterizer/codegen/gen_llvm_types.py swr_context.h --input $(srcdir)/swr_context.h \ --output swr_context_llvm.h -rasterizer/codegen/gen_knobs.cpp: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/knobs.template +rasterizer/codegen/gen_knobs.cpp: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/knobs_template.cpp $(MKDIR_GEN) $(PYTHON_GEN) \ $(srcdir)/rasterizer/codegen/gen_knobs.py \ - --input $(srcdir)/rasterizer/codegen/templates/knobs.template \ + --input $(srcdir)/rasterizer/codegen/templates/knobs_template.cpp \ --output rasterizer/codegen/gen_knobs.cpp \ --gen_cpp -rasterizer/codegen/gen_knobs.h: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/knobs.template +rasterizer/codegen/gen_knobs.h: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/knobs_template.cpp $(MKDIR_GEN) $(PYTHON_GEN) \ $(srcdir)/rasterizer/codegen/gen_knobs.py \ - --input $(srcdir)/rasterizer/codegen/templates/knobs.template \ + --input $(srcdir)/rasterizer/codegen/templates/knobs_template.cpp \ --output rasterizer/codegen/gen_knobs.h \ --gen_h @@ -258,7 +258,7 @@ EXTRA_DIST = \ rasterizer/codegen/mako/runtime.py \ rasterizer/codegen/mako/template.py \ rasterizer/codegen/mako/util.py \ - rasterizer/codegen/templates/knobs.template \ + rasterizer/codegen/templates/knobs_template.cpp \ rasterizer/codegen/templates/ar_event_h.template \ rasterizer/codegen/templates/ar_event_cpp.template \ rasterizer/codegen/templates/ar_eventhandler_h.template \ diff --git a/src/gallium/drivers/swr/SConscript b/src/gallium/drivers/swr/SConscript index 6e228f43154..754e6784f2e 100644 --- a/src/gallium/drivers/swr/SConscript +++ b/src/gallium/drivers/swr/SConscript @@ -51,14 +51,14 @@ swrroot = '#src/gallium/drivers/swr/' env.CodeGenerate( target = 'rasterizer/codegen/gen_knobs.cpp', script = swrroot + 'rasterizer/codegen/gen_knobs.py', - source = 'rasterizer/codegen/templates/knobs.template', + source = 'rasterizer/codegen/templates/knobs_template.cpp', command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET --gen_cpp' ) env.CodeGenerate( target = 'rasterizer/codegen/gen_knobs.h', script = swrroot + 'rasterizer/codegen/gen_knobs.py', - source = 'rasterizer/codegen/templates/knobs.template', + source = 'rasterizer/codegen/templates/knobs_template.cpp', command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET --gen_h' ) diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py index d6367ca73f1..c889ea5816e 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py +++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py @@ -103,6 +103,7 @@ def main(args=sys.argv[1:]): write_template_to_file( templateCpp, baseCppName % str(fileNum), + cmdline=sys.argv, fileNum=fileNum, funcList=chunkedList[fileNum]) @@ -114,6 +115,7 @@ def main(args=sys.argv[1:]): write_template_to_file( templateCmake, cmakeFile, + cmdline=sys.argv, numFiles=numFiles, baseCppName=baseCppName.replace('\\','/')) diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py index 225082e7882..50afdcdd10c 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py +++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py @@ -62,6 +62,7 @@ def main(args=sys.argv[1:]): if args.gen_h: write_template_to_file(args.input, args.output, + cmdline=sys.argv, filename='gen_knobs', knobs=knob_defs.KNOBS, includes=['core/knobs_init.h', 'common/os.h', 'sstream', 'iomanip'], @@ -70,6 +71,7 @@ def main(args=sys.argv[1:]): if args.gen_cpp: write_template_to_file(args.input, args.output, + cmdline=sys.argv, filename='gen_knobs', knobs=knob_defs.KNOBS, includes=['core/knobs_init.h', 'common/os.h', 'sstream', 'iomanip'], diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py index 202dadaeeab..cfd63942dc1 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py +++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py @@ -218,6 +218,7 @@ def generate_gen_h(functions, output_dir): write_template_to_file( template, output_filename, + cmdline=sys.argv, comment='Builder IR Wrappers', filename=filename, functions=templfuncs, @@ -244,6 +245,7 @@ def generate_x86_h(output_dir): write_template_to_file( template, output_filename, + cmdline=sys.argv, comment='x86 intrinsics', filename=filename, functions=functions, diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/backend_template.cpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/backend_template.cpp index bb770fa7790..4eb4ad4f2b3 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/templates/backend_template.cpp +++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/backend_template.cpp @@ -26,6 +26,9 @@ // // DO NOT EDIT // +// Generation Command Line: +// ${'\n// '.join(cmdline)} +// //============================================================================ #include "core/backend.h" diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder_template.hpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder_template.hpp index 6a56eb11573..2e957581ac4 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder_template.hpp +++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder_template.hpp @@ -26,6 +26,9 @@ // // DO NOT EDIT // +// Generation Command Line: +// ${'\n// '.join(cmdline)} +// //============================================================================ #pragma once diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/knobs.template b/src/gallium/drivers/swr/rasterizer/codegen/templates/knobs_template.cpp similarity index 98% rename from src/gallium/drivers/swr/rasterizer/codegen/templates/knobs.template rename to src/gallium/drivers/swr/rasterizer/codegen/templates/knobs_template.cpp index 1ae45e52e74..99294d2290e 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/templates/knobs.template +++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/knobs_template.cpp @@ -24,7 +24,7 @@ %>/****************************************************************************** * -* Copyright 2015-2016 +* Copyright 2015-2017 * Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -49,6 +49,9 @@ * * ======================= AUTO GENERATED: DO NOT EDIT !!! ==================== * +* Generation Command Line: +* ${'\n* '.join(cmdline)} +* ******************************************************************************/ %if gen_header: #pragma once -- 2.30.2