mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibCore+LibGfx+LibWeb: Move VulkanContext into LibGfx
Since the Vulkan context is currently only used by LibGfx, it could be moved there to avoid having Vulkan as a dependency for everything that uses LibCore.
This commit is contained in:
parent
c4bc4fc5f6
commit
ab9ecbd79d
Notes:
github-actions[bot]
2024-11-07 12:49:19 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/ab9ecbd79d2 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1532 Reviewed-by: https://github.com/ADKaster
8 changed files with 22 additions and 24 deletions
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -58,7 +58,7 @@ private:
|
|||
NonnullOwnPtr<skgpu::VulkanExtensions> m_extensions;
|
||||
};
|
||||
|
||||
RefPtr<SkiaBackendContext> SkiaBackendContext::create_vulkan_context(Core::VulkanContext& vulkan_context)
|
||||
RefPtr<SkiaBackendContext> SkiaBackendContext::create_vulkan_context(Gfx::VulkanContext& vulkan_context)
|
||||
{
|
||||
skgpu::VulkanBackendContext backend_context;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef USE_VULKAN
|
||||
# include <LibCore/VulkanContext.h>
|
||||
# include <LibGfx/VulkanContext.h>
|
||||
#endif
|
||||
|
||||
class GrDirectContext;
|
||||
|
@ -28,7 +28,7 @@ class SkiaBackendContext : public RefCounted<SkiaBackendContext> {
|
|||
|
||||
public:
|
||||
#ifdef USE_VULKAN
|
||||
static RefPtr<SkiaBackendContext> create_vulkan_context(Core::VulkanContext&);
|
||||
static RefPtr<SkiaBackendContext> create_vulkan_context(Gfx::VulkanContext&);
|
||||
#endif
|
||||
|
||||
#ifdef AK_OS_MACOS
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/VulkanContext.h>
|
||||
#include <LibGfx/VulkanContext.h>
|
||||
|
||||
namespace Core {
|
||||
namespace Gfx {
|
||||
|
||||
static ErrorOr<VkInstance> create_instance(uint32_t api_version)
|
||||
{
|
|
@ -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 <AK/Forward.h>
|
||||
#include <AK/Function.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
# include <AK/Forward.h>
|
||||
# include <AK/Function.h>
|
||||
# include <vulkan/vulkan.h>
|
||||
|
||||
namespace Core {
|
||||
namespace Gfx {
|
||||
|
||||
struct VulkanContext {
|
||||
uint32_t api_version { VK_API_VERSION_1_0 };
|
||||
|
@ -27,3 +25,5 @@ struct VulkanContext {
|
|||
ErrorOr<VulkanContext> create_vulkan_context();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -39,7 +39,7 @@ TraversableNavigable::TraversableNavigable(JS::NonnullGCPtr<Page> 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);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef USE_VULKAN
|
||||
# include <LibCore/VulkanContext.h>
|
||||
# include <LibGfx/VulkanContext.h>
|
||||
#endif
|
||||
|
||||
namespace Web::HTML {
|
||||
|
|
Loading…
Reference in a new issue