0
votes

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?

3
alax.info/blog/1383 gets you 0x88990001 D2DERR_WRONG_STATE and info on thousands (no kidding) of other HRESULT codes.Roman R.

3 Answers

3
votes

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.

0
votes

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.

0
votes

(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