Page 1 of 1

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

Posted: Fri Nov 07, 2003 5:49 pm
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)

Posted: Fri Nov 07, 2003 6:48 pm
by dmoc
Maybe you need to use DrawingBufferPitch/Format()?

Posted: Sat Nov 08, 2003 12:15 pm
by Johan_Haegg
bpl.w = DrawingBufferPitch()

Format is known, 32bpp (thats the x.w *4)

Posted: Sat Nov 08, 2003 1:43 pm
by dmoc
Oops 8O Sorry, hadn't noticed that before :?