diff --git a/pkgs/by-name/vu/vulkan-caps-viewer/Fix-darwin-metal-layer.patch b/pkgs/by-name/vu/vulkan-caps-viewer/Fix-darwin-metal-layer.patch new file mode 100644 index 000000000000..fd59563a9b08 --- /dev/null +++ b/pkgs/by-name/vu/vulkan-caps-viewer/Fix-darwin-metal-layer.patch @@ -0,0 +1,17 @@ +diff --git a/appleutils.mm b/appleutils.mm +index 52058b5..afc568f 100644 +--- a/appleutils.mm ++++ b/appleutils.mm +@@ -45,7 +45,11 @@ extern "C" void *makeViewMetalCompatible(void* handle) + NSView* view = (__bridge NSView*)handle; + assert([view isKindOfClass:[NSView class]]); + +- void *pLayer = (__bridge void *)view.layer; ++ // In Qt 6.10+, the window has an intermediate QContainerLayer in which ++ // the actual Metal CALayer is nested. ++ // https://github.com/qt/qtbase/commit/0bdbf4688e4265a1ddf42efbe4c780770809d365 ++ id containerLayer = view.layer; ++ void *pLayer = (__bridge void*)[containerLayer contentLayer]; + return pLayer; + #endif + } diff --git a/pkgs/tools/graphics/vulkan-caps-viewer/default.nix b/pkgs/by-name/vu/vulkan-caps-viewer/package.nix similarity index 50% rename from pkgs/tools/graphics/vulkan-caps-viewer/default.nix rename to pkgs/by-name/vu/vulkan-caps-viewer/package.nix index bfaf01b1620e..97aa395e7692 100644 --- a/pkgs/tools/graphics/vulkan-caps-viewer/default.nix +++ b/pkgs/by-name/vu/vulkan-caps-viewer/package.nix @@ -2,48 +2,73 @@ lib, stdenv, fetchFromGitHub, - qmake, + qt6, vulkan-loader, wayland, - wrapQtAppsHook, + xcbuild, + + waylandSupport ? lib.meta.availableOn stdenv.hostPlatform wayland, x11Support ? !stdenv.hostPlatform.isDarwin, - qtx11extras, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "vulkan-caps-viewer"; - version = "4.03"; + version = "4.11"; src = fetchFromGitHub { owner = "SaschaWillems"; repo = "VulkanCapsViewer"; - rev = version; - hash = "sha256-LaZdQ5w7QYaD3Nxl9ML30kGws8Yyr3c0jzO3ElUvJ/I="; + tag = finalAttrs.version; + hash = "sha256-Vc4zK1Kurirp+xK7A2D3CC4veJSghE9mS7YzRA3CnHM="; # Note: this derivation strictly requires vulkan-header to be the same it was developed against. # To help us, they've put it in a git-submodule. # The result will work with any vulkan-loader version. fetchSubmodules = true; }; + patches = [ + # In Qt 6.10+, the path of the Metal layer has changed. + # Without this patch, the application fails to launch on darwin. + # Upstream PR: https://github.com/SaschaWillems/VulkanCapsViewer/pull/270 + ./Fix-darwin-metal-layer.patch + ]; + + postPatch = '' + # These paths are appended to the install target, so we strip the /usr/ prefix + substituteInPlace vulkanCapsViewer.pro \ + --replace-fail '/usr/' '/' \ + --replace-fail '$(VULKAN_SDK)/lib/libvulkan.dylib' '${lib.getLib vulkan-loader}/lib/libvulkan.dylib' + ''; + nativeBuildInputs = [ - qmake - wrapQtAppsHook + qt6.qmake + qt6.wrapQtAppsHook + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + xcbuild ]; buildInputs = [ vulkan-loader ] - ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform wayland) [ wayland ] - ++ lib.lists.optionals x11Support [ qtx11extras ]; - - patchPhase = '' - substituteInPlace vulkanCapsViewer.pro \ - --replace-fail '/usr/' "/" \ - --replace-fail '$(VULKAN_SDK)/lib/libvulkan.dylib' '${lib.getLib vulkan-loader}/lib/libvulkan.dylib' - ''; + ++ lib.optionals waylandSupport [ + wayland + ]; qmakeFlags = [ "CONFIG+=release" + ] + # The README incorrectly states that these should not be defined simultaneously. + # Enabling both WAYLAND and X11 at the same time doesn't cause any issues + # and is actually required to automatically fallback to the X11 surface test + # when no Wayland display is available. + # These two variables only control the surface presentation tests for the + # queue families of a GPU and are not related to how the Qt application is rendered. + ++ lib.optionals waylandSupport [ + "DEFINES+=WAYLAND" + ] + ++ lib.optionals x11Support [ + "DEFINES+=X11" ]; installFlags = [ "INSTALL_ROOT=$(out)" ]; @@ -62,8 +87,11 @@ stdenv.mkDerivation rec { ''; homepage = "https://vulkan.gpuinfo.org/"; platforms = lib.platforms.unix; - license = lib.licenses.gpl2Only; - maintainers = with lib.maintainers; [ pedrohlc ]; - changelog = "https://github.com/SaschaWillems/VulkanCapsViewer/releases/tag/${version}"; + license = lib.licenses.lgpl3Only; + maintainers = with lib.maintainers; [ + pedrohlc + niklaskorz + ]; + changelog = "https://github.com/SaschaWillems/VulkanCapsViewer/releases/tag/${finalAttrs.version}"; }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 223949269fe7..d6a94b80c309 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7630,8 +7630,6 @@ with pkgs; vtkWithQt6 = vtk.override { withQt6 = true; }; - vulkan-caps-viewer = libsForQt5.callPackage ../tools/graphics/vulkan-caps-viewer { }; - wayland = callPackage ../development/libraries/wayland { }; wayland-scanner = callPackage ../development/libraries/wayland/scanner.nix { };