Unverified Commit 58674b7f authored by Niklas Korz's avatar Niklas Korz Committed by GitHub
Browse files

vulkan-caps-viewer: 4.03 -> 4.11, fix license and move to pkgs/by-name (#500097)

parents 19edc32a 87f75aa5
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
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
 }
+49 −21
Original line number Diff line number Diff line
@@ -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}";
  };
}
})
+0 −2
Original line number Diff line number Diff line
@@ -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 { };