mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-05-05 19:09:37 +00:00
feat: Integrate ILogger into VulkanDeviceService for improved logging
This commit is contained in:
@@ -85,6 +85,7 @@ void BufferService::Cleanup() {
|
||||
}
|
||||
|
||||
void BufferService::Shutdown() noexcept {
|
||||
logger_->TraceFunction(__func__);
|
||||
CleanupBuffers();
|
||||
}
|
||||
|
||||
@@ -128,9 +129,4 @@ void BufferService::CleanupBuffers() {
|
||||
indexCount_ = 0;
|
||||
}
|
||||
|
||||
void BufferService::Shutdown() noexcept {
|
||||
logger_->TraceFunction(__func__);
|
||||
CleanupBuffers();
|
||||
}
|
||||
|
||||
} // namespace sdl3cpp::services::impl
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "vulkan_device_service.hpp"
|
||||
#include "../../logging/logger.hpp"
|
||||
#include <SDL3/SDL_vulkan.h>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
@@ -8,6 +7,9 @@
|
||||
|
||||
namespace sdl3cpp::services::impl {
|
||||
|
||||
VulkanDeviceService::VulkanDeviceService(std::shared_ptr<ILogger> logger)
|
||||
: logger_(logger) {}
|
||||
|
||||
VulkanDeviceService::~VulkanDeviceService() {
|
||||
if (device_ != VK_NULL_HANDLE) {
|
||||
Shutdown();
|
||||
@@ -16,7 +18,7 @@ VulkanDeviceService::~VulkanDeviceService() {
|
||||
|
||||
void VulkanDeviceService::Initialize(const std::vector<const char*>& deviceExtensions,
|
||||
bool enableValidationLayers) {
|
||||
logging::TraceGuard trace;
|
||||
logger_->TraceFunction(__func__);
|
||||
|
||||
deviceExtensions_ = deviceExtensions;
|
||||
validationLayersEnabled_ = enableValidationLayers;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../interfaces/i_vulkan_device_service.hpp"
|
||||
#include "../interfaces/i_logger.hpp"
|
||||
#include "../../di/lifecycle.hpp"
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
@@ -16,7 +17,7 @@ namespace sdl3cpp::services::impl {
|
||||
class VulkanDeviceService : public IVulkanDeviceService,
|
||||
public di::IShutdownable {
|
||||
public:
|
||||
VulkanDeviceService() = default;
|
||||
explicit VulkanDeviceService(std::shared_ptr<ILogger> logger);
|
||||
~VulkanDeviceService() override;
|
||||
|
||||
// IVulkanDeviceService interface
|
||||
@@ -39,6 +40,8 @@ public:
|
||||
VkMemoryPropertyFlags properties) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<ILogger> logger_;
|
||||
|
||||
VkInstance instance_ = VK_NULL_HANDLE;
|
||||
VkSurfaceKHR surface_ = VK_NULL_HANDLE;
|
||||
VkPhysicalDevice physicalDevice_ = VK_NULL_HANDLE;
|
||||
|
||||
Reference in New Issue
Block a user