Merge pull request 'perf(ui): reuse handles vector in WebGPU custom Dispatch (#132)' (#148) from claude/issue-132 into master
This commit is contained in:
commit
4c659319cb
1 changed files with 6 additions and 1 deletions
|
|
@ -177,7 +177,12 @@ void UIRenderer::Dispatch(GraphicsCommandBuffer /*cmd*/, const GraphicsComputeSh
|
|||
// data at the recorded offset, look up the GPU handle in the heap,
|
||||
// and assemble a list of handles in the same order the JS bridge
|
||||
// expects (matching shader.customBindings).
|
||||
std::vector<std::uint32_t> handles;
|
||||
// Reuse one vector across dispatches: custom compute runs per-frame, so a
|
||||
// fresh malloc+free each call is pure churn. thread_local keeps it valid
|
||||
// even if dispatches ever cross threads; its capacity grows to the high
|
||||
// water mark once and is reused thereafter.
|
||||
thread_local std::vector<std::uint32_t> handles;
|
||||
handles.clear();
|
||||
handles.reserve(shader.customBindings.size());
|
||||
const std::uint8_t* p = static_cast<const std::uint8_t*>(push);
|
||||
for (const auto& b : shader.customBindings) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue