Geometry shader emulation for macOS (#5551)

* Implement vertex and geometry shader conversion to compute

* Call InitializeReservedCounts for compute too

* PR feedback

* Set clip distance mask for geometry and tessellation shaders too

* Transform feedback emulation only for vertex
This commit is contained in:
gdkchan 2023-08-29 21:10:34 -03:00 committed by GitHub
parent 93d78f9ac4
commit f09bba82b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 3912 additions and 593 deletions

View file

@ -29,6 +29,12 @@ namespace Ryujinx.ShaderTools
[Option("compute", Required = false, Default = false, HelpText = "Indicate that the shader is a compute shader.")]
public bool Compute { get; set; }
[Option("vertex-as-compute", Required = false, Default = false, HelpText = "Indicate that the shader is a vertex shader and should be converted to compute.")]
public bool VertexAsCompute { get; set; }
[Option("vertex-passthrough", Required = false, Default = false, HelpText = "Indicate that the shader is a vertex passthrough shader for compute output.")]
public bool VertexPassthrough { get; set; }
[Option("target-language", Required = false, Default = TargetLanguage.Glsl, HelpText = "Indicate the target shader language to use.")]
public TargetLanguage TargetLanguage { get; set; }
@ -54,8 +60,18 @@ namespace Ryujinx.ShaderTools
byte[] data = File.ReadAllBytes(options.InputPath);
TranslationOptions translationOptions = new(options.TargetLanguage, options.TargetApi, flags);
TranslatorContext translatorContext = Translator.CreateContext(0, new GpuAccessor(data), translationOptions);
ShaderProgram program = Translator.CreateContext(0, new GpuAccessor(data), translationOptions).Translate();
ShaderProgram program;
if (options.VertexPassthrough)
{
program = translatorContext.GenerateVertexPassthroughForCompute();
}
else
{
program = translatorContext.Translate(options.VertexAsCompute);
}
if (options.OutputPath == null)
{