diff options
author | Alok Hota <[email protected]> | 2018-08-23 19:25:39 -0500 |
---|---|---|
committer | Alok Hota <[email protected]> | 2019-02-15 14:54:04 -0600 |
commit | dc7b3c95a45078fcbf32e68bf6b2c972c6df41c9 (patch) | |
tree | 372b481defcfd192baff54c770004c8522a4bbbd /src/gallium/drivers | |
parent | 05e4ff33f5c717275e88844e67d0fc3dd12d9d2b (diff) |
swr/rast: Move knob defaults to generated cpp file
Reduces amount of compile churn when testing different default values
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp | 7 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.h | 14 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp index 9375569ebeb..ba1ad5effee 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp +++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.cpp @@ -95,6 +95,13 @@ void KnobBase::autoExpandEnvironmentVariables(std::string& text) //======================================================== // Static Data Members //======================================================== +% for knob in knobs: +% if knob[1]['type'] == 'std::string': +${knob[1]['type']} GlobalKnobs::Knob_${knob[0]}::m_default = "${repr(knob[1]['default'])[1:-1]}"; +% else: +${knob[1]['type']} GlobalKnobs::Knob_${knob[0]}::m_default = ${knob[1]['default']}; +% endif +% endfor GlobalKnobs g_GlobalKnobs; //======================================================== diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.h b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.h index 71dbdacfd1d..8b88a11706c 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.h +++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_knobs.h @@ -72,7 +72,7 @@ private: T m_Value; }; -#define DEFINE_KNOB(_name, _type, _default) \\ +#define DEFINE_KNOB(_name, _type) \\ struct Knob_##_name : Knob<_type> \\ @@ -80,7 +80,11 @@ private: static const char* Name() { return "KNOB_" #_name; } \\ - static _type DefaultValue() { return (_default); } \\ + static _type DefaultValue() { return (m_default); } \\ + + private: \\ + + static _type m_default; \\ } _name; @@ -105,11 +109,7 @@ struct GlobalKnobs % 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 + DEFINE_KNOB(${knob[0]}, ${knob[1]['type']}); % endfor |