-
Notifications
You must be signed in to change notification settings - Fork 3
/
compile_shader.editor_script
147 lines (140 loc) · 5.9 KB
/
compile_shader.editor_script
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
-- Download and install Mali Offline Compiler Version 6.4 and Arm Mobile Studio from the links:
-- https://developer.arm.com/tools-and-software/graphics-and-gaming/mali-offline-compiler/downloads
-- https://developer.arm.com/tools-and-software/graphics-and-gaming/arm-mobile-studio/components/mali-offline-compiler
local M = {}
local function ends_with(str, ending)
return ending == "" or str:sub(-#ending) == ending
end
function M.get_commands()
return {
-- Samsung Chromebook Plus
{
label = "Compile Fragment Shader (Chromebook Plus - T860)",
locations = {"Edit", "Assets"},
query = {selection = {type = "resource", cardinality = "one"}},
active = function(opts)
local path = editor.get(opts.selection, "path")
return ends_with(path, ".fp")
end,
run = function(opts)
local path = editor.get(opts.selection, "path")
path = path:sub(2)
return {
{action = "shell", command = {"cmd", "/C", "malioc.exe", "--core", "Mali-T860", "--fragment", path}}
}
end
}, {
label = "Compile Vertex Shader (Chromebook Plus - T860)",
locations = {"Edit", "Assets"},
query = {selection = {type = "resource", cardinality = "one"}},
active = function(opts)
local path = editor.get(opts.selection, "path")
return ends_with(path, ".vp")
end,
run = function(opts)
local path = editor.get(opts.selection, "path")
path = path:sub(2)
return {
{action = "shell", command = {"cmd", "/C", "malioc.exe", "--core", "Mali-T860", "--vertex", path}}
}
end
},
-- Amazon Fire HD 8 Plus (2020)
{
label = "Compile Fragment Shader (Fire HD - G52)",
locations = {"Edit", "Assets"},
query = {selection = {type = "resource", cardinality = "one"}},
active = function(opts)
local path = editor.get(opts.selection, "path")
return ends_with(path, ".fp")
end,
run = function(opts)
local path = editor.get(opts.selection, "path")
path = path:sub(2)
return {
{action = "shell", command = {"cmd", "/C", "malioc.exe", "--core", "Mali-G52", "--fragment", path}}
}
end
}, {
label = "Compile Vertex Shader (Fire HD - G52)",
locations = {"Edit", "Assets"},
query = {selection = {type = "resource", cardinality = "one"}},
active = function(opts)
local path = editor.get(opts.selection, "path")
return ends_with(path, ".vp")
end,
run = function(opts)
local path = editor.get(opts.selection, "path")
path = path:sub(2)
return {
{action = "shell", command = {"cmd", "/C", "malioc.exe", "--core", "Mali-G52", "--vertex", path}}
}
end
},
-- Samsung Galaxy J3 (2016) EU
{
label = "Compile Fragment Shader (Galaxy J3 - Mali-400)",
locations = {"Edit", "Assets"},
query = {selection = {type = "resource", cardinality = "one"}},
active = function(opts)
local path = editor.get(opts.selection, "path")
return ends_with(path, ".fp")
end,
run = function(opts)
local path = editor.get(opts.selection, "path")
path = path:sub(2)
return {
{action = "shell", command = {"cmd", "/C", "malisc", "--core", "Mali-400", "--fragment", path}}
}
end
}, {
label = "Compile Vertex Shader (Galaxy J3 - Mali-400)",
locations = {"Edit", "Assets"},
query = {selection = {type = "resource", cardinality = "one"}},
active = function(opts)
local path = editor.get(opts.selection, "path")
return ends_with(path, ".vp")
end,
run = function(opts)
local path = editor.get(opts.selection, "path")
path = path:sub(2)
return {
{action = "shell", command = {"cmd", "/C", "malisc", "--core", "Mali-400", "--vertex", path}}
}
end
},
-- Samsung Galaxy J3 (2016) USA
{
label = "Compile Fragment Shader (Galaxy J3 - T720)",
locations = {"Edit", "Assets"},
query = {selection = {type = "resource", cardinality = "one"}},
active = function(opts)
local path = editor.get(opts.selection, "path")
return ends_with(path, ".fp")
end,
run = function(opts)
local path = editor.get(opts.selection, "path")
path = path:sub(2)
return {
{action = "shell", command = {"cmd", "/C", "malisc", "--core", "Mali-T720", "--fragment", path}}
}
end
}, {
label = "Compile Vertex Shader (Galaxy J3 - T720)",
locations = {"Edit", "Assets"},
query = {selection = {type = "resource", cardinality = "one"}},
active = function(opts)
local path = editor.get(opts.selection, "path")
return ends_with(path, ".vp")
end,
run = function(opts)
local path = editor.get(opts.selection, "path")
path = path:sub(2)
return {
{action = "shell", command = {"cmd", "/C", "malisc", "--core", "Mali-T720", "--vertex", path}}
}
end
}
}
end
return M