Skip to content

Commit 566b242

Browse files
committed
Add (non-working) dxr mode for rga
1 parent f4dd79f commit 566b242

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

build.cake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ Task("Download-RGA")
442442
DownloadRga("2.3", "**/*.*");
443443
DownloadRga("2.3.1", "**/*.*");
444444
DownloadRga("2.4", "**/*.*");
445+
DownloadRga("2.4.1", "**/*.*");
445446
});
446447

447448
Task("Download-IntelShaderAnalyzer")

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal sealed class RgaCompiler : IShaderCompiler
1313
static RgaCompiler()
1414
{
1515
ProcessHelper.Run(
16-
Path.Combine(AppContext.BaseDirectory, "Binaries", "rga", "2.2", "rga.exe"),
16+
Path.Combine(AppContext.BaseDirectory, "Binaries", "rga", "2.4.1", "rga.exe"),
1717
"-s dx11 --list-asics",
1818
out var stdOutput,
1919
out var _);
@@ -78,6 +78,7 @@ static RgaCompiler()
7878

7979
private static readonly string[] DirectXModeOptions =
8080
{
81+
"dxr",
8182
"dx11",
8283
"dx12",
8384
};
@@ -97,6 +98,7 @@ public ShaderCompilerResult Compile(ShaderCode shaderCode, ShaderCompilerArgumen
9798

9899
var isVersion21OrLater = version >= new Version(2, 1);
99100
var isVersion22OrLater = version >= new Version(2, 2);
101+
var isVersion241OrLater = version >= new Version(2, 4, 1);
100102

101103
var asic = arguments.GetString("Asic");
102104
var directXMode = arguments.GetString("DirectXMode");
@@ -119,6 +121,16 @@ public ShaderCompilerResult Compile(ShaderCode shaderCode, ShaderCompilerArgumen
119121
case LanguageNames.Hlsl:
120122
switch (directXMode)
121123
{
124+
case "dxr":
125+
if (!isVersion241OrLater)
126+
{
127+
throw new InvalidOperationException("DXR mode is only supported on RGA 2.4.1 and above");
128+
}
129+
args += " -s dxr";
130+
args += $" --export {entryPoint}";
131+
args += $" --hlsl \"{tempFile.FilePath}\"";
132+
break;
133+
122134
case "dx11":
123135
args += isVersion22OrLater ? $" -s dx11" : " -s hlsl";
124136
args += $" --profile {targetProfile} --function {entryPoint}";

0 commit comments

Comments
 (0)