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 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.
///
/// Host program with all the shader stages
/// GPU state used to create this version of the shader
/// Shaders
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();
}
}
}