Home > Krita, Open Source > Shiva, a lot of excitement for a small achievement.

Shiva, a lot of excitement for a small achievement.

Shiva is the sister to CTL programing language I am developing, for the second class of graphics algorithms: kernels. Since both CTL and Shiva are heavily based on C, they can share a lot of code, almost the same parser and lexer, and the code generation is made by llvm.

Anyway, back to the point, a big excitement for a small achievement. Last night, I was at last, able to generate this image with Shiva:

I guess you are wondering wether their browser is broken and is unable to correcly display the image. I can’t be serious about being excited by the generation of a gray image, can I ? Well I did say it was a small achievement. The only beauty behind this image is the way it was generated:

kernel PlainGenerator
  void evaluatePixel(out pixel result)
    result[0] = 0.5;

Shiva aimed at being simple to learn, and easy to share, meaning the user don’t have to learn how to compile it, or how to find binary specific for its system, that he can use it without fear of virus, and last, but not least, that he can use it in any application, a few lines of code are enough to integrate OpenShiva in an application.

While the above image was the first to be generated, it’s allready possible to generate more sophisticated images, such as a gradient:

Or generates fractal :

While OpenShiva is currently only able to generate images, and not mix images together, which is what a kernel is about, the most difficult part of the library has been written now, all what remains to do (and it’s still a lot of work) is to connect all the bits together, and then, debug (writing the fractal generator made me discovered a ton of bugs…), and polish, and debug, and polish, and…

  1. Benoit
    24 June, 2008 at 01:15

    Man, for doing all this, how many arms do you have? Oh, wait, I suppose that this is why you called it Shiva…Anyway, the idea of using llvm to do high-performance scripting seems wonderful, and the C-like syntax is indeed a great idea, should help adoption a lot.

  2. Thomas
    24 June, 2008 at 06:42

    Cool stuff, I noted that one line about virus.The fact that your engine is implemented in C means that there is a good chance there are traditional bugs in there, like buffer overflow and the like. These can actually most of the time be exploited by a well written virus.So, please do check with valgrind and let as many experienced C-gurus look it over as possible 🙂

  3. Cyrille Berger
    24 June, 2008 at 17:54

    @benoit, hehe, to be honest the hardest part is handled by llvm 😉@thomas, yes you are definitively right, buffer overflow are a plague, you can never be fully protected from them, at best, you have taken as much protection as possible. One things that gives some protection in that area is that the actual library and llvm are written in C++ using the standard string, which reduce a lot string overflow, compared to use char*. There is also a need for protection on access to arrays inside a Shiva/CTL program, stuff like “int array[1]; array[-10000] = 10;” could give access for viruses.One other level of protection is that neither CTL nor Shiva allows “machine” code extensions and don’t provide system function.But yes, since security is one of the goal, and I invit anyone to find security issues and to report them to me.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: