mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 04:51:18 +00:00
Clean up code
This commit is contained in:
parent
7c0b286e13
commit
f6686b7e4f
@ -136,9 +136,9 @@ if(ENGINE_BUILD_VULKAN)
|
||||
set(VOLK_STATIC_DEFINES "")
|
||||
set(VOLK_PULL_IN_VULKAN ON)
|
||||
set(VOLK_INSTALL OFF)
|
||||
set(VOLK_HEADERS_ONLY ON)
|
||||
set(VOLK_HEADERS_ONLY OFF)
|
||||
add_subdirectory(dependencies/volk)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE volk_headers)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE volk::volk)
|
||||
# Vulkan Memory Allocator
|
||||
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE dependencies/VulkanMemoryAllocator/include)
|
||||
# shaderc
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "log.hpp"
|
||||
#include "util/files.hpp"
|
||||
|
||||
#define VOLK_IMPLEMENTATION
|
||||
#include <volk.h>
|
||||
|
||||
#define VMA_STATIC_VULKAN_FUNCTIONS 0
|
||||
@ -598,14 +597,22 @@ namespace engine {
|
||||
}
|
||||
|
||||
swapchain->presentMode = VK_PRESENT_MODE_FIFO_KHR; // This mode is always available
|
||||
if (settings.vsync == false) {
|
||||
if (settings.vsync == true) {
|
||||
for (const auto& presMode : presentModes) {
|
||||
if (presMode == VK_PRESENT_MODE_MAILBOX_KHR) {
|
||||
swapchain->presentMode = presMode; // this mode allows uncapped FPS while also avoiding screen tearing
|
||||
swapchain->presentMode = presMode; // this mode allows V-sync without fixing FPS to refresh rate
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (const auto& presMode : presentModes) {
|
||||
if (presMode == VK_PRESENT_MODE_IMMEDIATE_KHR) {
|
||||
swapchain->presentMode = presMode; // V-sync off
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INFO("V-sync: {}", swapchain->presentMode == VK_PRESENT_MODE_FIFO_KHR || swapchain->presentMode == VK_PRESENT_MODE_MAILBOX_KHR ? "ON" : "OFF");
|
||||
|
||||
uint32_t imageCount = caps.minImageCount + 1;
|
||||
if (caps.maxImageCount > 0 && imageCount > caps.maxImageCount) {
|
||||
imageCount = caps.maxImageCount;
|
||||
@ -1738,9 +1745,8 @@ namespace engine {
|
||||
presentInfo.waitSemaphoreCount = 1;
|
||||
presentInfo.pWaitSemaphores = &pimpl->swapchain.releaseSemaphores[frameIndex];
|
||||
|
||||
VkSwapchainKHR swapchains[] = { pimpl->swapchain.swapchain };
|
||||
presentInfo.swapchainCount = 1;
|
||||
presentInfo.pSwapchains = swapchains;
|
||||
presentInfo.pSwapchains = &pimpl->swapchain.swapchain;
|
||||
presentInfo.pImageIndices = &imageIndex;
|
||||
presentInfo.pResults = nullptr;
|
||||
|
||||
|
@ -29,10 +29,6 @@ namespace engine {
|
||||
|
||||
Scene::~Scene()
|
||||
{
|
||||
INFO("Entity signatures:");
|
||||
for (auto [entity, signature] : m_signatures) {
|
||||
INFO("entity {}, signature: {}", entity, signature.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t Scene::createEntity(const std::string& tag, uint32_t parent)
|
||||
|
@ -40,9 +40,11 @@ static void configureInputs(engine::InputManager* inputManager)
|
||||
|
||||
void playGame(bool enableFrameLimiter)
|
||||
{
|
||||
INFO("FPS limiter: {}", enableFrameLimiter ? "ON" : "OFF");
|
||||
|
||||
engine::gfx::GraphicsSettings graphicsSettings{};
|
||||
graphicsSettings.vsync = false;
|
||||
graphicsSettings.msaaLevel = engine::gfx::MSAALevel::MSAA_16X;
|
||||
graphicsSettings.msaaLevel = engine::gfx::MSAALevel::MSAA_OFF;
|
||||
engine::Application app(PROJECT_NAME, PROJECT_VERSION, graphicsSettings);
|
||||
|
||||
app.setFrameLimiter(enableFrameLimiter);
|
||||
|
Loading…
Reference in New Issue
Block a user