racket / racket/gui

Windows always requests MSAA when creating an OpenGL context.

Open Beginner friendly
#235 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
68
Forks
82
PR merge metrics
No merged PRs in 30d

Description

You can see the problem here: https://github.com/racket/gui/blob/172b7d5a561b74375004decbb68a7ab471e2c53f/gui-lib/mred/private/wx/win32/gl-context.rkt#L300

If wglChoosePixelFormatARB is present on the system (which it will be for virtually everything), it will always be called with the WGL_SAMPLE_BUFFERS_ARB attribute set, even if the number of samples is set to zero. My machine happily accepts this, despite the number of MSAA samples requested being 0, and creates an MSAA target, greatly degrading rendering performance. My GPU is a nvidia 1060, driver version 460.89. This can be easily verified with Renderdoc, where the final framebuffer will be a Texture 2D MS.

I believe the correct behavior is simply omitting the WGL_SAMPLE_BUFFERS_ARB and WGL_SAMPLES_ARB parameters when the number of samples on the provided gl-config object is 0.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in gui-lib/mred/private/wx/win32/gl-context.rkt around line 300, where the Windows OpenGL pixel format is selected. Inspect the wglChoosePixelFormatARB attributes and use RenderDoc or an equivalent context check to compare zero-sample and multisample configurations. Done means a zero-sample gl-config no longer produces a multisampled framebuffer, while nonzero sample requests still work.

Written by the indexing model from the issue text.

Assessment

Domain
computer-graphics, desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.