Advertisement Jump to content
Sign in to follow this  
db123

DX11 is there any difference about the order of clear rendertargetview and setrendertarget in dx11?

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

in directx9, if i want to clear a surface, i must set this surface as current rendertarget, and clear it.

but in directx11, there is a render target view. i find that some codes clear all rendertargetview before set them to be current render target:

like this:

void injectRSM( ID3D10Device *device, const ReflectiveShadowMap &rsm ) 
{
			stateBlock->Capture();

			LPVs[0].clear( device );
			LPVs[0].setRenderTarget( device );

			// set the viewport
			D3D10_VIEWPORT viewport;
			viewport.TopLeftX = viewport.TopLeftY = 0;
			viewport.Width = width;
			viewport.Height = height;
			viewport.MinDepth = 0.0f;
			viewport.MaxDepth = 1.0f;

			device->RSSetViewports( 1, &viewport );
}

  is there any difference about this order?

Share this post


Link to post
Share on other sites
Advertisement

I don't know the answer to your question but 

I used it too at the start because tutorials had it, then I realize in my application I didn't really need it and I took the clear method out and gained lots of FPS

Share this post


Link to post
Share on other sites

In D3D10/D3D11 clear works regardless of whether or not you bind the render target, so it doesn't matter which order you do it.

Share this post


Link to post
Share on other sites

In D3D10/D3D11 clear works regardless of whether or not you bind the render target, so it doesn't matter which order you do it.

 

thank you.

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!