microsoft / DirectX-Graphics-Samples

This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.
MIT License
6k stars 2.02k forks source link

Missing a sample Direct3D 12 on Windows 7 + Direct2D Interop (D3D1211On12On7) #636

Open ghost opened 4 years ago

ghost commented 4 years ago

Request. It's trivial to figure out the way because ID3D12CommandQueueDownLevel presents a backbuffer to a window directly. Calling ID3D12CommandQueue.ExecuteCommandLists (to emulate D3D1211On7 sample) simply fails with"Debug Output: D3D12: Removing Device" (if you had succesfully created DxgiSurfaceRenderTarget before).

I got working empty window filled with some color, on Windows 7, but no idea how to draw DirectWrite/Direct2D now. All attempts results in a crash inside either d3d11.dll or d2d1.dll right away on calling EndDraw of constructed ID2D1RenderTarget. Amount of rearrangements of AcquireWrapperResource, Formats, ResourceBarriers flags, BeginDraw and End Draw in the code i've tried are numbered a half of hundred, which all failed. What's the trick?

walbourn commented 4 years ago

Note that D3D12_DEBUG_FEATURE_EMULATE_WINDOWS7 was introduced in Windows 10 18362, but has some major bugs particularly around presentation loops so you should make sure you are on Windows 10 19041.

ghost commented 4 years ago

I'm testing on 7 directly. EndDraw leads to crash at d3d11on12.dll+A5C4 (always), the code looks for 'DXBC' marker, but there's none. Then starts subtracting RSI register by 4 to search further without checking for boundaries, reaches allocated page limit and crashes Nice loop)

It generally seems that underlying resources in D2D which autocreated by DrawText/DrawGeometry/etc. haven't been taken into account, unlike D3D's ones. Starting to think that some d2d1on12on7.dll is required now as well.