[Mesa-dev] [PATCH 2/2] wglinfo: query and report multisample information
Jose Fonseca
jfonseca at vmware.com
Mon Jun 9 15:39:10 PDT 2014
----- Original Message -----
> On 06/09/2014 11:38 AM, Jose Fonseca wrote:
> >
> >
> > ----- Original Message -----
> >> On 06/09/2014 07:22 AM, Jose Fonseca wrote:
> >>> I don't think that OpenGL ICD should advertise multi-sample formats via
> >>> the
> >>> standard DescribePixelFormat.
> >>> http://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt states:
> >>>
> >>> Indices are assigned to pixel formats in the following order:
> >>>
> >>> 1. Accelerated pixel formats that are displayable
> >>>
> >>> 2. Accelerated pixel formats that are displayable and which have
> >>> extended attributes
> >>>
> >>> 3. Generic pixel formats
> >>>
> >>> 4. Accelerated pixel formats that are non displayable
> >>>
> >>> ChoosePixelFormat will never select pixel formats from either group
> >>> 2 or group 4. Each pixel format in group 2 is required to appear
> >>> identical to some pixel format in group 1 when queried by
> >>> DescribePixelFormat. Consequently, ChoosePixelFormat will always
> >>> select a format from group 1 when it might otherwise have selected
> >>> a
> >>> format from group 2. Pixel formats in group 4 cannot be accessed by
> >>> ChoosePixelFormat at all.
> >>>
> >>> That is, IIUC, in order to discover multi-sampled formats one must get
> >>> the
> >>> the number of pixel formats via
> >>> wglGetPixelFormatAttribivARB(WGL_NUMBER_PIXEL_FORMATS_ARB) instead of
> >>>
> >>> numVisuals = DescribePixelFormat(hdc, 1,
> >>> sizeof(PIXELFORMATDESCRIPTOR),
> >>> NULL);
> >>> if (numVisuals == 0)
> >>> return;
> >>>
> >>> And I'm not even sure if it is OK to call DescribePixelFormat() with
> >>> extended pixel formats or if one must use exclusively
> >>> wglGetPixelFormatAttribivARB/wglGetPixelFormatAttribivARB. You can see
> >>> how GLFW does it on
> >>> https://github.com/glfw/glfw/blob/master/src/wgl_context.c#L144
> >>
> >> Nothing's ever easy on Windows. <sigh>
> >
> > No. OPENGL32.DLL interface
> >
> >> The code as-is seems to work fine both on a Windows/nvidia host and in
> >> the guest but I'll try the changes you suggested...
> >
> > Is wglinfo displaying multi-sampled pixelformats on NVIDIA as is? If so
> > then my interpretation might be wrong somehow.
>
> Yes. I'm attaching the output of wglinfo on a windows/nvidia host w/
> the patch in question.
Interesting. So indeed it does seem that either I'm misinterpreting (may be both group 1 and 2 are supposed to be exposed to Describe/ChoosePixelFormat, and not just group 1 as I initially though), or NVIDIA opted for non-strict conformance. I'll need to re-read the spec and our wgl state tracker more closely.
Either way, it seems that if all MSAA pixelformats have a non-MSAA correspondent, and that these non-MSAA pixelformats are listed first, then ChoosePixelFormat will never pick a later pixel format by mistake.
It wouldn't hurt to eventually extend wglinfo to iterate over WGL_NUMBER_PIXEL_FORMATS_ARB though -- as it might show additional pixel formats (group 4?), at least for some GL drivers out there. But if/when to do that is entirely up to you.
Jose
More information about the mesa-dev
mailing list