MVVM rebuild complete
This commit is contained in:
@@ -37,6 +37,7 @@ using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
@@ -48,19 +49,22 @@ namespace StgSharp
|
||||
[DllImport(SSC_libName, EntryPoint = "glCheckShaderStat",
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
#pragma warning disable CA5392
|
||||
internal static extern int glCheckShaderStatus(ref GLcontext context, uint shaderHandle, int key, ref IntPtr logPtr);
|
||||
internal static extern int glCheckShaderStatus(ref OpenglContext context, uint shaderHandle, int key, ref IntPtr logPtr);
|
||||
#pragma warning restore CA5392
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace StgSharp.Graphics.OpenGL
|
||||
{
|
||||
|
||||
|
||||
public unsafe partial class GlFunction
|
||||
{
|
||||
|
||||
private static Dictionary<IntPtr, GlFunction> contextToGLMap = new Dictionary<IntPtr, GlFunction>();
|
||||
private GLcontext* _context;
|
||||
private OpenglContext* _context;
|
||||
|
||||
private GlFunction()
|
||||
{
|
||||
@@ -70,7 +74,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
|
||||
internal IntPtr ContextHandle => (IntPtr)_context;
|
||||
|
||||
protected ref GLcontext Context
|
||||
protected ref OpenglContext Context
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -156,6 +160,27 @@ namespace StgSharp.Graphics.OpenGL
|
||||
while (Context.glGetError() != 0) { }
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public void Assert(bool shouldReportWhenNormal)
|
||||
{
|
||||
try
|
||||
{
|
||||
uint code = Context.glGetError();
|
||||
if (code != GLconst.NO_ERROR)
|
||||
{
|
||||
throw new GlExecutionException(code);
|
||||
}
|
||||
if (shouldReportWhenNormal)
|
||||
{
|
||||
Console.WriteLine("OpenGL runs normally");
|
||||
}
|
||||
}
|
||||
catch (GlExecutionException ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void GenerateMipmap(Texture2DTarget target)
|
||||
{
|
||||
@@ -169,9 +194,9 @@ namespace StgSharp.Graphics.OpenGL
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void CombineFrameBufferRenderBuffer(GlHandle fboHandle, GlHandle rboHandle)
|
||||
public void CombineFrameBufferRenderBuffer(FrameBufferAttachment attachment, GlHandle rboHandle)
|
||||
{
|
||||
Context.glFramebufferRenderbuffer(GLconst.FRAMEBUFFER, fboHandle.Value, GLconst.RENDERBUFFER, rboHandle.Value);
|
||||
Context.glFramebufferRenderbuffer(GLconst.FRAMEBUFFER, (uint)attachment, GLconst.RENDERBUFFER, rboHandle.Value);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -708,7 +733,7 @@ namespace StgSharp.Graphics.OpenGL
|
||||
{
|
||||
return pack;
|
||||
}
|
||||
pack = new GlFunction { _context = (GLcontext*)handle };
|
||||
pack = new GlFunction { _context = (OpenglContext*)handle };
|
||||
contextToGLMap.Add(handle, pack);
|
||||
return pack;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user