Update seed_rng() in stdlib to take a varying seed.

Previously, we were trying to take a uniform seed and then shuffle that
around to initialize the state for each of the program instances.  This
was becoming increasingly untenable and brittle.

Now a varying seed is expected and used.
This commit is contained in:
Matt Pharr
2012-05-30 10:35:41 -07:00
parent 5cb53f52c3
commit 8fd9b84a80
6 changed files with 11 additions and 58 deletions

View File

@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
RNGState state;
seed_rng(&state, 1);
seed_rng(&state, programIndex);
int count[32];
for (uniform int i = 0; i < 32; ++i)
count[i] = (b == 5.) ? 0 : 1;

View File

@@ -3,7 +3,7 @@ export uniform int width() { return programCount; }
export void f_f(uniform float RET[], uniform float aFOO[]) {
RNGState state;
seed_rng(&state, 1);
seed_rng(&state, programIndex);
float sum = 0;
uniform int iters = 40000;
for (unsigned int i = 0; i < iters; ++i)