CNA-BUG-180: Win32GlContext ignores multisample and per-channel format requests and reports the requested description as if it were granted
Evidence basis: source-verified at the pinned commit; tests exist (not executed for this page). Claims on this page were checked by reading the CNA source at commit 009d40f5; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.
DescribeFormat ignores GlContextDescription's per-channel and multisample fields, and GetContextAttributes returns the requested description verbatim, so a legacy fallback context is reported as the requested version.
- Identifier
CNA-BUG-180- Category
- Bug
- Subsystem
- Platforms
- Status
- Open
- Verified against
- CNA
009d40f5(009d40f5dd085c4e674d3479675fac84b12b3e0a) - Severity
- Low (a triage suggestion, not a project priority)
- Evidence basis
- Source-verified: read at TARGET, not executed
- Tests touching this area
- Yes: see Current tests
- Affected contract
- CNA::Platform::IPlatformGlContext::CreateContext and GetContextAttributes on the Win32 backend
Expected behaviour
GetContextAttributes is documented as returning what the driver actually granted: “A driver may grant more than was requested (a higher version, more samples) or less ... the granted values are queryable rather than assumed.” A renderer reads it to learn the real GL version and framebuffer format.
Actual behaviour at TARGET
DescribeFormat builds a PIXELFORMATDESCRIPTOR with a fixed cColorBits = 32 and cAlphaBits = 8, honouring only depth and stencil (clamped) and the double-buffer flag; it ignores GlContextDescription::redBits/greenBits/blueBits and multisampleBuffers/multisampleSamples, and Win32Window reads neither WindowDescription::renderIntent nor openGlFramebuffer. CreateContext stores granted = description (the requested values) and GetContextAttributes returns that record, so it reports the request, not the result. When wglCreateContextAttribsARB is absent or fails, the legacy bootstrap context (created with no version or profile attributes) is returned while GetContextAttributes still reports the requested version and profile.
Source locations
modules/platform/src/Win32/Win32GraphicsServices.cpp— DescribeFormat (fixed format, ignores multisample/per-channel); CreateContext (granted = description; legacy fallback); GetContextAttributes (returns the requested description)modules/platform/src/Win32/Win32Window.cpp— does not read renderIntent or openGlFramebuffermodules/platform/include/CNA/Platform/IPlatformGlContext.hpp— GetContextAttributes documents granted-not-requested values; GlContextDescription's multisample and per-channel fields
Evidence
Checked by reading DescribeFormat, CreateContext and GetContextAttributes in Win32GraphicsServices.cpp, the IPlatformGlContext contract and Win32Window's window creation at 009d40f5. Not executed (no Windows host). The Win32 conformance test only checks that the granted major version is positive, which the verbatim copy satisfies. The Development Win32 page records these WGL gaps.
Focused reproduction
No focused reproduction is known. Nothing has been invented here; the evidence above is what exists.
Current tests
Win32GraphicsServicesTests.cpp's AContextEitherIsCreatedAndUsableOrFailsExplicitly requests 3.3 Core and asserts only granted.majorVersion > 0; no test requests multisampling or a specific channel layout, or checks the reported version against the real context.
Regression test
Request multisampling and a non-default channel layout and assert either that they are honoured or that GetContextAttributes reports the real granted values (query the created context with glGetIntegerv/wglGetPixelFormatAttribivARB), not the request.
Blast radius
The direct effect at 009d40f5 is narrow. No in-tree GL renderer requests multisampling or a channel layout through GlContextDescription: EasyGL's RequestedGlContext and OpenGL4's RequestedContext ask only for a version and profile, a 24-bit depth buffer, an 8-bit stencil buffer and double buffering, which DescribeFormat honours. Nothing in the tree reads GetContextAttributes outside tests (PlatformGlContextOwner::GetAttributes has no caller). The in-tree consequence is the legacy fallback: on a driver without, or refusing, wglCreateContextAttribsARB, an EasyGL or OpenGL4 renderer that asked for a 3.3 Core context silently receives the legacy bootstrap context and nothing at context creation reports the downgrade. Out-of-tree renderers or tools built on the platform service get the requested description back instead of the granted one.
Workaround
Do not rely on Win32 GetContextAttributes for the true context version or format; query the live GL context directly.
Related pages
The same subject is explained at several altitudes. These are the neighbouring pages at each one.
- User guide
- Native platforms: Win32
- Internals
- Win32 platform internals: surfaces
- Maintainer workflow
- Modify a platform backend
- Known issues
- Bug index