Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

test(renderer): the sampler-pinning case knows the frame's record unit

esengine67e1343ab6e4
diff --git a/tests/renderer/test_batch_builder.cpp b/tests/renderer/test_batch_builder.cpp
index 3dcca562e..2f2a1bc22 100644
--- a/tests/renderer/test_batch_builder.cpp
+++ b/tests/renderer/test_batch_builder.cpp
@@ -405,11 +405,18 @@ TEST_CASE("execute: a sampling draw pins every sampler unit it does not use") {
u32 boundAt[MAX_CMD_TEXTURE_SLOTS] = {};
bool seen[MAX_CMD_TEXTURE_SLOTS] = {};
+ bool record = false;
for (const auto& [unit, tex] : h.device.bindLog) {
+ // The frame's per-object record rides its own unit above the draw's eight.
+ if (unit == MESH_INSTANCE_TEXTURE_UNIT) {
+ record = true;
+ continue;
+ }
REQUIRE(unit < MAX_CMD_TEXTURE_SLOTS);
boundAt[unit] = static_cast<u32>(tex);
seen[unit] = true;
}
+ CHECK(record);
for (u32 unit = 0; unit < MAX_CMD_TEXTURE_SLOTS; ++unit) {
CHECK(seen[unit]); // no unit left to whatever ran before
CHECK(boundAt[unit] == (unit == 0 ? 7u : white));