Does DirectComposition render texture?

I would like directcomposition to display texture. Is it possible?

The reason for this is that I would like to be able to visualize a gpu-accelerated transparent flash player with backlighting without backlighting before the texture. Something that is usually not possible, but which I hope to achieve with DirectComposition.

+6
source share
1 answer

It is unlikely that it is possible to quote MSDN (highlight mine)

DirectComposition does not offer any rasterization services. . An application must use some other software or hardware accelerated rasterization library, such as Direct2D or Direct3D, to populate the bitmaps that need to be compiled. Once compiled, DirectComposition transfers the contents of the bitmap to the Desktop Window Manager (DWM) for display on the screen.

As far as I know, there are only official APIs for sharing your external screens with DWM, but there is no API for reading access to the DWM surface.

What DWM allows you to redirect HWND surfaces so that you can display surfaces of other HWNDs in your window. This can be done either through DirectComposition (via CreateSurfaceFromHwnd ) or the DWM API (through DwmRegisterThumbnail ). See the example of the latter here .

If you want to go to the β€œhack route” as indicated in your comment, there are undocumented APIs that look like they can give you access on the DWM surface, in particular, DwmpDxGetWindowSharedSurface sounds promising. Someone else has already done some reverse engineering and understood the signature, but could not get it to work (the texture works, but it does black). This guy seems to have had more luck and was able to visualize window textures in 3d. I do not understand his language, but it seems to you that you need to use DwmpDxUpdateWindowSharedSurface (also undocumented).

However, you should be aware that using undocumented functions is not a good idea, Microsoft can change them at any time (even in service pack releases) or completely remove them, because they are used only by Microsoft themselves, they have no reason to maintain compatibility. There is also a good the chance that you are going to use them incorrectly (for example, you may lack the necessary synchronization and cause random crashes or, even worse).

However, since the functionality is indeed available, it is hoped that Microsoft will indeed be able to open it for use in dolls in a future version of Windows.

+3
source

Source: https://habr.com/ru/post/948447/


All Articles