summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_algebraic.py
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-03-23 17:22:44 -0700
committerJason Ekstrand <[email protected]>2015-04-01 12:51:03 -0700
commit22ee7eeb4e08ffdd8d53aa68e4d2b2c09f1721d0 (patch)
treeb75f5586931febfca60bde05f57607d76d0afefd /src/glsl/nir/nir_algebraic.py
parent793a94d6b5fc589ca8d7475347def4e222cd3d7c (diff)
nir/algebraic: #define around structure definitions
Previously, we couldn't generate two algebraic passes in the same file because of multiple structure definitions. To solve this, we play the age-old header file trick and just #define around it. Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_algebraic.py')
-rw-r--r--src/glsl/nir/nir_algebraic.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/glsl/nir/nir_algebraic.py b/src/glsl/nir/nir_algebraic.py
index afab1a0084f..bbf4f08ef92 100644
--- a/src/glsl/nir/nir_algebraic.py
+++ b/src/glsl/nir/nir_algebraic.py
@@ -181,12 +181,23 @@ _algebraic_pass_template = mako.template.Template("""
#include "nir.h"
#include "nir_search.h"
+#ifndef NIR_OPT_ALGEBRAIC_STRUCT_DEFS
+#define NIR_OPT_ALGEBRAIC_STRUCT_DEFS
+
struct transform {
const nir_search_expression *search;
const nir_search_value *replace;
unsigned condition_offset;
};
+struct opt_state {
+ void *mem_ctx;
+ bool progress;
+ const bool *condition_flags;
+};
+
+#endif
+
% for (opcode, xform_list) in xform_dict.iteritems():
% for xform in xform_list:
${xform.search.render()}
@@ -200,12 +211,6 @@ static const struct transform ${pass_name}_${opcode}_xforms[] = {
};
% endfor
-struct opt_state {
- void *mem_ctx;
- bool progress;
- const bool *condition_flags;
-};
-
static bool
${pass_name}_block(nir_block *block, void *void_state)
{