mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-11-22 18:15:11 +00:00
99ffc061d3
* Changes 1 * Changes 2 * Better ModifiedSequence handling This should handle PreciseEvents properly, and simplifies a few things. * Minor changes, remove debug log * Handle stage.Info being null Hopefully fixes Catherine crash * Fix shader specialization fast texture lookup * Fix some things. * Address Feedback Part 1 * Make method static.
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// Host shader program object.
|
|
/// </summary>
|
|
public IProgram HostProgram { get; }
|
|
|
|
/// <summary>
|
|
/// GPU state used to create this version of the shader.
|
|
/// </summary>
|
|
public ShaderSpecializationState SpecializationState { get; }
|
|
|
|
/// <summary>
|
|
/// Compiled shader for each shader stage.
|
|
/// </summary>
|
|
public CachedShaderStage[] 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="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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Dispose of the host shader resources.
|
|
/// </summary>
|
|
public void Dispose()
|
|
{
|
|
HostProgram.Dispose();
|
|
}
|
|
}
|
|
}
|