Jump to content
  • Advertisement
Sign in to follow this  
user88

PIX Debugger strange behavior

This topic is 2953 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 here!

When i tried to debug my effect under application with PIX i was surprised its behavior. Some simptomes:

- Pixel shader function output different values than i can see upon back buffer.

float4 ShadowMapPS(...) : COLOR0;
{
float shadow;
...
return float4(0, 0, 0, shadow);
}




As you see there is example of pixel shader function named ShadowMapPS. That function calls in second pass right after phong shading pass. that function receives shadow map texture and other data and calculates shadow. black color outputs with specified alpha value on backbuffer where already phong shading is presented. Note, that shader works good in FX Composer but not in my application. Very strange things happens when i debug it. I get next values when try to debug function:
shadow == 1;
ShadowMapPS == (2362.23, 2362.23, 2362,23, 1);
Frame Buffer value == (0, 0, 0, 0);

- Other strange thing: variable changes its value with any related code after cursor go out from if statement in PIX debugger.

I compile effect with no_presader, debug, no_optimization flags. Also alpha blend is enabled.

Can be that strange behavior the reason of some div by zero??

Any help would be appreciated.

[Edited by - user88 on July 20, 2010 3:28:55 AM]

Share this post


Link to post
Share on other sites
Advertisement
Does the alpha channel get written to, or does nothing get modified by the draw call? Also, which version of the api are you using? I haven't had much luck with PIX shadier debugging either on D3D9, but D3D10 seemed to work reasonably well...

If it works in FX Composer and not your app, then probably there is a state not being set in either a shadier constant or the pipeline itself (probably alpha state I would guess...).

Share this post


Link to post
Share on other sites
Thanks for answer Jason.

I use DX9 under SlimDX.

Now effect works good with my app too. But PIX debugger still has strange behavior. It works properly till that time while it move to cycle "for" statement. Here it execute one iteration and go out even if the is no conditions for that. The yellow arrow (in the left side of effect text) holds in its position and only text cursor moves when i do step (F10) in debugger.

I thought that that is the reason of effect optimization and tried different ways to compile effect. But with no success. Now i compile effect in such way:

// using the shader debugger.
ShaderFlags shaderFlags = ShaderFlags.None;
#if DEBUG
shaderFlags |= ShaderFlags.Debug;
#endif
#if DEBUG_VS
shaderFlags |= ShaderFlags.ForceVSSoftwareNoOpt;
#endif
#if DEBUG_PS
shaderFlags |= ShaderFlags.ForcePSSoftwareNoOpt;
#endif

Share this post


Link to post
Share on other sites
It seems PIX cannot debug double cycles under DXD9 api.
In the past i have two for cycles and debugger simply go out from the cycles even if condition wasn't true.

// iterate through search region and add up depth values
for (int i=0; i<numSamples; i++)
{
for (int j=0; j<numSamples; j++)
{
float shadMapDepth = tex2D(ShadowMap, uv + float2(i*stepSize,j*stepSize)).x;
// found a blocker
if (shadMapDepth < receiver)
{
blockerSum += shadMapDepth;
blockerCount++;
foundBlocker = 1;
}
}
}



Now i changed that two for cycles by two while cyles and debugger start working good.

// iterate through search region and add up depth values
float i = 0, j = 0;
while (i<numSamples)
{
while (j<numSamples)
{
float shadMapDepth = tex2D(ShadowMap, uv + float2(i*stepSize,j*stepSize)).x;
// found a blocker
if (shadMapDepth < receiver)
{
blockerSum += shadMapDepth;
blockerCount++;
foundBlocker = 1;
}
j++;
}
i++;
}




I hope this post will save time for someone who will has the same problem. [smile]

Share this post


Link to post
Share on other sites
oh no.. early to rejoice..

now with two "whiles" it does thee iterations and left the cycles. but should be 6x6 iterations...

it seems it is unable to debug such code under dxd9 and with PIX debugger.. [oh]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!