locked
App not running in 9_1 feature level

    Question

  • Hi,

    I have an xaml application which uses c++ dll containing directx stuff. When I run the app in 9_1 feature level (I set the feature level using DXCPL.exe), I am getting a blue screen and then the app crashes with System.AccessViolationException while calling d2dContext->CreateBitmapFromDxgiSurface method. Can I know how to solve this issue?

    Thanks

    Monday, October 29, 2012 1:51 PM

All replies

  • Hi,

    I am still having this issue. Can anyone give some solution?

    Thanks,

    Tuesday, October 30, 2012 12:08 PM
  • Hi Raju,

    You don't provide enough information to give you a solution. When asking for help please make sure you provide full details on what your code is doing and exactly where and how it fails.

    What do you see when you examine this in the debugger? Is d2dContext set?

    Make sure you check the return values from all of your D2D calls. If you are using any flags, settings, etc. which require a higher feature level then functions may fail and you need to be able to handle that.

    --Rob

    Wednesday, October 31, 2012 5:07 AM
    Owner
  • Hi Rob,

    I use the following code to create the device and context,

    Microsoft::WRL::ComPtr<ISurfaceImageSourceNative> nativeImgSrc;

    UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;

        D3D_FEATURE_LEVEL featureLevels[] =
        {
            D3D_FEATURE_LEVEL_11_1,
            D3D_FEATURE_LEVEL_11_0,
            D3D_FEATURE_LEVEL_10_1,
            D3D_FEATURE_LEVEL_10_0,
            D3D_FEATURE_LEVEL_9_3,
            D3D_FEATURE_LEVEL_9_2,
            D3D_FEATURE_LEVEL_9_1
        };

     ComPtr<ID3D11Device> device;
        ComPtr<ID3D11DeviceContext> context;
     D3D_FEATURE_LEVEL m_featureLevel;
    ComPtr<IDXGIDevice> dxgiDevice;

     D3D11CreateDevice(
        null,                  
        D3D_DRIVER_TYPE_HARDWARE,
        0,                        
        creationFlags,            
        featureLevels,            
        ARRAYSIZE(featureLevels), 
        D3D11_SDK_VERSION,        
        &device,                  
        &m_featureLevel,          
        &context                  
        );

     
     device.As(&dxgiDevice);

     this->nativeImgSrc->SetDevice(dxgiDevice.Get());


     ComPtr<ID2D1Device> d2dDevice;
        D2D1CreateDevice(dxgiDevice.Get(), NULL, &d2dDevice);
     d2dDevice->CreateDeviceContext( D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &this->d2dContext);

    While debugging, I found that the following call to BeginDraw returns E_FAIL result,

     ComPtr<IDXGISurface> surface;

    HRESULT hResult = this->nativeImgSrc->BeginDraw(rect, &surface, &offset);

    and subsequently, System.AccessViolationException occurs at the following call,

    d2dContext->CreateBitmapFromDxgiSurface(surface.Get(), NULL, &bitmap);

    I think IDXGISurface is not created.

    Thanks,

    Wednesday, October 31, 2012 6:21 AM