31 July 2023, 17:54 | #1 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,335
|
Image data and chipmem
Hi,
I noticed that ImageData from struct Image must point to chipmem otherwise it will not work (for use on a gadget or directly via intuition/DrawImage). Now wondering if it is possible to remove this limitation -- other than creating temporary data in chipmem. |
31 July 2023, 18:58 | #2 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,247
|
Two obvious answers. Obvious answer #1 is to redirect the blits to the CPU, for example with "Native" and P96. Obvious answer #2 is to use a Boopsi and there render the data with the CPU. A boopsi of the image class can be used in all places where an IntuiImage would work.
|
31 July 2023, 19:15 | #3 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,335
|
And... how do I redirect/render the blits to/with the cpu ?
On own screen i can take over planar data, but there it's a window on WB screen... |
31 July 2023, 22:08 | #4 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,247
|
You have to write your own blitter emulation, obviously. Roughly, you need to lock the layer of the target rastport, then perform a DoHookClipRects() on this layer, and implement the lower level rendering on the bitmap you receive from the above functions through your hook yourself.
|
03 August 2023, 03:10 | #5 | |
Registered User
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,649
|
Quote:
|
|
03 August 2023, 08:36 | #6 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,335
|
|
03 August 2023, 09:10 | #7 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,247
|
Unfortunately, a CPU-based blitter implementation that covers all cases correctly is "needlessly complicated" - in particular if you want to cover also RTG in such cases.
It depends on what you want to actually render as image. If the image can be constructed by usual rendering calls to the graphics library (such as drawing lines and rectangles), then it is relatively easy as you do not need to simulate the blitter but can use what is there. The advantage of the boopsi would be then that you could plug it in wherever an IntuiImage is needed (e.g. in Gadgets). If the input is a generic bitmap, it can become quite complex as it may also include changing the pixel mode, e.g. if the output is direct color (truecolor or highcolor), chunky or planar, and you need to perform clipping yourself, too. As said earlier, I would suggest to look into DoHookClipRects() as this call at least provides you with the infrastructure of splitting the (potential) blit into all the cliprects a particular rastport can have, and there are really multiple of them (visible but clipped, invisible, and superbitmap cliprects) and it is easy to miss some of them. This function at least gives a nice interface for walking all the cliprects. Anyhow. The easiest approach is probably just to depend on some other package providing CPU blitting. All you need then is a way to find out whether a bitmaps can be put into FastRAM. For that, check whether the screen bitmap is in chip. If not so, you are safe. Otherwise, if it is in chip ram, allocate a (throwaway) bitmap as invisible, non-displayable friend bitmap of the bitmap of the screen rastport. If that is in fast, you are also safe. If it is in chip, you need to put your bitmaps into chip as well. |
03 August 2023, 09:34 | #8 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,335
|
I think it may be better for me to just allocate some temporary chipmem area for copying the bitmap. If used with DrawImage calls rather than integrated into gadgets, it doesn't even need to stay there and i can recycle the buffer immediately afterwards.
This gives the extra benefit of removing alignment restrictions on bitplane data located inside of the program. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A1200 no chipmem | imi2003 | support.Hardware | 3 | 01 October 2020 21:56 |
A3000 chipmem error? | dalek | support.Hardware | 2 | 22 January 2020 00:27 |
hard drive image errors at 75% data corrupt ? | Stratplayer | support.Hardware | 1 | 19 July 2018 20:01 |
Tool for examining raw image data | roger_bratseth | Coders. General | 2 | 31 May 2018 18:36 |
ChipMEM Bug. | FOL | support.WinUAE | 4 | 09 January 2013 22:41 |
|
|