qdtk / openshadinglanguage

Automatically exported from code.google.com/p/openshadinglanguage
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

input connections to output parameters can lead to inconsistent results #53

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
shader ( output float my_output = 0) {
  float local_var = 10;
  my_output = local_var;
  my_output = mix(my_output, 20, v);
}

2. Connect another shader _into_ "my_output"

3. The connected shader runs after the first assignment to my_output,
overwriting its value.

What is the expected output? What do you see instead?

I expect to see local_var preserved in my_output

Please use labels and text to provide additional information.

Either we should emit the useparam instruction on the first write, or we
should not allow input connections to output parameters at all.

Original issue reported on code.google.com by cku...@gmail.com on 5 Feb 2010 at 11:18

GoogleCodeExporter commented 9 years ago
Another example of a potentially tricky shader:

shader (output float my_output = 0) {
  if (u > 0.4 && u < 0.6) {
      my_output = 1;
  }
}

This example suggests that we should issue "useparam" for every output 
parameter at
the very start of a shader.

Original comment by cku...@gmail.com on 5 Feb 2010 at 11:46