File tree Expand file tree Collapse file tree
testsuite/reparam-connected-crash Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -356,7 +356,7 @@ macro (osl_add_all_tests)
356356 printf-reg
357357 printf-whole-array
358358 raytype raytype-reg raytype-specialized regex -reg
359- reparam reparam-arrays reparam-string testoptix-reparam
359+ reparam reparam-arrays reparam-connected-crash reparam- string testoptix-reparam
360360 render-background render-bumptest
361361 render-bunny
362362 render-cornell
Original file line number Diff line number Diff line change @@ -232,7 +232,8 @@ BackendLLVM::getLLVMSymbolBase(const Symbol& sym)
232232 llvm_type (sym.typespec ().elementtype ()));
233233 return result;
234234 }
235- if (sym.symtype () == SymTypeParam && sym.interactive ()) {
235+ if (sym.symtype () == SymTypeParam && sym.interactive ()
236+ && !sym.connected ()) {
236237 // Special case for interactively-edited parameters -- they live in
237238 // the interactive data block for the group.
238239 // Generate the pointer to this symbol by offsetting into the
Original file line number Diff line number Diff line change @@ -454,7 +454,8 @@ BatchedBackendLLVM::getLLVMSymbolBase(const Symbol& sym)
454454 return result;
455455 }
456456
457- if (sym.symtype () == SymTypeParam && sym.interactive ()) {
457+ if (sym.symtype () == SymTypeParam && sym.interactive ()
458+ && !sym.connected ()) {
458459 // Special case for interactively-edited parameters -- they live in
459460 // the interactive data block for the group.
460461 // Generate the pointer to this symbol by offsetting into the
Original file line number Diff line number Diff line change 1+ // Copyright Contributors to the Open Shading Language project.
2+ // SPDX-License-Identifier: BSD-3-Clause
3+ // https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
4+
5+ // Downstream layer: 'in' will be marked interactive with an instance value
6+ // via testshade -param:interactive=1
7+ shader downstream(float in = 0, output float result = 0)
8+ {
9+ printf("in = %g\n", in);
10+ result = in;
11+ }
Original file line number Diff line number Diff line change 1+ Compiled downstream.osl -> downstream.oso
2+ Compiled upstream.osl -> upstream.oso
3+ Connect upstream_layer.out to downstream_layer.in
4+ in = 0.5
5+
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ # Copyright Contributors to the Open Shading Language project.
4+ # SPDX-License-Identifier: BSD-3-Clause
5+ # https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
6+
7+ # Regression test: downstream input param is both connected (from upstream) and
8+ # marked interactive with an instance value.
9+ #
10+ # Bug: OSL give precedence to the interactive trait instead of connected. This
11+ # leads to an attempted write of the interactive buffer. However, the offset
12+ # is calculated incorrectly and the write occurs at interactive_buffer[-1].
13+ #
14+ # Correct output: in = 0.5 (u at the default shade point, from the connection)
15+ # Buggy output: in = <garbage> (corrupted memory) or crash
16+
17+ command += testshade (
18+ "-layer upstream_layer upstream "
19+ "-layer downstream_layer -param:interactive=1 in 9.0 downstream "
20+ "-connect upstream_layer out downstream_layer in "
21+ )
22+
23+ outputs = ["out.txt" ]
Original file line number Diff line number Diff line change 1+ // Copyright Contributors to the Open Shading Language project.
2+ // SPDX-License-Identifier: BSD-3-Clause
3+ // https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
4+
5+ shader upstream(output float out = 0)
6+ {
7+ out = u; // don't constant-fold
8+ }
You can’t perform that action at this time.
0 commit comments