2020-04-25 09:02:18 -04:00
|
|
|
|
using OpenTK.Graphics.OpenGL;
|
|
|
|
|
using Ryujinx.Graphics.GAL;
|
|
|
|
|
|
2020-05-23 05:46:09 -04:00
|
|
|
|
namespace Ryujinx.Graphics.OpenGL.Image
|
2020-04-25 09:02:18 -04:00
|
|
|
|
{
|
2021-04-12 21:09:42 -04:00
|
|
|
|
class TextureBase
|
2020-04-25 09:02:18 -04:00
|
|
|
|
{
|
|
|
|
|
public int Handle { get; protected set; }
|
|
|
|
|
|
2020-07-25 23:03:40 -04:00
|
|
|
|
public TextureCreateInfo Info { get; }
|
2020-04-25 09:02:18 -04:00
|
|
|
|
|
2020-10-29 17:57:34 -04:00
|
|
|
|
public int Width => Info.Width;
|
|
|
|
|
public int Height => Info.Height;
|
2020-07-06 22:41:07 -04:00
|
|
|
|
public float ScaleFactor { get; }
|
2020-04-25 09:02:18 -04:00
|
|
|
|
|
|
|
|
|
public Target Target => Info.Target;
|
|
|
|
|
public Format Format => Info.Format;
|
|
|
|
|
|
2020-07-06 22:41:07 -04:00
|
|
|
|
public TextureBase(TextureCreateInfo info, float scaleFactor = 1f)
|
2020-04-25 09:02:18 -04:00
|
|
|
|
{
|
|
|
|
|
Info = info;
|
2020-07-06 22:41:07 -04:00
|
|
|
|
ScaleFactor = scaleFactor;
|
2020-04-25 09:02:18 -04:00
|
|
|
|
|
|
|
|
|
Handle = GL.GenTexture();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Bind(int unit)
|
|
|
|
|
{
|
|
|
|
|
Bind(Target.Convert(), unit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void Bind(TextureTarget target, int unit)
|
|
|
|
|
{
|
|
|
|
|
GL.ActiveTexture(TextureUnit.Texture0 + unit);
|
|
|
|
|
GL.BindTexture(target, Handle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|