[Mesa-dev] [PATCH v1 1/2] glsl/standalone: segfault with --dump-builder for ir_texture
Sergii Romantsov
sergii.romantsov at gmail.com
Fri Aug 31 09:49:24 UTC 2018
Shader that contains builtin functions texture* causes segfault for
standalone compiler with parameter --dump-builder.
Added handling of ir_texture as rhs of assignment.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107767
Signed-off-by: Sergii Romantsov <sergii.romantsov at globallogic.com>
---
src/compiler/glsl/ir_builder_print_visitor.cpp | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/compiler/glsl/ir_builder_print_visitor.cpp b/src/compiler/glsl/ir_builder_print_visitor.cpp
index da04868..eb98f41 100644
--- a/src/compiler/glsl/ir_builder_print_visitor.cpp
+++ b/src/compiler/glsl/ir_builder_print_visitor.cpp
@@ -60,6 +60,8 @@ public:
virtual ir_visitor_status visit_leave(class ir_swizzle *);
virtual ir_visitor_status visit_leave(class ir_return *);
+ virtual ir_visitor_status visit_enter(ir_texture *ir);
+
private:
void print_with_indent(const char *fmt, ...);
void print_without_indent(const char *fmt, ...);
@@ -446,6 +448,7 @@ ir_builder_print_visitor::print_without_declaration(const ir_swizzle *ir)
print_without_declaration(ir->val);
print_without_indent(")");
} else {
+ assert(he);
print_without_indent("swizzle_%c(r%04X)",
swiz[ir->mask.x],
(unsigned)(uintptr_t) he->data);
@@ -453,6 +456,7 @@ ir_builder_print_visitor::print_without_declaration(const ir_swizzle *ir)
} else {
static const char swiz[4] = { 'X', 'Y', 'Z', 'W' };
+ assert(he);
print_without_indent("swizzle(r%04X, MAKE_SWIZZLE4(SWIZZLE_%c, SWIZZLE_%c, SWIZZLE_%c, SWIZZLE_%c), %u)",
(unsigned)(uintptr_t) he->data,
swiz[ir->mask.x],
@@ -527,6 +531,7 @@ ir_builder_print_visitor::visit_leave(ir_assignment *ir)
_mesa_hash_table_search(index_map, ir->rhs);
assert(ir->condition == NULL);
+ assert(ir->lhs && ir->rhs);
print_with_indent("body.emit(assign(r%04X, r%04X, 0x%02x));\n\n",
(unsigned)(uintptr_t) he_lhs->data,
@@ -684,6 +689,20 @@ ir_builder_print_visitor::visit_leave(ir_return *ir)
}
ir_visitor_status
+ir_builder_print_visitor::visit_enter(ir_texture *ir)
+{
+ const struct hash_entry *const he =
+ _mesa_hash_table_search(index_map, ir);
+ if (!he)
+ {
+ const unsigned my_index = next_ir_index++;
+ _mesa_hash_table_insert(index_map, ir, (void *)(uintptr_t) my_index);
+ }
+
+ return visit_continue;
+}
+
+ir_visitor_status
ir_builder_print_visitor::visit_leave(ir_call *ir)
{
const unsigned my_index = next_ir_index++;
--
2.7.4
More information about the mesa-dev
mailing list