AcademySoftwareFoundation / AcademySoftwareFoundation/OpenShadingLanguage
[BUG] Bad output indices from `pointcloud_search()` with batched shading
- Vorherrschende Sprache
- C++
- Sterne
- 2.3k
- Forks
- 414
- Ø Merge
- 3 T. 1 Std.
- Gemergte PRs (30 T.)
- 10
Beschreibung
**Describe the bug**
When using `pointcloud_search()` with batched shader execution, the output `indices` array is not being filled correctly. It looks a little like OSL thinks the output is a uniform rather than a varying value, but I don't know enough about what is going on under the hood to be sure.
**OSL version and dependencies**
* OSL branch/version: 1.14.5.1
* OS: Rocky 8.8
* C++ compiler: GCC 11.2.1
* LLVM version: 15.0.7
* OIIO version: 3.0.6.1
**To Reproduce**
Steps to reproduce the behavior:
1. `oslc search.osl` (source code in section below).
2. `testshade -g 16 16 -batched -param file cloud.geo search.oso -o Cout batched.png`
3. `testshade -g 16 16 -param file cloud.geo search.oso -o Cout unbatched.png`
4. Compare `batched.png` to `unbatched.png`. The latter has the expected results, and the former does not.
In the above commands, `cloud.geo` is `testsuite/pointcloud-fold/cloud.geo` from the OSL repo.
**Evidence**
search.osl
```
shader search( string file = "", output color Cout = 0 )
{
int indices[1];
// Uncommenting this workaround gives the expected results in batched
// mode. I suspect it works by tricking OSL into realising that `indices`
// is a varying quantity.
// indices[0] = P[0];
if( pointcloud_search( file, P, 1, 1, "index", indices ) )
{
Cout = color( indices[0] / 15.0 );
}
else
{
Cout = color( 1, 0, 0 );
}
}
```
batched.png :
unbatched.png :
Beitragsleitfaden
Rechercherichtung
Führe die aufgeführten oslc- und testshade-Befehle mit testsuite/pointcloud-fold/cloud.geo aus und vergleiche anschließend die gebatchte und die ungebatchte Ausgabe. Beginne beim Einstiegspunkt pointcloud_search und verfolge, wie das Ausgabe-Indizes-Array während der Batch-Ausführung verarbeitet wird. Als abgeschlossen gilt die Aufgabe, wenn batched.png ohne den Workaround mit den erwarteten Ergebnissen der ungebatchten Ausführung übereinstimmt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp
- Bereich
- computer-graphics
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 40/100