mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 18:25:38 +00:00
Debugging crash on X11 32bits.
This commit is contained in:
parent
53f2e4c48f
commit
d19466956b
|
@ -134,7 +134,7 @@ namespace Examples.Tutorial
|
|||
|
||||
private void DrawCube()
|
||||
{
|
||||
GL.Begin(GL.Enums.BeginMode.QUADS);
|
||||
GL.Begin(GL.Enums.BeginMode.QUADS);
|
||||
|
||||
GL.Color3(1.0f, 0.0f, 0.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
|
@ -164,7 +164,7 @@ namespace Examples.Tutorial
|
|||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
|
||||
GL.Color3(0.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace OpenTK.Platform
|
|||
/// Constructs a new DisplayMode with default values.
|
||||
/// </summary>
|
||||
public DisplayMode()
|
||||
: this(0, 0, new ColorDepth(32), 0, 0, 0, 0, false, false, false, 0.0f)
|
||||
: this(0, 0, new ColorDepth(32), 16, 0, 0, 0, false, false, false, 0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ namespace OpenTK.Platform
|
|||
/// <param name="width">The Width of the DisplayMode in pixels.</param>
|
||||
/// <param name="height">The Height of the DisplayMode in pixels.</param>
|
||||
public DisplayMode(int width, int height)
|
||||
: this(width, height, new ColorDepth(32), 0, 0, 0, 0, false, false, false, 0.0f)
|
||||
: this(width, height, new ColorDepth(32), 16, 0, 0, 0, false, false, false, 0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -199,9 +199,10 @@ namespace OpenTK.Platform
|
|||
{
|
||||
return string.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
"{0}x{1}, {2}, {3}Hz",
|
||||
"{0}x{1}, rgba: {2}, depth: {3}, refresh {4}Hz",
|
||||
Width, Height,
|
||||
Color.ToString(),
|
||||
Color.ToString(),
|
||||
DepthBits,
|
||||
RefreshRate
|
||||
);
|
||||
}
|
||||
|
|
|
@ -552,7 +552,7 @@ XF86VidModeGetGammaRampSize(
|
|||
public override string ToString()
|
||||
{
|
||||
// return base.ToString();
|
||||
return String.Format("VisualInfo: id ({0}), screen ({1}), depth ({2}), class ({3})",
|
||||
return String.Format("id ({0}), screen ({1}), depth ({2}), class ({3})",
|
||||
visualid, screen, depth, @class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -304,16 +304,13 @@ namespace OpenTK.Platform.X11
|
|||
internal extern static IntPtr ChooseVisual(IntPtr dpy, int screen, IntPtr attriblist);
|
||||
|
||||
internal static IntPtr ChooseVisual(IntPtr dpy, int screen, int[] attriblist)
|
||||
{
|
||||
GCHandle h0 = GCHandle.Alloc(attriblist, GCHandleType.Pinned);
|
||||
|
||||
try
|
||||
{
|
||||
return ChooseVisual(dpy, screen, h0.AddrOfPinnedObject());
|
||||
}
|
||||
finally
|
||||
{
|
||||
h0.Free();
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed (int* attriblist_ptr = attriblist)
|
||||
{
|
||||
return ChooseVisual(dpy, screen, (IntPtr)attriblist_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -834,7 +834,7 @@ namespace OpenTK.Platform.X11
|
|||
}
|
||||
|
||||
[Flags]
|
||||
internal enum EventMask : long
|
||||
internal enum EventMask
|
||||
{
|
||||
NoEventMask = 0,
|
||||
KeyPressMask = 1 << 0,
|
||||
|
@ -1654,4 +1654,4 @@ namespace OpenTK.Platform.X11
|
|||
UnregisterAccelerator = 13,
|
||||
ActivateAccelerator = 14
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,11 @@ namespace OpenTK.Platform.X11
|
|||
/// </summary>
|
||||
internal class WindowInfo : IWindowInfo
|
||||
{
|
||||
internal WindowInfo() { }
|
||||
internal WindowInfo()
|
||||
{
|
||||
visinfo = new VisualInfo();
|
||||
}
|
||||
|
||||
internal WindowInfo(WindowInfo parent)
|
||||
{
|
||||
this.TopLevelWindow = parent.TopLevelWindow;
|
||||
|
|
|
@ -187,7 +187,7 @@ namespace OpenTK.Platform.X11
|
|||
{
|
||||
Debug.WriteLine("Creating visual.");
|
||||
Debug.Indent();
|
||||
/*
|
||||
|
||||
ColorDepth color = new ColorDepth(24);
|
||||
int depthBits = 16;
|
||||
|
||||
|
@ -206,10 +206,15 @@ namespace OpenTK.Platform.X11
|
|||
visualAttributes.Add((int)depthBits);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE);
|
||||
*/
|
||||
|
||||
Debug.Print("Requesting visual: {0}... ", mode.ToString());
|
||||
|
||||
/*
|
||||
Debug.Print("Requesting DisplayMode: {0}. ", mode.ToString());
|
||||
// Hack; Temp workaround for invalid depth of 24
|
||||
if (mode.DepthBits == 24)
|
||||
{
|
||||
mode.DepthBits = 16;
|
||||
Debug.WriteLine("Temporary workaround applied: depth changed to 16.");
|
||||
}
|
||||
|
||||
List<int> visualAttributes = new List<int>();
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RED_SIZE);
|
||||
|
@ -219,23 +224,23 @@ namespace OpenTK.Platform.X11
|
|||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.BLUE_SIZE);
|
||||
visualAttributes.Add((int)mode.Color.Blue);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE);
|
||||
visualAttributes.Add((int)mode.Color.Alpha);
|
||||
visualAttributes.Add((int)mode.Color.Alpha);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE);
|
||||
visualAttributes.Add((int)mode.DepthBits);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE);
|
||||
|
||||
*/
|
||||
visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, visualAttributes.ToArray());
|
||||
if (visual == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Requested visual not available.");
|
||||
throw new ApplicationException("Requested mode not available.");
|
||||
}
|
||||
visualInfo = (VisualInfo)Marshal.PtrToStructure(visual, typeof(VisualInfo));
|
||||
Debug.Print("Got visual: {0}", visualInfo.ToString());
|
||||
windowInfo.VisualInfo = (VisualInfo)Marshal.PtrToStructure(visual, typeof(VisualInfo));
|
||||
Debug.Print("Got visual: {0}", windowInfo.VisualInfo.ToString());
|
||||
|
||||
Debug.Unindent();
|
||||
|
||||
return visualInfo;
|
||||
return windowInfo.VisualInfo;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -247,7 +252,7 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
internal VisualInfo XVisualInfo
|
||||
{
|
||||
get { return this.visualInfo; }
|
||||
get { return windowInfo.VisualInfo; }
|
||||
}
|
||||
|
||||
internal IntPtr XColormap
|
||||
|
|
|
@ -247,23 +247,23 @@ namespace OpenTK.Platform.X11
|
|||
window.VisualInfo = glContext.CreateVisual();
|
||||
|
||||
// Create a window on this display using the visual above
|
||||
Debug.Write("Creating output window... ");
|
||||
|
||||
Debug.Write("Creating output window... ");
|
||||
|
||||
XSetWindowAttributes attributes = new XSetWindowAttributes();
|
||||
attributes.colormap = glContext.colormap;
|
||||
//attributes.colormap = glContext.colormap;
|
||||
attributes.event_mask = (IntPtr)(EventMask.StructureNotifyMask |
|
||||
EventMask.SubstructureNotifyMask | EventMask.ExposureMask);
|
||||
|
||||
SetWindowValuemask mask = SetWindowValuemask.ColorMap | SetWindowValuemask.EventMask;
|
||||
|
||||
window.Handle = Functions.XCreateWindow(window.Display, window.RootWindow,
|
||||
0, 0, mode.Width, mode.Height, 0, glContext.XVisualInfo.depth,
|
||||
(int)CreateWindowArgs.InputOutput, glContext.XVisualInfo.visual, (UIntPtr)mask,
|
||||
uint mask = (uint)SetWindowValuemask.ColorMap | (uint)SetWindowValuemask.EventMask;
|
||||
|
||||
window.Handle = Functions.XCreateWindow(window.Display, /*window.RootWindow*/0,
|
||||
0, 0, mode.Width, mode.Height, 0, /*window.VisualInfo.depth*/(int)CreateWindowArgs.CopyFromParent,
|
||||
(int)CreateWindowArgs.InputOutput, window.VisualInfo.visual, (UIntPtr)mask,
|
||||
ref attributes);
|
||||
|
||||
if (window.Handle == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Could not create window.");
|
||||
throw new ApplicationException("Could not create window.");
|
||||
}
|
||||
/*
|
||||
// Set the window hints
|
||||
|
|
Loading…
Reference in a new issue