Jump to content
  • Advertisement
Sign in to follow this  
powerpill

D3DLOCKED_RECT.Pitch divisible by Bpp?

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

Is it safe to assume that D3DLOCKED_RECT.Pitch, returned from a IDirect3DTexture9->Lock() call will be divisible by the Bpp of the texture? e.g. Would a texture of format D3DFMT_A8R8G8B8 would return a pitch divisible by 4? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
My guess would be no.
If you are using a bpp of 24 they will probably pad it to the nearest 4 byte boundary, so Pitch/3 != Width

Why would you want to do this anyways? The only reason i can think of is to get the width, but im sure you can get that elsewhere, accurately and safely

Share this post


Link to post
Share on other sites
Like "anonymous poster" said, you can't assume the pitch is divisible by bpp because it might be rounded to the next 4-byte boundary. But an A8R8G8B8 texture has a pitch that is divisible by 4, since alignment won't change it.
P.S: divising the pitch by bpp is useful if you want to know how many pixels are on a scan line. It's useful if you want to iterate per pixel (e.g. incrementing a DWORD pointer on a A8R8G8B8 texture) but it can be easily avoided.

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!