AcademySoftwareFoundation / AcademySoftwareFoundation/OpenShadingLanguage

can't set shader parameter with init code to zero

Aperta
#906 1 commento 0 reazioni 1 assegnatario Rivendicata da @lgritz Vedi su GitHub
Lingua principale
C++
Stelle
2.3k
Fork
414
Merge medio
3g 1h
PR unite (30g)
10

Descrizione

A shader parameter with some initialization code can't be set to zero. It looks a lot like zero is used as a magic value to know if the init code should be run or not.

The problem is easy to reproduce with this trivial shader:

```
shader simple(
float a = 0.5,
float value = 1 - a )
{
printf("value is %f\n", value);
}
```

Default run is fine:
```
$ testshade --shader simple l
value is 0.500000
```
Most values work fine:
```
$ testshade --param value 0.8 --shader simple l
value is 0.800000
```
But zero runs the init code anyway:
```
$ testshade --param value 0.0 --shader simple l
value is 0.500000
```

That last case should print `0.000000`, not `0.500000`

The same happens with a color parameter. Tested against current master branch (7a56abdfb0b2b560415dc6e85b8861c09bbc3a77) on linux.

Oh and it seems to check for binary zero as this works:
```
$ testshade --param value -0.0 --shader simple l
value is -0.000000
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.