I dont know anymore
This commit is contained in:
@@ -17,6 +17,8 @@
|
|||||||
#include "Shader.h"
|
#include "Shader.h"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
#include <GLFW/glfw3native.h>
|
||||||
|
#include <vulkan/vulkan_wayland.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vulkan/vulkan_core.h>
|
#include <vulkan/vulkan_core.h>
|
||||||
|
|
||||||
@@ -142,9 +144,7 @@ Graphics::~Graphics() {
|
|||||||
|
|
||||||
void Graphics::init(GraphicsInitializer initInfo) {
|
void Graphics::init(GraphicsInitializer initInfo) {
|
||||||
initInstance(initInfo);
|
initInstance(initInfo);
|
||||||
#ifdef ENABLE_VALIDATION
|
|
||||||
setupDebugCallback();
|
setupDebugCallback();
|
||||||
#endif
|
|
||||||
pickPhysicalDevice();
|
pickPhysicalDevice();
|
||||||
createDevice(initInfo);
|
createDevice(initInfo);
|
||||||
VmaAllocatorCreateInfo createInfo = {
|
VmaAllocatorCreateInfo createInfo = {
|
||||||
@@ -675,7 +675,9 @@ Array<const char*> Graphics::getRequiredExtensions() {
|
|||||||
message += ": ";
|
message += ": ";
|
||||||
message += glfwError;
|
message += glfwError;
|
||||||
}
|
}
|
||||||
throw std::runtime_error(message);
|
extensions.add(VK_KHR_SURFACE_EXTENSION_NAME);
|
||||||
|
extensions.add(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME);
|
||||||
|
std::cerr << "Warning: " << message << ". Falling back to a default set of extensions." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < glfwExtensionCount; i++) {
|
for (unsigned int i = 0; i < glfwExtensionCount; i++) {
|
||||||
@@ -692,7 +694,6 @@ void Graphics::initInstance(GraphicsInitializer initInfo) {
|
|||||||
// Work around libdecor runtime regressions on some Wayland stacks.
|
// Work around libdecor runtime regressions on some Wayland stacks.
|
||||||
glfwInitHint(GLFW_WAYLAND_LIBDECOR, GLFW_WAYLAND_DISABLE_LIBDECOR);
|
glfwInitHint(GLFW_WAYLAND_LIBDECOR, GLFW_WAYLAND_DISABLE_LIBDECOR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!glfwInit()) {
|
if (!glfwInit()) {
|
||||||
throw std::runtime_error("Failed to initialize GLFW");
|
throw std::runtime_error("Failed to initialize GLFW");
|
||||||
}
|
}
|
||||||
@@ -717,25 +718,6 @@ void Graphics::initInstance(GraphicsInitializer initInfo) {
|
|||||||
extensions.add("VK_KHR_portability_enumeration");
|
extensions.add("VK_KHR_portability_enumeration");
|
||||||
#endif
|
#endif
|
||||||
Array<const char*> layers = initInfo.layers;
|
Array<const char*> layers = initInfo.layers;
|
||||||
#ifdef ENABLE_VALIDATION
|
|
||||||
bool hasValidationLayer = false;
|
|
||||||
uint32 layerCount = 0;
|
|
||||||
vkEnumerateInstanceLayerProperties(&layerCount, nullptr);
|
|
||||||
Array<VkLayerProperties> availableLayers(layerCount);
|
|
||||||
vkEnumerateInstanceLayerProperties(&layerCount, availableLayers.data());
|
|
||||||
for (const auto& layer : availableLayers) {
|
|
||||||
if (std::strcmp(layer.layerName, "VK_LAYER_KHRONOS_validation") == 0) {
|
|
||||||
hasValidationLayer = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hasValidationLayer) {
|
|
||||||
layers.add("VK_LAYER_KHRONOS_validation");
|
|
||||||
std::cerr << "Enabled Vulkan validation layer: VK_LAYER_KHRONOS_validation" << std::endl;
|
|
||||||
} else {
|
|
||||||
std::cerr << "ENABLE_VALIDATION is set, but VK_LAYER_KHRONOS_validation is unavailable on this system." << std::endl;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
VkInstanceCreateInfo info = {
|
VkInstanceCreateInfo info = {
|
||||||
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
using namespace Seele::Vulkan;
|
using namespace Seele::Vulkan;
|
||||||
|
|
||||||
|
|
||||||
double currentFrameDelta = 0;
|
double currentFrameDelta = 0;
|
||||||
double Gfx::getCurrentFrameDelta() { return currentFrameDelta; }
|
double Gfx::getCurrentFrameDelta() { return currentFrameDelta; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
{
|
{
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
{
|
|
||||||
"name": "vulkan"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "vulkan-memory-allocator"
|
"name": "vulkan-memory-allocator"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user