Fixing glfw package breaking changes
This commit is contained in:
@@ -688,6 +688,11 @@ Array<const char*> Graphics::getRequiredExtensions() {
|
||||
}
|
||||
|
||||
void Graphics::initInstance(GraphicsInitializer initInfo) {
|
||||
#if defined(GLFW_WAYLAND_LIBDECOR) && defined(GLFW_WAYLAND_DISABLE_LIBDECOR)
|
||||
// Work around libdecor runtime regressions on some Wayland stacks.
|
||||
glfwInitHint(GLFW_WAYLAND_LIBDECOR, GLFW_WAYLAND_DISABLE_LIBDECOR);
|
||||
#endif
|
||||
|
||||
if (!glfwInit()) {
|
||||
throw std::runtime_error("Failed to initialize GLFW");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include "Resources.h"
|
||||
#include "Command.h"
|
||||
#include "Enums.h"
|
||||
#include "Graphics.h"
|
||||
#include "Window.h"
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::Vulkan;
|
||||
|
||||
@@ -61,6 +61,7 @@ Window::Window(PGraphics graphics, const WindowCreateInfo& createInfo)
|
||||
glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &contentScaleX, &contentScaleY);
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
|
||||
GLFWwindow* handle = glfwCreateWindow(createInfo.width / contentScaleX, createInfo.height / contentScaleY, createInfo.title, nullptr, nullptr);
|
||||
if (handle == nullptr) {
|
||||
const char* glfwError = nullptr;
|
||||
@@ -125,6 +126,9 @@ void Window::beginFrame() {
|
||||
imageAvailableFences[currentSemaphoreIndex]->getHandle(), ¤tImageIndex));
|
||||
imageAvailableSemaphores[currentSemaphoreIndex]->encodeSignal();
|
||||
imageAvailableFences[currentSemaphoreIndex]->submit();
|
||||
// The image was reacquired, so the previous presentation using this image's
|
||||
// renderDone semaphore has completed and it can be safely reused
|
||||
renderingDoneSemaphores[currentImageIndex]->resolveSignal();
|
||||
graphics->getGraphicsCommands()->getCommands()->waitForSemaphore(VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||
imageAvailableSemaphores[currentSemaphoreIndex]);
|
||||
static double start = glfwGetTime();
|
||||
@@ -138,9 +142,9 @@ void Window::endFrame() {
|
||||
swapChainTextures[currentImageIndex]->changeLayout(Gfx::SE_IMAGE_LAYOUT_PRESENT_SRC_KHR, Gfx::SE_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, Gfx::SE_ACCESS_MEMORY_READ_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
|
||||
renderingDoneSemaphores[currentSemaphoreIndex]->rotateSemaphore();
|
||||
graphics->getGraphicsCommands()->submitCommands(renderingDoneSemaphores[currentSemaphoreIndex]);
|
||||
VkSemaphore renderDoneHandle = renderingDoneSemaphores[currentSemaphoreIndex]->getHandle();
|
||||
renderingDoneSemaphores[currentImageIndex]->rotateSemaphore();
|
||||
graphics->getGraphicsCommands()->submitCommands(renderingDoneSemaphores[currentImageIndex]);
|
||||
VkSemaphore renderDoneHandle = renderingDoneSemaphores[currentImageIndex]->getHandle();
|
||||
VkPresentInfoKHR presentInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
|
||||
.pNext = nullptr,
|
||||
@@ -158,7 +162,7 @@ void Window::endFrame() {
|
||||
} else {
|
||||
VK_CHECK(r);
|
||||
}
|
||||
renderingDoneSemaphores[currentSemaphoreIndex]->resolveSignal();
|
||||
renderingDoneSemaphores[currentImageIndex]->encodeSignal();
|
||||
currentSemaphoreIndex = (currentSemaphoreIndex + 1) % Gfx::numFramesBuffered;
|
||||
currentFrameIndex = currentSemaphoreIndex;
|
||||
// graphics->waitDeviceIdle();
|
||||
@@ -270,6 +274,7 @@ void Window::chooseSwapExtent() {
|
||||
}
|
||||
|
||||
void Window::createSwapChain() {
|
||||
graphics->waitDeviceIdle();
|
||||
uint32 imageCount = Gfx::numFramesBuffered;
|
||||
VkSwapchainCreateInfoKHR createInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
|
||||
|
||||
Reference in New Issue
Block a user