Hacker News new | ask | show | jobs
by Nition 2484 days ago
Man, that's a super interesting and very specific question! Wish I had enough rep to apply to reopen it.

I suspect the "too broad" closers wanted it to ask re a specific programming language. But of course in this case the asker didn't care what language they'd have to write it in (although they helpfully tagged the most likely C++ and C#).

1 comments

Indeed, very interesting question. That’s why I spent some time trying to reopen.

I happen to have experience DLL injecting into dwm.exe’s swap chains. AFAIK it’s the only way to get frames in VRAM for hardware encoding of desktop video on Win7. Desktop duplication which provides same data through officially supported API was only introduced in Win8, while desktop compositor runs on GPU since Vista (usually, i.e. when Aero is enabled). I didn’t need to process frames, just copy to another texture in VRAM shared with my capture process, which encodes them with media foundation. But the same DLL injection approach can be used to process frames in real time like OP wanted, by rendering extra pass[es] before each IDXGISwapChain::Present().