Renderer.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using OpenTK.Graphics.OpenGL;
  2. using Ryujinx.Graphics.GAL;
  3. using Ryujinx.Graphics.GAL.Sampler;
  4. using Ryujinx.Graphics.GAL.Texture;
  5. using Ryujinx.Graphics.Shader;
  6. namespace Ryujinx.Graphics.OpenGL
  7. {
  8. public class Renderer : IRenderer
  9. {
  10. public IPipeline Pipeline { get; }
  11. private Counters _counters;
  12. private Window _window;
  13. public IWindow Window => _window;
  14. internal TextureCopy TextureCopy { get; }
  15. public Renderer()
  16. {
  17. Pipeline = new Pipeline();
  18. _counters = new Counters();
  19. _window = new Window();
  20. TextureCopy = new TextureCopy();
  21. }
  22. public IShader CompileShader(ShaderProgram shader)
  23. {
  24. return new Shader(shader);
  25. }
  26. public IBuffer CreateBuffer(int size)
  27. {
  28. return new Buffer(size);
  29. }
  30. public IProgram CreateProgram(IShader[] shaders)
  31. {
  32. return new Program(shaders);
  33. }
  34. public ISampler CreateSampler(SamplerCreateInfo info)
  35. {
  36. return new Sampler(info);
  37. }
  38. public ITexture CreateTexture(TextureCreateInfo info)
  39. {
  40. return new TextureStorage(this, info).CreateDefaultView();
  41. }
  42. public void FlushPipelines()
  43. {
  44. GL.Finish();
  45. }
  46. public Capabilities GetCapabilities()
  47. {
  48. return new Capabilities(HwCapabilities.SupportsAstcCompression);
  49. }
  50. public ulong GetCounter(CounterType type)
  51. {
  52. return _counters.GetCounter(type);
  53. }
  54. public void InitializeCounters()
  55. {
  56. _counters.Initialize();
  57. }
  58. public void ResetCounter(CounterType type)
  59. {
  60. _counters.ResetCounter(type);
  61. }
  62. }
  63. }