blob: efdbc3ebe09d34da59b785c830abda5638be291e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
using Ryujinx.Graphics.GAL;
using System;
namespace Ryujinx.Graphics.Gpu.Shader
{
/// <summary>
/// Represents a program composed of one or more shader stages (for graphics shaders),
/// or a single shader (for compute shaders).
/// </summary>
class ShaderBundle : IDisposable
{
/// <summary>
/// Host shader program object.
/// </summary>
public IProgram HostProgram { get; }
/// <summary>
/// Compiled shader for each shader stage.
/// </summary>
public ShaderCodeHolder[] Shaders { get; }
/// <summary>
/// Creates a new instance of the shader bundle.
/// </summary>
/// <param name="hostProgram">Host program with all the shader stages</param>
/// <param name="shaders">Shaders</param>
public ShaderBundle(IProgram hostProgram, params ShaderCodeHolder[] shaders)
{
HostProgram = hostProgram;
Shaders = shaders;
}
/// <summary>
/// Dispose of the host shader resources.
/// </summary>
public void Dispose()
{
HostProgram.Dispose();
foreach (ShaderCodeHolder holder in Shaders)
{
holder?.HostShader?.Dispose();
}
}
}
}
|