Advertisement Jump to content
Sign in to follow this  
lomateron

using CopySubresourceRegion

This topic is 1865 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 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;
 

 

Share this post


Link to post
Share on other sites
Advertisement

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

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!