DMA für alles.. well, not every pixel

Advanced game related topics
Johan_Haegg
User
User
Posts: 60
Joined: Wed Apr 30, 2003 2:25 pm
Location: Västerås
Contact:

DMA für alles.. well, not every pixel

Post by Johan_Haegg »

Been testing some DMA for those extre milliseconds i need in a alphatransparent pixelparticle-system i am codeing for a game (will draw those smoke/dirt/whatever particles as alphatransperent pixels on top of ogre)
However, i think each fourth line, it moves one step to the right.
Feels like this puts data on places in the memory buffer where it should not be, so test on your own risk

Code: Select all

Structure Lung
  l.l
EndStructure

Procedure DMAPoint32(x.w, y.w, addr.l, bpl.w)
  *memaddr.Lung = (addr.l + (y.w * bpl.w) + (x.w * 4))
  ProcedureReturn *memaddr\l
EndProcedure

Procedure DMADraw32(x.w, y.w, addr.l, bpl.w, color.l)
  *memaddr.Lung = (addr.l + (y.w * bpl.w) + (x.w * 4))
  *memaddr\l = color.l
EndProcedure  

InitSprite()
OpenScreen(640, 480, 32, "TesttheDMA")
StartDrawing(ScreenOutput())
addr.l = DrawingBuffer()
bpl.w = DrawingBufferPitch()
bpp.b = 4
FillArea(0,0,1, RGB(0,0,255))
Start.l = GetTickCount_()
For x = 0 To #ScreenX - 1
  For y = 0 To #ScreenY - 1
    DMADraw32(x, y, addr.l, bpl.w, RGB(0,0,255))
  Next y
Next x

Debug GetTickCount_() - Start.l

FlipBuffers()
Delay(3000)
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

Maybe you need to use DrawingBufferPitch/Format()?
Johan_Haegg
User
User
Posts: 60
Joined: Wed Apr 30, 2003 2:25 pm
Location: Västerås
Contact:

Post by Johan_Haegg »

bpl.w = DrawingBufferPitch()

Format is known, 32bpp (thats the x.w *4)
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

Oops 8O Sorry, hadn't noticed that before :?
Post Reply