0

The following EndDraw() function returns an HRESULT error code: http://msdn.microsoft.com/en-us/library/windows/desktop/dd371924%28v=vs.85%29.aspx

The documentation specifies:

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to the tags that were active when the error occurred.

...and then returns an HRESULT indicating the success of the operations...

I am getting a return value of -2003238911 (0x88990001) which doesn't appear on Microsoft's "Common HRESULT values" page: http://msdn.microsoft.com/en-us/library/windows/desktop/aa378137%28v=vs.85%29.aspx

I have also searched for the error code in WinError.h but can't find it there either. If it returns this code, there must be a way to find out what it means.

How do I interpret this error code to find out what went wrong?

Community
  • 1
  • 1
user974967
  • 2,928
  • 10
  • 28
  • 45
  • http://alax.info/blog/1383 gets you `0x88990001` `D2DERR_WRONG_STATE` and info on thousands (no kidding) of other `HRESULT` codes. – Roman R. Feb 11 '13 at 13:10

3 Answers3

3

You use the Google, on which the top result for that hex code has this:

D2DERR_WRONG_STATE
0x88990001
The object was not in the correct state to process the method.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd370979(v=vs.85).aspx

I don't know the first thing about graphics programming or Windows programming, but I think this answers your question, combined with the docs stating that the tag values will be given back to you referring to the point where the error occurred.

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • 1
    Thanks for the link. I know what function call is failing but am not sure why the object is not in the correct state. The error code seems slightly vague! – user974967 Feb 11 '13 at 12:22
  • 2
    For Direct2D and Direct3D debugging, the best thing to do is to enable the "debug device" which should provide additional context and information. See [Direct2D Debug Layer](http://msdn.microsoft.com/en-us/library/windows/desktop/ee794278.aspx). The only trick here is that the debug layers are OS version specific. You manually download and install Direct2D debugging for Windows 7 RTM, or install the Windows 8.x SDK to get it for Windows 7 SP1 or Windows 8.x. See [Direct3D SDK Debug Layer Tricks](http://blogs.msdn.com/b/chuckw/archive/2012/11/30/direct3d-sdk-debug-layer-tricks.aspx). – Chuck Walbourn Oct 21 '14 at 03:52
0

Last but not least..

I got the same error, till i realized that i wasn't calling ID2D1HwndRenderTarget::BeginDraw() first in order to prepare the render target for draw calls.

Loul G.
  • 997
  • 13
  • 27
0

(I just created an account to vote up the answer by Loul G. but I don't have permission to vote yet...)

I have had this same issue...

When BeginDraw() and EndDraw() are called out of order you can get HRESULT: 0X88990001

Trace back to see the order in which they are called.

Also, to help protect against this you can surround BeginDraw(), EndDraw() calls like:

bool beginCalled;
int beginCount;//for debugging
int endCount;//for debugging
//initialize variables somewhere...

void begin(){
   rendTarget>BeginDraw();
   beginCalled = true;
   beginCount++;
}

void end(){
   if(beginCalled){
      rendTarget->EndDraw();
      beginCalled = false;
   }
   endCount++;

} 

//print counts as necessary for debugging
NRCIS
  • 11