I tried emailing my patch for new PerlMagick APIs to the mailing list provided, but got bounced... it indicated that an IP address (184.108.40.206 - not mine) was listed in spam.dnsbl.sorbs.net
So in the mean time, you can find my patch at:
Here's the rest of the message that was bounced:
> You can use this address to communicate directly with the
> ImageMagick developers.
Attached is my PerlMagick patch. I notice that the trunk is in flux, so
hopefully the patch is still current.
I've completed my testing/benchmarks for my new PerlMagick APIs:
Get('Quantum') - returns IM's cache depth.
ImageToPointer() - returns a C pointer to IM's image cache.
SyncPointer() - syncs IM's image cache.
I decided not to add a PointerToImage API - as much as I'd like to share a
pointer between the GPU and IM, there are cases where OpenGL can release a
pointer, which would cause a seg-fault in IM. I may revisit this again in
That said, just adding the ImageToPointer API has provided a 188X
performance improvement over ImageToBlob:
ImageToBlob + glTexImage2D_s: 44.789 FPS
GetPixels + glTexImage2D_p: 45.595 FPS
ImageToPointer + glTexImage2D_c: 8614.444 FPS
ImageToBlob returns a pointer to IM's image cache - without copying.
Granted, this will only work for small or memory-mapped caches - but this is
generally the case for OpenGL textures. POGL's "_c" APIs take C pointers
directly (without copying/casting/converting) - so they'll give you nearly
the same performance as C APIs.
Since the cache size depends on IM's quantum-depth, I've added a 'Quantum'
parameter to Get. I've also added a SyncPointer to sync the cache after
it's been updated via OpenGL.
Developer's note: IM's cache is stored in BGRA format, with the alpha
channel inverted. OpenGL supports BGRA, RGBA8 and RGBA16; some newer GPUs
support RGB32F (float), but not RGBA32 (long), so this interface will most
likely be used with Q8, Q16 and possibly High Dynamic Range. Until OpenGL
adds an RGBA32, Q32 will work for VBOs, but not textures.
As indicated, I've attached a diff/patch file of my changes. Let me know
what beta version this will be tagged with, so that POGL apps can detect
whether or not ImageToPointer support is available.
Input/feedback appreciated! - Bob