Jump to content

  • Log In with Google      Sign In   
  • Create Account


copy contents within the same surface


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
3 replies to this topic

#1 llyzs.vic   Members   -  Reputation: 101

Like
0Likes
Like

Posted 15 December 2012 - 07:44 AM

Hi,

I am writing a program with Direct3D 9Ex. In certain requirement I have to copy (not stretch) a rectangle of a render target surface (which has something rendered) into the same surface, possibly overlapped. SctrechRect clearly does not support it; setting the render target as a texture and render to itself does not work either. So what is the fastest way to do it? I am aware that I can create a staging surface and does two copy operations but it looks really silly. In my program such operation has to be done multiple times per frame so I want to know if there's a faster way.

Thanks!

Sponsor:

#2 MJP   Moderators   -  Reputation: 10632

Like
0Likes
Like

Posted 15 December 2012 - 10:09 PM

Your only option with D3D9 is to copy to an intermediate texture first, and then read from that when writing to the original render target texture.

#3 llyzs   Members   -  Reputation: 103

Like
0Likes
Like

Posted 16 December 2012 - 12:53 AM

Your only option with D3D9 is to copy to an intermediate texture first, and then read from that when writing to the original render target texture.


Thanks! So is it possible in D3D11? If so I could setup a D3D11 context and share the resource to it. But when I read MSDN it says CopySubresourceRegion in D3D11 also has to be done between different subresources.


Edited by Michael Tanczos, 28 December 2012 - 12:29 AM.


#4 MJP   Moderators   -  Reputation: 10632

Like
0Likes
Like

Posted 17 December 2012 - 01:36 AM

In D3D11 you can use unordered access views for read and write access to a texture from a pixel or compute shader. However you have to be careful about cross-thread synchronization, although in your case you should be okay as long as any given output pixel is only read from and written to by a single thread.




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