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 CachedShaderProgram : IDisposable
/// Host shader program object.
public IProgram HostProgram { get; }
/// GPU state used to create this version of the shader.
public ShaderSpecializationState SpecializationState { get; }
/// Compiled shader for each shader stage.
public CachedShaderStage[] Shaders { get; }
/// Creates a new instance of the shader bundle.
/// <param name="hostProgram">Host program with all the shader stages</param>
/// <param name="specializationState">GPU state used to create this version of the shader</param>
/// <param name="shaders">Shaders</param>
public CachedShaderProgram(IProgram hostProgram, ShaderSpecializationState specializationState, params CachedShaderStage[] shaders)
HostProgram = hostProgram;
SpecializationState = specializationState;
Shaders = shaders;
SpecializationState.Prepare(shaders);
}
/// Dispose of the host shader resources.
public void Dispose()
HostProgram.Dispose();