BizHawk/Bizware/BizHawk.Bizware.BizwareGL/Shader.cs

44 lines
954 B
C#
Raw Normal View History

2014-01-27 00:02:21 +00:00
using System;
using System.Collections.Generic;
namespace BizHawk.Bizware.BizwareGL
{
/// <summary>
2015-08-20 23:35:53 +00:00
/// Represents an individual (fragment,vertex) shader.
/// It isnt IDisposable because itll be lifecycle-managed by the IGL (disposed when all dependent pipelines are disposed)
/// But if you want to be sure to save it for later, use AddRef
2014-01-27 00:02:21 +00:00
/// </summary>
2015-08-20 23:35:53 +00:00
public class Shader
2014-01-27 00:02:21 +00:00
{
2015-08-20 23:35:53 +00:00
public Shader(IGL owner, object opaque, bool available)
2014-01-27 00:02:21 +00:00
{
Owner = owner;
2015-08-20 23:35:53 +00:00
Opaque = opaque;
Available = available;
Errors = "";
2014-01-27 00:02:21 +00:00
}
public IGL Owner { get; private set; }
2015-08-20 23:35:53 +00:00
public object Opaque { get; private set; }
public bool Available { get; private set; }
public string Errors { get; set; }
2014-01-27 00:02:21 +00:00
2015-08-20 23:35:53 +00:00
int RefCount;
public void Release()
2014-01-27 00:02:21 +00:00
{
2015-08-20 23:35:53 +00:00
RefCount--;
if (RefCount <= 0)
{
Owner.Internal_FreeShader(this);
Available = false;
}
2014-01-27 00:02:21 +00:00
}
2015-08-20 23:35:53 +00:00
public void AddRef()
{
RefCount++;
}
2014-01-27 00:02:21 +00:00
}
}