mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 07:35:30 +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\NSOpenGLPixelFormatAttribute.cs" />
|
||||
<Compile Include="Platform\MacOS\Cocoa\NSOpenGLProfile.cs" />
|
||||
<Compile Include="Platform\MacOS\Cocoa\NSOpenGLContextParameter.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -35,6 +35,9 @@ namespace OpenTK.Platform.MacOS
|
|||
[DllImport(LibObjC, EntryPoint="objc_msgSend")]
|
||||
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")]
|
||||
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)
|
||||
// {
|
||||
// int *p = &val;
|
||||
// context.SetValues ((IntPtr)p, par);
|
||||
// }
|
||||
//
|
||||
// private unsafe int GetContextValue (NSOpenGLContextParameter par)
|
||||
// {
|
||||
// int ret;
|
||||
// int *p = &ret;
|
||||
// context.GetValues ((IntPtr)p, par);
|
||||
//
|
||||
// return ret;
|
||||
// }
|
||||
private unsafe void SetContextValue (int val, NSOpenGLContextParameter par)
|
||||
{
|
||||
int* p = &val;
|
||||
Cocoa.SendVoid(Handle.Handle, Selector.Get("setValues:forParameter:"), (IntPtr)p, (int)par);
|
||||
}
|
||||
|
||||
private unsafe int GetContextValue (NSOpenGLContextParameter par)
|
||||
{
|
||||
int ret;
|
||||
int* p = &ret;
|
||||
Cocoa.SendVoid(Handle.Handle, Selector.Get("getValues:forParameter:"), (IntPtr)p, (int)par);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public override int SwapInterval
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
//return GetContextValue(NSOpenGLContextParameter.SwapInterval);
|
||||
return GetContextValue(NSOpenGLContextParameter.SwapInterval);
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
//SetContextValue(value, NSOpenGLContextParameter.SwapInterval);
|
||||
SetContextValue(value, NSOpenGLContextParameter.SwapInterval);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,12 +229,10 @@ namespace OpenTK
|
|||
|
||||
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;
|
||||
|
||||
IsDisposed = true;
|
||||
|
|
Loading…
Reference in a new issue