Skip to content

Commit

Permalink
feat: no more dropping
Browse files Browse the repository at this point in the history
  • Loading branch information
wozeparrot committed Aug 28, 2023
1 parent 34ce63e commit 3b4ccf3
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 24 deletions.
1 change: 0 additions & 1 deletion entropy/render.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ function Render:init_default(): void
end

function Render:cleanup(): void
wgpuInstanceDrop(self.instance)
end

function Render:request_adapter_device(surface: WGPUSurface): (WGPUAdapter, WGPUDevice)
Expand Down
7 changes: 0 additions & 7 deletions entropy/render/context/glfw.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,13 @@ function GLFWContext:init(title: string, width: uint32, height: uint32, vsync: b
end

function GLFWContext:cleanup(): void
wgpuDeviceDrop(self.device)
wgpuAdapterDrop(self.adapter)

glfwTerminate()
end

function GLFWContext:view(): WGPUTextureView <inline>
return wgpuSwapChainGetCurrentTextureView(self.swapchain)
end

function GLFWContext:drop_view(view: WGPUTextureView): void <inline>
wgpuTextureViewDrop(view)
end

function GLFWContext:present(): void <inline>
wgpuSwapChainPresent(self.swapchain)
end
Expand Down
6 changes: 0 additions & 6 deletions entropy/render/context/wasm.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,12 @@ function WASMContext:init(selector: string, width: uint32, height: uint32, vsync
end

function WASMContext:cleanup(): void
wgpuDeviceDrop(self.device)
wgpuAdapterDrop(self.adapter)
end

function WASMContext:view(): WGPUTextureView <inline>
return wgpuSwapChainGetCurrentTextureView(self.swapchain)
end

function WASMContext:drop_view(view: WGPUTextureView): void <inline>
wgpuTextureViewDrop(view)
end

function WASMContext:present(): void <inline>
wgpuSwapChainPresent(self.swapchain)
end
Expand Down
5 changes: 0 additions & 5 deletions entropy/render/impl/mesh.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,9 @@ function Impl:init(renderer: a_renderer): void
-- cleanup now unneeded resources
vs_shader:cleanup()
fs_shader:cleanup()
wgpuPipelineLayoutDrop(pipeline_layout)
wgpuBindGroupLayoutDrop(globals_bind_group_layout)
end

function Impl:cleanup(renderer: a_renderer): void
wgpuRenderPipelineDrop(self.pipeline)
wgpuBufferDrop(self.globals_buffer)
wgpuBindGroupDrop(self.globals_bind_group)
end

function Impl:resize(renderer: a_renderer): void
Expand Down
1 change: 0 additions & 1 deletion entropy/render/shader.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ function Shader:create(device: WGPUDevice): void
end

function Shader:cleanup(): void
wgpuShaderModuleDrop(self.module)
end

return Shader
2 changes: 0 additions & 2 deletions entropy/scene/mesh.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ function Mesh:instance(): Mesh.Instance
end

function Mesh:cleanup()
wgpuBufferDrop(self.vertex_buffer)
wgpuBufferDrop(self.index_buffer)
end

function Mesh:prepare(renderer: a_renderer)
Expand Down
1 change: 0 additions & 1 deletion main.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ while not context:should_close() do
local view = context:view()
renderer:render(view, &world)
context:present()
context:drop_view(view)

fps_list:push(1 / (world:now() - now))
if #fps_list > 30 then
Expand Down
1 change: 0 additions & 1 deletion main_wasm.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ local function onAnimationFrame() <cexport, codename 'onAnimationFrame'>
local view = context:view()
renderer:render(view, &world)
context:present()
context:drop_view(view)
end

0 comments on commit 3b4ccf3

Please sign in to comment.