gpu: cleanup
This commit is contained in:
@@ -157,31 +157,6 @@ void gpu_barrier(gpu_texture_t *render_target, gpu_texture_state_t state_after)
|
||||
render_target->state = state_after;
|
||||
}
|
||||
|
||||
void gpu_destroy() {
|
||||
wait_for_fence(fence, fence_value, fence_event);
|
||||
for (int i = 0; i < GPU_FRAMEBUFFER_COUNT; ++i) {
|
||||
gpu_texture_destroy_internal(&framebuffers[i]);
|
||||
}
|
||||
if (framebuffer_depth.width > 0) {
|
||||
gpu_texture_destroy_internal(&framebuffer_depth);
|
||||
}
|
||||
if (readback_buffer != NULL) {
|
||||
readback_buffer->lpVtbl->Release(readback_buffer);
|
||||
}
|
||||
if (upload_buffer != NULL) {
|
||||
upload_buffer->lpVtbl->Release(upload_buffer);
|
||||
}
|
||||
command_list->lpVtbl->Release(command_list);
|
||||
command_allocator->lpVtbl->Release(command_allocator);
|
||||
window_swapchain->lpVtbl->Release(window_swapchain);
|
||||
queue->lpVtbl->Release(queue);
|
||||
root_signature->lpVtbl->Release(root_signature);
|
||||
gpu_srv_heap->lpVtbl->Release(gpu_srv_heap);
|
||||
fence->lpVtbl->Release(fence);
|
||||
CloseHandle(fence_event);
|
||||
device->lpVtbl->Release(device);
|
||||
}
|
||||
|
||||
static D3D12_CPU_DESCRIPTOR_HANDLE descriptor_handle(ID3D12DescriptorHeap *heap, D3D12_DESCRIPTOR_HEAP_TYPE type, int index) {
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE h;
|
||||
heap->lpVtbl->GetCPUDescriptorHandleForHeapStart(heap, &h);
|
||||
|
||||
@@ -1196,12 +1196,9 @@ void iron_init(iron_window_options_t *ops) {
|
||||
}
|
||||
|
||||
void iron_internal_shutdown() {
|
||||
gpu_destroy();
|
||||
|
||||
#ifdef WITH_GAMEPAD
|
||||
iron_linux_closeHIDGamepads();
|
||||
#endif
|
||||
|
||||
free(clipboardString);
|
||||
XCloseDisplay(x11_ctx.display);
|
||||
iron_internal_shutdown_callback();
|
||||
|
||||
@@ -117,11 +117,6 @@ void gpu_render_target_init2(gpu_texture_t *target, int width, int height, gpu_t
|
||||
}
|
||||
}
|
||||
|
||||
void gpu_destroy(void) {
|
||||
id<MTLTexture> readback = (__bridge_transfer id<MTLTexture>)readback_buffer;
|
||||
readback = nil;
|
||||
}
|
||||
|
||||
void gpu_resize_internal(int width, int height) {
|
||||
resized = true;
|
||||
}
|
||||
|
||||
@@ -1012,18 +1012,6 @@ void gpu_init_internal(int depth_buffer_bits, bool vsync) {
|
||||
vkCreateFence(device, &fence_info, NULL, &fence);
|
||||
}
|
||||
|
||||
void gpu_destroy() {
|
||||
if (readback_buffer_size > 0) {
|
||||
vkFreeMemory(device, readback_mem, NULL);
|
||||
vkDestroyBuffer(device, readback_buffer, NULL);
|
||||
}
|
||||
vkFreeCommandBuffers(device, cmd_pool, 1, &command_buffer);
|
||||
vkDestroyFence(device, fence, NULL);
|
||||
VkSwapchainKHR swapchain = cleanup_swapchain();
|
||||
vkDestroySwapchainKHR(device, swapchain, NULL);
|
||||
vkDestroySurfaceKHR(instance, surface, NULL);
|
||||
}
|
||||
|
||||
void iron_vulkan_surface_destroyed() {
|
||||
surface_destroyed = true;
|
||||
}
|
||||
|
||||
@@ -305,18 +305,6 @@ void gpu_init_internal(int depth_buffer_bits, bool vsync) {
|
||||
create_swapchain();
|
||||
}
|
||||
|
||||
void gpu_destroy() {
|
||||
if (readback_buffer_size > 0) {
|
||||
wgpuBufferDestroy(readback_buffer);
|
||||
wgpuBufferRelease(readback_buffer);
|
||||
}
|
||||
// wgpuSurfaceUnconfigure(surface);
|
||||
// wgpuSurfaceRelease(surface);
|
||||
// wgpuDeviceRelease(device);
|
||||
// wgpuAdapterRelease(gpu);
|
||||
// wgpuInstanceRelease(instance);
|
||||
}
|
||||
|
||||
void gpu_begin_internal(gpu_clear_t flags, unsigned color, float depth) {
|
||||
int width = iron_window_width();
|
||||
int height = iron_window_height();
|
||||
|
||||
@@ -944,7 +944,6 @@ void iron_internal_shutdown() {
|
||||
iron_windows_hide_windows();
|
||||
iron_internal_shutdown_callback();
|
||||
iron_windows_destroy_windows();
|
||||
gpu_destroy();
|
||||
iron_windows_restore_displays();
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,6 @@ void gpu_barrier(gpu_texture_t *render_target, gpu_texture_state_t state_after);
|
||||
void gpu_create_framebuffers(int depth_buffer_bits);
|
||||
void gpu_init(int depth_buffer_bits, bool vsync);
|
||||
void gpu_init_internal(int depth_buffer_bits, bool vsync);
|
||||
void gpu_destroy(void);
|
||||
void gpu_draw(void);
|
||||
void gpu_resize(int width, int height);
|
||||
void gpu_resize_internal(int width, int height);
|
||||
|
||||
Reference in New Issue
Block a user