2020-04-25 15:02:18 +02:00
|
|
|
|
using OpenTK.Graphics.OpenGL;
|
|
|
|
|
using Ryujinx.Graphics.GAL;
|
|
|
|
|
|
2020-05-23 11:46:09 +02:00
|
|
|
|
namespace Ryujinx.Graphics.OpenGL.Image
|
2020-04-25 15:02:18 +02:00
|
|
|
|
{
|
2021-04-13 03:09:42 +02:00
|
|
|
|
class TextureBase
|
2020-04-25 15:02:18 +02:00
|
|
|
|
{
|
|
|
|
|
public int Handle { get; protected set; }
|
|
|
|
|
|
2020-07-26 05:03:40 +02:00
|
|
|
|
public TextureCreateInfo Info { get; }
|
2020-04-25 15:02:18 +02:00
|
|
|
|
|
2020-10-29 22:57:34 +01:00
|
|
|
|
public int Width => Info.Width;
|
|
|
|
|
public int Height => Info.Height;
|
2020-04-25 15:02:18 +02:00
|
|
|
|
|
|
|
|
|
public Target Target => Info.Target;
|
|
|
|
|
public Format Format => Info.Format;
|
|
|
|
|
|
2023-07-11 19:07:41 +02:00
|
|
|
|
public TextureBase(TextureCreateInfo info)
|
2020-04-25 15:02:18 +02:00
|
|
|
|
{
|
|
|
|
|
Info = info;
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
2022-11-10 17:38:38 +01:00
|
|
|
|
|
|
|
|
|
public static void ClearBinding(int unit)
|
|
|
|
|
{
|
|
|
|
|
GL.ActiveTexture(TextureUnit.Texture0 + unit);
|
|
|
|
|
GL.BindTextureUnit(unit, 0);
|
|
|
|
|
}
|
2020-04-25 15:02:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|