Skip to content

Commit

Permalink
Client: Eliminate some redundant buffer writes
Browse files Browse the repository at this point in the history
Huh, this doesn't make any sense at all... The scenewide uniform data needs to be updated once per frame, not once per mesh. Perhaps this was supposed to be per-material or even per-mesh data, but I think it's just a copy/paste error.

Caught this thanks to tracing WebGPU API calls, so etrace already paid off... This is wasteful and can safely be removed.
  • Loading branch information
rdw-software committed Dec 15, 2023
1 parent f89f82a commit 12332d3
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions Core/NativeClient/Renderer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,6 @@ function Renderer:DrawMesh(renderPass, mesh)
RenderPassEncoder:SetVertexBuffer(renderPass, 2, mesh.diffuseTexCoordsBuffer, 0, diffuseTexCoordsBufferSize)
RenderPassEncoder:SetIndexBuffer(renderPass, mesh.indexBuffer, ffi.C.WGPUIndexFormat_Uint16, 0, indexBufferSize)

local currentTime = uv.hrtime() / 10E9
self.perSceneUniformData.time = currentTime
Queue:WriteBuffer(
Device:GetQueue(self.wgpuDevice),
self.uniformBuffer,
0,
self.perSceneUniformData,
ffi.sizeof(self.perSceneUniformData)
)

RenderPassEncoder:SetBindGroup(renderPass, 0, self.bindGroup, 0, nil)

if not mesh.texture then
Expand Down

0 comments on commit 12332d3

Please sign in to comment.