Jump to content

  • Log In with Google      Sign In   
  • Create Account


using CopySubresourceRegion


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: 281

Like
0Likes
Like

Posted 08 December 2013 - 11:10 AM

I want to use CopySubresourceRegion()

I have a 50x50 2D texture

If I want to copy the first row of texels

the D3D10_BOX should be like this?

 

D3D10_BOX sourceRegion;

sourceRegion.left = 0;
sourceRegion.right = 50;
sourceRegion.top = 0;
sourceRegion.bottom = 1 ;
sourceRegion.front = 0;
sourceRegion.back = 1;
 
is that correct?
it is a little confusing, because if its just one row it should be:
sourceRegion.top = 0;
sourceRegion.bottom = 0;
and if the start location is 0 and the texels are 50 in the row I want to copy, the left and right should be:
sourceRegion.left = 0;
sourceRegion.right = 49;
 

 



Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 6354

Like
1Likes
Like

Posted 08 December 2013 - 11:23 AM

The documentation for D3D11_BOX (which is identical to a D3D10_BOX) explains this:

 

 

The values for right, bottom, and back are each one pixel past the end of the pixels that are included in the box region. That is, the values for left, top, and front are included in the box region while the values for right, bottom, and back are excluded from the box region. For example, for a box that is one pixel wide, (right - left) == 1; the box region includes the left pixel but not the right pixel.

 

As for the why, it's consistent with other similar structs used by Windows APIs for decades, such as RECT.


Edited by mhagain, 08 December 2013 - 11:24 AM.

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