Skip to content

Commit 5617e92

Browse files
committed
Fix scene cache output determinism
Two of our structures had uninitialized padding space; as a result, some of the data that we were writing to scene cache would have uninitialized bytes which meant the cache was not reproducible run to run. The padding amount would be conditional on the contents of the rest of the structure, so this is not ideal for maintenance but for now this fixes the problem and makes it easier to debug.
1 parent ac8037e commit 5617e92

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/scene.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ struct alignas(16) Material
3232
vec4 diffuseFactor;
3333
vec4 specularFactor;
3434
vec3 emissiveFactor;
35+
36+
uint32_t padding; // TODO: this is fragile
3537
};
3638

3739
struct alignas(16) MeshDraw
@@ -73,6 +75,8 @@ struct alignas(16) Mesh
7375

7476
uint32_t lodCount;
7577
MeshLod lods[8];
78+
79+
uint32_t padding; // TODO: this is fragile
7680
};
7781

7882
struct Geometry

0 commit comments

Comments
 (0)