Skip to main content
GameDev.net gamedev.net
🔒 Locked

DDraw Surface dimension question ?

Started by granat Nov 7, 2000 at 2:37 PM 11 replies 350+ views
Original Post
granat
granat
Would it be unwise of me to create surfaces of weird dimensions like 100 x 600 in video memory ? Should I try to make the width closer to the screen resolution width(640) ? I want to place some of my surfaces of equal size in one surface. If I have 6 surfaces (100 x 100) it will be far easier to place these surfaces on top of each other in the y-direction automatically. I could just as well place them next to each other. But what if I had 7 surfaces ? That would make it a waste of space as I would have to place the last under the others (wide surface problem). -- There IS something rotten in the state of Denmark -- "Yeah, I''ve seen people w/ ''so-called'' lives. They are petty and thoughtless." - Nazrix
-------------Ban KalvinB !
furby100
furby100
Surfaces must have a width divisible by 8, and be under the primary surface''s width and height on a display adapter without wide surface support. They must also be the same color depth as the primary surface. These are the only restrictions placed upon surface sizes. Apart from this surfaces can be any size you want.



Please state the nature of the debugging emergency.


sharewaregames.20m.com

Ironblayde
Ironblayde
Surfaces don''t have to have a width divisible by 8. Maybe your video card prefers them that way (and so you''re likely to get surfaces whose pitch is greater than the number of bytes required for the pixels), but a call to CreateSurface() using a width not divisible by 8 will not fail for that reason. At least, not on my computer it won''t.

-Ironblayde
 Aeon Software

The following sentence is true.
The preceding sentence is false.
"Your superior intellect is no match for our puny weapons!"
cheez_keeper
cheez_keeper
Keeping the surface width divible by 8 insures that video cards that require page flipping the memory location will not have to perform the extra page flip for the bits not lining up properly... small game performance enhancement ensues.

Brett Lynnes
cheez_keeper@hotmail.com
Brett Lynnescheez_keeper@hotmail.com
furby100
furby100
I think they only have to be divisible by four in 16-bit mode. I it helps to have surface memory quad word aligned. It also helps if you do any MMX optimisation.



Please state the nature of the debugging emergency.


sharewaregames.20m.com

Ironblayde
Ironblayde
I know it''s a good idea to have surfaces aligned in that way -- and I set my surface dimensions accordingly. I just said that the call to CreateSurface() wouldn''t fail if for some reason you didn''t use those dimension restrictions.

-Ironblayde
 Aeon Software

The following sentence is true.
The preceding sentence is false.
"Your superior intellect is no match for our puny weapons!"
granat
granat


Listen...I know I can create surfaces of practically any size (except for the width).

All I care about is that I don´t waste precious videomem.

My question still stands...
-------------Ban KalvinB !
furby100
furby100
Either way, it''s going to take up the same amount of video memory, since only the actual surface data is stored in the video memory, the COM objects are stored in system RAM. Also, the minimum amount of Video memory you''re going to have to deal with is 2 megabytes, and you are probably not going to need that for all your surfaces at any one time. If you are using 16-bit color, then 100 is already QWORD aligned, and what I said about that doesn''t matter.



Please state the nature of the debugging emergency.


sharewaregames.20m.com

furby100
furby100
quote:
Original post by Ironblayde

I know it''s a good idea to have surfaces aligned in that way -- and I set my surface dimensions accordingly. I just said that the call to CreateSurface() wouldn''t fail if for some reason you didn''t use those dimension restrictions.

-Ironblayde
 Aeon Software

The following sentence is true.
The preceding sentence is false.



It fails on my main PC but not on my laptop PC. It can fail on some PCs.





Please state the nature of the debugging emergency.


sharewaregames.20m.com

granat
granat

I don´t remember reading about those restrictions in the dx-docs ?

I never really got an answer...but never mind.....
-------------Ban KalvinB !
furby100
furby100
Well I get DDERR_INVALIDPARAMS if I try to create a surface like that on my desktop computer. I only worked out that was the problem after looking in the DX docs for ages. My laptop has actually got a very strange graphics system. The memory is completely linear (I don''t need to use lpitch, I can just use the width of the surface), and it often places surfaces right next to each other in video memory.



Please state the nature of the debugging emergency.


sharewaregames.20m.com

iwasbiggs
iwasbiggs
Don''t create surfaces in video memory unless you know the exact capabilities of the video card (or have requirements) and if your surface can be created to the correct dimensions, video cards vary widely.

Shoot for system memory (for every surface created, even primary), it never fails and ends up being some times just as fast.
___________________________Freeware development:ruinedsoft.com
cheez_keeper
cheez_keeper
It would have to be a sad video card to not be able to hold the primary surface. I have actaully tested (on a Voodoo2 and 3 chipset) with having the primary surface in system memory... for every test the FPS were ALWAYS better with it on the graphics card.


Brett Lynnes
cheez_keeper@hotmail.com
Brett Lynnescheez_keeper@hotmail.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.