Jump to content

  • Log In with Google      Sign In   
  • Create Account


Using ID3D10Resource question


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 lomateron   Members   -  Reputation: 303

Like
0Likes
Like

Posted 18 April 2013 - 10:28 AM

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();

 

 



Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 7610

Like
0Likes
Like

Posted 18 April 2013 - 12:24 PM

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, 18 April 2013 - 12:27 PM.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS