-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglslc.lua
More file actions
69 lines (60 loc) · 1.63 KB
/
glslc.lua
File metadata and controls
69 lines (60 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
-- Note: known bug: make clean won't delete the generated .spv files.
local binname = nil;
local shaderc = "third_party/shaderc";
local host = os.host();
if "windows" == host then
binname = "win-x86_64/glslc.exe";
elseif "linux" == host then
binname = "linux-x86_64/glslc";
else
error( "No glslc binary for this platform (" .. host .. ")" );
end
local glslc = path.join( shaderc, binname );
local glslc_build_command_ = function( kind, ext, opt, opath, ipaths )
local istr = "";
for _,ipath in ipairs(ipaths) do
if "/" == ipath:sub(1,1) then
istr = istr .. "-I" .. ipath;
else
istr = istr .. "-I%{wks.location}/" .. ipath
end
end
istr = istr .. " ";
local ofile, odir = "", "";
if "/" == opath:sub(1,1) then
odir = opath;
ofile = ofile .. opath;
else
odir = "%{wks.location}/" .. opath;
ofile = ofile .. "%{wks.location}/" .. opath;
end
ofile = ofile .. "/%{file.name}.spv";
filter( "files:**." .. ext )
buildmessage( "GLSLC: [" .. kind .. "] '%{file.name}'" );
buildcommands( "{mkdir} " .. odir );
buildcommands(
"%{wks.location}/" .. glslc .. " "
.. opt .. " "
.. istr
.. "-o " .. ofile .. " "
.. "%{file.relpath}".." ".."--target-env=vulkan1.2"
)
buildoutputs( ofile )
filter "*"
end
handle_glsl_files = function( opt, opath, ipaths )
local types = {
{ "VERT", "vert" },
{ "FRAG", "frag" },
{ "GEOM", "geom" },
{ "COMP", "comp" },
{ "RCHIT", "rchit" },
{ "RINT", "rint" },
{ "RGEN", "rgen" },
{ "RMISS", "rmiss" },
};
for _,ty in ipairs(types) do
glslc_build_command_( ty[1], ty[2], opt, opath, ipaths )
end
end
--EOF vim:syntax=lua:foldmethod=marker:ts=4:noexpandtab: