Skip to content

Commit

Permalink
add ability to turn off logging from client
Browse files Browse the repository at this point in the history
  • Loading branch information
tadgem committed Jul 17, 2024
1 parent 18e2f9a commit bf01a95
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
1 change: 1 addition & 0 deletions backends/sdl/include/VulkanAPI_SDL.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace lvk {
class VulkanAPI_SDL : public VulkanAPI
{
public:
VulkanAPI_SDL(bool enableDebugValidation = true);
virtual ~VulkanAPI_SDL();
void HandleSDLEvent(SDL_Event& sdl_event);
// Inherited via VulkanAPI
Expand Down
5 changes: 5 additions & 0 deletions backends/sdl/src/VulkanAPI_SDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ VkExtent2D lvk::VulkanAPI_SDL::GetMaxFramebufferResolution()
return res;
}

lvk::VulkanAPI_SDL::VulkanAPI_SDL(bool enableDebugValidation) : VulkanAPI(enableDebugValidation)
{

}

lvk::VulkanAPIWindowHandle_SDL::VulkanAPIWindowHandle_SDL(SDL_Window* sdlWindow) : m_SdlWindow(sdlWindow)
{

Expand Down
2 changes: 2 additions & 0 deletions lvk/include/lvk/VulkanAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ namespace lvk
const bool m_UseValidation = true;
const bool m_UseImGui = true;

VulkanAPI(bool enableDebugValidation);


enum class ShaderStage
{
Expand Down
31 changes: 20 additions & 11 deletions lvk/src/lvk/VulkanAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,23 @@ void lvk::VulkanAPI::CreateInstance()

std::vector<const char*> extensionNames = GetRequiredExtensions();

for (const auto& extension : extensionNames)
{
spdlog::info("SDL Extension : {}", extension);
if(m_UseValidation) {
for (const auto &extension: extensionNames) {
spdlog::info("Backend Extension : {}", extension);
}
}

uint32_t extensionCount;
vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);
std::vector<VkExtensionProperties> extensions(extensionCount);
vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, extensions.data());

spdlog::info("Supported m_Instance extensions: ");
for (const auto& extension : extensions)
{
spdlog::info("{}", &extension.extensionName[0]);
if(m_UseValidation) {
spdlog::info("Supported m_Instance extensions: ");
}
for (const auto& extension : extensions) {
if (m_UseValidation) {
spdlog::info("{}", &extension.extensionName[0]);
}
bool shouldAdd = true;
for (int i = 0; i < extensionNames.size(); i++)
{
Expand Down Expand Up @@ -447,9 +450,10 @@ void lvk::VulkanAPI::PickPhysicalDevice()
VkPhysicalDeviceProperties deviceProperties{};
vkGetPhysicalDeviceProperties(m_PhysicalDevice, &deviceProperties);

spdlog::info("Chose GPU : {}", &deviceProperties.deviceName[0]);
ListDeviceExtensions(m_PhysicalDevice);

if(m_UseValidation) {
spdlog::info("Chose GPU : {}", &deviceProperties.deviceName[0]);
ListDeviceExtensions(m_PhysicalDevice);
}
}

void lvk::VulkanAPI::CreateLogicalDevice()
Expand Down Expand Up @@ -2507,3 +2511,8 @@ void lvk::VulkanAPI::CleanupImGui()
}
}

VulkanAPI::VulkanAPI(bool enableDebugValidation) : m_UseValidation(enableDebugValidation)
{

}

0 comments on commit bf01a95

Please sign in to comment.