Direct3D Not working outside project?

Started by
12 comments, last by Jason Z 11 years, 2 months ago

Hi. Using DirectX9.... We have a 2D game called 9th Dawn which used DirectxSprite for rendering. We recently switched it to Direct3D rendering using D3DPT_TRIANGLELIST. This works fine when running directly from Visual Studio~ however when I take the generated .exe and try running it, I get triangle artifacts instead of textures. I have tried the .exe in an isolated folder with the exact same .dlls and data (includes textures) as the visual studio build, and also tried running the .exe in the exact same folder as Visual Studio project so it uses the same data.

Title screen comparrison:

https://dl.dropbox.com/u/15579799/dxscreens/title1.png

https://dl.dropbox.com/u/15579799/dxscreens/title2.png

In game comparrison:

https://dl.dropbox.com/u/15579799/dxscreens/game1.png

https://dl.dropbox.com/u/15579799/dxscreens/game2.png

I have no idea what's going on. I tried the release build on another computer and I got the triangle artifacts. I sent it to a friend in USA and he actually saw the correct textures.

It looks like the textures are definitely getting loaded because their colours seem correctish, it just seems to be only using the first pixel in the texture. I load textures from a DAT file buffer using D3DXCreateTextureFromFileInMemoryEx(...). I have a radeon 7950 graphics card

Could it be I need to set a render state?

Advertisement

This could happen for a lot of reasons. Are you able to see it work in release when deployed from VS?

Perception is when one imagination clashes with another

This could happen for a lot of reasons. Are you able to see it work in release when deployed from VS?

Hi Seabolt thanks for your reply. I'm only building in Release mode, which works fine if ran from VS, but the .exe it generates to the Release folder has the problem. Is that what you meant?

Ah alright. Have you tried running the exe generated in the Release folder of your solution? Does that work? Also are you error checking your asset loads?

Perception is when one imagination clashes with another

Hi Seabolt, yes I have tried running the .exe in the Release folder (no assets get loaded, no fonts or textures). I have tried running it in an isolated folder with identical assets, and the main project folder which uses the exact same assets as the VS-ran build. I get the same behaviour all the time, the .exe never renders textures properly.

I do error check my texture loads, they are being found in the DAT buffer and loaded fine. I don't understand how it can be any different than running it in VS :/

Are you using absolute paths to your assets? Try taking the exe and moving it into various folders and seeing if it will work at all.

Perception is when one imagination clashes with another

I'm using relative paths to the DAT folder, ie. "data\\datfile", the .exe does find it and load from that file correctly (along with sound effects which work). I've tried it in all possible folders

thanks

Have you tried using PIX to check what is going on in your scene rendering? It would seem that the textures aren't properly loaded for some reason - what are you using to load the textures? Are you sure that all of the runtime dependencies are installed on the machine that you are testing on?

When you take a frame grab in PIX, examine the textures that are being bound and make sure they are loaded properly - I would bet that this is the source of the issue.

Hi Jason, thanks for you reply. I'm loading textures from a DAT file, using my own error checking I can see that the DAT file IS found and textures are loaded from it. This is the function:
https://dl.dropbox.com/u/15579799/dxscreens/loadtext.JPG

I have new information on this issue. I loaded up my newest engine which has some simple d3d render calls, again in 2D. It works from the IDE in debug mode, but NOT in release mode. The generated .exe from the debug mode WORKS, but the generated .exe from the release mode doesn't work. After some googling I found out it was the /MDd to /MD flag in Project Properties->c++->code generation, as outlined in this post:

http://stackoverflow.com/questions/10526566/directx-release-build-works-through-vs2010-but-not-exe

On further reading it may be due to some directx things not being initialised in Release mode, where they are automatically initialised in debug mode, but I have no idea what that could be, even after cross referencing with a few directx tutorials~ I can't see anything I may have missed.


Here are some pics of the current issue regarding debug and release mode:
https://dl.dropbox.com/u/15579799/dxscreens/c1.jpg
https://dl.dropbox.com/u/15579799/dxscreens/c2.jpg

The problems ONLY occur with textured triangle lists. The NULL textured triangle lists (such as the white rectangle in the background) are fine. In this engine, fonts are rendered using textured triangle lists.

Thanks for suggesting PIX, I never used it before but it provided some cool information, but nothing that I could work out why the error was happening. If we isolate to the first rendered triangle list, the left 'panel' graphic, pix shows this as the current rendered image:
https://dl.dropbox.com/u/15579799/dxscreens/pix1.jpg

It shows the following location and UV coorindates, which I have checked match up with the screen dimensions and texture:
https://dl.dropbox.com/u/15579799/dxscreens/pix2.jpg

And this is the texture it is setting, showing correctly in PIX, which I assume means it loaded correctly:
https://dl.dropbox.com/u/15579799/dxscreens/pix3.jpg

So, I've learned a lot, but still no idea how on earth to fix this, I must be missing something...
I can confirm that the release build in IDE DOES WORK if I set /MDd flag, and the generated .exe also WORKS with that flag set. When changed to /MD neither work.

Any tips? Have I missed a step in the frame calls?

Can you show a screen shot of the PIX mesh window for 'Pre-' and 'Post-' vertex shader? It looks like one of the two triangles is being culled, and it would be helpful to see what w-values those triangles have before heading into the rasterizer (the xyz would be interesting too).

One other thing to try is to use the reference device and generate a PIX frame grab from that with a debug build and a release build to see if anything is different between the two, as well as to find out if it properly renders the scene. If you aren't getting any errors, and you get totally different results between debug and release builds, then it could potentially be something with your driver (have you updated recently?).

This topic is closed to new replies.

Advertisement