render: resolve GPU textures once per draw and sort by handle

RenderSceneGPU resolves each draw's texture while classifying it and
sorts opaque draws by the texture handle instead of comparing paths;
invalid draws are dropped before sorting. Bumps sdk (skin cache).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-12 16:30:32 +09:00
co-authored by Claude Opus 5.5
parent f03f63e700
commit 545cbb1e5d
4 changed files with 28 additions and 10 deletions
+15
View File
@@ -117,6 +117,21 @@ int main(int argc, char** argv) {
std::cout << "Draw " << i << " texture0: '" << draws[i].texture0 << "'" << std::endl;
}
assert(!draws.empty() && "Must produce at least one 3D draw command");
{
// GPU draw caches keep skinned texture names; skin changes after the cache is built must apply.
auto skinned = ava2::Gr2ModelInstance::Load(model_path);assert(skinned);
const auto base = skinned->BuildDrawCommands(-1.0f, nullptr, true);assert(!base.empty());
assert(skinned->BuildDrawCommands(-1.0f, nullptr, true)[0].texture0 == base[0].texture0);
std::string upper = base[0].texture0;for (auto& c : upper) c = static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
skinned->SetSkin(upper, "skin-test.dds");
assert(skinned->BuildDrawCommands(-1.0f, nullptr, true)[0].texture0 == "skin-test.dds");
assert(skinned->BuildDrawCommands(-1.0f, nullptr, true)[0].texture0 == "skin-test.dds");
skinned->ClearSkins();
assert(skinned->BuildDrawCommands(-1.0f, nullptr, true)[0].texture0 == base[0].texture0);
auto fresh = ava2::Gr2ModelInstance::Load(model_path);assert(fresh);fresh->SetSkin(base[0].texture0, "skin-test.dds");
assert(fresh->BuildDrawCommands(-1.0f, nullptr, true)[0].texture0 == "skin-test.dds");
assert(fresh->BuildDrawCommands(-1.0f, nullptr, true)[0].texture0 == "skin-test.dds");
}
// Setup 3D Scene Renderer
const int width = 1024;