aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.GAL/Multithreading/Resources/Programs')
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/BinaryProgramRequest.cs21
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/IProgramRequest.cs8
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/SourceProgramRequest.cs32
3 files changed, 61 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/BinaryProgramRequest.cs b/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/BinaryProgramRequest.cs
new file mode 100644
index 00000000..96bfedf8
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/BinaryProgramRequest.cs
@@ -0,0 +1,21 @@
+namespace Ryujinx.Graphics.GAL.Multithreading.Resources.Programs
+{
+ class BinaryProgramRequest : IProgramRequest
+ {
+ public ThreadedProgram Threaded { get; set; }
+
+ private byte[] _data;
+
+ public BinaryProgramRequest(ThreadedProgram program, byte[] data)
+ {
+ Threaded = program;
+
+ _data = data;
+ }
+
+ public IProgram Create(IRenderer renderer)
+ {
+ return renderer.LoadProgramBinary(_data);
+ }
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/IProgramRequest.cs b/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/IProgramRequest.cs
new file mode 100644
index 00000000..cdbfe03c
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/IProgramRequest.cs
@@ -0,0 +1,8 @@
+namespace Ryujinx.Graphics.GAL.Multithreading.Resources.Programs
+{
+ interface IProgramRequest
+ {
+ ThreadedProgram Threaded { get; set; }
+ IProgram Create(IRenderer renderer);
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/SourceProgramRequest.cs b/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/SourceProgramRequest.cs
new file mode 100644
index 00000000..d40ce6a4
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Resources/Programs/SourceProgramRequest.cs
@@ -0,0 +1,32 @@
+using System.Linq;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Resources.Programs
+{
+ class SourceProgramRequest : IProgramRequest
+ {
+ public ThreadedProgram Threaded { get; set; }
+
+ private IShader[] _shaders;
+ private TransformFeedbackDescriptor[] _transformFeedbackDescriptors;
+
+ public SourceProgramRequest(ThreadedProgram program, IShader[] shaders, TransformFeedbackDescriptor[] transformFeedbackDescriptors)
+ {
+ Threaded = program;
+
+ _shaders = shaders;
+ _transformFeedbackDescriptors = transformFeedbackDescriptors;
+ }
+
+ public IProgram Create(IRenderer renderer)
+ {
+ IShader[] shaders = _shaders.Select(shader =>
+ {
+ var threaded = (ThreadedShader)shader;
+ threaded?.EnsureCreated();
+ return threaded?.Base;
+ }).ToArray();
+
+ return renderer.CreateProgram(shaders, _transformFeedbackDescriptors);
+ }
+ }
+}