Sign in to follow this  

Why does retail runtime look bad when debug works?

This topic is 4339 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, With Sirob's help, I've been working on terrain rendering. I've noticed a strange thing tho, I wonder if anyone can explain? When the app is run in debug mode ( in control panel DX settings ), it works fine, texturing polys fine with shaders. However, in retail mode, the polys are incorrectly textured so each poly is very evident. In fact, each poly looks like a repeat of all the others. Has anyone had a similar experience? Many Thanks Simon

Share this post


Link to post
Share on other sites
Did the debug runtime give any debug output? Try putting on maximum validation and full verbosity.

Maybe the debug runtime allows some bad things while doing its validation, but when the runtime is on (with no checks) these cause problems?

Also have you tried the reference device? Sorry, that is in debug only, my mistake.
Have you tried on another computer or graphics card?

Share this post


Link to post
Share on other sites
The fully validated debug runtime has a few of these:

Direct3D9: (WARN) :Stream 0 stride and vertex size, computed from the current vertex declaration or FVF, are different, which might not work with pre-DX8 drivers

I'll try and pin down the cause.




Is it anything to do with building it with d3dx9d rather than d3dx9?

Share this post


Link to post
Share on other sites
This is the part that causes that stride/FVF error:
	g_device->SetStreamSource(0, m_VB, 0, sizeof(TerrainVertex));
g_device->SetFVF( TerrainVertex::FVF );
g_device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, m_VertCount / 3);[




but this is the definition, looks alright to me:

class TerrainVertex
{
public:
D3DXVECTOR3 Position;
D3DXVECTOR3 Normal;
D3DCOLOR Color;
float u, v;
float u2, v2;

const static DWORD FVF = D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX1|D3DFVF_TEX2;
};

Share this post


Link to post
Share on other sites
Hi

Can we see your calls to DrawPrimitive, your FVF (or vertex declaration) and your vertex structure?

It seems to be saying that the stream stride you're passing in is different from your vertex size, or that your vertex structure does not correspond to your FVF or vertex declaration.

'Is it anything to do with building it with d3dx9d rather than d3dx9?'
From the warning, the debug runtime has found the difference in sizes so is probably using the correct size rather than yours, but of course the runtime does not have these checks and would just use yours.

You should always fix any errors or warnings that come up as some picky drivers will probably have problems with the causes of those warnings.

Good luck

Share this post


Link to post
Share on other sites
Beat me to it :p

That looks good...hmm

From the docs 'When a FVF vertex shader is used, the stride of the vertex stream must match the vertex size, computed from the FVF.'
I think there might be a D3DX function to compute the size from the FVF so you could try doing that and comparing the result with your 'sizeof'.
They should be the same though! I'm sure D3DCOLOR is 32 bits.

I'm sorry, I don't think I can help any more...is that the only place where you use DrawPrimitive - how are you so sure it's that place?

Share this post


Link to post
Share on other sites
Not obvious is it?!

To find it was that place, I put a breakpoint on every DP call, then stepped over them. This point caused the debug warning.

Thanks for trying

Si

Share this post


Link to post
Share on other sites
Hi Simon,

Still getting problems?

I've replied to your E-mail with some info, but maybe you could pop an image up to ImageShack so we could see what the problem looks like? If it's visible in an image. I couldn't quite figure out what the problem was.

I've recently noticed that PIX tends to mess up stuff with an MDX clone of the app, causing bad texturing, so that might have something to do with it.

Share this post


Link to post
Share on other sites
Hi Sirob.

What is PIX?

Retail image:


Debug image:



Theres a few fishy things going on - I think the far distance of the retail one is properly textured, plus I have some sort of frustrum culling problem I can't pin down. As the camera points down towards the terrain, more patches are culled! Ouch!

Share this post


Link to post
Share on other sites

This topic is 4339 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this