OpenCL acceleration with gographics/imagick - go

I have been putting enormous effort trying to get GPU acceleration for my Imagemagick resize operations using Go and its imagick library: https://gopkg.in/gographics/imagick.v2/imagick
I have built imagemagick with OpenCL support and OpenCL acceleration works perfectly well when used in command line. However when using the resize operation in my Go code using imagick, no GPU acceleration happens. I have verified this through performance tests.
I have also tried modifying the imagick library in my own fork by adding support for explicitly initializing OpenCL (InitImageMagickOpenCL) but this provided no solution whatsoever.
I'd really appreciate if someone had a solution to this issue.
Thank you in advance.

Related

Compiling OpenGL ES 2.0 for ARM Mali on Ubuntu

I'm really asking for some help, at least to be pointed in the right direction. I'm working with a drone, the Parrot Bebop, which features a ARM Mali 400 GPU. I would like to be able to use such GPU for some image processing, for example, to correct the image provided by the fisheye camera, or things like that. The project is based on Paparazzi, and I use Ubuntu to program and compile, with an arm cross-compiler. What should I do to compile OpenGL ES 2.0 (which is supported by the GPU) programs on my platform? I understand I must obtain the GLES libraries for the ARM GPU but I don't know where to find them, or what to do.
Thank you for your help,
Davide

How do you guys debug GLSL?

I recently attempted to write some GLSL shader code and did not have much luck when the shader didn't draw what I expected (basically, everything is black on screen). Here are the tools I tried:
Nvidia NSight VS integration - It crashes right away when I start the application, try couples other application even with the simple triangle drawing and still have no luck. Search through the internet and Nvidia forum and seem it is a common issue, and didn't seems to find any solution.
glslDevil - It can start the application but then the program keeps exiting before any rendering happens, the GL Trace is
wglMakeCurrent(0, 0)
wglDeleteContext(00010000)
ChildProcess exited
Get another crash when running another application when after calling
glDeleteTexture(1, 0314EF74)
Child process exited
I have no clue what is going on.
AMD PerfStudio 2 - It seems it is the most promising tools, successfully run my application and display the required information. However, it didn't seems support debugging GLSL, I cannot step through the shader and watching the local variables etc? It seems only support DirextX shader
gDebugger - It works pretty well tool, similar to AMD PerfStudio, but again it is not a debugger, cannot step through the shader code and watching any local variables.
Printf - ?? Someone on stack overflow saying using printf, how can I do printf() in the shader?
Convert DirectX shader to GLSL - Since DirectX shader have better debugging tool, and there are tools like http://sourceforge.net/projects/hlsl2glsl/ to automatically convert the hlsl to glsl, it seems it can be an alternative. I personally didn't like this solution, and really wish I have another choice.
Can anyone suggest how you debug your GLSL? What tool you are using successfully?
I am running on:
NVidia GFX 460v2
Visual Studio 2008 and 2010
GLEW
OpenGL 2.0
You can specify extra outputs using the glDrawBuffers and then inspect that (your printf).
However that doesn't fixes anything when the primitive is outside the drawing area.
Otherwise it's old school programming by pure reasoning and mental debugging.
After many hours struggle, I finally make my NSight working on my machine, and I write up the process in here and hope it will help someone with similar problem,
Download NSight from https://developer.nvidia.com/nsight-visual-studio-edition-downloads, and it involves couple download steps, just follow the instruction. I have Nsight Tegra install before and get a NSight menu in my Visual Studio, however, when I start the graphics debugger, the application crash right away. I think the NSight integration come with the NSight Terga is broken, and reinstall the NSight follow the above link seems fix the problem
When running the NSight graphics debugger, I am not able to debug my shader code due to the fact that my app is using some incompatible function, such as
glTexImage2D()
glTexEnvf()
and much more. The graphics debugger told me I can call a tool named Nav.Launcher.exe to find out a list of incompatible functions in my application. However, I cannot find the tool in my hard drive.
Then I decide to use the gDEBugger to run my application again and turn on Breakpoints->Break On Deprecated Function. This allow my to know all deprecated functions I called in my code. After removed all deprecated functions, the NSight graphics debugger's frame debugger feature can be enabled and I can finally step through my shader code line by line in Visual Studio
Hope this help.

QtOpenGL and MacOS X -- Software rendering?

I'm developing a cross-platform application and am not very familiar with the Mac platform. I use Qt for the GUI. I use a QGLWidget to make sure the drawing (with QPainter) is done in OpenGL.
My project built fine in XCode and runs. However, drawing is slow as hell, in situations where on Windows and Linux machines speed is not an issue. The Macbook has an Nvidia GPU, whereas the Windows machine has only onboard intel graphics.
When I look at the binary, it seems that while linking to QtOpenGL lib, it does not explicitely link to the GL lib itself.
How can I test if hardware acceleration is working or software fallback rendering is doing the job?
Shouldn't my binary link to the GL lib, or is this hidden as being a recursive dependency?
The best way to see what OpenGL implementation is using is to print the value of glGetString(GL_VENDOR) and glGetString(GL_RENDERER), this should help pinpoint the problem.

Easiest way to run a simple GLES/EGL/OpenVG app on a PC?

I thought this should be easy, but... geesh! A vendor gave me a fairly simple demo program meant to showcase some trivial icon animations. The target platform is an embedded system (MX51) with accelerated OpenGL ES 2.0/OpenVG and EGL support.
Unfortunately, the demo also has an annoying dependency on a few Qt utility classes (e.g., QImage). If not for this dependency, I would compile/run the thing on the target. But I don't relish the thought of cross-compiling Qt just to run this little demo---even if there were enough room for it on the embedded board.
I hoped I might be able to run the app on a standard(ish) Ubuntu 10.04 VM, and started following these directions to make it happen. And I actually managed---like, 10 hours later---to compile everything and get a runnable binary of the demo program. However, when I run it, I see the following error:
eglCreateWindowSurface: egl error "EGL_BAD_CONFIG" (0x3005)
Sigh. Not what I wanted to see after all that effort. This seems way more difficult than it should be.
Is the embedded GL landscape really such a ghetto that I have to run even trivial programs on the target using some vendor-supplied BSP? Judging from the lack of responses to this guy's question, I'm thinking the answer might be yes. But I don't even care about acceleration (yet). I just want to run the stupidest of OpenGL ES 2/OpenVG programs on a desktop PC and get an idea of how it looks. (It doesn't matter to me whether the PC is running Linux or Windows.) How do people do this sort of thing?
There are several OpenGL ES 2.0 emulators, such as:
For ARM Mali GPUs
For PowerVR GPUs
Also very recently, AMD has posted drivers that expose OpenGL ES 2.0 on desktop.
More recently, OpenGL 4.1 exposes the GL_ARB_ES2_compatibility extension, which makes OpenGL 4.1 drivers GL ES 2.0 compatible.
For OpenVG, you can use AmanithVG GLE.
Qualcomm's OpenGL ES emulator includes OpenVG support. You can download it from http://developer.qualcomm.com

C++ Cross Platform Image Loader for OpenGL

I have tried everything from SDL to DevIL, and they have all failed for various reasons.
SDL segfaults for various reasons, and DevIL is having some weird problem where even after i include IL/ilut.h and linking everything, and including the other headers, it is not defining the functions i need to load images into opengl textures (something about USE_OPEN_GL not being defined). I am asking for any other lib out there for loading bitmaps or png's into a format i can easily convert to opengl, or a solution to the devil problem.
thanks
Both libpng and libjpeg can be rather daunting to build & use -- no wonder there are all sorts of wrapper libraries for both.
A very simple and minimal no-nonsense loader for jpg/png (and some other stuff aswell) without dependencies in a single C file is Sean Barrett's stb_image.c, if you just want to load some image files it adds absolutely minimal overhead to your program and is straightforward to use:
http://nothings.org/stb_image.c
As Adam suggests, I would also recommend to use libpng and libjpeg. You are not specifying if you write in C or C++, but if in C++, then I'd suggest to take a look at two handy thin wrappers on the both libraries: pngxx and jpegxx
LodePNG is a highly compact PNG Loader with no dependencies.
Comment on your experience with DevIL - it works flawlessly for me and many others. Why not try again to resolve your build problems? - shouldn't be too hard)
You can also try FreeImage library. It supports loading different image types and is functionally similar to DevIL, may work out of the box for you.
And about your problem with DevIL, you do not have to build ilu or ilut libraries to make DevIL functional. I would recommend you manage the OpenGL texture objects yourself, including uploading image data to OpenGL side.
SOIL is a decent lightweight one I've used before. It's actually specialized for loading OpenGL textures too.
http://lonesock.net/soil.html
you dont need ILUT to do what you want. you can simply use ilGetData() and glTexImage2d()
Loading bitmaps (.bmp) and netpbm images (.pbm, pgm, .pnm) is fairly trivial, since they store images uncompressed. For loading PNGs, use libpng. For loading JPEGs, use libjpeg. For other image types, use an appropriate library. There's a good change that slapping on 'lib' to the beginning of the image name will give you such a library, e.g. libtiff, libtga, etc.
Once you've loaded and uncompressed the raw image data, loading it into an OpenGL texture is just a matter of calling glTexImage2D() with the right parameters, and a couple of other GL state changes (e.g. how to do mipmapping).
Image Magick with either the C or C++ bindings?
http://www.imagemagick.org/script/index.php
Young but yet great enough SFML could be the one you're searching for. I've used it for numerous projects and all of 'em worked well on all my platforms (Win7 and Ubuntu).

Resources