Jump to content

  • Log In with Google      Sign In   
  • Create Account


Present fails randomly on C++ Direct3D9 app


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 dario_ramos   Members   -  Reputation: 135

Like
0Likes
Like

Posted 25 April 2012 - 09:11 AM

I have a mixed .NET application (managed and unmanaged code bridged by C++/CLI wrappers) which uses unmanaged Direct3D9 9.0c to do rendering inside a control which is wrapped inside a C++/CLI class which extends System.WIndows.Forns.UserControl.

Everything has been working fine for years now, but I recently put another instance of this Direct3D9 control inside a new Windows Form. That is, I have two concurrent instances of the control. I had done that before and it worked, but now I have issues. Perhaps the problem was always there, but because it's related to a race condition, it started happening now...

Ok, the details: When I try to render an image over a texture on the new instance of the control, sometimes it works, sometimes it doesn't. And when it doesn't, nothing is rendered, and from that point onwards, all Present calls fail (I log those failures). If I close the form and open it again, it might work or not. Nasty.

If I use DXGetErrorString and DXGetErrorDescription, all I get is something like:

EFAILED Undetermined error

Not really helpful... To make matters worse, I can't reproduce the issue in my development environment; I only see it in a production box.

As far as I know, the main reason Present fails like this is a Lost Device. But I implemented the usual scheme to handle that (I can post the code if necessary), and it seems like the device is not being lost... What else can I try?

Sponsor:

#2 kubera   Members   -  Reputation: 860

Like
0Likes
Like

Posted 26 April 2012 - 12:57 PM

Hi!

Often applications fail randomly on bad pointers. I think you know it...
Maybe you would reinvestigate your code.

The other idea, not enough resources, VideoRAM. etc.
Please consider checking the debug console, also.

#3 Adam_42   Crossbones+   -  Reputation: 2361

Like
1Likes
Like

Posted 26 April 2012 - 01:46 PM

It sounds possible that it's a hardware / driver issue. I'd try updating the driver on the machine that's failing first. If possible try replacing the graphics card too.

Out of curiosity which card / driver version is causing the problems?

#4 dario_ramos   Members   -  Reputation: 135

Like
0Likes
Like

Posted 26 April 2012 - 02:54 PM

Often applications fail randomly on bad pointers. I think you know it...
Maybe you would reinvestigate your code.


If that were the case, the app would most surely crash. But it doesn't. Sometimes it renders, sometimes it doesn't. It never crashes. Based on that, I ruled out access violations, undefined behavior, and the like.


The other idea, not enough resources, VideoRAM. etc.
Please consider checking the debug console, also.


Same consideration. If resources were running out, the app wouldn't recover, or would stop rendering completely. As for checking the debug output of the runtime, that would be great, but the error only happens in a client's machine where only the Direct3D redistributable is installed. Since we operate it remotely and it's in another country, installing software is a hassle. If there is a way to capture Direct3D debug output without installing anything, I'm all eyes. Anyway, as a last resort, we could install the SDK and PIX... When we get desperate enough :P


It sounds possible that it's a hardware / driver issue. I'd try updating the driver on the machine that's failing first. If possible try replacing the graphics card too.


Good idea. It'll be quite a hassle, since we'll have to log remotely to the client machine, and maybe ask the operator over there to try changing the card. But I'll give it a shot and post back.

Out of curiosity which card / driver version is causing the problems?


I'll post this info tomorrow when I log remotely.

#5 kubera   Members   -  Reputation: 860

Like
1Likes
Like

Posted 26 April 2012 - 11:47 PM

If resources were running out, the app wouldn't recover, or would stop rendering completely.

I am no sure.
I remember an issue on the Intel GPU.
I could not render all textures. The surface become white. After closing a few instances, others started working properly.
(I think that it was done without devices recreation)
The test was made on many instances of the same Direct3D9c app. Posted Image

P. S.
I think you are right. Everything should be checked.
Good luck.

#6 dario_ramos   Members   -  Reputation: 135

Like
0Likes
Like

Posted 27 April 2012 - 07:31 AM

@Adam_42: It's an Nvidia quadro NVS 290, drivers version: 6.14.12.7533
@Everyone: We made a little change and the error seems to have disappeared. When getting the viewport dimensions, we were using ::GetWindowRect instead of ::GetClientRect. Now that we're using the second function, the error seems to not happen anymore. We came up with this idea when we compared the differences between the client's software version and ours. If the error happens again, I'll try your suggestions, that is, updating graphic drivers first, checking debgu spew later.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS