WGL: Fix pixel format count in a Parallels VM
In a Parallels VM wglGetPixelFormatAttribivARB returns fewer pixel
formats than DescribePixelFormat. This broke context creation on
Windows in Parallels since the changes in
2c0f34b60f
. The previous version of the
code worked accidentally.
This adds a workaround by iterating through the minimum of both counts.
It should have no effect when running on conforming implementations.
Tested on Parallels by @ dougbinks.
Closes #2191
Fixes #2406
Fixes #2467
This commit is contained in:
parent
86d7bcb124
commit
00e86d4b73
@ -47,6 +47,7 @@ video tutorials.
|
|||||||
- Bailey Cosier
|
- Bailey Cosier
|
||||||
- Noel Cower
|
- Noel Cower
|
||||||
- CuriouserThing
|
- CuriouserThing
|
||||||
|
- Bill Currie
|
||||||
- Jason Daly
|
- Jason Daly
|
||||||
- danhambleton
|
- danhambleton
|
||||||
- Jarrod Davis
|
- Jarrod Davis
|
||||||
@ -166,6 +167,7 @@ video tutorials.
|
|||||||
- Pascal Muetschard
|
- Pascal Muetschard
|
||||||
- James Murphy
|
- James Murphy
|
||||||
- Julian Møller
|
- Julian Møller
|
||||||
|
- NateIsStalling
|
||||||
- ndogxj
|
- ndogxj
|
||||||
- F. Nedelec
|
- F. Nedelec
|
||||||
- n3rdopolis
|
- n3rdopolis
|
||||||
|
@ -115,6 +115,23 @@ static int choosePixelFormatWGL(_GLFWwindow* window,
|
|||||||
if (_glfw.wgl.EXT_colorspace)
|
if (_glfw.wgl.EXT_colorspace)
|
||||||
ADD_ATTRIB(WGL_COLORSPACE_EXT);
|
ADD_ATTRIB(WGL_COLORSPACE_EXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: In a Parallels VM WGL_ARB_pixel_format returns fewer pixel formats than
|
||||||
|
// DescribePixelFormat, violating the guarantees of the extension spec
|
||||||
|
// HACK: Iterate through the minimum of both counts
|
||||||
|
|
||||||
|
const int attrib = WGL_NUMBER_PIXEL_FORMATS_ARB;
|
||||||
|
int extensionCount;
|
||||||
|
|
||||||
|
if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
|
||||||
|
1, 0, 1, &attrib, &extensionCount))
|
||||||
|
{
|
||||||
|
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||||
|
"WGL: Failed to retrieve pixel format attribute");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
nativeCount = _glfw_min(nativeCount, extensionCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
|
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||||
|
Loading…
Reference in New Issue
Block a user