using Ryujinx.Graphics.GAL;
using System;
namespace Ryujinx.Graphics.Gpu.Shader
{
///
/// Represents a program composed of one or more shader stages (for graphics shaders),
/// or a single shader (for compute shaders).
///
class ShaderBundle : IDisposable
{
///
/// Host shader program object.
///
public IProgram HostProgram { get; }
///
/// Compiled shader for each shader stage.
///
public ShaderCodeHolder[] Shaders { get; }
///
/// Creates a new instance of the shader bundle.
///
/// Host program with all the shader stages
/// Shaders
public ShaderBundle(IProgram hostProgram, params ShaderCodeHolder[] shaders)
{
HostProgram = hostProgram;
Shaders = shaders;
}
///
/// Dispose of the host shader resources.
///
public void Dispose()
{
HostProgram.Dispose();
foreach (ShaderCodeHolder holder in Shaders)
{
holder?.HostShader?.Dispose();
}
}
}
}