Jump to content
  • Advertisement
Sign in to follow this  

Retail and Debug DX Runtime problem

This topic is 3269 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

Is there a guide on what checks the debug runtime performs compared to the retail DX runtime? The reason is that I have some pixel shaders which work fine in the debug runtime, but when in the retail they look like the shader is not referencing the correct coordinates!? Its hard to explain so here are two screenshots from the game. The only difference is the dx runtimes. Debug Retail

Share this post

Link to post
Share on other sites
I might be wrong, but I would check the values of the shader variables.

If the application is compiled in release and the problem surfaces only when switching DX runtimes, you might have a shader parameter which is not set. Something like:

float4 foobar;

The debug runtimes could assign (0,0,0,0) to it, while its values in release runtimes could be undefined.

I'm sorry but I can't think about anything better...

Share this post

Link to post
Share on other sites
Yeah its a weird one.

How would I check the values at runtime? Or is it a case of manually following the code through?

It almost looks like the texture is repeated across the full screen quad loads of times and the first line of pixels in the X direction is repeated downwards. I can't seem to find any other way of seeing whats going on!! I had the same problem using pixel shaders only. I changed the framework I have developed to use the Effects framework and it still does the same thing :(

Share this post

Link to post
Share on other sites
In theory you could use pix (but if you are using release runtimes it might not help you).

If you want a straightforward way to validate an input (like a texcoord), just output them at the beginning of the pixel shader:

return float4(In.uv.x,In.uv.y,0,1);

Or something like;

// If it's in the correct range output a green pixel, if it's not output a red pixel!
float4 col = float4(0,1,0,1);
if( In.uv.x > 1.0f )
col = float4(1,0,0,1);
return col;

If the output is different between the debug and the release runtimes, you'll know the input coordinates are wrong.

Sometimes I prefer this kind of "hacky visual debugging" instead of starting a pix experiment and spend time checking each operation performed on a single frame...

Share this post

Link to post
Share on other sites
Great method of debugging!!

Looks like the code I use to render the quad is faulty somehow :s

SCREEN_VERTEX g_Vertex[4];

D3DSURFACE_DESC texDesc, bbDesc;


// Ensure that we're directly mapping texels to pixels by offset by 0.5
// For more info see the doc page titled "Directly Mapping Texels to Pixels"
FLOAT fWidth5 = (FLOAT)bbDesc.Width - 0.5f;
FLOAT fHeight5 = (FLOAT)bbDesc.Height - 0.5f;

FLOAT fTexWidth1 = (FLOAT)bbDesc.Width / (FLOAT)texDesc.Width;
FLOAT fTexHeight1 = (FLOAT)bbDesc.Height / (FLOAT)texDesc.Height;

// Fill in the vertex values
g_Vertex[0].pos = D3DXVECTOR4(fWidth5, -0.5f, 0.0f, 1.0f);
g_Vertex[0].clr = D3DXCOLOR(0.5f, 0.5f, 0.5f, 0.66666f);
g_Vertex[0].tex1 = D3DXVECTOR2(fTexWidth1, 0.0f);

g_Vertex[1].pos = D3DXVECTOR4(fWidth5, fHeight5, 0.0f, 1.0f);
g_Vertex[1].clr = D3DXCOLOR(0.5f, 0.5f, 0.5f, 0.66666f);
g_Vertex[1].tex1 = D3DXVECTOR2(fTexWidth1, fTexHeight1);

g_Vertex[2].pos = D3DXVECTOR4(-0.5f, -0.5f, 0.0f, 1.0f);
g_Vertex[2].clr = D3DXCOLOR(0.5f, 0.5f, 0.5f, 0.66666f);
g_Vertex[2].tex1 = D3DXVECTOR2(0.0f, 0.0f);

g_Vertex[3].pos = D3DXVECTOR4(-0.5f, fHeight5, 0.0f, 1.0f);
g_Vertex[3].clr = D3DXCOLOR(0.5f, 0.5f, 0.5f, 0.66666f);
g_Vertex[3].tex1 = D3DXVECTOR2(0.0f, fTexHeight1);

// Set the FVF and the textures
this->SetConstant("cFrame", tempTex);
this->SetConstant("pFrame", g_GEngine->GetPrevFrame());

// Draw the fullscreen quad w/ texture

// Setup the effect
UINT numPasses;

this->effect->Begin(&numPasses, NULL);

for (int i = 0; i < numPasses; i++)
g_GEngine->GetDevice()->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, g_Vertex, sizeof(SCREEN_VERTEX));




Share this post

Link to post
Share on other sites
Ok managed to chase down one fault!!

Turns out I was getting the back buffers width and height from the backbuffer itself and it was passing 22 as the width and 1 as the height :S I am unsure of why this is though. Setting the values via the window height makes it work fine.

Share this post

Link to post
Share on other sites
Original post by undead
Original post by Jamoflaw
Setting the values via the window height makes it work fine.


Indeed :p rather annoying, I hadn't considered that the backbuffer may not report its correct width and height :s! Turns out my other problems were all related to that as well!!!

Thank you v much for your help

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!