struct DrawInfo dri_Depth contains wrong value

This forum is for general developer support questions.
Post Reply
chris
Posts: 564
Joined: Sat Jun 18, 2011 12:05 pm
Contact:

struct DrawInfo dri_Depth contains wrong value

Post by chris »

I'm trying to find out the depth of the screen I'm running on. To do this, I've got a DrawInfo structure through GetScreenDrawInfo(), and queried the dri_Depth value.

It always returns 8 on screens with a depth >= 8.

Unless this is some sort of compatiblity kludge (in which case I'd like to know (a) why, and (b) how to find out the *actual* screen depth), there seems to be a bug in that the DrawInfo structure, dri_Depth field does not report the correct screen depth.

I've attached example code. It's easy to test by switching Workbench's screenmode and re-running the executable.
Attachments
depthtest.zip
Show WB screen depth
(2.82 KiB) Downloaded 580 times
User avatar
LyleHaze
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 525
Joined: Sat Jun 18, 2011 5:06 pm
Location: North Florida, near the Big Bend

Re: struct DrawInfo dri_Depth contains wrong value

Post by LyleHaze »

This might help, from Picasso96API.doc:

In the original graphics.library, bitmaps were always planar and
could hold up to eight bitplanes. With the Picasso96 graphics
system, there is also support for chunky, hicolor and truecolor
bitmaps.

When using Picasso96 bitmaps, never look into the BitMap structure
directly, but use the GetBitMapAttr() and p96GetBitMapAttr() query
functions. Especially the plane pointer entries are no longer valid.
Under no circumstances try to use them in any way!
chris
Posts: 564
Joined: Sat Jun 18, 2011 12:05 pm
Contact:

Re: struct DrawInfo dri_Depth contains wrong value

Post by chris »

LyleHaze wrote:This might help, from Picasso96API.doc:

In the original graphics.library, bitmaps were always planar and
could hold up to eight bitplanes. With the Picasso96 graphics
system, there is also support for chunky, hicolor and truecolor
bitmaps.

When using Picasso96 bitmaps, never look into the BitMap structure
directly, but use the GetBitMapAttr() and p96GetBitMapAttr() query
functions. Especially the plane pointer entries are no longer valid.
Under no circumstances try to use them in any way!
Hmm, I'm not touching the BitMap structure, but I suppose I could.

I've changed it to:

Code: Select all

depth = GetBitMapAttr(screen->RastPort.BitMap, BMA_DEPTH);
And this returns the correct thing (except it sees a 32-bit screenmode as having a 24-bit BitMap).

That's solved my problem, anyway. Thanks.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 534
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland
Contact:

Re: struct DrawInfo dri_Depth contains wrong value

Post by salass00 »

And this returns the correct thing (except it sees a 32-bit screenmode as having a 24-bit BitMap).
Which it is, 24 bits of RGB data + 8 bits of padding.

If you need more detailed information about which RGB format is used you need to use p96GetBitMapAttr() (use it with P96BMA_ISP96 first to make sure it's a P96 bitmap). P96BMA_BITSPERPIXEL should return 32 for your 32-bit bitmap while P96BMA_DEPTH will return the actual depth of the bitmap same as BMA_DEPTH.
Post Reply