Fixing glfw package breaking changes
This commit is contained in:
@@ -1,2 +0,0 @@
|
|||||||
(?<enum>[A-Z_]*) = [0-9]*,
|
|
||||||
case SE_${enum}:\nreturn VK_${enum};
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
|
|
||||||
// such as names of functions and macros.
|
|
||||||
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
|
|
||||||
#define DECLARE_REF(x)
|
|
||||||
@@ -688,6 +688,11 @@ Array<const char*> Graphics::getRequiredExtensions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::initInstance(GraphicsInitializer initInfo) {
|
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()) {
|
if (!glfwInit()) {
|
||||||
throw std::runtime_error("Failed to initialize GLFW");
|
throw std::runtime_error("Failed to initialize GLFW");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#include "Resources.h"
|
#include "Resources.h"
|
||||||
#include "Command.h"
|
|
||||||
#include "Enums.h"
|
#include "Enums.h"
|
||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
#include "Window.h"
|
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
using namespace Seele::Vulkan;
|
using namespace Seele::Vulkan;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ Window::Window(PGraphics graphics, const WindowCreateInfo& createInfo)
|
|||||||
glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &contentScaleX, &contentScaleY);
|
glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &contentScaleX, &contentScaleY);
|
||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||||
|
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
|
||||||
GLFWwindow* handle = glfwCreateWindow(createInfo.width / contentScaleX, createInfo.height / contentScaleY, createInfo.title, nullptr, nullptr);
|
GLFWwindow* handle = glfwCreateWindow(createInfo.width / contentScaleX, createInfo.height / contentScaleY, createInfo.title, nullptr, nullptr);
|
||||||
if (handle == nullptr) {
|
if (handle == nullptr) {
|
||||||
const char* glfwError = nullptr;
|
const char* glfwError = nullptr;
|
||||||
@@ -125,6 +126,9 @@ void Window::beginFrame() {
|
|||||||
imageAvailableFences[currentSemaphoreIndex]->getHandle(), ¤tImageIndex));
|
imageAvailableFences[currentSemaphoreIndex]->getHandle(), ¤tImageIndex));
|
||||||
imageAvailableSemaphores[currentSemaphoreIndex]->encodeSignal();
|
imageAvailableSemaphores[currentSemaphoreIndex]->encodeSignal();
|
||||||
imageAvailableFences[currentSemaphoreIndex]->submit();
|
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,
|
graphics->getGraphicsCommands()->getCommands()->waitForSemaphore(VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||||
imageAvailableSemaphores[currentSemaphoreIndex]);
|
imageAvailableSemaphores[currentSemaphoreIndex]);
|
||||||
static double start = glfwGetTime();
|
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,
|
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_COLOR_ATTACHMENT_OUTPUT_BIT, Gfx::SE_ACCESS_MEMORY_READ_BIT,
|
||||||
Gfx::SE_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
|
Gfx::SE_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
|
||||||
renderingDoneSemaphores[currentSemaphoreIndex]->rotateSemaphore();
|
renderingDoneSemaphores[currentImageIndex]->rotateSemaphore();
|
||||||
graphics->getGraphicsCommands()->submitCommands(renderingDoneSemaphores[currentSemaphoreIndex]);
|
graphics->getGraphicsCommands()->submitCommands(renderingDoneSemaphores[currentImageIndex]);
|
||||||
VkSemaphore renderDoneHandle = renderingDoneSemaphores[currentSemaphoreIndex]->getHandle();
|
VkSemaphore renderDoneHandle = renderingDoneSemaphores[currentImageIndex]->getHandle();
|
||||||
VkPresentInfoKHR presentInfo = {
|
VkPresentInfoKHR presentInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
|
.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
@@ -158,7 +162,7 @@ void Window::endFrame() {
|
|||||||
} else {
|
} else {
|
||||||
VK_CHECK(r);
|
VK_CHECK(r);
|
||||||
}
|
}
|
||||||
renderingDoneSemaphores[currentSemaphoreIndex]->resolveSignal();
|
renderingDoneSemaphores[currentImageIndex]->encodeSignal();
|
||||||
currentSemaphoreIndex = (currentSemaphoreIndex + 1) % Gfx::numFramesBuffered;
|
currentSemaphoreIndex = (currentSemaphoreIndex + 1) % Gfx::numFramesBuffered;
|
||||||
currentFrameIndex = currentSemaphoreIndex;
|
currentFrameIndex = currentSemaphoreIndex;
|
||||||
// graphics->waitDeviceIdle();
|
// graphics->waitDeviceIdle();
|
||||||
@@ -270,6 +274,7 @@ void Window::chooseSwapExtent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window::createSwapChain() {
|
void Window::createSwapChain() {
|
||||||
|
graphics->waitDeviceIdle();
|
||||||
uint32 imageCount = Gfx::numFramesBuffered;
|
uint32 imageCount = Gfx::numFramesBuffered;
|
||||||
VkSwapchainCreateInfoKHR createInfo = {
|
VkSwapchainCreateInfoKHR createInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
|
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
|
||||||
|
|||||||
+6
-2
@@ -3,7 +3,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vulkan"
|
"name": "vulkan"
|
||||||
},
|
},
|
||||||
"vulkan-loader",
|
|
||||||
{
|
{
|
||||||
"name": "vulkan-memory-allocator"
|
"name": "vulkan-memory-allocator"
|
||||||
},
|
},
|
||||||
@@ -11,7 +10,12 @@
|
|||||||
"stb",
|
"stb",
|
||||||
"entt",
|
"entt",
|
||||||
"freetype",
|
"freetype",
|
||||||
"glfw3",
|
{
|
||||||
|
"name": "glfw3",
|
||||||
|
"features": [
|
||||||
|
"wayland"
|
||||||
|
]
|
||||||
|
},
|
||||||
"glm",
|
"glm",
|
||||||
"ktx",
|
"ktx",
|
||||||
"nlohmann-json",
|
"nlohmann-json",
|
||||||
|
|||||||
Reference in New Issue
Block a user