mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-26 03:01:05 +00:00
Corrected device handle passed to aglChoosePixelFormat.
This commit is contained in:
parent
e6c736e7ec
commit
34e283367d
|
@ -89,7 +89,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_ACCUM_BLUE_SIZE, mode.AccumulatorFormat.Blue);
|
AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_ACCUM_BLUE_SIZE, mode.AccumulatorFormat.Blue);
|
||||||
AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_ACCUM_ALPHA_SIZE, mode.AccumulatorFormat.Alpha);
|
AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_ACCUM_ALPHA_SIZE, mode.AccumulatorFormat.Alpha);
|
||||||
}
|
}
|
||||||
//AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_FULLSCREEN);
|
AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_FULLSCREEN);
|
||||||
AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_NONE);
|
AddPixelAttrib(aglAttributes, Agl.PixelFormatAttribute.AGL_NONE);
|
||||||
|
|
||||||
Debug.Unindent();
|
Debug.Unindent();
|
||||||
|
@ -100,14 +100,23 @@ namespace OpenTK.Platform.MacOS
|
||||||
Debug.WriteLine("");
|
Debug.WriteLine("");
|
||||||
|
|
||||||
AGLPixelFormat myAGLPixelFormat;
|
AGLPixelFormat myAGLPixelFormat;
|
||||||
IntPtr shareContextRef = IntPtr.Zero;
|
IntPtr gdevice;
|
||||||
|
|
||||||
|
OSStatus status = Carbon.API.DMGetGDeviceByDisplayID(
|
||||||
|
QuartzDisplayDeviceDriver.MainDisplay, out gdevice, false);
|
||||||
|
if (status != OSStatus.NoError)
|
||||||
|
throw new MacOSException(status, "DMGetGDeviceByDisplayID failed.");
|
||||||
|
|
||||||
// Choose a pixel format with the attributes we specified.
|
// Choose a pixel format with the attributes we specified.
|
||||||
myAGLPixelFormat = Agl.aglChoosePixelFormat(QuartzDisplayDeviceDriver.MainDisplay,
|
myAGLPixelFormat = Agl.aglChoosePixelFormat(
|
||||||
1, aglAttributes.ToArray());
|
ref gdevice, 1,
|
||||||
|
//IntPtr.Zero, 0,
|
||||||
|
aglAttributes.ToArray());
|
||||||
|
|
||||||
MyAGLReportError("aglChoosePixelFormat");
|
MyAGLReportError("aglChoosePixelFormat");
|
||||||
|
|
||||||
|
|
||||||
|
IntPtr shareContextRef = IntPtr.Zero;
|
||||||
if (shareContext != null)
|
if (shareContext != null)
|
||||||
{
|
{
|
||||||
Debug.Print("shareContext type is {0}", shareContext.GetType());
|
Debug.Print("shareContext type is {0}", shareContext.GetType());
|
||||||
|
@ -216,7 +225,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
internal void SetFullScreen()
|
internal void SetFullScreen()
|
||||||
{
|
{
|
||||||
Agl.aglSetFullScreen(contextRef, 0, 0, 0, 0);
|
Agl.aglSetFullScreen(contextRef, 640, 480, 60, 0);
|
||||||
}
|
}
|
||||||
internal void UnsetFullScreen()
|
internal void UnsetFullScreen()
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace OpenTK.Platform.MacOS
|
namespace OpenTK.Platform.MacOS
|
||||||
|
@ -279,7 +280,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
/*
|
/*
|
||||||
** Pixel format functions
|
** Pixel format functions
|
||||||
*/
|
*/
|
||||||
[DllImport(agl)] internal static extern AGLPixelFormat aglChoosePixelFormat(AGLDevice gdevs, int ndev, int []attribs);
|
[DllImport(agl)] internal static extern AGLPixelFormat aglChoosePixelFormat(ref AGLDevice gdevs, int ndev, int []attribs);
|
||||||
[DllImport(agl)] internal static extern void aglDestroyPixelFormat(AGLPixelFormat pix);
|
[DllImport(agl)] internal static extern void aglDestroyPixelFormat(AGLPixelFormat pix);
|
||||||
[DllImport(agl)] internal static extern AGLPixelFormat aglNextPixelFormat(AGLPixelFormat pix);
|
[DllImport(agl)] internal static extern AGLPixelFormat aglNextPixelFormat(AGLPixelFormat pix);
|
||||||
[DllImport(agl)] static extern byte aglDescribePixelFormat(AGLPixelFormat pix, int attrib, out int value);
|
[DllImport(agl)] static extern byte aglDescribePixelFormat(AGLPixelFormat pix, int attrib, out int value);
|
||||||
|
@ -331,11 +332,40 @@ namespace OpenTK.Platform.MacOS
|
||||||
/*
|
/*
|
||||||
** Drawable Functions
|
** Drawable Functions
|
||||||
*/
|
*/
|
||||||
[DllImport(agl)] internal static extern byte aglSetDrawable(AGLContext ctx, AGLDrawable draw);
|
[DllImport(agl,EntryPoint="aglSetDrawable")]
|
||||||
|
static extern byte _aglSetDrawable(AGLContext ctx, AGLDrawable draw);
|
||||||
|
|
||||||
|
internal static void aglSetDrawable(AGLContext ctx, AGLDrawable draw)
|
||||||
|
{
|
||||||
|
byte retval = _aglSetDrawable(ctx, draw);
|
||||||
|
|
||||||
|
if (retval == 0)
|
||||||
|
{
|
||||||
|
AglError err = GetError();
|
||||||
|
|
||||||
|
throw new MacOSException(err, ErrorString(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
[DllImport(agl)] static extern byte aglSetOffScreen(AGLContext ctx, int width, int height, int rowbytes, IntPtr baseaddr);
|
[DllImport(agl)] static extern byte aglSetOffScreen(AGLContext ctx, int width, int height, int rowbytes, IntPtr baseaddr);
|
||||||
[DllImport(agl)] internal static extern byte aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device);
|
|
||||||
[DllImport(agl)] static extern AGLDrawable aglGetDrawable(AGLContext ctx);
|
[DllImport(agl)] static extern AGLDrawable aglGetDrawable(AGLContext ctx);
|
||||||
|
|
||||||
|
[DllImport(agl, EntryPoint = "aglSetFullScreen")]
|
||||||
|
static extern byte _aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device);
|
||||||
|
internal static void aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device)
|
||||||
|
{
|
||||||
|
byte retval = _aglSetFullScreen(ctx, width, height, freq, device);
|
||||||
|
|
||||||
|
if (retval == 0)
|
||||||
|
{
|
||||||
|
AglError err = GetError();
|
||||||
|
Debug.Print("AGL Error: {0}", err);
|
||||||
|
Debug.Indent();
|
||||||
|
Debug.Print(ErrorString(err));
|
||||||
|
Debug.Unindent();
|
||||||
|
|
||||||
|
throw new MacOSException(err, ErrorString(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
** Virtual screen functions
|
** Virtual screen functions
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -848,6 +848,11 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DllImport(carbon)]
|
||||||
|
internal unsafe static extern OSStatus DMGetGDeviceByDisplayID(
|
||||||
|
IntPtr displayID, out IntPtr displayDevice, Boolean failToMain);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -19,7 +19,11 @@ namespace OpenTK.Platform.MacOS
|
||||||
{
|
{
|
||||||
this.errorCode = errorCode;
|
this.errorCode = errorCode;
|
||||||
}
|
}
|
||||||
|
internal MacOSException(Agl.AglError errorCode, string message)
|
||||||
|
: base(message)
|
||||||
|
{
|
||||||
|
this.errorCode = (OSStatus)errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
public OSStatus ErrorCode
|
public OSStatus ErrorCode
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue