Wednesday 24 November 2010

OpenCLGL

I had another go at playing with GL images via OpenCL today. Although the GPU is currently the main bottleneck i'm a little concerned about moving stuff off and back onto it when it isn't necessary and i'm starting to run into some memory and performance issues.

The code was running but nothing was happening - no matter what I was doing nothing was being written by the opencl code to the texture memory. I was missing one crucial detail from the documentation - I wasn't acquiring the objects for OpenCL before using them. Stupid mistake.

But that was only step one. Absolutely no luck trying to get it to run from another thread - an definite requirement if i am to use it. But eventually the google came to the rescue and I found this question in the nvidia forums by a guy who answered it himself:
Just wanted to report that I had solved the problem. I just release the GL objects before drawing and reacquire them after rendering is complete. Since these rendering calls happen in the process rather than the thread, it doesn't throw any error. I can still run my kernel through the host thread.
I was also having a lot of stability issues and it turns out GLJPanel shouldn't be used at the moment, so I just changed to a GLCanvas and it seemed to fix those issues.

There's still the little matter of the application crashing when you close it - but as far as I can ascertain this is a nvidia driver bug. It seems to work ok on my ATI card. That's still a little untidy so I might have to see if it happens on microsoft windows too before deciding if I should try that route.

As with anything the more complex it becomes and the more of the API you're using the more likely you're to run into bugs or other problems, so there are risks with this. I really need some quality performance metrics to find out if there are benefits which make the risks worth it, but there's a lot of work just in that.

GOW III

I finally finished God of War III last night - i'd been playing a few hours here and there and giving up when I felt like throwing the controller around. Unfortunately about mid-way through after dying for the 20th time against one baddie I switched to easy mode ... which made it perhaps a bit too easy. But I guess it's better than giving up entirely.

It unlocked a really interesting bunch of videos which I also went through. Some of the technology is pretty nice. The segment about the Poseidon battle got me interested in playing it again to see how it looked. I'd forgotten how good it looked (a few beers in when I started) - very very impressed. I would guess they spent a lot more time on that than the last few bits of the game and it shows. Still either way, looking at the OpenGL api today I wondered how much effort and knowledge it took to turn it into something like that.

GT5 comes out tomorrow (25th here in Australia - as per usual one day behind the rest of the world), and if I get energetic I might wander down to a shop to grab it. Was a big fan of 3, not so much of 4 and somewhat disappointed in the 'hd' preview. Maybe I should wait for the reviews and the inevitable 'platinum'ning of it if it isn't much special. Hmm, apparently it still has screen tearing and frame-drops, most probably because of the rather idiotic idea to run at 1080p ... well that's a massive disappointment, to me that's about the most offensive mistake anyone can make with a video game. This entertaining partial review doesn't inspire confidence either ...

No comments: