11

MSDN says (Extended Window Styles):

WS_EX_NOREDIRECTIONBITMAP: The window does not render to a redirection surface. This is for windows that do not have visible content or that use mechanisms other than surfaces to provide their visual.

What does in this case "window render to a redirection surface" vs "mechanisms other than surfaces" mean? Which of these: GDI, D3D9, D3D11, D3D12 count as the former vs the latter? Am I supposed to use this extended window style when I'm just drawing using Direct3D?

  • 5
    It is an optimization to prevent the back buffer from getting created. The one that DWM (aka Aero) uses to composite the windows in your UI to the screen. Definitely not appropriate for GDI, definitely for DirectComposition, maybe for DirectX. Always easy to tell when you shouldn't use it, your winodw's client area will be invisible or features like live thumbnails and Aero Peek don't work. – Hans Passant Jul 4 '16 at 16:50
  • 7
    Kenny Kerr briefly explains what the window style does in his article Windows with C++ : High-Performance Window Layering Using the Windows Composition Engine. – IInspectable Jul 4 '16 at 17:34
3

DirectComposition is the main api that you can use to draw a window with no redirection bitmap. DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL on swapchains without DirectComposition might also trigger this mode.

One thing to worry about when using the api is that there won't necessarily be an opaque window background, so dwm can do a lot of extra work blending with things behind the window that aren't actually not visible

| improve this answer | |
  • Don't you mean "...with things behind the window that aren't actually visible?" – Glenn Slayden May 25 '17 at 1:54
5

WS_EX_NOREDIRECTIONBITMAP is for windows that use DirectComposition for rendering.

E.g. Sciter creates windows with WS_EX_NOREDIRECTIONBITMAP to support Acrylic composition effects like here:

enter image description here

This is an ordinary Win32 window (not UWP) that uses DirectComposition and WS_EX_NOREDIRECTIONBITMAP.

Rendering on such windows should be done by Direct2D means. GDI rendering is barely useful with WS_EX_NOREDIRECTIONBITMAP.

| improve this answer | |
  • I've tried the acrylic-window demo, and while doing nothing but display, it eats a constant 20% of my GPU. Is the acrylic really done using dcomp? effects? d2D? desktop duplication? Maybe this is not the place to discuss this. No offense, I'm not at all complaining, just trying to understand :-) – Simon Mourier May 3 at 7:49
  • What exactly is the "acrylic-window demo"? Anyway try usciter.exe from sciter SDK ( sciter.com/download ). It uses WS_EX_NOREDIRECTIONBITMAP and Direct2D/DirectComposition. – c-smile May 4 at 3:18
  • I mean the samples\acrylic-window\acrylic-window-sketch.htm file. I do see the acrylic effect (FYI I tried with usciter and it still takes around 20% GPU). I'm curious to how you achieve the acrylic effect with the window behind. – Simon Mourier May 4 at 6:55
  • Ah, that one. That demo runs animation so it refreshes the window with 60 FPS frequency. Yet, on my machines here Windows Task Manager shows 3-5% GPU load on that. What do you mean "acrylic effect with the window behind" ? – c-smile May 4 at 21:59
  • I don't have a dedicated GPU (it's an integrated intel one) maybe that's the reason. I mean exactly what is shown in the screenshot in your answer where the window behind the demo is blended with the demo – Simon Mourier May 5 at 5:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.