Archived

This topic is now archived and is closed to further replies.

Direct surface is funny!!

This topic is 5013 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 recently did a directX program which has several off screen surface holding sprite.i know that for some video card video memory isnt linear,and when you want to move from line to line,lpitch is needed to get the correct address.the funny thing is one of my off screen is 64x64 while another one is 72x80,and 64x64 one is linear on the other hand the 72x80 needs lpitch!!can somebody tell me what the hell is wrong with that thing please?

Share this post


Link to post
Share on other sites
Maybe your videocard could fit a 64x64 chunk into memory properly without requiring a pitch. Who knows. Maybe one chunk gets loaded into the video card and the other into system mem. Just be safe and use lpitch all the time.

Share this post


Link to post
Share on other sites
Very probably this is due to texture cache alignment (powers of two fill the cache completely, while otherwise the data needs to be padded to start the next scanline on a clean cache block).

Note that there''s no "standard" as to how the pitch is realized, but this is the most common way.

What is standardized is that the pitch always equals two consecutive scanline''s distance in memory, measured in bytes, and when manipulating texture data directly, you should use it always.

-Nik

Share this post


Link to post
Share on other sites