Sign in to follow this  

Problem rendering full screen quad

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

I'm trying to render a full screen quad, but when I reset my device nothing shows up on screen.

Let me explain. I first render some terrain in 3D, which shows up after I reset my device. Before implementing HDR lights I've started to build the screen quad. Everything goes fine until I reset my device. Nothing shows on screen.

I've debugged it with PIX and after I reset my device, the mesh shows up in the "Mesh" tab, but not on the "Render tab". Everything seems to be ok in the "Mesh" tab. Before I reset my device, when I debug a pixel it shows up all the events such as "clear" and the pixel shader stuff. After I reset my device just the "clear" and "final color" events appear.

This is the shader code:

struct VertexToPixel
{
float4 Position : POSITION;
float2 TexCoords : TEXCOORD0;
};

struct PixelToFrame
{
float4 Color : COLOR0;
};

VertexToPixel SimplestVertexShader( float4 inPos : POSITION, float2 inTexCoords : TEXCOORD0)
{
VertexToPixel Output = (VertexToPixel)0;

Output.Position =inPos;
Output.Position.z = 1.0f;
Output.Position.w = 1.0f;
Output.Position.xy=Output.Position.xy/2.0f;
Output.TexCoords = inTexCoords;

return Output;
}

PixelToFrame OurFirstPixelShader(VertexToPixel PSIn)
{
PixelToFrame Output = (PixelToFrame)0;

Output.Color = 0.9f;
Output.Color.a = 1.0f;

return Output;
}

technique Simplest
{
pass Pass0
{
VertexShader = compile vs_3_0 SimplestVertexShader();
PixelShader = compile ps_3_0 OurFirstPixelShader();
}
}


This is the render code:
direct3Ddevice->SetVertexDeclaration(g_pVertexDeclHardware2);
direct3Ddevice->SetIndices(LE_TERRAIN_QuadIndexBuffer);
direct3Ddevice->SetStreamSource(0, LE_TERRAIN_ScreenQuadVertexBuffer, 0, sizeof(le_screenQuadVertexFormat));
direct3Ddevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );

LE_ENGINE_screenQuadEffect->SetTechnique("Simplest");
LE_ENGINE_screenQuadEffect->CommitChanges();
UINT numPasses;
LE_ENGINE_screenQuadEffect->Begin(&numPasses, 0);
LE_ENGINE_screenQuadEffect->BeginPass(0);

direct3Ddevice->Clear(0, NULL, D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 0, 0);
direct3Ddevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 4, 0, 2);
direct3Ddevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );

LE_ENGINE_screenQuadEffect->EndPass();
LE_ENGINE_screenQuadEffect->End();
direct3Ddevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );

I can't figure out what's wrong... I call effect.onLostDevice, effect.onResetDevice. The vertex buffer is reinitialized after the device resets. What's wrong???

Share this post


Link to post
Share on other sites
Compare the render states before and after the reset, PIX can do a full dump of them. I remember a thread where someone suddenly had fog enabled after a reset. Obviously a reset can have such nasty effects.

And I'd set states and clear before calling effect->Begin(), maybe this is problematic, too.

Share this post


Link to post
Share on other sites

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