AcademySoftwareFoundation / AcademySoftwareFoundation/OpenShadingLanguage

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

Aperta
#692 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
2.3k
Fork
414
Merge medio
3g 1h
PR unite (30g)
10

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Riproduci il problema con lo shader UninitializedMatrix fornito eseguendo ripetutamente oslc seguito da testshade e confronta i valori della matrice stampati. Traccia il modo in cui oslc gestisce l'inizializzatore della matrice relativo al mondo, quindi determina il comportamento previsto — rifiutarlo o usare una matrice identità — e aggiungi una copertura per un output deterministico o una diagnostica.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
compilers, computer-graphics
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.