locked
SurfaceImageSource and D3D_FEATURE_LEVEL_9_3

    Question

  • I've almost finished an app that uses Direct2D to draw on a Xaml based layout using SurfaceImageSource.

    Since I'm trying to pass the certification, I had to test using lesser Direct3D feature levels, as the Windows App Cert Kit does.

    I've found that BeginDraw(...) called on ISurfaceImageSourceNative returns E_FAIL with any Direct3D 9.x hardware feature level modes (I'm using DXCPL.exe to force the app to use the desired feature level).

    Is this a bug or a known limitation?

    Since ARM apps require support for 9.x hardware feature level, this would block my app from being published on the Arm Windows Store.

    The XAML/Direct2D interop documentation makes no mention of D3D hardware feature levels limitations:

    http://msdn.microsoft.com/en-us/library/hh825871.aspx

    It's not just my code, I've verified that the same thing happens for example with the Direct2D App Magazine sample:

    http://code.msdn.microsoft.com/windowsapps/Magazine-Sample-2a657289

    To reproduce: 

    - build the sample from the URL above

    - run DXCPL.exe

    - add the sample .exe to the list of affected applications

    - select any 9_x setting in the lower "Feature level limit" drop down box.

    Thanks for any help,

    Flavio.

    Monday, October 15, 2012 5:01 PM

Answers

  • Hi Flavio,

    You should be able to use Direct2D and SurfaceImageSource with feature level 9_1, and I can't reproduce the problem you are running into. Both the Magazine sample and the XAML SurfaceImageSource DirectX interop sample work fine for me with the feature level limited to 9_1. I tested the limit both with DXCLP and by requesting only D3D_FEATURE_LEVEL_9_1 in my D3D11CreateDevice call.

    --Rob

    Monday, October 15, 2012 8:32 PM
    Owner
  • Hi Flavio,

    For the NVIDIA laptop it looks like you are running into a known issue with an early driver. If you upgrade the driver on that system to the latest from Windows Update or NVidia you should get correct behavior.

    I'm not sure what is going on with the other. I'm not aware of any known problems with that driver which should cause this problem, but you might check to see if there is a newer version which affects the problem.

    Beyond that, you can try debugging the app to see where it fails. I'd recommend using the simpler sample rather than the Magazine if you can reproduce the problem with that.

    --Rob

    Wednesday, November 14, 2012 12:46 AM
    Owner

All replies

  • Hi Flavio,

    You should be able to use Direct2D and SurfaceImageSource with feature level 9_1, and I can't reproduce the problem you are running into. Both the Magazine sample and the XAML SurfaceImageSource DirectX interop sample work fine for me with the feature level limited to 9_1. I tested the limit both with DXCLP and by requesting only D3D_FEATURE_LEVEL_9_1 in my D3D11CreateDevice call.

    --Rob

    Monday, October 15, 2012 8:32 PM
    Owner
  • I also could not repro it on my PC (ASUS EP121).  I wonder if it's an issue with the graphics device drivers on your PC, Flavio?

    Jim Chapman

    Tuesday, October 16, 2012 1:47 PM
  • Hi Flavio,

    You should be able to use Direct2D and SurfaceImageSource with feature level 9_1, and I can't reproduce the problem you are running into. Both the Magazine sample and the XAML SurfaceImageSource DirectX interop sample work fine for me with the feature level limited to 9_1. I tested the limit both with DXCLP and by requesting only D3D_FEATURE_LEVEL_9_1 in my D3D11CreateDevice call.

    --Rob

    I'm trying with two different computers: a laptop with an NVIDIA GeForce GT 650 M (NVIDIA driver version 8.17.12.9649, dated 03/04/2012, Microsoft Windows Hardware Compatibility Publisher) and a desktop with an ATI Radeon HD 4550 (WDDM v1.1) version 8.97.10.6 dated 19/6/2012), and I get the same results:

    - forcing the feature level with DXCPL.exe to any 9.x level I get a light blue screen, either my app or the Magazine sample

    - setting the featureLevels array passed to D3D11CreateDevice() with only 9_x levels, the call returns a NULL device.

    Are you sure you've used DXCPL correctly? It's not very intuitive, you have to select "Edit list", select the app .exe (in the AppX folder), add it to the list,  and then set the feature level limit in the lower drop-down box.

    Should I file a bug report?

    Thanks,

    Flavio.

    Wednesday, October 17, 2012 10:36 AM
  • So the plot thickens I'm afraid - I have tried to repro it on my (ASUS E121) setup, and even when I changed my code to only request D3D_FEATURE_LEVEL_9_1, I still got a SurfaceImageSource device that worked fine.  So there is definitely some inconsistency between your environment and mine.

    Jim Chapman

    Thursday, October 18, 2012 8:20 PM
  • I am seeing the same failure although changing feature levels isn't helping.

    Loading the MSFT symbols and stepping through the assembly code, here is the call stack to the comparisons that fails and throws the E_FAIL for me:

    Windows.UI.Xaml.dll!CSurfaceImageSource::BeginDraw()  + 0x61 bytes 
    Windows.UI.Xaml.dll!_SurfaceImageSource_BeginDraw()  + 0x38 bytes 
    Windows.UI.Xaml.dll!DirectUI::SurfaceImageSource::BeginDraw()  + 0x7e bytes 
    D2DInterop.dll!D2DInterop::D2DSurface::[D2DInterop::__ID2DSurfacePublicNonVirtuals]::BeginDraw(Windows::Foundation::Rect updateRect)  Line 73 + 0x4d bytes C++
    D2DInterop.dll!D2DInterop::D2DSurface::[D2DInterop::__ID2DSurfacePublicNonVirtuals]::__abi_D2DInterop___ID2DSurfacePublicNonVirtuals____abi_BeginDraw(Windows::Foundation::Rect updateRect, D2DInterop::D2DContext * * __abi_returnValue)  Line 65535 C++

    And the disassembly:

    50D423D6  cmp         ecx,eax
    50D423D8  jg          CSurfaceImageSource::BeginDraw+1AEh (50D42523h)
    50D423DE  cmp         dword ptr [ebp+18h],1
    50D423E2  jl          CSurfaceImageSource::BeginDraw+1AEh (50D42523h)
    50D423E8  cmp         edx,1
    50D423EB  jl          CSurfaceImageSource::BeginDraw+1AEh (50D42523h)
    50D423F1  cmp         dword ptr [ebx+64h],edi
    50D423F4  jne         CSurfaceImageSource::BeginDraw+90h (50D42405h)
    50D423F6  mov         esi,80004005h
    50D423FB  call        OnFailure<526> (50D427BFh) 

    edi was loaded from ebp-20;

    Friday, October 19, 2012 6:16 PM
  • I'm checking the feature level returned from D3D11CreateDevice, so I'm definitely getting the D3D_FEATURE_LEVEL_9_1. I also tested on a system with 9_3 hardware and both samples worked without error there.

    It is definitely odd that you are getting different results than both Jim and I are getting with the same samples on multiple machines.

    If you're getting a failure from D3D11CreateDevice, what is the HRESULT? That will hopefully give a hint as to why it failed.

    ISurfaceImageSource::BeginDraw returns E_FAIL if can't get its surface to draw on. From JJ's disassembly it looks like that SetDevice was not successfully called.

    --Rob

    Friday, October 19, 2012 10:16 PM
    Owner
  • That is correct.  It appears I missed a QI from ID3dDevice to my IDXGIDevice variable so I was attempting to set the device using null (which was returning S_OK so I didn't realize it).  I guess S_OK is fine for the set device (assuming you can set it to null), but it would be nice I the E_FAIL was a little more descriptive.

    Thanks.

    • Marked as answer by Jesse Jiang Monday, October 22, 2012 3:22 AM
    • Unmarked as answer by FlavioA74 Monday, October 22, 2012 9:38 AM
    Saturday, October 20, 2012 5:53 AM
  • The HRESULT I'm getting from D3D11CreateDevice is 0x887a0004. The descriptive text is (Visual Studio tooltip on the hresult): "The specified device interface or feature level is not supported on this system".
    This is the Magazine sample just like it was downloaded, only commenting the initial 4 elements of the featureLevels[] array (Renderer.cpp line 87) leaving only 9_x feature levels.
    This happens on the laptop with  NVIDIA GeForce GT 650 M  graphics card.

    On the other PC D3D11CreateDevice() always works correctly, even when passing only 9_x levels, so the problem with D3D11CreateDevice() may be specific to the laptop graphics drivers, however on both computers, the unmodified Magazine sample fails to display properly when using DXCPL.exe to limit the feature level to 9_x levels only.

    Any ideas?


    Thanks,

    Flavio.


    Monday, October 22, 2012 9:46 AM
  • Hi Flavio,

    For the NVIDIA laptop it looks like you are running into a known issue with an early driver. If you upgrade the driver on that system to the latest from Windows Update or NVidia you should get correct behavior.

    I'm not sure what is going on with the other. I'm not aware of any known problems with that driver which should cause this problem, but you might check to see if there is a newer version which affects the problem.

    Beyond that, you can try debugging the app to see where it fails. I'd recommend using the simpler sample rather than the Magazine if you can reproduce the problem with that.

    --Rob

    Wednesday, November 14, 2012 12:46 AM
    Owner