Refactor shader GPU state and memory access (#1203)
* Refactor shader GPU state and memory access * Fix NVDEC project build * Address PR feedback and add missing XML comments
This commit is contained in:
parent
7f500e7cae
commit
b8eb6abecc
35 changed files with 633 additions and 684 deletions
46
Ryujinx.Graphics.Gpu/Shader/ShaderBundle.cs
Normal file
46
Ryujinx.Graphics.Gpu/Shader/ShaderBundle.cs
Normal file
|
@ -0,0 +1,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue