TextureBase.cs 894 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using OpenTK.Graphics.OpenGL;
  2. using Ryujinx.Graphics.GAL;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. namespace Ryujinx.Graphics.OpenGL
  7. {
  8. class TextureBase
  9. {
  10. public int Handle { get; protected set; }
  11. protected TextureCreateInfo Info { get; }
  12. public int Width => Info.Width;
  13. public int Height => Info.Height;
  14. public Target Target => Info.Target;
  15. public Format Format => Info.Format;
  16. public TextureBase(TextureCreateInfo info)
  17. {
  18. Info = info;
  19. Handle = GL.GenTexture();
  20. }
  21. public void Bind(int unit)
  22. {
  23. Bind(Target.Convert(), unit);
  24. }
  25. protected void Bind(TextureTarget target, int unit)
  26. {
  27. GL.ActiveTexture(TextureUnit.Texture0 + unit);
  28. GL.BindTexture(target, Handle);
  29. }
  30. }
  31. }