- Vulkan Configuration Implementations - Fixed build errors on GCC and Clang
73 lines
2.2 KiB
C++
73 lines
2.2 KiB
C++
// =====================================================================================================================
|
|
// fennec, a free and open source game engine
|
|
// Copyright © 2025 Medusa Slockbower
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
// =====================================================================================================================
|
|
|
|
|
|
#include <fennec/platform/linux/wayland/vulkan/context.h>
|
|
|
|
#include <volk.h>
|
|
#include <fennec/platform/linux/wayland/server.h>
|
|
#include <fennec/renderers/vulkan/vksurface.h>
|
|
|
|
namespace fennec
|
|
{
|
|
|
|
namespace vk
|
|
{
|
|
|
|
struct wayland_surface_create_info : VkWaylandSurfaceCreateInfoKHR {
|
|
|
|
// Constructor & Destructor ============================================================================================
|
|
public:
|
|
wayland_surface_create_info(display_server* server, window* window)
|
|
: VkWaylandSurfaceCreateInfoKHR {
|
|
.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR,
|
|
.pNext = nullptr,
|
|
.flags = 0,
|
|
.display = static_cast<wl_display*>(server->get_native_handle()),
|
|
.surface = static_cast<wl_surface*>(window->get_native_handle())
|
|
} {
|
|
}
|
|
|
|
operator const VkWaylandSurfaceCreateInfoKHR*() const {
|
|
return this;
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
|
|
wayland_vkcontext::wayland_vkcontext(display_server* display)
|
|
: vkcontext(display, extensions) {
|
|
}
|
|
|
|
wayland_vkcontext::~wayland_vkcontext() {
|
|
|
|
}
|
|
|
|
gfxsurface* wayland_vkcontext::create_surface(window* window) {
|
|
|
|
vk::wayland_surface_create_info info(window->server, window);
|
|
|
|
VkSurfaceKHR surface;
|
|
vkCreateWaylandSurfaceKHR(*instance, info, nullptr, &surface);
|
|
|
|
return new vksurface(window, this, make_unique<vk::surface>(surface));
|
|
}
|
|
|
|
}
|