locked
DirectX 9_1, D2DRenderTarget EndDraw Out of Memory Exception

    Question

  • My code works fine for DirectX 10 and up (and I'm pretty sure it used to work with 9.1 in the pre-release version of VS 2012).

    Anyway, if I now limit the feature level to 9_1, ID2D1RenderTarget::EndDraw throws an out of memory exception after a single glyph run of 16 glyphs.  Specially, the EndDraw's hresult is: Not enough storage is available to complete this operation.

    Any suggestions?


    • Edited by Mike Muir Monday, December 10, 2012 2:27 PM typo
    Sunday, December 09, 2012 3:11 PM

Answers

All replies

  • Some more detail--I'm pretty stumped at how to debug this:

    // this is in a loop that draws a few glyphs to a render target
    
    DWRITE_GLYPH_RUN glyphRun = { 0 };
    glyphRun.fontFace = m_fontFace.Get();
    glyphRun.fontEmSize = m_fontSize;
    glyphRun.glyphCount = count; // count was 1 for this test
    glyphRun.glyphIndices = glyphs;
    glyphRun.glyphAdvances = advance;
    
    D2D1_POINT_2F pos = { px, py };
    
    DebugMessage("drawing glyph...");
    d2dTarget->BeginDraw();
    d2dTarget->DrawGlyphRun(pos, &glyphRun, m_whiteBrush.Get());
    d2dTarget->EndDraw();
    This is the output:

    drawing glyph...

    drawing glyph...

    First-chance exception at 0x000007FEC57389CC in Game.exe: Microsoft C++ exception: _com_error at memory location 0x000000F30D98AD40.

    First-chance exception at 0x000007FEC57389CC in Game.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x000000F30D98C730.

    The thread 0x17cc has exited with code 0 (0x0).

    D3D11 WARNING: Using ID3D11Debug::ReportLiveDeviceObjects with D3D11_RLDO_DETAIL will help drill into object lifetimes. Objects with Refcount=0 and IntRef=0 will be eventually destroyed through typical Immediate Context usage. However, if the application requires these objects to be destroyed sooner, ClearState followed by Flush on the Immediate Context will realize their destruction.

    [ STATE_CREATION WARNING #422: LIVE_OBJECT_SUMMARY]

    D3D11 WARNING: Live ID3D11Device at 0x000000F30B786730, Refcount: 107 [ STATE_CREATION WARNING #441: LIVE_DEVICE]

    D2D DEBUG WARNING - A Draw call by a render target failed [8007000e]. Tags [0x0, 0x0].

    ERROR: Not enough storage is available to complete this operation.

    First-chance exception at 0x000007FEC57389CC in EyehookGame.exe: Microsoft C++ exception: Platform::OutOfMemoryException ^ __ptr64 at memory location 0x000000F30D98DE10. HRESULT:0x8007000E

    Monday, December 10, 2012 2:26 PM
  • Ah, found this exact same issue here:

    http://social.msdn.microsoft.com/Forums/en-US/wingameswithdirectx/thread/4d6611bd-eafc-4ac7-922a-db0b59add21e

    Checking "Disable Feature Level Upgrade" in the directx control panel with feature level 9_1 selected works.  Which, I believe, means that the code should work correctly on a system that only support feature level 9_1.

    I'm going to close this and move any further comments over to the original thread about this.

    • Marked as answer by Mike Muir Monday, December 10, 2012 2:36 PM
    Monday, December 10, 2012 2:36 PM
  • Thanks for sharing the solution.

    Best regards,

    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, December 12, 2012 8:12 AM
    Moderator