Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shader-slang: init at 2025.2 #358202

Merged
merged 1 commit into from
Jan 11, 2025
Merged

Conversation

niklaskorz
Copy link
Contributor

@niklaskorz niklaskorz commented Nov 22, 2024

Closes #359925

Slang is a cross-platform and cross-graphics-API shading language that compiles to SPIR-V, HLSL, Metal, WGSL, and other targets. This PR packages the Slang command line tools (the compiler and the language server) as well as its libraries.

Currently using Slang's own vendored version of glslang as it is not compatible with version 15 (which we have in nixpkgs) yet. Considered disabling glslang altogether after some discussion on Matrix, but that would mean not being able to compile shaders to SPIR-V, which heavily reduces the usefulness of Slang (although that still leaves Metal and WebGPU, for example). Patching in glslang 15 compatibility wasn't too hard after I knew where to look (see 3-glslang-15.patch).

LLVM is disabled by default as all Slang features except JIT for "host-callable" work without it. If LLVM is enabled through withLLVM = true;, the 2-shared-llvm.patch ensures libllvm and libclang are dynamically linked (can be disabled using withSharedLLVM = false;).

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@niklaskorz niklaskorz changed the title shader-slang: init at 2024.14.5 shader-slang: init at 2024.14.6 Nov 29, 2024
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Nov 30, 2024
@niklaskorz niklaskorz force-pushed the shader-slang branch 2 times, most recently from b6eb23d to c561923 Compare November 30, 2024 12:24
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 10.rebuild-linux: 1 and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Dec 1, 2024
@ArchercatNEO
Copy link
Contributor

Yeah great work since I'm assuming pinging me means it works already. I'm not familiar enough with packaging to determine if the code fits the style but just skimming the CMakeLists.txt to see what other features we could get I have a few.

Debug symbols: Slangs seems to enable debug symbols for release builds https://github.com/shader-slang/slang/blob/master/CMakeLists.txt#L192 but I don't see a debug output on this drv. If the cmake compilation makes a binary with a build-id and debug symbols on our end it should be as simple as enabling separateDebugInfo = true;
CUDA, Optix, Aftermath: These all seem to be nvidia things? I think we'd be fine not enabling these since won't be availible on all systems.
vendored unordered_dense: I don't believe this one is packaged yet so we can't unvendor it.

Debug symbols is the only one I believe could be helpful now but the other 2 may be nice in the future.
Even then if there's no build id and no easy way to enable it then I say merge.

@niklaskorz
Copy link
Contributor Author

Yeah great work since I'm assuming pinging me means it works already. I'm not familiar enough with packaging to determine if the code fits the style but just skimming the CMakeLists.txt to see what other features we could get I have a few.

Debug symbols: Slangs seems to enable debug symbols for release builds https://github.com/shader-slang/slang/blob/master/CMakeLists.txt#L192 but I don't see a debug output on this drv. If the cmake compilation makes a binary with a build-id and debug symbols on our end it should be as simple as enabling separateDebugInfo = true; CUDA, Optix, Aftermath: These all seem to be nvidia things? I think we'd be fine not enabling these since won't be availible on all systems. vendored unordered_dense: I don't believe this one is packaged yet so we can't unvendor it.

Debug symbols is the only one I believe could be helpful now but the other 2 may be nice in the future. Even then if there's no build id and no easy way to enable it then I say merge.

Yup it's functional, tested on Darwin and Linux. I didn't know about the package request issue before today as it was opened after I created this PR, but now that it's ready I double checked so I could link to it. I can look into the debug symbols. As for nvidia, I'd leave it out initially and we can look into adding unfree features (which anything depending on CUDA would be) in another PR.

@niklaskorz
Copy link
Contributor Author

niklaskorz commented Jan 3, 2025

Debug output has been added and I removed the explicit dependecy on apple-sdk_11, as that is now the default for x86_64-darwin as well

Copy link
Contributor

@ArchercatNEO ArchercatNEO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@niklaskorz niklaskorz changed the title shader-slang: init at 2024.17 shader-slang: init at 2025.2 Jan 11, 2025
@niklaskorz
Copy link
Contributor Author

Bumped to 2025.2, tested on aarch64-darwin and x86_64-linux

@GaetanLepage
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 358202


x86_64-linux

✅ 4 packages built:
  • shader-slang
  • shader-slang.debug
  • shader-slang.dev
  • shader-slang.doc

aarch64-linux

✅ 4 packages built:
  • shader-slang
  • shader-slang.debug
  • shader-slang.dev
  • shader-slang.doc

x86_64-darwin

✅ 3 packages built:
  • shader-slang
  • shader-slang.dev
  • shader-slang.doc

aarch64-darwin

✅ 3 packages built:
  • shader-slang
  • shader-slang.dev
  • shader-slang.doc

Copy link
Contributor

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

@GaetanLepage GaetanLepage requested a review from drupol January 11, 2025 11:49
@GaetanLepage GaetanLepage merged commit 48d5c5f into NixOS:master Jan 11, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package request: slang
4 participants