diff --git a/Userland/Libraries/LibCore/CMakeLists.txt b/Userland/Libraries/LibCore/CMakeLists.txt index 9caa1484946..e5967c1f4f4 100644 --- a/Userland/Libraries/LibCore/CMakeLists.txt +++ b/Userland/Libraries/LibCore/CMakeLists.txt @@ -1,5 +1,3 @@ -include(vulkan) - # These are the minimal set of sources needed to build the code generators. We separate them to allow # LibCore to depend on generated sources. set(SOURCES @@ -81,10 +79,6 @@ else() ) endif() -if (HAS_VULKAN) - list(APPEND SOURCES VulkanContext.cpp) -endif() - if (APPLE OR CMAKE_SYSTEM_NAME STREQUAL "GNU") list(APPEND SOURCES MachPort.cpp) endif() @@ -107,7 +101,3 @@ endif() if (ANDROID) target_link_libraries(LibCore PRIVATE log) endif() - -if (HAS_VULKAN) - target_link_libraries(LibCore PUBLIC Vulkan::Vulkan Vulkan::Headers) -endif() diff --git a/Userland/Libraries/LibGfx/CMakeLists.txt b/Userland/Libraries/LibGfx/CMakeLists.txt index 5816b52878b..86d90285ee6 100644 --- a/Userland/Libraries/LibGfx/CMakeLists.txt +++ b/Userland/Libraries/LibGfx/CMakeLists.txt @@ -74,6 +74,10 @@ if (APPLE) list(APPEND SOURCES MetalContext.mm) endif() +if (HAS_VULKAN) + list(APPEND SOURCES VulkanContext.cpp) +endif() + serenity_lib(LibGfx gfx) target_link_libraries(LibGfx PRIVATE LibCompress LibCore LibCrypto LibFileSystem LibRIFF LibTextCodec LibIPC LibUnicode LibURL) @@ -137,3 +141,7 @@ endif() if (APPLE) target_link_libraries(LibCore PUBLIC "-framework Metal") endif() + +if (HAS_VULKAN) + target_link_libraries(LibCore PUBLIC Vulkan::Vulkan Vulkan::Headers) +endif() diff --git a/Userland/Libraries/LibGfx/SkiaBackendContext.cpp b/Userland/Libraries/LibGfx/SkiaBackendContext.cpp index 0a9a28ae225..1bb41469a52 100644 --- a/Userland/Libraries/LibGfx/SkiaBackendContext.cpp +++ b/Userland/Libraries/LibGfx/SkiaBackendContext.cpp @@ -58,7 +58,7 @@ private: NonnullOwnPtr m_extensions; }; -RefPtr SkiaBackendContext::create_vulkan_context(Core::VulkanContext& vulkan_context) +RefPtr SkiaBackendContext::create_vulkan_context(Gfx::VulkanContext& vulkan_context) { skgpu::VulkanBackendContext backend_context; diff --git a/Userland/Libraries/LibGfx/SkiaBackendContext.h b/Userland/Libraries/LibGfx/SkiaBackendContext.h index 409dfafb8f1..0a4b93c556d 100644 --- a/Userland/Libraries/LibGfx/SkiaBackendContext.h +++ b/Userland/Libraries/LibGfx/SkiaBackendContext.h @@ -14,7 +14,7 @@ #endif #ifdef USE_VULKAN -# include +# include #endif class GrDirectContext; @@ -28,7 +28,7 @@ class SkiaBackendContext : public RefCounted { public: #ifdef USE_VULKAN - static RefPtr create_vulkan_context(Core::VulkanContext&); + static RefPtr create_vulkan_context(Gfx::VulkanContext&); #endif #ifdef AK_OS_MACOS diff --git a/Userland/Libraries/LibCore/VulkanContext.cpp b/Userland/Libraries/LibGfx/VulkanContext.cpp similarity index 98% rename from Userland/Libraries/LibCore/VulkanContext.cpp rename to Userland/Libraries/LibGfx/VulkanContext.cpp index 5680116dbd5..c7f0bb0b6a0 100644 --- a/Userland/Libraries/LibCore/VulkanContext.cpp +++ b/Userland/Libraries/LibGfx/VulkanContext.cpp @@ -6,9 +6,9 @@ #include #include -#include +#include -namespace Core { +namespace Gfx { static ErrorOr create_instance(uint32_t api_version) { diff --git a/Userland/Libraries/LibCore/VulkanContext.h b/Userland/Libraries/LibGfx/VulkanContext.h similarity index 70% rename from Userland/Libraries/LibCore/VulkanContext.h rename to Userland/Libraries/LibGfx/VulkanContext.h index 04fdfd344c5..7972f1779a6 100644 --- a/Userland/Libraries/LibCore/VulkanContext.h +++ b/Userland/Libraries/LibGfx/VulkanContext.h @@ -6,15 +6,13 @@ #pragma once -#if !defined(USE_VULKAN) -static_assert(false, "This file must only be used when Vulkan is available"); -#endif +#ifdef USE_VULKAN -#include -#include -#include +# include +# include +# include -namespace Core { +namespace Gfx { struct VulkanContext { uint32_t api_version { VK_API_VERSION_1_0 }; @@ -27,3 +25,5 @@ struct VulkanContext { ErrorOr create_vulkan_context(); } + +#endif diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp index 747e50919da..f893dff1411 100644 --- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp +++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp @@ -39,7 +39,7 @@ TraversableNavigable::TraversableNavigable(JS::NonnullGCPtr page) #ifdef USE_VULKAN auto display_list_player_type = page->client().display_list_player_type(); if (display_list_player_type == DisplayListPlayerType::SkiaGPUIfAvailable) { - auto maybe_vulkan_context = Core::create_vulkan_context(); + auto maybe_vulkan_context = Gfx::create_vulkan_context(); if (!maybe_vulkan_context.is_error()) { auto vulkan_context = maybe_vulkan_context.release_value(); m_skia_backend_context = Gfx::SkiaBackendContext::create_vulkan_context(vulkan_context); diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h index dccf9cb8cb9..5e8f548a1f7 100644 --- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h +++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h @@ -20,7 +20,7 @@ #endif #ifdef USE_VULKAN -# include +# include #endif namespace Web::HTML {