AcademySoftwareFoundation / AcademySoftwareFoundation/OpenShadingLanguage

Initializing Shader Matrix Parameter Relative To World Writes Random Values to .oso

Offen
#692 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
2.3k
Forks
414
Ø Merge
3 T. 1 Std.
Gemergte PRs (30 T.)
10

Beschreibung

This isn't a big issue - it should perhaps just be illegal to do, but currently oslc accepts it, and produces a randomly varying .oso, which isn't good.

If I write a shader like this:
```
shader UninitializedMatrix
(
matrix projectionOrigin = matrix( "world", 1 ),
)
{
printf( "%f\n", projectionOrigin );
}
```

and then repeatedly run:
```oslc UninitializedMatrix.osl && testshade UninitializedMatrix```

I get varying results such as:

```0.000000 1.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000```

```0.000000 1.000000 0.000000 0.000000 8667008283398819024714655604160856064.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000```

```0.000000 1.000000 0.000000 0.000000 2573104625500368666624.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1913952141312.000000 0.000000 0.000000 0.000000 160447971328.000000 0.000000```

Worst case, I had a situation where the parameter would always be connected to something, so I hadn't noticed that the initializer wasn't working, until one compile hit some particularly bad luck and wrote a nan into the .oso, which caused the .oso to fail to parse.

Not a problem for me now that I'm aware, but perhaps to make it more obvious to others this should be an error, or should receive an identity matrix even though the actual world matrix isn't know yet during compile?

I'm testing in 1.7.2 on Linux, in case this behaviour has changed recently.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduziere das Problem mit dem bereitgestellten UninitializedMatrix shader, indem du wiederholt oslc gefolgt von testshade ausführst und die ausgegebenen Matrixwerte vergleichst. Verfolge, wie oslc den weltbezogenen Matrixinitialisierer behandelt, bestimme dann das beabsichtigte Verhalten – ihn abzulehnen oder eine Einheitsmatrix zu verwenden – und füge eine Testabdeckung für eine deterministische Ausgabe oder eine Diagnose hinzu.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
compilers, computer-graphics
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.