All template files and generated files are prefixed with gen_.
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
-swr_context_llvm.h
+gen_swr_context_llvm.h
rasterizer/archrast/gen_ar_event.cpp
-rasterizer/archrast/gen_ar_event.h
-rasterizer/archrast/gen_ar_eventhandler.h
-rasterizer/archrast/gen_ar_eventhandlerfile.h
+rasterizer/archrast/gen_ar_event.hpp
+rasterizer/archrast/gen_ar_eventhandler.hpp
+rasterizer/archrast/gen_ar_eventhandlerfile.hpp
rasterizer/jitter/gen_builder.hpp
rasterizer/jitter/gen_builder_x86.hpp
-rasterizer/jitter/state_llvm.h
+rasterizer/jitter/gen_state_llvm.h
rasterizer/codegen/gen_knobs.cpp
rasterizer/codegen/gen_knobs.h
-rasterizer/core/BackendPixelRate0.cpp
+rasterizer/core/gen_BackendPixelRate0.cpp
$(BUILT_SOURCES)
BUILT_SOURCES = \
- swr_context_llvm.h \
+ gen_swr_context_llvm.h \
rasterizer/codegen/gen_knobs.cpp \
rasterizer/codegen/gen_knobs.h \
- rasterizer/jitter/state_llvm.h \
+ rasterizer/jitter/gen_state_llvm.h \
rasterizer/jitter/gen_builder_x86.hpp \
- rasterizer/archrast/gen_ar_event.h \
+ rasterizer/archrast/gen_ar_event.hpp \
rasterizer/archrast/gen_ar_event.cpp \
- rasterizer/archrast/gen_ar_eventhandler.h \
- rasterizer/archrast/gen_ar_eventhandlerfile.h \
- rasterizer/core/BackendPixelRate0.cpp
+ rasterizer/archrast/gen_ar_eventhandler.hpp \
+ rasterizer/archrast/gen_ar_eventhandlerfile.hpp \
+ rasterizer/core/gen_BackendPixelRate0.cpp
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
-swr_context_llvm.h: rasterizer/codegen/gen_llvm_types.py rasterizer/codegen/templates/gen_llvm.hpp swr_context.h
+gen_swr_context_llvm.h: rasterizer/codegen/gen_llvm_types.py rasterizer/codegen/templates/gen_llvm.hpp swr_context.h
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_llvm_types.py \
--input $(srcdir)/swr_context.h \
- --output ./swr_context_llvm.h
+ --output ./gen_swr_context_llvm.h
-rasterizer/codegen/gen_knobs.cpp: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/knobs_template.cpp
+rasterizer/codegen/gen_knobs.cpp: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/gen_knobs.cpp
$(MKDIR_GEN)
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_knobs.py \
- --input $(srcdir)/rasterizer/codegen/templates/knobs_template.cpp \
+ --input $(srcdir)/rasterizer/codegen/templates/gen_knobs.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.cpp
+rasterizer/codegen/gen_knobs.h: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/gen_knobs.cpp
$(MKDIR_GEN)
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_knobs.py \
- --input $(srcdir)/rasterizer/codegen/templates/knobs_template.cpp \
+ --input $(srcdir)/rasterizer/codegen/templates/gen_knobs.cpp \
--output rasterizer/codegen/gen_knobs.h \
--gen_h
-rasterizer/jitter/state_llvm.h: rasterizer/codegen/gen_llvm_types.py rasterizer/codegen/templates/gen_llvm.hpp rasterizer/core/state.h
+rasterizer/jitter/gen_state_llvm.h: rasterizer/codegen/gen_llvm_types.py rasterizer/codegen/templates/gen_llvm.hpp rasterizer/core/state.h
$(MKDIR_GEN)
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_llvm_types.py \
--input $(srcdir)/rasterizer/core/state.h \
- --output rasterizer/jitter/state_llvm.h
+ --output rasterizer/jitter/gen_state_llvm.h
-rasterizer/jitter/gen_builder.hpp: rasterizer/codegen/gen_llvm_ir_macros.py rasterizer/codegen/templates/gen_builder_template.hpp
+rasterizer/jitter/gen_builder.hpp: rasterizer/codegen/gen_llvm_ir_macros.py rasterizer/codegen/templates/gen_builder.hpp
$(MKDIR_GEN)
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_llvm_ir_macros.py \
--output rasterizer/jitter \
--gen_h
-rasterizer/jitter/gen_builder_x86.hpp: rasterizer/codegen/gen_llvm_ir_macros.py rasterizer/codegen/templates/gen_builder_template.hpp
+rasterizer/jitter/gen_builder_x86.hpp: rasterizer/codegen/gen_llvm_ir_macros.py rasterizer/codegen/templates/gen_builder.hpp
$(MKDIR_GEN)
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_llvm_ir_macros.py \
--output rasterizer/jitter \
--gen_x86_h
-rasterizer/archrast/gen_ar_event.h: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/ar_event_h.template rasterizer/archrast/events.proto
+rasterizer/archrast/gen_ar_event.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_event.hpp rasterizer/archrast/events.proto
$(MKDIR_GEN)
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_archrast.py \
--proto $(srcdir)/rasterizer/archrast/events.proto \
- --output rasterizer/archrast/gen_ar_event.h \
+ --output rasterizer/archrast/gen_ar_event.hpp \
--gen_event_h
-rasterizer/archrast/gen_ar_event.cpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/ar_event_cpp.template rasterizer/archrast/events.proto
+rasterizer/archrast/gen_ar_event.cpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_event.cpp rasterizer/archrast/events.proto
$(MKDIR_GEN)
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_archrast.py \
--output rasterizer/archrast/gen_ar_event.cpp \
--gen_event_cpp
-rasterizer/archrast/gen_ar_eventhandler.h: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/ar_eventhandler_h.template rasterizer/archrast/events.proto
+rasterizer/archrast/gen_ar_eventhandler.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_eventhandler.hpp rasterizer/archrast/events.proto
$(MKDIR_GEN)
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_archrast.py \
--proto $(srcdir)/rasterizer/archrast/events.proto \
- --output rasterizer/archrast/gen_ar_eventhandler.h \
+ --output rasterizer/archrast/gen_ar_eventhandler.hpp \
--gen_eventhandler_h
-rasterizer/archrast/gen_ar_eventhandlerfile.h: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/ar_eventhandlerfile_h.template rasterizer/archrast/events.proto
+rasterizer/archrast/gen_ar_eventhandlerfile.hpp: rasterizer/codegen/gen_archrast.py rasterizer/codegen/templates/gen_ar_eventhandlerfile.hpp rasterizer/archrast/events.proto
$(MKDIR_GEN)
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_archrast.py \
--proto $(srcdir)/rasterizer/archrast/events.proto \
- --output rasterizer/archrast/gen_ar_eventhandlerfile.h \
+ --output rasterizer/archrast/gen_ar_eventhandlerfile.hpp \
--gen_eventhandlerfile_h
# 5 SWR_MULTISAMPLE_TYPE_COUNT
# 2 centroid
# 2 forcedSampleCount
# 2 canEarlyZ
-rasterizer/core/BackendPixelRate0.cpp: rasterizer/codegen/gen_backends.py rasterizer/codegen/templates/backend_template.cpp
+rasterizer/core/gen_BackendPixelRate0.cpp: rasterizer/codegen/gen_backends.py rasterizer/codegen/templates/gen_backend.cpp
$(MKDIR_GEN)
$(PYTHON_GEN) \
$(srcdir)/rasterizer/codegen/gen_backends.py \
rasterizer/codegen/mako/runtime.py \
rasterizer/codegen/mako/template.py \
rasterizer/codegen/mako/util.py \
- 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 \
- rasterizer/codegen/templates/ar_eventhandlerfile_h.template \
- rasterizer/codegen/templates/backend_template.cpp \
- rasterizer/codegen/templates/gen_builder_template.hpp \
+ rasterizer/codegen/templates/gen_ar_event.cpp \
+ rasterizer/codegen/templates/gen_ar_event.hpp \
+ rasterizer/codegen/templates/gen_ar_eventhandler.hpp \
+ rasterizer/codegen/templates/gen_ar_eventhandlerfile.hpp \
+ rasterizer/codegen/templates/gen_backend.cpp \
+ rasterizer/codegen/templates/gen_builder.hpp \
+ rasterizer/codegen/templates/gen_knobs.cpp \
rasterizer/codegen/templates/gen_llvm.hpp
env.CodeGenerate(
target = 'rasterizer/codegen/gen_knobs.cpp',
script = swrroot + 'rasterizer/codegen/gen_knobs.py',
- source = 'rasterizer/codegen/templates/knobs_template.cpp',
+ source = 'rasterizer/codegen/templates/gen_knobs.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.cpp',
+ source = 'rasterizer/codegen/templates/gen_knobs.cpp',
command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET --gen_h'
)
env.CodeGenerate(
- target = 'rasterizer/jitter/state_llvm.h',
+ target = 'rasterizer/jitter/gen_state_llvm.h',
script = swrroot + 'rasterizer/codegen/gen_llvm_types.py',
source = 'rasterizer/core/state.h',
command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET'
)
env.CodeGenerate(
- target = './swr_context_llvm.h',
+ target = './gen_swr_context_llvm.h',
script = swrroot + 'rasterizer/codegen/gen_llvm_types.py',
source = 'swr_context.h',
command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET'
)
env.CodeGenerate(
- target = 'rasterizer/archrast/gen_ar_event.h',
+ target = 'rasterizer/archrast/gen_ar_event.hpp',
script = swrroot + 'rasterizer/codegen/gen_archrast.py',
source = 'rasterizer/archrast/events.proto',
command = python_cmd + ' $SCRIPT --proto $SOURCE --output $TARGET --gen_event_h'
)
env.CodeGenerate(
- target = 'rasterizer/archrast/gen_ar_eventhandler.h',
+ target = 'rasterizer/archrast/gen_ar_eventhandler.hpp',
script = swrroot + 'rasterizer/codegen/gen_archrast.py',
source = 'rasterizer/archrast/events.proto',
command = python_cmd + ' $SCRIPT --proto $SOURCE --output $TARGET --gen_eventhandler_h'
)
env.CodeGenerate(
- target = 'rasterizer/archrast/gen_ar_eventhandlerfile.h',
+ target = 'rasterizer/archrast/gen_ar_eventhandlerfile.hpp',
script = swrroot + 'rasterizer/codegen/gen_archrast.py',
source = 'rasterizer/archrast/events.proto',
command = python_cmd + ' $SCRIPT --proto $SOURCE --output $TARGET --gen_eventhandlerfile_h'
# 2 forcedSampleCount
# 2 canEarlyZ
env.CodeGenerate(
- target = 'rasterizer/core/BackendPixelRate0.cpp',
+ target = 'rasterizer/core/gen_BackendPixelRate0.cpp',
script = swrroot + 'rasterizer/codegen/gen_backends.py',
command = python_cmd + ' $SCRIPT --output rasterizer/core --dim 5 2 3 2 2 2 --split 0 --cpp'
)
built_sources = [
'rasterizer/codegen/gen_knobs.cpp',
'rasterizer/archrast/gen_ar_event.cpp',
- 'rasterizer/core/BackendPixelRate0.cpp',
+ 'rasterizer/core/gen_BackendPixelRate0.cpp',
]
source = built_sources
#include "common/os.h"
#include "archrast/archrast.h"
#include "archrast/eventmanager.h"
-#include "gen_ar_eventhandlerfile.h"
+#include "gen_ar_eventhandlerfile.hpp"
namespace ArchRast
{
#pragma once
#include "common/os.h"
-#include "gen_ar_event.h"
+#include "gen_ar_event.hpp"
namespace ArchRast
{
#include "common/os.h"
-#include "gen_ar_event.h"
-#include "gen_ar_eventhandler.h"
+#include "gen_ar_event.hpp"
+#include "gen_ar_eventhandler.hpp"
#include <vector>
except:
traceback = RichTraceback()
for (filename, lineno, function, line) in traceback.traceback:
- print("File %s, line %s, in %s" % (filename, lineno, function))
- print(line, "\n")
- print("%s: %s" % (str(traceback.error.__class__.__name__), traceback.error))
+ print('File %s, line %s, in %s' % (filename, lineno, function))
+ print(line, '\n')
+ print('%s: %s' % (str(traceback.error.__class__.__name__), traceback.error))
def write_template_to_file(template_filename, output_filename, **kwargs):
- with open(output_filename, "w") as outfile:
+ with open(output_filename, 'w') as outfile:
print(write_template_to_string(template_filename, **kwargs), file=outfile)
def parse_event_fields(lines, idx, event_dict):
line = lines[idx].rstrip()
idx += 1
- field = re.match(r"(\s*)(\w+)(\s*)(\w+)", line)
+ field = re.match(r'(\s*)(\w+)(\s*)(\w+)', line)
if field:
field_types.append(field.group(2))
field_names.append(field.group(4))
num_fields += 1
- end_of_event = re.match(r"(\s*)};", line)
+ end_of_event = re.match(r'(\s*)};', line)
event_dict['field_types'] = field_types
event_dict['field_names'] = field_names
line = lines[idx].rstrip()
idx += 1
- preprocessor = re.search(r"#if|#endif", line)
+ preprocessor = re.search(r'#if|#endif', line)
if not preprocessor:
- enum = re.match(r"(\s*)(\w+)(\s*)", line)
+ enum = re.match(r'(\s*)(\w+)(\s*)', line)
if enum:
enum_names.append(line)
- end_of_enum = re.match(r"(\s*)};", line)
+ end_of_enum = re.match(r'(\s*)};', line)
event_dict['names'] = enum_names
return idx
idx += 1
# search for event definitions.
- match = re.match(r"(\s*)event(\s*)(\w+)", line)
+ match = re.match(r'(\s*)event(\s*)(\w+)', line)
if match:
eventId += 1
idx = parse_event_fields(lines, idx, protos['events'][event_name])
# search for enums.
- match = re.match(r"(\s*)enum(\s*)(\w+)", line)
+ match = re.match(r'(\s*)enum(\s*)(\w+)', line)
if match:
enum_name = match.group(3)
# Parse args...
parser = argparse.ArgumentParser()
- parser.add_argument("--proto", "-p", help="Path to proto file", required=True)
- parser.add_argument("--output", "-o", help="Output filename (i.e. event.h)", required=True)
- parser.add_argument("--gen_event_h", "-geh", help="Generate event header", action="store_true", default=False)
- parser.add_argument("--gen_event_cpp", "-gec", help="Generate event cpp", action="store_true", default=False)
- parser.add_argument("--gen_eventhandler_h", "-gehh", help="Generate eventhandler header", action="store_true", default=False)
- parser.add_argument("--gen_eventhandlerfile_h", "-gehf", help="Generate eventhandler header for writing to files", action="store_true", default=False)
+ parser.add_argument('--proto', '-p', help='Path to proto file', required=True)
+ parser.add_argument('--output', '-o', help='Output filename (i.e. event.hpp)', required=True)
+ parser.add_argument('--gen_event_hpp', help='Generate event header', action='store_true', default=False)
+ parser.add_argument('--gen_event_cpp', help='Generate event cpp', action='store_true', default=False)
+ parser.add_argument('--gen_eventhandler_hpp', help='Generate eventhandler header', action='store_true', default=False)
+ parser.add_argument('--gen_eventhandlerfile_hpp', help='Generate eventhandler header for writing to files', action='store_true', default=False)
args = parser.parse_args()
proto_filename = args.proto
(output_dir, output_filename) = os.path.split(args.output)
if not output_dir:
- output_dir = "."
+ output_dir = '.'
- #print("output_dir = %s" % output_dir, file=sys.stderr)
- #print("output_filename = %s" % output_filename, file=sys.stderr)
+ #print('output_dir = %s' % output_dir, file=sys.stderr)
+ #print('output_filename = %s' % output_filename, file=sys.stderr)
if not os.path.exists(proto_filename):
- print("Error: Could not find proto file %s" % proto_filename, file=sys.stderr)
+ print('Error: Could not find proto file %s' % proto_filename, file=sys.stderr)
return 1
protos = parse_protos(proto_filename)
# Generate event header
- if args.gen_event_h:
+ if args.gen_event_hpp:
curdir = os.path.dirname(os.path.abspath(__file__))
- template_file = os.sep.join([curdir, 'templates', 'ar_event_h.template'])
+ template_file = os.sep.join([curdir, 'templates', 'gen_ar_event.hpp'])
output_fullpath = os.sep.join([output_dir, output_filename])
write_template_to_file(template_file, output_fullpath,
# Generate event implementation
if args.gen_event_cpp:
curdir = os.path.dirname(os.path.abspath(__file__))
- template_file = os.sep.join([curdir, 'templates', 'ar_event_cpp.template'])
+ template_file = os.sep.join([curdir, 'templates', 'gen_ar_event.cpp'])
output_fullpath = os.sep.join([output_dir, output_filename])
write_template_to_file(template_file, output_fullpath,
protos=protos)
# Generate event handler header
- if args.gen_eventhandler_h:
+ if args.gen_eventhandler_hpp:
curdir = os.path.dirname(os.path.abspath(__file__))
- template_file = os.sep.join([curdir, 'templates', 'ar_eventhandler_h.template'])
+ template_file = os.sep.join([curdir, 'templates', 'gen_ar_eventhandler.hpp'])
output_fullpath = os.sep.join([output_dir, output_filename])
write_template_to_file(template_file, output_fullpath,
filename=output_filename,
- event_header="gen_ar_event.h", # todo: fix this!
+ event_header='gen_ar_event.hpp',
protos=protos)
# Generate event handler header
- if args.gen_eventhandlerfile_h:
+ if args.gen_eventhandlerfile_hpp:
curdir = os.path.dirname(os.path.abspath(__file__))
- template_file = os.sep.join([curdir, 'templates', 'ar_eventhandlerfile_h.template'])
+ template_file = os.sep.join([curdir, 'templates', 'gen_ar_eventhandlerfile.hpp'])
output_fullpath = os.sep.join([output_dir, output_filename])
write_template_to_file(template_file, output_fullpath,
filename=output_filename,
- event_header="gen_ar_eventhandler.h", # todo: fix this!
+ event_header='gen_ar_eventhandler.hpp',
protos=protos)
return 0
# generate .cpp files
if args.cpp:
- baseCppName = os.path.join(args.outdir, 'BackendPixelRate%s.cpp')
- templateCpp = os.path.join(thisDir, 'templates', 'backend_template.cpp')
+ baseCppName = os.path.join(args.outdir, 'gen_BackendPixelRate%s.cpp')
+ templateCpp = os.path.join(thisDir, 'templates', 'gen_backend.cpp')
for fileNum in range(numFiles):
filename = baseCppName % str(fileNum)
# generate gen_backend.cmake file
if args.cmake:
- templateCmake = os.path.join(thisDir, 'templates', 'backend_template.cmake')
+ templateCmake = os.path.join(thisDir, 'templates', 'gen_backend.cmake')
cmakeFile = os.path.join(args.outdir, 'gen_backends.cmake')
#print('Generating', cmakeFile)
write_template_to_file(
cmakeFile,
cmdline=sys.argv,
numFiles=numFiles,
- baseCppName=baseCppName.replace('\\','/'))
+ baseCppName='${RASTY_GEN_SRC_DIR}/backends/' + os.path.basename(baseCppName))
#print("Generated %d template instantiations in %d files" % (len(output_list), numFiles))
# parse args
parser = argparse.ArgumentParser()
- parser.add_argument("--input", "-i", help="Path to knobs.template", required=True)
+ parser.add_argument("--input", "-i", help="Path to gen_knobs.cpp template", required=True)
parser.add_argument("--output", "-o", help="Path to output file", required=True)
parser.add_argument("--gen_h", "-gen_h", help="Generate gen_knobs.h", action="store_true", default=False)
parser.add_argument("--gen_cpp", "-gen_cpp", help="Generate gen_knobs.cpp", action="store_true", required=False)
]
this_dir = os.path.dirname(os.path.abspath(__file__))
-template = os.path.join(this_dir, 'templates', 'gen_builder_template.hpp')
+template = os.path.join(this_dir, 'templates', 'gen_builder.hpp')
def convert_uppercamel(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
+++ /dev/null
-/****************************************************************************
-* Copyright (C) 2016 Intel Corporation. All Rights Reserved.
-*
-* 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.
-*
-* @file ${filename}
-*
-* @brief Implementation for events. auto-generated file
-*
-* DO NOT EDIT
-*
-******************************************************************************/
-#include "common/os.h"
-#include "gen_ar_event.h"
-#include "gen_ar_eventhandler.h"
-
-using namespace ArchRast;
-% for name in protos['event_names']:
-
-void ${name}::Accept(EventHandler* pHandler)
-{
- pHandler->Handle(*this);
-}
-% endfor
+++ /dev/null
-/****************************************************************************
-* Copyright (C) 2016 Intel Corporation. All Rights Reserved.
-*
-* 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.
-*
-* @file ${filename}
-*
-* @brief Definitions for events. auto-generated file
-*
-* DO NOT EDIT
-*
-******************************************************************************/
-#pragma once
-
-#include "common/os.h"
-#include "core/state.h"
-
-namespace ArchRast
-{
-% for name in protos['enum_names']:
- enum ${name}
- {<% names = protos['enums'][name]['names'] %>
- % for i in range(len(names)):
- ${names[i].lstrip()}
- % endfor
- };
-% endfor
-
- //Forward decl
- class EventHandler;
-
- //////////////////////////////////////////////////////////////////////////
- /// Event - interface for handling events.
- //////////////////////////////////////////////////////////////////////////
- struct Event
- {
- Event() {}
- virtual ~Event() {}
-
- virtual void Accept(EventHandler* pHandler) = 0;
- };
-% for name in protos['event_names']:
-
- //////////////////////////////////////////////////////////////////////////
- /// ${name}Data
- //////////////////////////////////////////////////////////////////////////
-#pragma pack(push, 1)
- struct ${name}Data
- {<%
- field_names = protos['events'][name]['field_names']
- field_types = protos['events'][name]['field_types'] %>
- // Fields
- % for i in range(len(field_names)):
- ${field_types[i]} ${field_names[i]};
- % endfor
- };
-#pragma pack(pop)
-
- //////////////////////////////////////////////////////////////////////////
- /// ${name}
- //////////////////////////////////////////////////////////////////////////
- struct ${name} : Event
- {<%
- field_names = protos['events'][name]['field_names']
- field_types = protos['events'][name]['field_types'] %>
- ${name}Data data;
-
- // Constructor
- ${name}(
- % for i in range(len(field_names)):
- % if i < len(field_names)-1:
- ${field_types[i]} ${field_names[i]},
- % endif
- % if i == len(field_names)-1:
- ${field_types[i]} ${field_names[i]}
- % endif
- % endfor
- )
- {
- % for i in range(len(field_names)):
- data.${field_names[i]} = ${field_names[i]};
- % endfor
- }
-
- virtual void Accept(EventHandler* pHandler);
- };
-% endfor
-}
\ No newline at end of file
+++ /dev/null
-/****************************************************************************
-* Copyright (C) 2016 Intel Corporation. All Rights Reserved.
-*
-* 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.
-*
-* @file ${filename}
-*
-* @brief Event handler interface. auto-generated file
-*
-* DO NOT EDIT
-*
-******************************************************************************/
-#pragma once
-
-#include "${event_header}"
-
-namespace ArchRast
-{
- //////////////////////////////////////////////////////////////////////////
- /// EventHandler - interface for handling events.
- //////////////////////////////////////////////////////////////////////////
- class EventHandler
- {
- public:
- EventHandler() {}
- virtual ~EventHandler() {}
-
- virtual void FlushDraw(uint32_t drawId) {}
-
-% for name in protos['event_names']:
- virtual void Handle(const ${name}& event) {}
-% endfor
- };
-}
+++ /dev/null
-/****************************************************************************
-* Copyright (C) 2016 Intel Corporation. All Rights Reserved.
-*
-* 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.
-*
-* @file ${filename}
-*
-* @brief Event handler interface. auto-generated file
-*
-* DO NOT EDIT
-*
-******************************************************************************/
-#pragma once
-
-#include "common/os.h"
-#include "${event_header}"
-#include <fstream>
-#include <sstream>
-
-namespace ArchRast
-{
- //////////////////////////////////////////////////////////////////////////
- /// EventHandlerFile - interface for handling events.
- //////////////////////////////////////////////////////////////////////////
- class EventHandlerFile : public EventHandler
- {
- public:
- EventHandlerFile(uint32_t id)
- : mBufOffset(0)
- {
-#if defined(_WIN32)
- DWORD pid = GetCurrentProcessId();
- TCHAR procname[MAX_PATH];
- GetModuleFileName(NULL, procname, MAX_PATH);
- const char* pBaseName = strrchr(procname, '\\');
- std::stringstream outDir;
- outDir << KNOB_DEBUG_OUTPUT_DIR << pBaseName << "_" << pid << std::ends;
- CreateDirectory(outDir.str().c_str(), NULL);
-
- char buf[255];
- // There could be multiple threads creating thread pools. We
- // want to make sure they are uniquly identified by adding in
- // the creator's thread id into the filename.
- sprintf(buf, "%s\\ar_event%d_%d.bin", outDir.str().c_str(), GetCurrentThreadId(), id);
- mFilename = std::string(buf);
-#else
- char buf[255];
- // There could be multiple threads creating thread pools. We
- // want to make sure they are uniquly identified by adding in
- // the creator's thread id into the filename.
- sprintf(buf, "%s/ar_event%d_%d.bin", "/tmp", GetCurrentThreadId(), id);
- mFilename = std::string(buf);
-#endif
- }
-
- virtual ~EventHandlerFile()
- {
- FlushBuffer();
- }
-
- //////////////////////////////////////////////////////////////////////////
- /// @brief Flush buffer to file.
- bool FlushBuffer()
- {
- if (mBufOffset > 0)
- {
- if (mBufOffset == mHeaderBufOffset)
- {
- // Nothing to flush. Only header has been generated.
- return false;
- }
-
- std::ofstream file;
- file.open(mFilename, std::ios::out | std::ios::app | std::ios::binary);
-
- if (!file.is_open())
- {
- SWR_INVALID("ArchRast: Could not open event file!");
- return false;
- }
-
- file.write((char*)mBuffer, mBufOffset);
- file.close();
-
- mBufOffset = 0;
- mHeaderBufOffset = 0; // Reset header offset so its no longer considered.
- }
- return true;
- }
-
- //////////////////////////////////////////////////////////////////////////
- /// @brief Write event and its payload to the memory buffer.
- void Write(uint32_t eventId, const char* pBlock, uint32_t size)
- {
- if ((mBufOffset + size + sizeof(eventId)) > mBufferSize)
- {
- if (!FlushBuffer())
- {
- // Don't corrupt what's already in the buffer?
- /// @todo Maybe add corrupt marker to buffer here in case we can open file in future?
- return;
- }
- }
-
- memcpy(&mBuffer[mBufOffset], (char*)&eventId, sizeof(eventId));
- mBufOffset += sizeof(eventId);
- memcpy(&mBuffer[mBufOffset], pBlock, size);
- mBufOffset += size;
- }
-
-% for name in protos['event_names']:
- //////////////////////////////////////////////////////////////////////////
- /// @brief Handle ${name} event
- virtual void Handle(const ${name}& event)
- {
-% if protos['events'][name]['num_fields'] == 0:
- Write(${protos['events'][name]['event_id']}, (char*)&event.data, 0);
-% else:
- Write(${protos['events'][name]['event_id']}, (char*)&event.data, sizeof(event.data));
-%endif
- }
-% endfor
-
- //////////////////////////////////////////////////////////////////////////
- /// @brief Everything written to buffer this point is the header.
- virtual void MarkHeader()
- {
- mHeaderBufOffset = mBufOffset;
- }
-
- std::string mFilename;
-
- static const uint32_t mBufferSize = 1024;
- uint8_t mBuffer[mBufferSize];
- uint32_t mBufOffset{0};
- uint32_t mHeaderBufOffset{0};
- };
-}
+++ /dev/null
-//============================================================================
-// Copyright (C) 2017 Intel Corporation. All Rights Reserved.
-//
-// 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.
-//
-// @file BackendPixelRate${fileNum}.cpp
-//
-// @brief auto-generated file
-//
-// DO NOT EDIT
-//
-// Generation Command Line:
-// ${'\n// '.join(cmdline)}
-//
-//============================================================================
-
-#include "core/backend.h"
-
-void InitBackendPixelRate${fileNum}()
-{
- %for func in funcList:
- ${func}
- %endfor
-}
--- /dev/null
+/****************************************************************************
+* Copyright (C) 2016 Intel Corporation. All Rights Reserved.
+*
+* 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.
+*
+* @file ${filename}
+*
+* @brief Implementation for events. auto-generated file
+*
+* DO NOT EDIT
+*
+******************************************************************************/
+#include "common/os.h"
+#include "gen_ar_event.hpp"
+#include "gen_ar_eventhandler.hpp"
+
+using namespace ArchRast;
+% for name in protos['event_names']:
+
+void ${name}::Accept(EventHandler* pHandler)
+{
+ pHandler->Handle(*this);
+}
+% endfor
--- /dev/null
+/****************************************************************************
+* Copyright (C) 2016 Intel Corporation. All Rights Reserved.
+*
+* 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.
+*
+* @file ${filename}
+*
+* @brief Definitions for events. auto-generated file
+*
+* DO NOT EDIT
+*
+******************************************************************************/
+#pragma once
+
+#include "common/os.h"
+#include "core/state.h"
+
+namespace ArchRast
+{
+% for name in protos['enum_names']:
+ enum ${name}
+ {<% names = protos['enums'][name]['names'] %>
+ % for i in range(len(names)):
+ ${names[i].lstrip()}
+ % endfor
+ };
+% endfor
+
+ //Forward decl
+ class EventHandler;
+
+ //////////////////////////////////////////////////////////////////////////
+ /// Event - interface for handling events.
+ //////////////////////////////////////////////////////////////////////////
+ struct Event
+ {
+ Event() {}
+ virtual ~Event() {}
+
+ virtual void Accept(EventHandler* pHandler) = 0;
+ };
+% for name in protos['event_names']:
+
+ //////////////////////////////////////////////////////////////////////////
+ /// ${name}Data
+ //////////////////////////////////////////////////////////////////////////
+#pragma pack(push, 1)
+ struct ${name}Data
+ {<%
+ field_names = protos['events'][name]['field_names']
+ field_types = protos['events'][name]['field_types'] %>
+ // Fields
+ % for i in range(len(field_names)):
+ ${field_types[i]} ${field_names[i]};
+ % endfor
+ };
+#pragma pack(pop)
+
+ //////////////////////////////////////////////////////////////////////////
+ /// ${name}
+ //////////////////////////////////////////////////////////////////////////
+ struct ${name} : Event
+ {<%
+ field_names = protos['events'][name]['field_names']
+ field_types = protos['events'][name]['field_types'] %>
+ ${name}Data data;
+
+ // Constructor
+ ${name}(
+ % for i in range(len(field_names)):
+ % if i < len(field_names)-1:
+ ${field_types[i]} ${field_names[i]},
+ % endif
+ % if i == len(field_names)-1:
+ ${field_types[i]} ${field_names[i]}
+ % endif
+ % endfor
+ )
+ {
+ % for i in range(len(field_names)):
+ data.${field_names[i]} = ${field_names[i]};
+ % endfor
+ }
+
+ virtual void Accept(EventHandler* pHandler);
+ };
+% endfor
+}
\ No newline at end of file
--- /dev/null
+/****************************************************************************
+* Copyright (C) 2016 Intel Corporation. All Rights Reserved.
+*
+* 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.
+*
+* @file ${filename}
+*
+* @brief Event handler interface. auto-generated file
+*
+* DO NOT EDIT
+*
+******************************************************************************/
+#pragma once
+
+#include "${event_header}"
+
+namespace ArchRast
+{
+ //////////////////////////////////////////////////////////////////////////
+ /// EventHandler - interface for handling events.
+ //////////////////////////////////////////////////////////////////////////
+ class EventHandler
+ {
+ public:
+ EventHandler() {}
+ virtual ~EventHandler() {}
+
+ virtual void FlushDraw(uint32_t drawId) {}
+
+% for name in protos['event_names']:
+ virtual void Handle(const ${name}& event) {}
+% endfor
+ };
+}
--- /dev/null
+/****************************************************************************
+* Copyright (C) 2016 Intel Corporation. All Rights Reserved.
+*
+* 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.
+*
+* @file ${filename}
+*
+* @brief Event handler interface. auto-generated file
+*
+* DO NOT EDIT
+*
+******************************************************************************/
+#pragma once
+
+#include "common/os.h"
+#include "${event_header}"
+#include <fstream>
+#include <sstream>
+
+namespace ArchRast
+{
+ //////////////////////////////////////////////////////////////////////////
+ /// EventHandlerFile - interface for handling events.
+ //////////////////////////////////////////////////////////////////////////
+ class EventHandlerFile : public EventHandler
+ {
+ public:
+ EventHandlerFile(uint32_t id)
+ : mBufOffset(0)
+ {
+#if defined(_WIN32)
+ DWORD pid = GetCurrentProcessId();
+ TCHAR procname[MAX_PATH];
+ GetModuleFileName(NULL, procname, MAX_PATH);
+ const char* pBaseName = strrchr(procname, '\\');
+ std::stringstream outDir;
+ outDir << KNOB_DEBUG_OUTPUT_DIR << pBaseName << "_" << pid << std::ends;
+ CreateDirectory(outDir.str().c_str(), NULL);
+
+ char buf[255];
+ // There could be multiple threads creating thread pools. We
+ // want to make sure they are uniquly identified by adding in
+ // the creator's thread id into the filename.
+ sprintf(buf, "%s\\ar_event%d_%d.bin", outDir.str().c_str(), GetCurrentThreadId(), id);
+ mFilename = std::string(buf);
+#else
+ char buf[255];
+ // There could be multiple threads creating thread pools. We
+ // want to make sure they are uniquly identified by adding in
+ // the creator's thread id into the filename.
+ sprintf(buf, "%s/ar_event%d_%d.bin", "/tmp", GetCurrentThreadId(), id);
+ mFilename = std::string(buf);
+#endif
+ }
+
+ virtual ~EventHandlerFile()
+ {
+ FlushBuffer();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ /// @brief Flush buffer to file.
+ bool FlushBuffer()
+ {
+ if (mBufOffset > 0)
+ {
+ if (mBufOffset == mHeaderBufOffset)
+ {
+ // Nothing to flush. Only header has been generated.
+ return false;
+ }
+
+ std::ofstream file;
+ file.open(mFilename, std::ios::out | std::ios::app | std::ios::binary);
+
+ if (!file.is_open())
+ {
+ SWR_INVALID("ArchRast: Could not open event file!");
+ return false;
+ }
+
+ file.write((char*)mBuffer, mBufOffset);
+ file.close();
+
+ mBufOffset = 0;
+ mHeaderBufOffset = 0; // Reset header offset so its no longer considered.
+ }
+ return true;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ /// @brief Write event and its payload to the memory buffer.
+ void Write(uint32_t eventId, const char* pBlock, uint32_t size)
+ {
+ if ((mBufOffset + size + sizeof(eventId)) > mBufferSize)
+ {
+ if (!FlushBuffer())
+ {
+ // Don't corrupt what's already in the buffer?
+ /// @todo Maybe add corrupt marker to buffer here in case we can open file in future?
+ return;
+ }
+ }
+
+ memcpy(&mBuffer[mBufOffset], (char*)&eventId, sizeof(eventId));
+ mBufOffset += sizeof(eventId);
+ memcpy(&mBuffer[mBufOffset], pBlock, size);
+ mBufOffset += size;
+ }
+
+% for name in protos['event_names']:
+ //////////////////////////////////////////////////////////////////////////
+ /// @brief Handle ${name} event
+ virtual void Handle(const ${name}& event)
+ {
+% if protos['events'][name]['num_fields'] == 0:
+ Write(${protos['events'][name]['event_id']}, (char*)&event.data, 0);
+% else:
+ Write(${protos['events'][name]['event_id']}, (char*)&event.data, sizeof(event.data));
+%endif
+ }
+% endfor
+
+ //////////////////////////////////////////////////////////////////////////
+ /// @brief Everything written to buffer this point is the header.
+ virtual void MarkHeader()
+ {
+ mHeaderBufOffset = mBufOffset;
+ }
+
+ std::string mFilename;
+
+ static const uint32_t mBufferSize = 1024;
+ uint8_t mBuffer[mBufferSize];
+ uint32_t mBufOffset{0};
+ uint32_t mHeaderBufOffset{0};
+ };
+}
--- /dev/null
+//============================================================================
+// Copyright (C) 2017 Intel Corporation. All Rights Reserved.
+//
+// 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.
+//
+// @file BackendPixelRate${fileNum}.cpp
+//
+// @brief auto-generated file
+//
+// DO NOT EDIT
+//
+// Generation Command Line:
+// ${'\n// '.join(cmdline)}
+//
+//============================================================================
+
+#include "core/backend.h"
+
+void InitBackendPixelRate${fileNum}()
+{
+ %for func in funcList:
+ ${func}
+ %endfor
+}
--- /dev/null
+//============================================================================
+// Copyright (C) 2014-2017 Intel Corporation. All Rights Reserved.
+//
+// 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.
+//
+// @file ${filename}
+//
+// @brief auto-generated file
+//
+// DO NOT EDIT
+//
+// Generation Command Line:
+// ${'\n// '.join(cmdline)}
+//
+//============================================================================
+#pragma once
+
+//============================================================================
+// Auto-generated ${comment}
+//============================================================================
+
+%for func in functions:
+${func['decl']}
+{
+%if isX86:
+ Function *pFunc = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::${func['intrin']});
+ return CALL(pFunc, std::initializer_list<Value*>{${func['args']}});
+%else:
+ return IRB()->${func['intrin']}(${func['args']});
+%endif
+}
+
+%endfor
+++ /dev/null
-//============================================================================
-// Copyright (C) 2014-2017 Intel Corporation. All Rights Reserved.
-//
-// 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.
-//
-// @file ${filename}
-//
-// @brief auto-generated file
-//
-// DO NOT EDIT
-//
-// Generation Command Line:
-// ${'\n// '.join(cmdline)}
-//
-//============================================================================
-#pragma once
-
-//============================================================================
-// Auto-generated ${comment}
-//============================================================================
-
-%for func in functions:
-${func['decl']}
-{
-%if isX86:
- Function *pFunc = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::${func['intrin']});
- return CALL(pFunc, std::initializer_list<Value*>{${func['args']}});
-%else:
- return IRB()->${func['intrin']}(${func['args']});
-%endif
-}
-
-%endfor
--- /dev/null
+/******************************************************************************
+*
+* Copyright 2015-2017
+* Intel Corporation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http ://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+% if gen_header:
+* @file ${filename}.h
+% else:
+* @file ${filename}.cpp
+% endif
+*
+* @brief Dynamic Knobs for Core.
+*
+* ======================= AUTO GENERATED: DO NOT EDIT !!! ====================
+*
+* Generation Command Line:
+* ${'\n* '.join(cmdline)}
+*
+******************************************************************************/
+<% calc_max_knob_len(knobs) %>
+%if gen_header:
+#pragma once
+#include <string>
+
+template <typename T>
+struct Knob
+{
+ const T& Value() const { return m_Value; }
+ const T& Value(const T& newValue) { m_Value = newValue; return Value(); }
+
+protected:
+ Knob(const T& defaultValue) : m_Value(defaultValue) {}
+
+private:
+ T m_Value;
+};
+
+#define DEFINE_KNOB(_name, _type, _default) \\
+
+ struct Knob_##_name : Knob<_type> \\
+
+ { \\
+
+ Knob_##_name() : Knob<_type>(_default) { } \\
+
+ static const char* Name() { return "KNOB_" #_name; } \\
+
+ } _name;
+
+#define GET_KNOB(_name) g_GlobalKnobs._name.Value()
+#define SET_KNOB(_name, _newValue) g_GlobalKnobs._name.Value(_newValue)
+
+struct GlobalKnobs
+{
+ % for knob in knobs:
+ //-----------------------------------------------------------
+ // KNOB_${knob[0]}
+ //
+ % for line in knob[1]['desc']:
+ // ${line}
+ % endfor
+ % if knob[1].get('choices'):
+ <%
+ choices = knob[1].get('choices')
+ _max_len = calc_max_name_len(choices) %>//
+ % for i in range(len(choices)):
+ // ${choices[i]['name']}${space_name(choices[i]['name'], _max_len)} = ${format(choices[i]['value'], '#010x')}
+ % endfor
+ % endif
+ //
+ % if knob[1]['type'] == 'std::string':
+ DEFINE_KNOB(${knob[0]}, ${knob[1]['type']}, "${repr(knob[1]['default'])[1:-1]}");
+ % else:
+ DEFINE_KNOB(${knob[0]}, ${knob[1]['type']}, ${knob[1]['default']});
+ % endif
+
+ % endfor
+ GlobalKnobs();
+ std::string ToString(const char* optPerLinePrefix="");
+};
+extern GlobalKnobs g_GlobalKnobs;
+
+#undef DEFINE_KNOB
+
+% for knob in knobs:
+#define KNOB_${knob[0]}${space_knob(knob[0])} GET_KNOB(${knob[0]})
+% endfor
+
+% else:
+% for inc in includes:
+#include <${inc}>
+% endfor
+
+//========================================================
+// Static Data Members
+//========================================================
+GlobalKnobs g_GlobalKnobs;
+
+//========================================================
+// Knob Initialization
+//========================================================
+GlobalKnobs::GlobalKnobs()
+{
+ % for knob in knobs:
+ InitKnob(${knob[0]});
+ % endfor
+}
+
+//========================================================
+// Knob Display (Convert to String)
+//========================================================
+std::string GlobalKnobs::ToString(const char* optPerLinePrefix)
+{
+ std::basic_stringstream<char> str;
+ str << std::showbase << std::setprecision(1) << std::fixed;
+
+ if (optPerLinePrefix == nullptr) { optPerLinePrefix = ""; }
+
+ % for knob in knobs:
+ str << optPerLinePrefix << "KNOB_${knob[0]}:${space_knob(knob[0])}";
+ % if knob[1]['type'] == 'bool':
+ str << (KNOB_${knob[0]} ? "+\n" : "-\n");
+ % elif knob[1]['type'] != 'float' and knob[1]['type'] != 'std::string':
+ str << std::hex << std::setw(11) << std::left << KNOB_${knob[0]};
+ str << std::dec << KNOB_${knob[0]} << "\n";
+ % else:
+ str << KNOB_${knob[0]} << "\n";
+ % endif
+ % endfor
+ str << std::ends;
+
+ return str.str();
+}
+
+% endif
+
+<%!
+ # Globally available python
+ max_len = 0
+ def calc_max_knob_len(knobs):
+ global max_len
+ max_len = 0
+ for knob in knobs:
+ if len(knob[0]) > max_len: max_len = len(knob[0])
+ max_len += len('KNOB_ ')
+ if max_len % 4: max_len += 4 - (max_len % 4)
+
+ def space_knob(knob):
+ knob_len = len('KNOB_' + knob)
+ return ' '*(max_len - knob_len)
+
+ def calc_max_name_len(choices_array):
+ _max_len = 0
+ for choice in choices_array:
+ if len(choice['name']) > _max_len: _max_len = len(choice['name'])
+
+ if _max_len % 4: _max_len += 4 - (_max_len % 4)
+ return _max_len
+
+ def space_name(name, max_len):
+ name_len = len(name)
+ return ' '*(max_len - name_len)
+
+
+%>
\ No newline at end of file
* ${'\n* '.join(cmdline)}
*
******************************************************************************/
-<%!
- def calc_max_len(fields):
- max_type_len = 0
- max_name_len = 0
- for f in fields:
- if len(f['type']) > max_type_len: max_type_len = len(f['type'])
- if len(f['name']) > max_name_len: max_name_len = len(f['name'])
- return (max_type_len, max_name_len)
-
- def pad(cur_len, max_len):
- pad_amt = max_len - cur_len
- return ' '*pad_amt
-%>
#pragma once
namespace SwrJit
(max_type_len, max_name_len) = calc_max_len(type['members'])
%>
%for member in type['members']:
- /* ${member['name']} ${pad(len(member['name']), max_name_len)} */ members.push_back( ${member['type']} );
+ /* ${member['name']} ${pad(len(member['name']), max_name_len)}*/ members.push_back( ${member['type']} );
%endfor
return StructType::get(ctx, members, false);
%endfor
} // ns SwrJit
+
+<%! # Global function definitions
+ def calc_max_len(fields):
+ max_type_len = 0
+ max_name_len = 0
+ for f in fields:
+ if len(f['type']) > max_type_len: max_type_len = len(f['type'])
+ if len(f['name']) > max_name_len: max_name_len = len(f['name'])
+ return (max_type_len, max_name_len)
+
+ def pad(cur_len, max_len):
+ pad_amt = max_len - cur_len
+ return ' '*pad_amt
+%>
+++ /dev/null
-<%
- max_len = 0
- for knob in knobs:
- if len(knob[0]) > max_len: max_len = len(knob[0])
- max_len += len('KNOB_ ')
- if max_len % 4: max_len += 4 - (max_len % 4)
-
- def space_knob(knob):
- knob_len = len('KNOB_' + knob)
- return ' '*(max_len - knob_len)
-
- def calc_max_name_len(choices_array):
- _max_len = 0
- for choice in choices_array:
- if len(choice['name']) > _max_len: _max_len = len(choice['name'])
-
- if _max_len % 4: _max_len += 4 - (_max_len % 4)
- return _max_len
-
- def space_name(name, max_len):
- name_len = len(name)
- return ' '*(max_len - name_len)
-
-
-%>/******************************************************************************
-*
-* Copyright 2015-2017
-* Intel Corporation
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http ://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-% if gen_header:
-* @file ${filename}.h
-% else:
-* @file ${filename}.cpp
-% endif
-*
-* @brief Dynamic Knobs for Core.
-*
-* ======================= AUTO GENERATED: DO NOT EDIT !!! ====================
-*
-* Generation Command Line:
-* ${'\n* '.join(cmdline)}
-*
-******************************************************************************/
-%if gen_header:
-#pragma once
-#include <string>
-
-template <typename T>
-struct Knob
-{
- const T& Value() const { return m_Value; }
- const T& Value(const T& newValue) { m_Value = newValue; return Value(); }
-
-protected:
- Knob(const T& defaultValue) : m_Value(defaultValue) {}
-
-private:
- T m_Value;
-};
-
-#define DEFINE_KNOB(_name, _type, _default) \\
-
- struct Knob_##_name : Knob<_type> \\
-
- { \\
-
- Knob_##_name() : Knob<_type>(_default) { } \\
-
- static const char* Name() { return "KNOB_" #_name; } \\
-
- } _name;
-
-#define GET_KNOB(_name) g_GlobalKnobs._name.Value()
-#define SET_KNOB(_name, _newValue) g_GlobalKnobs._name.Value(_newValue)
-
-struct GlobalKnobs
-{
- % for knob in knobs:
- //-----------------------------------------------------------
- // KNOB_${knob[0]}
- //
- % for line in knob[1]['desc']:
- // ${line}
- % endfor
- % if knob[1].get('choices'):
- <%
- choices = knob[1].get('choices')
- _max_len = calc_max_name_len(choices) %>//
- % for i in range(len(choices)):
- // ${choices[i]['name']}${space_name(choices[i]['name'], _max_len)} = ${format(choices[i]['value'], '#010x')}
- % endfor
- % endif
- //
- % if knob[1]['type'] == 'std::string':
- DEFINE_KNOB(${knob[0]}, ${knob[1]['type']}, "${repr(knob[1]['default'])[1:-1]}");
- % else:
- DEFINE_KNOB(${knob[0]}, ${knob[1]['type']}, ${knob[1]['default']});
- % endif
-
- % endfor
- GlobalKnobs();
- std::string ToString(const char* optPerLinePrefix="");
-};
-extern GlobalKnobs g_GlobalKnobs;
-
-#undef DEFINE_KNOB
-
-% for knob in knobs:
-#define KNOB_${knob[0]}${space_knob(knob[0])} GET_KNOB(${knob[0]})
-% endfor
-
-% else:
-% for inc in includes:
-#include <${inc}>
-% endfor
-
-//========================================================
-// Static Data Members
-//========================================================
-GlobalKnobs g_GlobalKnobs;
-
-//========================================================
-// Knob Initialization
-//========================================================
-GlobalKnobs::GlobalKnobs()
-{
- % for knob in knobs:
- InitKnob(${knob[0]});
- % endfor
-}
-
-//========================================================
-// Knob Display (Convert to String)
-//========================================================
-std::string GlobalKnobs::ToString(const char* optPerLinePrefix)
-{
- std::basic_stringstream<char> str;
- str << std::showbase << std::setprecision(1) << std::fixed;
-
- if (optPerLinePrefix == nullptr) { optPerLinePrefix = ""; }
-
- % for knob in knobs:
- str << optPerLinePrefix << "KNOB_${knob[0]}:${space_knob(knob[0])}";
- % if knob[1]['type'] == 'bool':
- str << (KNOB_${knob[0]} ? "+\n" : "-\n");
- % elif knob[1]['type'] != 'float' and knob[1]['type'] != 'std::string':
- str << std::hex << std::setw(11) << std::left << KNOB_${knob[0]};
- str << std::dec << KNOB_${knob[0]} << "\n";
- % else:
- str << KNOB_${knob[0]} << "\n";
- % endif
- % endfor
- str << std::ends;
-
- return str.str();
-}
-
-% endif
#include "core/clip.h"
#include "core/utils.h"
-#include "common/simdintrin.h"
#include "common/os.h"
static const SWR_RECT g_MaxScissorRect = { 0, 0, KNOB_MAX_SCISSOR_X, KNOB_MAX_SCISSOR_Y };
#include "core/state.h"
-#include "state_llvm.h"
+#include "gen_state_llvm.h"
#include <sstream>
#if defined(_WIN32)
#include "builder.h"
#include "jit_api.h"
#include "blend_jit.h"
-#include "state_llvm.h"
+#include "gen_state_llvm.h"
#include <sstream>
#include "builder.h"
#include "jit_api.h"
#include "fetch_jit.h"
-#include "state_llvm.h"
+#include "gen_state_llvm.h"
#include <sstream>
#include <tuple>
#include "builder.h"
#include "jit_api.h"
#include "streamout_jit.h"
-#include "state_llvm.h"
+#include "gen_state_llvm.h"
#include "llvm/IR/DataLayout.h"
#include <sstream>
#pragma pop_macro("DEBUG")
#include "state.h"
-#include "state_llvm.h"
+#include "gen_state_llvm.h"
#include "builder.h"
#include "tgsi/tgsi_strings.h"
#include "gallivm/lp_bld_tgsi.h"
#include "swr_context.h"
-#include "swr_context_llvm.h"
+#include "gen_swr_context_llvm.h"
#include "swr_resource.h"
#include "swr_state.h"
#include "swr_screen.h"
#include "common/os.h"
#include "jit_api.h"
-#include "state_llvm.h"
+#include "gen_state_llvm.h"
#include "gallivm/lp_bld_tgsi.h"
#include "util/u_format.h"
#include "swr_state.h"
#include "swr_context.h"
-#include "swr_context_llvm.h"
+#include "gen_swr_context_llvm.h"
#include "swr_screen.h"
#include "swr_resource.h"
#include "swr_tex_sample.h"
#include "state.h"
#include "JitManager.h"
-#include "state_llvm.h"
+#include "gen_state_llvm.h"
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_memory.h"
#include "swr_tex_sample.h"
-#include "swr_context_llvm.h"
+#include "gen_swr_context_llvm.h"
using namespace SwrJit;