mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-27 11:52:09 +00:00
521751795a
* Some style fixes and nits on ITimeZoneService * Remove some unneeded usings * Remove the Ryujinx.HLE.OsHle.Handles namespace * Remove hbmenu automatic load on process exit * Rename Ns to Device, rename Os to System, rename SystemState to State * Move Exceptions and Utilities out of OsHle * Rename OsHle to HOS * Rename OsHle folder to HOS * IManagerDisplayService and ISystemDisplayService style fixes * BsdError shouldn't be public * Add a empty new line before using static * Remove unused file * Some style fixes on NPDM * Exit gracefully when the application is closed * Code style fixes on IGeneralService * Add 0x prefix on values printed as hex * Small improvements on finalization code * Move ProcessId and ThreadId out of AThreadState * Rename VFs to FileSystem * FsAccessHeader shouldn't be public. Also fix file names casing * More case changes on NPDM * Remove unused files * Move using to the correct place on NPDM * Use properties on KernelAccessControlMmio * Address PR feedback
86 lines
No EOL
2.2 KiB
C#
86 lines
No EOL
2.2 KiB
C#
using OpenTK.Graphics.OpenGL;
|
|
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<ShaderDeclInfo> ConstBufferUsage { get; private set; }
|
|
public IEnumerable<ShaderDeclInfo> TextureUsage { get; private set; }
|
|
|
|
public OGLShaderStage(
|
|
GalShaderType Type,
|
|
string Code,
|
|
IEnumerable<ShaderDeclInfo> ConstBufferUsage,
|
|
IEnumerable<ShaderDeclInfo> TextureUsage)
|
|
{
|
|
this.Type = Type;
|
|
this.Code = Code;
|
|
this.ConstBufferUsage = ConstBufferUsage;
|
|
this.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));
|
|
}
|
|
}
|
|
}
|
|
} |