aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/OpenGL/OglShaderProgram.cs
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-10-13 03:02:07 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit1876b346fea647e8284a66bb6d62c38801035cff (patch)
tree6eeff094298cda84d1613dc5ec0691e51d7b35f1 /Ryujinx.Graphics/Gal/OpenGL/OglShaderProgram.cs
parentf617fb542a0e3d36012d77a4b5acbde7b08902f2 (diff)
Initial work
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL/OglShaderProgram.cs')
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/OglShaderProgram.cs87
1 files changed, 0 insertions, 87 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglShaderProgram.cs b/Ryujinx.Graphics/Gal/OpenGL/OglShaderProgram.cs
deleted file mode 100644
index 86126bca..00000000
--- a/Ryujinx.Graphics/Gal/OpenGL/OglShaderProgram.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-using OpenTK.Graphics.OpenGL;
-using Ryujinx.Graphics.Shader;
-using System;
-using System.Collections.Generic;
-
-namespace Ryujinx.Graphics.Gal.OpenGL
-{
- struct OglShaderProgram
- {
- public OglShaderStage Vertex;
- public OglShaderStage TessControl;
- public OglShaderStage TessEvaluation;
- public OglShaderStage Geometry;
- public OglShaderStage Fragment;
- }
-
- class OglShaderStage : IDisposable
- {
- public int Handle { get; private set; }
-
- public bool IsCompiled { get; private set; }
-
- public GalShaderType Type { get; private set; }
-
- public string Code { get; private set; }
-
- public IEnumerable<CBufferDescriptor> ConstBufferUsage { get; private set; }
- public IEnumerable<TextureDescriptor> TextureUsage { get; private set; }
-
- public OglShaderStage(
- GalShaderType type,
- string code,
- IEnumerable<CBufferDescriptor> constBufferUsage,
- IEnumerable<TextureDescriptor> textureUsage)
- {
- Type = type;
- Code = code;
- ConstBufferUsage = constBufferUsage;
- TextureUsage = textureUsage;
- }
-
- public void Compile()
- {
- if (Handle == 0)
- {
- Handle = GL.CreateShader(OglEnumConverter.GetShaderType(Type));
-
- CompileAndCheck(Handle, Code);
- }
- }
-
- public void Dispose()
- {
- Dispose(true);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing && Handle != 0)
- {
- GL.DeleteShader(Handle);
-
- Handle = 0;
- }
- }
-
- public static void CompileAndCheck(int handle, string code)
- {
- GL.ShaderSource(handle, code);
- GL.CompileShader(handle);
-
- CheckCompilation(handle);
- }
-
- private static void CheckCompilation(int handle)
- {
- int status = 0;
-
- GL.GetShader(handle, ShaderParameter.CompileStatus, out status);
-
- if (status == 0)
- {
- throw new ShaderException(GL.GetShaderInfoLog(handle));
- }
- }
- }
-} \ No newline at end of file