Przeglądaj źródła

Update nzsl to v1.1.2 (#8530)

* Update nzsl to v1.1.2

* update nzsl rules
Jérôme Leclercq 1 miesiąc temu
rodzic
commit
1a06a8efaa

+ 11 - 6
packages/n/nzsl/rules/archive_shaders.lua

@@ -3,14 +3,16 @@ rule("archive.shaders")
 	set_extensions(".nzsla")
 	add_deps("@nzsl/find_nzsl")
 
-    if add_orders then
-	    add_deps("@nzsl/compile.shaders")
-        add_orders("@nzsl/compile.shaders", "@nzsl/archive.shaders")
-    else
-	    add_deps("@nzsl/compile.shaders", { order = true })
-    end
+	if add_orders then
+		add_deps("@nzsl/compile.shaders")
+		add_orders("@nzsl/compile.shaders", "@nzsl/archive.shaders")
+	else
+		add_deps("@nzsl/compile.shaders", { order = true })
+	end
 
 	before_buildcmd_file(function (target, batchcmds, sourcefile, opt)
+		import("core.base.semver")
+
 		local nzsla = target:data("nzsla")
 		local runenvs = target:data("nzsl_runenv")
 		assert(nzsla, "nzsla not found! please install nzsl package with nzsla enabled")
@@ -19,6 +21,9 @@ rule("archive.shaders")
 
 		batchcmds:show_progress(opt.progress, "${color.build.object}archiving.shaders %s", sourcefile)
 		local argv = { "--archive" }
+		if semver.compare(nzsla.version, "1.1.0") >= 0 then
+			table.insert(argv, "--skip-unchanged")
+		end
 
 		if fileconfig.compress then
 			if type(fileconfig.compress) == "string" then

+ 7 - 2
packages/n/nzsl/rules/compile_shaders.lua

@@ -26,7 +26,7 @@ rule("compile.shaders")
 		if not table.empty(archives) then
 			assert(target:rule("@nzsl/archive.shaders"), "you must add the @nzsl/archive.shaders rule to the target")
 			for archive, archivefiles in table.orderpairs(archives) do
-				local args = { rule = "@nzsl/archive.shaders", always_added = true, compress = true, files = archivefiles }
+				local args = { always_added = true, compress = true, files = archivefiles }
 				if archive:endswith(".nzsla.h") or archive:endswith(".nzsla.hpp") then
 					args.header = path.extension(archive)
 					archive = archive:sub(1, -#args.header - 1) -- foo.nzsla.h => foo.nzsla
@@ -38,6 +38,8 @@ rule("compile.shaders")
 	end)
 
 	before_buildcmd_file(function (target, batchcmds, shaderfile, opt)
+		import("core.base.semver")
+
 		local outputdir = target:data("nzsl_includedirs")
 		local nzslc = target:data("nzslc")
 		local runenvs = target:data("nzsl_runenv")
@@ -48,7 +50,10 @@ rule("compile.shaders")
 
 		-- add commands
 		batchcmds:show_progress(opt.progress, "${color.build.object}compiling.shader %s", shaderfile)
-		local argv = { "--compile=nzslb" .. (header and "-header" or ""), "--partial", "--optimize", "--skip-unchanged" }
+		local argv = { "--compile=nzslb" .. (header and "-header" or ""), "--partial", "--optimize" }
+		if semver.compare(nzslc.version, "1.1.0") >= 0 then
+			table.insert(argv, "--skip-unchanged")
+		end
 		if outputdir then
 			batchcmds:mkdir(outputdir)
 			table.insert(argv, "--output=" .. outputdir)

+ 2 - 0
packages/n/nzsl/xmake.lua

@@ -6,6 +6,8 @@ package("nzsl")
     add_urls("https://github.com/NazaraEngine/ShaderLang/archive/refs/tags/$(version).tar.gz",
              "https://github.com/NazaraEngine/ShaderLang.git")
 
+    add_versions("v1.1.2", "48b3e5ce18f0c3d4bf22c0201ab41664b30c1d40f7df31b776d2d37a1559c0fb")
+    add_versions("v1.1.1", "e4e37d3274936d8f040d4ed29d2aa20b6cc93de755aa070309fd01cc17140525")
     add_versions("v1.1.0", "8b401a199c6ee7b2cc3b24871bbec2857a70ff47a25f043e35db54fa1f4129ef")
     add_versions("v1.0.0", "ef434fec5d32ddf64f2f7c7691a4d96a6ac24cab4cc6c091d46a542c86825359")