sdl3-shadercross: init at 0-unstable-2025-09-18 (#461163)

This commit is contained in:
Peder Bergebakken Sundt
2025-12-09 19:23:58 +00:00
committed by GitHub
2 changed files with 85 additions and 0 deletions
+6
View File
@@ -19288,6 +19288,12 @@
email = "nyu@nyuku.ru";
githubId = 97425873;
};
nyxonios = {
name = "nyxonios";
github = "Nyxonios";
email = "martin.n.seller@gmail.com";
githubId = 18164197;
};
nzbr = {
email = "nixos@nzbr.de";
github = "nzbr";
@@ -0,0 +1,79 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
ninja,
sdl3,
spirv-cross,
directx-shader-compiler,
nix-update-script,
runCommand,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "sdl3-shadercross";
version = "0-unstable-2025-09-18";
outputs = [
"out"
"lib"
"dev"
];
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL_shadercross";
rev = "3e572c3219ea438bff849cebea34f3aad7e1859b";
hash = "sha256-2kpW4AN5eYPY3GxxDpH++nVHtBhSVv5FM2X4I+F2iAU=";
};
strictDeps = true;
nativeBuildInputs = [
cmake
ninja
];
buildInputs = [
sdl3
spirv-cross
directx-shader-compiler
];
cmakeFlags = [
(lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "SDLSHADERCROSS_INSTALL" true)
(lib.cmakeBool "SDLSHADERCROSS_TESTS" finalAttrs.finalPackage.doCheck)
];
doCheck = true;
passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
passthru.tests.example = runCommand "compile-spv-example" { } ''
cat > example.vert.hlsl << EOF
struct Input
{
float4 position : POSITION;
float3 color : COLOR;
};
float3 main(in Input IN) : COLOR
{
return IN.color;
};
EOF
${lib.getExe finalAttrs.finalPackage} example.vert.hlsl -o example.spv
touch $out
'';
meta = {
description = "Shader translation library";
mainProgram = "shadercross";
homepage = "https://github.com/libsdl-org/SDL_shadercross";
license = lib.licenses.zlib;
maintainers = with lib.maintainers; [ nyxonios ];
teams = [ lib.teams.sdl ];
platforms = lib.platforms.linux;
};
})