aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Translation/Translator.cs
diff options
context:
space:
mode:
authorMary <me@thog.eu>2021-07-18 12:49:39 +0200
committerGitHub <noreply@github.com>2021-07-18 12:49:39 +0200
commit97a21332071aceeef6f5035178a3523177570448 (patch)
treea983c7cce46b891c4b27965d0e69b0358b861a72 /Ryujinx.Graphics.Shader/Translation/Translator.cs
parentca5ac37cd638222e7475ac8f632b878126f3462d (diff)
shadertools: Prepare for new target Languages and APIs (#2465)
* shadertools: Prepare for new target Langugaes and APIs This improves shader tools command line by adding support for target language and api. * Address gdkchan's comments
Diffstat (limited to 'Ryujinx.Graphics.Shader/Translation/Translator.cs')
-rw-r--r--Ryujinx.Graphics.Shader/Translation/Translator.cs14
1 files changed, 12 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Shader/Translation/Translator.cs b/Ryujinx.Graphics.Shader/Translation/Translator.cs
index 0f71b599..685b6a20 100644
--- a/Ryujinx.Graphics.Shader/Translation/Translator.cs
+++ b/Ryujinx.Graphics.Shader/Translation/Translator.cs
@@ -3,6 +3,7 @@ using Ryujinx.Graphics.Shader.Decoders;
using Ryujinx.Graphics.Shader.IntermediateRepresentation;
using Ryujinx.Graphics.Shader.StructuredIr;
using Ryujinx.Graphics.Shader.Translation.Optimizations;
+using System;
using System.Collections.Generic;
using static Ryujinx.Graphics.Shader.IntermediateRepresentation.OperandHelper;
@@ -87,7 +88,16 @@ namespace Ryujinx.Graphics.Shader.Translation
StructuredProgramInfo sInfo = StructuredProgram.MakeStructuredProgram(funcs, config);
- string glslCode = GlslGenerator.Generate(sInfo, config);
+ ShaderProgram program;
+
+ switch (config.Options.TargetLanguage)
+ {
+ case TargetLanguage.Glsl:
+ program = new ShaderProgram(config.Stage, GlslGenerator.Generate(sInfo, config));
+ break;
+ default:
+ throw new NotImplementedException(config.Options.TargetLanguage.ToString());
+ }
shaderProgramInfo = new ShaderProgramInfo(
config.GetConstantBufferDescriptors(),
@@ -97,7 +107,7 @@ namespace Ryujinx.Graphics.Shader.Translation
config.UsedFeatures.HasFlag(FeatureFlags.InstanceId),
config.ClipDistancesWritten);
- return new ShaderProgram(config.Stage, glslCode);
+ return program;
}
private static Block[][] DecodeShader(