random float
Some checks failed
CI / React UI Build (push) Successful in 11s
CI / Native Windows Build And Tests (push) Successful in 1m45s
CI / Windows Release Package (push) Has been cancelled

This commit is contained in:
2026-05-08 13:35:15 +10:00
parent c9fed70a60
commit 5eff189bbf
8 changed files with 27 additions and 8 deletions

View File

@@ -64,6 +64,7 @@ void TestGlobalParamStylePacking()
AppendStd140Vec2(buffer, 1280.0f, 720.0f); // output resolution
AppendStd140Float(buffer, 45296.0f); // UTC time of day
AppendStd140Float(buffer, 36000.0f); // UTC offset
AppendStd140Float(buffer, 0.75f); // startup random
AppendStd140Float(buffer, 42.0f); // frame count
AppendStd140Float(buffer, 0.5f); // mix
AppendStd140Float(buffer, 1.0f); // bypass
@@ -76,17 +77,18 @@ void TestGlobalParamStylePacking()
AppendStd140Int(buffer, 2); // enum parameter
buffer.resize(AlignStd140(buffer.size(), 16), 0);
Expect(buffer.size() == 96, "global parameter style block is padded to a 16-byte boundary");
Expect(buffer.size() == 112, "global parameter style block is padded to a 16-byte boundary");
Expect(ReadFloat(buffer, 0) == 10.0f, "time is at the start of the block");
Expect(ReadFloat(buffer, 8) == 1920.0f, "first vec2 aligns after scalar padding");
Expect(ReadFloat(buffer, 16) == 1280.0f, "second vec2 follows first vec2");
Expect(ReadFloat(buffer, 24) == 45296.0f, "UTC time follows output resolution");
Expect(ReadFloat(buffer, 28) == 36000.0f, "UTC offset follows UTC time");
Expect(ReadInt(buffer, 44) == 3, "history length scalar remains tightly packed");
Expect(ReadFloat(buffer, 56) == 4.0f, "vec2 shader parameter aligns to 8 bytes");
Expect(ReadFloat(buffer, 64) == 0.1f, "color parameter aligns to 16 bytes");
Expect(ReadInt(buffer, 80) == 1, "boolean parameter follows vec4");
Expect(ReadInt(buffer, 84) == 2, "enum parameter follows boolean");
Expect(ReadFloat(buffer, 32) == 0.75f, "startup random follows UTC offset");
Expect(ReadInt(buffer, 48) == 3, "history length scalar remains tightly packed");
Expect(ReadFloat(buffer, 64) == 4.0f, "vec2 shader parameter aligns to 8 bytes");
Expect(ReadFloat(buffer, 80) == 0.1f, "color parameter aligns to 16 bytes");
Expect(ReadInt(buffer, 96) == 1, "boolean parameter follows vec4");
Expect(ReadInt(buffer, 100) == 2, "enum parameter follows boolean");
}
}