glsl_to_nir: skip ir_var_shader_shared variables

These should be lowered away in GLSL IR but if we don't get dead
code to clean them up it causes issues in glsl_to_nir.

We wan't to drop as many GLSL IR opts in future as we can so this
makes glsl_to_nir just ignore the vars if it sees them.

In future we will want to just use the nir lowering pass that
Vulkan currently uses.

Acked-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Timothy Arceri
2017-01-19 10:41:57 +11:00
committed by Timothy Arceri
parent 7a7ee40c2d
commit aa021d50c0

View File

@@ -308,6 +308,13 @@ constant_copy(ir_constant *ir, void *mem_ctx)
void void
nir_visitor::visit(ir_variable *ir) nir_visitor::visit(ir_variable *ir)
{ {
/* TODO: In future we should switch to using the NIR lowering pass but for
* now just ignore these variables as GLSL IR should have lowered them.
* Anything remaining are just dead vars that weren't cleaned up.
*/
if (ir->data.mode == ir_var_shader_shared)
return;
nir_variable *var = ralloc(shader, nir_variable); nir_variable *var = ralloc(shader, nir_variable);
var->type = ir->type; var->type = ir->type;
var->name = ralloc_strdup(var, ir->name); var->name = ralloc_strdup(var, ir->name);