mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-05-18 20:07:01 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
44 lines
927 B
C#
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 );
|
|
}
|
|
}
|
|
}
|