Re: [Mesa-dev] [PATCH 11/18] glsl: Add support for EmitStreamVertex() and EndStreamPrimitive().

2014-06-16 Thread Iago Toral
Hi Chris, On Sat, 2014-06-14 at 08:34 +1200, Chris Forbes wrote: Right, this happens because ir_emit_vertex doesn't take a proper operand, so it can't keep it alive. What I think you want to do is change the stream in ir_emit_vertex and ir_end_primitive to be a pointer to ir_rvalue (and

Re: [Mesa-dev] [PATCH 11/18] glsl: Add support for EmitStreamVertex() and EndStreamPrimitive().

2014-06-16 Thread Chris Forbes
Have a look at the ir_texture stuff -- it's complex, but it has a whole bunch of ir_value* for the various texture parameters. You'll be able to do something simpler, but will probably have to touch most of the same places that currently treat texturing specially. On Mon, Jun 16, 2014 at 7:04 PM,

Re: [Mesa-dev] [PATCH 11/18] glsl: Add support for EmitStreamVertex() and EndStreamPrimitive().

2014-06-13 Thread Iago Toral
After debugging I have more information about what is going on. There are two problems, one is that the stream variable in ir_emit_vertex gets trashed and the other one is that even if we manage to avoid that it won't get its value assigned. I explain how these two come to happen below and maybe

Re: [Mesa-dev] [PATCH 11/18] glsl: Add support for EmitStreamVertex() and EndStreamPrimitive().

2014-06-13 Thread Iago Toral
I forgot to add an important piece of info. I also had to add this in the opt_dead_code.cpp, do_dead_code(): if (strcmp(entry-var-name, stream) == 0) continue; without that, the variable referenced by ir_emit_vertex() gets trashed anyway, whether the ralloc context in link_shaders is

Re: [Mesa-dev] [PATCH 11/18] glsl: Add support for EmitStreamVertex() and EndStreamPrimitive().

2014-06-13 Thread Iago Toral
On Fri, 2014-06-13 at 10:28 +0200, Iago Toral wrote: I forgot to add an important piece of info. I also had to add this in the opt_dead_code.cpp, do_dead_code(): if (strcmp(entry-var-name, stream) == 0) continue; without that, the variable referenced by ir_emit_vertex() gets trashed

Re: [Mesa-dev] [PATCH 11/18] glsl: Add support for EmitStreamVertex() and EndStreamPrimitive().

2014-06-13 Thread Chris Forbes
Right, this happens because ir_emit_vertex doesn't take a proper operand, so it can't keep it alive. What I think you want to do is change the stream in ir_emit_vertex and ir_end_primitive to be a pointer to ir_rvalue (and apply the various tweaks required to consider it alive; have rvalue

[Mesa-dev] [PATCH 11/18] glsl: Add support for EmitStreamVertex() and EndStreamPrimitive().

2014-06-11 Thread Iago Toral Quiroga
--- src/glsl/ast_function.cpp | 37 +- src/glsl/builtin_functions.cpp | 60 ++ src/glsl/ir.h | 18 - 3 files changed, 103 insertions(+), 12 deletions(-) diff --git a/src/glsl/ast_function.cpp

Re: [Mesa-dev] [PATCH 11/18] glsl: Add support for EmitStreamVertex() and EndStreamPrimitive().

2014-06-11 Thread Chris Forbes
This is pretty weird. We should be able to generate a normal builtin function body here which consists of just the ir_emit_vertex, passing the stream parameter to it. This would then get inlined like any other function leaving a bare ir_emit_vertex / ir_end_primitive with a constant operand. If