Files
sbox-public/engine/Sandbox.Engine/Systems/Render/ShaderCompile/ShaderCompileContext.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

44 lines
927 B
C#

namespace Sandbox.Engine.Shaders;
/// <summary>
/// Passed to shader compiles to provide a shared context between the compiles.
/// This provides the source code to the compile, but it also gives an opportunity
/// for the threaded, individual compiles, to share and cache information between them.
/// </summary>
class ShaderCompileContext : IDisposable
{
private IShaderCompileContext _native;
private string _maskedSource;
internal ShaderCompileContext( IShaderCompileContext shaderCompileContext )
{
_native = shaderCompileContext;
}
~ShaderCompileContext()
{
_native.Delete();
_native = default;
}
public void Dispose()
{
_native.Delete();
_native = default;
GC.SuppressFinalize( this );
}
internal IShaderCompileContext GetNative() => _native;
public string MaskedSource
{
get => _maskedSource;
set
{
_maskedSource = value;
_native.SetMaskedCode( _maskedSource );
}
}
}