Skip to content

Commit 5dae5b1

Browse files
committed
Aggregate ASICs from all rga versions
Fixes tgjones#108.
1 parent e236e64 commit 5dae5b1

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

src/ShaderPlayground.Core/Compilers/Rga/RgaCompiler.cs

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,29 @@ internal sealed class RgaCompiler : IShaderCompiler
1212
{
1313
static RgaCompiler()
1414
{
15-
ProcessHelper.Run(
16-
Path.Combine(AppContext.BaseDirectory, "Binaries", "rga", "2.6", "rga.exe"),
17-
"-s dx11 --list-asics",
18-
out var stdOutput,
19-
out var _);
20-
21-
// Extract ASICs from output.
22-
var coreRegex = new Regex(@"\n([a-zA-Z0-9 ]+) \(");
23-
var matches = coreRegex.Matches(stdOutput);
24-
25-
AsicOptions = matches
26-
.Cast<Match>()
27-
.Select(x => x.Groups[1].Value)
15+
var asicOptions = new List<string>();
16+
17+
foreach (var versionDirectory in Directory.GetDirectories(Path.Combine(AppContext.BaseDirectory, "Binaries", "rga")))
18+
{
19+
ProcessHelper.Run(
20+
Path.Combine(versionDirectory, "rga.exe"),
21+
"-s dx11 --list-asics",
22+
out var stdOutput,
23+
out var _);
24+
25+
// Extract ASICs from output.
26+
var coreRegex = new Regex(@"\n([a-zA-Z0-9 ]+) \(");
27+
var matches = coreRegex.Matches(stdOutput);
28+
29+
asicOptions.AddRange(matches
30+
.Cast<Match>()
31+
.Select(x => x.Groups[1].Value));
32+
}
33+
34+
AsicOptions =
35+
asicOptions
36+
.Distinct()
37+
.OrderBy(x => x)
2838
.ToArray();
2939
}
3040

0 commit comments

Comments
 (0)