[Mesa-dev] [PATCH v1 2/2] glsl/standalone: --dump-builder: dump of ir_texture

Sergii Romantsov sergii.romantsov at gmail.com
Fri Aug 31 09:49:25 UTC 2018


For standalone compilation with parameter --dump-builder in dump
absent description of texture invocation.
Added the simplest handling.

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 | 51 ++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/src/compiler/glsl/ir_builder_print_visitor.cpp b/src/compiler/glsl/ir_builder_print_visitor.cpp
index eb98f41..679d1b8 100644
--- a/src/compiler/glsl/ir_builder_print_visitor.cpp
+++ b/src/compiler/glsl/ir_builder_print_visitor.cpp
@@ -61,6 +61,7 @@ public:
    virtual ir_visitor_status visit_leave(class ir_return *);
 
    virtual ir_visitor_status visit_enter(ir_texture *ir);
+   virtual ir_visitor_status visit_leave(ir_texture *ir);
 
 private:
    void print_with_indent(const char *fmt, ...);
@@ -703,6 +704,56 @@ ir_builder_print_visitor::visit_enter(ir_texture *ir)
 }
 
 ir_visitor_status
+ir_builder_print_visitor::visit_leave(ir_texture *ir)
+{
+   const struct hash_entry *const he_lhs =
+      _mesa_hash_table_search(index_map, ir);
+   const struct hash_entry *const he_rhs_sampler =
+      _mesa_hash_table_search(index_map, ir->sampler);
+   const struct hash_entry *const he_rhs_coord =
+      _mesa_hash_table_search(index_map, ir->coordinate);
+   const struct hash_entry *const he_rhs_proj =
+      _mesa_hash_table_search(index_map, ir->projector);
+   const struct hash_entry *const he_rhs_comp =
+      _mesa_hash_table_search(index_map, ir->shadow_comparator);
+   const struct hash_entry *const he_rhs_offset =
+      _mesa_hash_table_search(index_map, ir->offset);
+   const struct hash_entry *const he_rhs_lodinfo = ir->op != ir_txd
+      ? _mesa_hash_table_search(index_map, ir->lod_info.lod)  //use any member due to union
+      : NULL;
+   const struct hash_entry *const he_rhs_lodinfo_pdx = ir->op == ir_txd
+      ? _mesa_hash_table_search(index_map, ir->lod_info.grad.dPdx)
+      : NULL;
+   const struct hash_entry *const he_rhs_lodinfo_pdy = ir->op == ir_txd
+      ? _mesa_hash_table_search(index_map, ir->lod_info.grad.dPdy)
+      : NULL;
+
+   print_with_indent("ir_texture *const r%04X = new(mem_ctx) ir_texture(%s, r%04X",
+                     he_lhs->data,
+                     ir->opcode_string(),
+                     he_rhs_sampler->data);
+   if (he_rhs_coord)
+      print_without_indent(", r%04X", he_rhs_coord->data);
+   if (he_rhs_proj)
+      print_without_indent(", r%04X", he_rhs_proj->data);
+   if (he_rhs_comp)
+      print_without_indent(", r%04X", he_rhs_comp->data);
+   if (he_rhs_offset)
+      print_without_indent(", r%04X", he_rhs_offset->data);
+   if (he_rhs_lodinfo)
+      print_without_indent(", r%04X", he_rhs_lodinfo->data);
+   if (he_rhs_lodinfo_pdx)
+      print_without_indent(", r%04X", he_rhs_lodinfo_pdx->data);
+   if (he_rhs_lodinfo_pdy)
+      print_without_indent(", r%04X", he_rhs_lodinfo_pdy->data);
+   print_without_indent(");\n");
+
+   print_with_indent("body.emit(r%04X);\n", he_lhs->data);
+
+   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