Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions packages/n/nzsl/rules/archive_shaders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down
9 changes: 7 additions & 2 deletions packages/n/nzsl/rules/compile_shaders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions packages/n/nzsl/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Loading