mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-20 03:48:27 +00:00
Fixed swap interval.
This commit is contained in:
parent
6c6beae4fc
commit
5457651676
|
@ -815,6 +815,7 @@
|
||||||
<Compile Include="Platform\MacOS\Cocoa\NSWindowStyle.cs" />
|
<Compile Include="Platform\MacOS\Cocoa\NSWindowStyle.cs" />
|
||||||
<Compile Include="Platform\MacOS\Cocoa\NSOpenGLPixelFormatAttribute.cs" />
|
<Compile Include="Platform\MacOS\Cocoa\NSOpenGLPixelFormatAttribute.cs" />
|
||||||
<Compile Include="Platform\MacOS\Cocoa\NSOpenGLProfile.cs" />
|
<Compile Include="Platform\MacOS\Cocoa\NSOpenGLProfile.cs" />
|
||||||
|
<Compile Include="Platform\MacOS\Cocoa\NSOpenGLContextParameter.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
@ -35,6 +35,9 @@ namespace OpenTK.Platform.MacOS
|
||||||
[DllImport(LibObjC, EntryPoint="objc_msgSend")]
|
[DllImport(LibObjC, EntryPoint="objc_msgSend")]
|
||||||
public extern static void SendVoid(IntPtr receiver, IntPtr selector, IntPtr intPtr1);
|
public extern static void SendVoid(IntPtr receiver, IntPtr selector, IntPtr intPtr1);
|
||||||
|
|
||||||
|
[DllImport(LibObjC, EntryPoint="objc_msgSend")]
|
||||||
|
public extern static void SendVoid(IntPtr receiver, IntPtr selector, IntPtr intPtr1, int int1);
|
||||||
|
|
||||||
[DllImport(LibObjC, EntryPoint="objc_msgSend")]
|
[DllImport(LibObjC, EntryPoint="objc_msgSend")]
|
||||||
public extern static void SendVoid(IntPtr receiver, IntPtr selector, int int1);
|
public extern static void SendVoid(IntPtr receiver, IntPtr selector, int int1);
|
||||||
|
|
||||||
|
|
23
Source/OpenTK/Platform/MacOS/Cocoa/NSOpenGLContextParameter.cs
Executable file
23
Source/OpenTK/Platform/MacOS/Cocoa/NSOpenGLContextParameter.cs
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OpenTK.Platform.MacOS
|
||||||
|
{
|
||||||
|
enum NSOpenGLContextParameter
|
||||||
|
{
|
||||||
|
[Obsolete] SwapRectangle = 200,
|
||||||
|
[Obsolete] SwapRectangleEnable = 201,
|
||||||
|
[Obsolete] RasterizationEnable = 221,
|
||||||
|
SwapInterval = 222,
|
||||||
|
SurfaceOrder = 235,
|
||||||
|
SurfaceOpacity = 236,
|
||||||
|
[Obsolete] StateValidation = 301,
|
||||||
|
SurfaceBackingSize = 304, // Lion
|
||||||
|
[Obsolete] SurfaceSurfaceVolatile = 306,
|
||||||
|
ReclaimResources = 308, // Lion
|
||||||
|
CurrentRendererID = 309, // Lion
|
||||||
|
GpuVertexProcessing = 310, // Lion
|
||||||
|
GpuFragmentProcessing = 311, // Lion
|
||||||
|
HasDrawable = 314, // Lion
|
||||||
|
MpsSwapsInFlight = 315, // Lion
|
||||||
|
}
|
||||||
|
}
|
|
@ -179,32 +179,29 @@ namespace OpenTK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// private unsafe void SetContextValue (int val, NSOpenGLContextParameter par)
|
private unsafe void SetContextValue (int val, NSOpenGLContextParameter par)
|
||||||
// {
|
{
|
||||||
// int *p = &val;
|
int* p = &val;
|
||||||
// context.SetValues ((IntPtr)p, par);
|
Cocoa.SendVoid(Handle.Handle, Selector.Get("setValues:forParameter:"), (IntPtr)p, (int)par);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private unsafe int GetContextValue (NSOpenGLContextParameter par)
|
private unsafe int GetContextValue (NSOpenGLContextParameter par)
|
||||||
// {
|
{
|
||||||
// int ret;
|
int ret;
|
||||||
// int *p = &ret;
|
int* p = &ret;
|
||||||
// context.GetValues ((IntPtr)p, par);
|
Cocoa.SendVoid(Handle.Handle, Selector.Get("getValues:forParameter:"), (IntPtr)p, (int)par);
|
||||||
//
|
return ret;
|
||||||
// return ret;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
public override int SwapInterval
|
public override int SwapInterval
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return 0;
|
return GetContextValue(NSOpenGLContextParameter.SwapInterval);
|
||||||
//return GetContextValue(NSOpenGLContextParameter.SwapInterval);
|
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
SetContextValue(value, NSOpenGLContextParameter.SwapInterval);
|
||||||
//SetContextValue(value, NSOpenGLContextParameter.SwapInterval);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,12 +229,10 @@ namespace OpenTK
|
||||||
|
|
||||||
Debug.Print("Disposing of Cocoa context.");
|
Debug.Print("Disposing of Cocoa context.");
|
||||||
|
|
||||||
Cocoa.SendIntPtr(NSOpenGLContext, Selector.Get("clearCurrentContext"));
|
Cocoa.SendVoid(NSOpenGLContext, Selector.Get("clearCurrentContext"));
|
||||||
|
Cocoa.SendVoid(currentContext, Selector.Get("clearDrawable"));
|
||||||
|
Cocoa.SendVoid(currentContext, Selector.Get("release"));
|
||||||
|
|
||||||
// NSOpenGLContext.ClearCurrentContext();
|
|
||||||
// context.ClearDrawable();
|
|
||||||
// context.Dispose();
|
|
||||||
// context = null;
|
|
||||||
Handle = ContextHandle.Zero;
|
Handle = ContextHandle.Zero;
|
||||||
|
|
||||||
IsDisposed = true;
|
IsDisposed = true;
|
||||||
|
|
Loading…
Reference in a new issue