Sign in to follow this  

Using ID3D10Resource question

This topic is 1734 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 am doing this code:

 

ID3D10Resource* reSo;

shaderResourceA->GetResource(&reSo);
g_pd3dDevice->CopyResource(Text1,reSo);

shaderResourceB->GetResource(&reSo);
g_pd3dDevice->CopyResource(Text2,reSo);

 

My question is, Where do i have to call Release()?
IS it like THIS:
 
ID3D10Resource* reSo;

shaderResourceA->GetResource(&reSo);
g_pd3dDevice->CopyResource(Text1,reSo);
reSo->Release();

shaderResourceB->GetResource(&reSo);
g_pd3dDevice->CopyResource(Text2,reSo);
reSo->Release();

 

or like THIS:
 
ID3D10Resource* reSo;

shaderResourceA->GetResource(&reSo);
g_pd3dDevice->CopyResource(Text1,reSo);

shaderResourceB->GetResource(&reSo);
g_pd3dDevice->CopyResource(Text2,reSo);

reSo->Release();
reSo->Release();

 

 

Share this post


Link to post
Share on other sites

Do it the first way.  The pointer returned by GetResource is going to be different for each call (as GetResource is called on a different shader resource each time), so by doing it the second way you'll (1) leak the resource returned by your first GetResource call, (2) actually destroy the resource returned by your second, and (3) risk crashing when you come to clean up the second for real.

Edited by mhagain

Share this post


Link to post
Share on other sites

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