From 1390ade131553ce0c22b6c9be333ad91bff24f29 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 18 Aug 2025 23:30:25 +0200 Subject: [PATCH] Remove application::get_device() --- client/application.h | 5 ----- client/render/gpu_buffer.h | 5 ++--- client/render/scene_loader.cpp | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/client/application.h b/client/application.h index 238f4a4f..e01a1ee7 100644 --- a/client/application.h +++ b/client/application.h @@ -363,11 +363,6 @@ public: return instance().physical_device_properties; } - static vk::raii::Device & get_device() - { - return instance().vk_device; - } - static vk::raii::Instance & get_vulkan_instance() { return instance().vk_instance; diff --git a/client/render/gpu_buffer.h b/client/render/gpu_buffer.h index 7f03c03e..892dc3fb 100644 --- a/client/render/gpu_buffer.h +++ b/client/render/gpu_buffer.h @@ -18,7 +18,6 @@ #pragma once -#include "application.h" #include "utils/alignment.h" #include "vk/allocation.h" #include @@ -115,10 +114,10 @@ public: } } - buffer_allocation copy_to_gpu() + buffer_allocation copy_to_gpu(vk::raii::Device & device) { buffer_allocation gpu_buffer{ - application::get_device(), + device, vk::BufferCreateInfo{ .size = bytes.size(), .usage = usage}, diff --git a/client/render/scene_loader.cpp b/client/render/scene_loader.cpp index 66ba86a4..07ceddfe 100644 --- a/client/render/scene_loader.cpp +++ b/client/render/scene_loader.cpp @@ -785,7 +785,7 @@ entt::registry scene_loader::operator()(const std::filesystem::path & gltf_path) // Copy the staging buffer to the GPU spdlog::debug("Uploading scene data ({} bytes) to GPU memory", staging_buffer.size()); - auto buffer = std::make_shared(staging_buffer.copy_to_gpu()); + auto buffer = std::make_shared(staging_buffer.copy_to_gpu(device)); for (auto & i: materials) i->buffer = buffer;