Metaprogramming GPUs with Sh
Martin Ecker writes "With the advent of powerful, programmable GPUs in consumer graphics hardware, an increasing number of shading languages to program these GPUs has become available. One quite interesting language that - in many ways - has a very different approach than other mainstream shading languages (such as Cg or the OpenGL Shading Language) is Sh. The recently released book "Metaprogramming GPUs with Sh" by Michael McCool and Stefanus Du Toit, both major contributors to the Sh project, explains the basics of the Sh high-level shading language and the corresponding API and also goes into some of the details of the implementation. The book is intended for an audience that is already familiar with traditional shader development for programmable GPUs. Also, a firm background in 3D graphics programming and C++ is a must for the interested reader." Read on for the rest.
Metaprogramming GPUs with Sh
author
Michael McCool, Stefanus Du Toit
pages
308
publisher
A K Peters
rating
7/10
reviewer
Martin Ecker
ISBN
0321197895
summary
A book that describes an interesting shading language and accompanying API to program GPUs.
Before discussing the book in more detail, I will try to give a basic overview of Sh, since most readers will not be familiar with it. For a more in-depth look at Sh, I recommend taking a look at a recently posted Gamasutra article by Michael McCool (http://www.gamasutra.com/features/20040716/mccool _01.shtml), the paper on Sh from the authors presented at the recently held SIGGRAPH 2004 conference (http://www.cgl.uwaterloo.ca/Projects/rendering/Pa pers/#algebra), and of course the Sh homepage at http://www.libsh.org.
Sh started out as a research project at the University of Waterloo (http://www.cgl.uwaterloo.ca), and it is both a shading language and a runtime API to use the Sh shaders. As a shading language Sh is embedded into C++ as a domain-specific language, which is made possible by using C++ operator overloading and by defining special tuple and matrix types that are used extensively in shader code. So instead of defining its own language that requires a full compiler, like other shading languages do, Sh uses regular C++ syntax to describe shader code, which is then dynamically (at runtime) compiled to a specific backend, such as a GPU or possibly even the CPU. In addition to compiling to a specific GPU or CPU target, Sh can also be used in a special stream mode where a shader is applied to a stream of input tuples. This is very useful for general purpose GPU programming where the GPU is basically used as an additional processor to the host CPU (see http://www.gpgpu.org for more information on the subject). Finally, Sh code can also be executed in an immediate mode where every Sh statement is directly executed on the host CPU (without being compiled into a shader program), which makes it very easy to debug shaders with any host debugger running on the CPU.
Due to the way Sh is embedded into C++, the full range of abstraction mechanisms offered by C++ can be used to structure and modularize shader code. Abstract base classes, regular functions, templates, and any other features offered by C++ can be used to develop shaders. This is an interesting consequence of the metaprogramming approach of Sh that also allows the use of software engineering principles in shader development, such as object orientation, that other shading languages currently cannot offer.
This kind of metaprogramming in C++ is used by an increasing number of libraries. For example, the Spirit parser framework (see http://spirit.sourceforge.net) uses a similar approach to describe and generate parsers directly in C++ instead of using traditional external tools, such as yacc or bison.
One of the most fascinating features of the Sh toolkit is the possibility to combine and connect shader programs to form new shader programs, which allows one to easily build complex shaders out of simple shader fragments. In a more general sense, Sh provides what can be called a shader algebra (see also the aforementioned SIGGRAPH 2004 paper), where shader programs are the objects on which special operators to combine and connect them are defined. An interesting application of this shader algebra is to specifically bind certain varying shader inputs to uniform variables and the other way around (this is what functional programming languages usually call currying). Also combining a matrix palette skinning shader with any light model shader (or any shaders that perform specific tasks, for that matter) is easily possible.
After this short introduction to the Sh toolkit, we shall now take a closer look at the book "Metaprogramming GPUs with Sh".
The book is split into three parts, an introduction, a reference, and an engineering overview.
The introduction consists of the first five chapters and discusses the basics of the Sh shading language and the API. In particular, the tuple and matrix types and the operators defined on them are presented. The way shader programs are defined and how parameters and attributes are handled is discussed, followed by the way textures are represented. Finally, the stream and channel concept used to feed data into shader programs is discussed. These introductory chapters contain a number of examples that demonstrate the presented concepts. Chapter three contains a quite interesting sample shader that uses constructive solid geometry techniques and metaprogramming in Sh to render text. While not the most useful use case, the shader shows some interesting capabilities of Sh, in particular the shader algebra operators. Chapter four on textures has some more nice sample shaders for doing shiny bump mapping, rendering wood and marble, and using Worley noise.
The second part of the book is a reference on Sh. Unlike references in many other computer books, this is not just a technical listing of the available features of Sh but is written in regular prose (with the occasional reference-like table here and there). The six chapters of the reference section describe how to setup and use the Sh library, and then discuss the available types, operators, and standard library functions more thoroughly than in the introduction. Additionally, the available backends are mentioned in the last chapter of this part of the book. A draft of the reference manual can also be found online at http://www.libsh.org/ref/online.
The final part of the book deals with engineering aspects of Sh. These final five chapters of the book discuss the details of the current implementation. The intermediate representation for shaders that is used by Sh is presented as well as how streams and textures are managed and stored internally. The interface between the Sh frontend and the various specific backends is discussed, as well as the current state of the optimizer including some further improvements that are planned in the future.
The images in the book are all in black and white except for 14 color plates in the middle of the book. The color plates and other images usually show teapots or animals, so they aren't all that exciting, but do demonstrate what the sample shaders presented in the book look like.
The book does not come with a CD-ROM, but with such a young library that is still under heavy development, putting a snapshot of the library's source code base on a CD-ROM would be a waste of resources. Sh itself as well as all sample shaders presented in the book can be downloaded from the Sh homepage at http://www.libsh.org. This website also has additional documentation, including some papers and the API reference documentation generated with Doxygen from the sources. Sh is distributed under a very liberal open source license (based on the zlib/libpng license) that also allows commercial use.
For the reader with enough expertise in 3D and shader programming, this book provides a concise and well-written introduction to Sh. The book will definitely contribute to enlarging the currently relative small user base of Sh and hopefully help the library grow and get more refined in the near future. Everyone familiar with "regular" high-level shading languages, such as Cg or the OpenGL Shading Language, should take a look at this book to see a new and interesting way of programming GPUs that the aforementioned languages do not offer.
About the review author:
The author has been involved in real-time graphics programming for more than 9 years and works as a games developer for arcade games. In his rare spare time he works on a graphics-related open source project called XEngine http://xengine.sourceforge.net.
Before discussing the book in more detail, I will try to give a basic overview of Sh, since most readers will not be familiar with it. For a more in-depth look at Sh, I recommend taking a look at a recently posted Gamasutra article by Michael McCool (http://www.gamasutra.com/features/20040716/mccool _01.shtml), the paper on Sh from the authors presented at the recently held SIGGRAPH 2004 conference (http://www.cgl.uwaterloo.ca/Projects/rendering/Pa pers/#algebra), and of course the Sh homepage at http://www.libsh.org.
Sh started out as a research project at the University of Waterloo (http://www.cgl.uwaterloo.ca), and it is both a shading language and a runtime API to use the Sh shaders. As a shading language Sh is embedded into C++ as a domain-specific language, which is made possible by using C++ operator overloading and by defining special tuple and matrix types that are used extensively in shader code. So instead of defining its own language that requires a full compiler, like other shading languages do, Sh uses regular C++ syntax to describe shader code, which is then dynamically (at runtime) compiled to a specific backend, such as a GPU or possibly even the CPU. In addition to compiling to a specific GPU or CPU target, Sh can also be used in a special stream mode where a shader is applied to a stream of input tuples. This is very useful for general purpose GPU programming where the GPU is basically used as an additional processor to the host CPU (see http://www.gpgpu.org for more information on the subject). Finally, Sh code can also be executed in an immediate mode where every Sh statement is directly executed on the host CPU (without being compiled into a shader program), which makes it very easy to debug shaders with any host debugger running on the CPU.
Due to the way Sh is embedded into C++, the full range of abstraction mechanisms offered by C++ can be used to structure and modularize shader code. Abstract base classes, regular functions, templates, and any other features offered by C++ can be used to develop shaders. This is an interesting consequence of the metaprogramming approach of Sh that also allows the use of software engineering principles in shader development, such as object orientation, that other shading languages currently cannot offer.
This kind of metaprogramming in C++ is used by an increasing number of libraries. For example, the Spirit parser framework (see http://spirit.sourceforge.net) uses a similar approach to describe and generate parsers directly in C++ instead of using traditional external tools, such as yacc or bison.
One of the most fascinating features of the Sh toolkit is the possibility to combine and connect shader programs to form new shader programs, which allows one to easily build complex shaders out of simple shader fragments. In a more general sense, Sh provides what can be called a shader algebra (see also the aforementioned SIGGRAPH 2004 paper), where shader programs are the objects on which special operators to combine and connect them are defined. An interesting application of this shader algebra is to specifically bind certain varying shader inputs to uniform variables and the other way around (this is what functional programming languages usually call currying). Also combining a matrix palette skinning shader with any light model shader (or any shaders that perform specific tasks, for that matter) is easily possible.
After this short introduction to the Sh toolkit, we shall now take a closer look at the book "Metaprogramming GPUs with Sh".
The book is split into three parts, an introduction, a reference, and an engineering overview.
The introduction consists of the first five chapters and discusses the basics of the Sh shading language and the API. In particular, the tuple and matrix types and the operators defined on them are presented. The way shader programs are defined and how parameters and attributes are handled is discussed, followed by the way textures are represented. Finally, the stream and channel concept used to feed data into shader programs is discussed. These introductory chapters contain a number of examples that demonstrate the presented concepts. Chapter three contains a quite interesting sample shader that uses constructive solid geometry techniques and metaprogramming in Sh to render text. While not the most useful use case, the shader shows some interesting capabilities of Sh, in particular the shader algebra operators. Chapter four on textures has some more nice sample shaders for doing shiny bump mapping, rendering wood and marble, and using Worley noise.
The second part of the book is a reference on Sh. Unlike references in many other computer books, this is not just a technical listing of the available features of Sh but is written in regular prose (with the occasional reference-like table here and there). The six chapters of the reference section describe how to setup and use the Sh library, and then discuss the available types, operators, and standard library functions more thoroughly than in the introduction. Additionally, the available backends are mentioned in the last chapter of this part of the book. A draft of the reference manual can also be found online at http://www.libsh.org/ref/online.
The final part of the book deals with engineering aspects of Sh. These final five chapters of the book discuss the details of the current implementation. The intermediate representation for shaders that is used by Sh is presented as well as how streams and textures are managed and stored internally. The interface between the Sh frontend and the various specific backends is discussed, as well as the current state of the optimizer including some further improvements that are planned in the future.
The images in the book are all in black and white except for 14 color plates in the middle of the book. The color plates and other images usually show teapots or animals, so they aren't all that exciting, but do demonstrate what the sample shaders presented in the book look like.
The book does not come with a CD-ROM, but with such a young library that is still under heavy development, putting a snapshot of the library's source code base on a CD-ROM would be a waste of resources. Sh itself as well as all sample shaders presented in the book can be downloaded from the Sh homepage at http://www.libsh.org. This website also has additional documentation, including some papers and the API reference documentation generated with Doxygen from the sources. Sh is distributed under a very liberal open source license (based on the zlib/libpng license) that also allows commercial use.
For the reader with enough expertise in 3D and shader programming, this book provides a concise and well-written introduction to Sh. The book will definitely contribute to enlarging the currently relative small user base of Sh and hopefully help the library grow and get more refined in the near future. Everyone familiar with "regular" high-level shading languages, such as Cg or the OpenGL Shading Language, should take a look at this book to see a new and interesting way of programming GPUs that the aforementioned languages do not offer.
About the review author:
The author has been involved in real-time graphics programming for more than 9 years and works as a games developer for arcade games. In his rare spare time he works on a graphics-related open source project called XEngine http://xengine.sourceforge.net.
You can purchase Metaprogramming GPUs with Sh from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
I thought I'd accidentally clicked on this article.
Is this the longest headline blurb ever?
Is the book review template broken or something? This is the second review in as many days that's been misclassified.
"They redundantly repeated themselves over and over again incessantly without end ad infinitum" -- ibid.
Awesome story formatting. Looks great!
Don't tell anybody about it.
Huh?
Schweet!!! I always wanted to write my own CounterStrike-like 3D FPS as a shell script! Now my uber-leet shell hacking skills can make me rock-star dollars as a video game developer!
"When the president does it, that means it's not illegal." - Richard M. Nixon
it really has to be, I thought I had hit the wrong link when I got to the page! someone wake up Tacoman and see whatup on the whois!
CB
free ipod and free gmail!
At first read I thought they ported bash to the Radeon GPU...
This is a shame, because perl's a nice quick way of working through the edit-try-edit-try-edit development process when working with OpenGL and 3D geometrical stuff in general.
I don't want to learn Yet Another Scripting Language just to try out some OpenGL routines, and I don't want to slog through a ton of C code makefile junk either. Script languages are a great help there.
[
Or, buy it from Amazon
This space for rent
poinis
Gamasutra article by Michael McCool
Gamasutra? Anybody else rofl?
i always do my low level device programming in sh. my graphics card has never been faster!
sed | awk | sed | grep | awk | sed | awk
Wave upon wave of demented avengers March cheerfully out of obscurity into the dream
hee hee
funny names
I don't need no instructions to know how to rock!!!!
What if I want to use korn or csh?
...thought that was shooting a little high for Bourne Shell...
lol, how many languages do we need? back in the day, knowing 2 or 3 languages very well (like c and some db language) would have been enough to land a job. add to that knowing another 2 or 3 languages well enough to feel comfortable doing small coding, and you have an excellent programmer. now it seems like there are so many languages, from python to cobol to fortran. there must easily be over 50. it is like if i wanted to work at the united nations and said i knew english and spanish and german, and they asked "well what about sanskrit and tagalog". how much is enough?
Come and say hi. http://forum.penpals.com/index.php
It may well be my utter ignorance of how GPUs work, but it would be nice, if possible, to have tools to utilize all of that computing power when I'm just displaying a simple GUI or text interface. I understand GPUs are heavily optimized for what they do, but I expect they're still good for general purpose tasks and might be really useful in some math-heavy applications.
Proud member of the Weirdo-American community.
The GPGPU course was at the top of my list for SIGGRAPH 2004 this year, and I was impressed with all of the presenters' material. However, in my estimation, Sh is built to more closely resemble the existing HLSL for DX and similar GLSLang from the ARB.
Brook, on the other hand, was written from a more C-like perspective, and approaches the GPU as a massively data-parallel stream processor (well, Sh does as well, but IMHO Brook achieves that aim more directly as is evidenced by things like iterator streams and similar kernels).
I'm a graphics and systems programmer at Midway Games.
I think it will be a while before sh / GPU metaprogramming will be commonly used for "real" games programming. For example, their paper on Worley shaders claimed interactive rates of 14 FPS on a very simple single model for stone shading on the fastest video hardware (6800GT) currently available.
The benefit of HLSL and Cg are that they achieve performance close to or better than the PS/VS-Asembler implementations and are orders of magnitude easier to program. This allows them to be used on hundreds of objects per frame at video game "interactive" framerates (which usually starts at 30 FPS, with 60 FPS as a gold standard, and 300 FPS or other crazy numbers as the Doom/Quake standard for some reason).
Still it's good to see that there are languages evolving that will handle more complex shading algorithms and as the hardware becomes faster in 2 or 3 years from now, this may be practical for real-time use in video games.
I just installed this "sh" thing in /bin, and now all my shell scripts run with 3D shading! This rules!!
Use Ctrl-C instead of ESC in Vim!
I was just thinking to myself, "You know what 00 these Bash scripts I wrote are clean, efficient, work well and are extremely portable across multiple platforms... but they lack pizazz." Nwo I have the perfect solution!
too bad this joke doesn't even work because the blurb was basically the whole book article anywyas
WTPOUAWYHTTOTWPA
What's the point of using acronyms when you have to type out the whole phrase anyways?
Look out for the second book, "Metaprogramming GPUs with bash", and a third and final "Metaprogramming GPUs with X11", comming soon to all fine book retailers.
CAn'T CompreHend SARcaSm?
"Also, a firm background in 3D graphics programming and C++ is a must for the interested reader."
in other words, you must be a slashdot regular
- Hi I'm Linus Torvalds and I pronounce Linux, Lih-nix..
I don't care what anyone says. With names like that the book has to be awesome.
"We can't solve problems by using the same kind of thinking we used when we created them."
#!/bin/sh
:] oh come on!!!
echo #
echo ###
echo #####
My penguin ate my sig
Seriously, what's with these people? It's not like they've never heard of bourne shell, or that they're running out of names... This is even worse and more blatant than Javascript vs Java. Sheesh!
Sh! Even before you start, that was a preemptive Sh. Just know I have a whole bag of Sh with your name on it.
In Soviet Rush, today's Tom Sawyer gets high on you.
Imagine how must fun it must be explaining to the human resource people that yes, you do have experience in sh and Sh, and yes, those are different.
Wow. It really is amazing what you can use the good ol' bourne shell for!
quidquid latine dictum sit altum videtur.
From the review, it sounds like SH is basically a library, and that library invocations are dressed up through the use of operator overloading.
Is this "metaprogramming"? Googling turns up a variety of definitions of the term, but the term sounds like it should mean writing a program which generates a program. Which is different from a library and syntactic sugar.
Is anyone working on a method of using the GPU on some of the faster video cards to offload processing power to from the cpu?
Is it even feasible?
"A free society is one where it is safe to be unpopular" --Adlai Stevenson
Unfortunately, the developers of Sh chose to publish the book which details features which are not yet supported in the library. Since the software is currently in the alpha stage of development and constantly changing, many of the examples described in their book do not work as expected (the minimal GLUT example doesn't even compile).
In short, a lot of work remains before they meet their full project goals. The name, however, which is an abbreviation of Serious Hack, seems quite appropriate.
The GPU ought to be able to be optimized for FP arithmetic, also.
This idea is not mine, but back when the first Netra came out, a couple of guys here in Houston who used to optimize Crays figured out how to use the GPU to do floating point arithmetic a whole magnitude faster than Sun knew it could be done.
My optimization skills are a little rusty, but the same architectural elements are there in the ATI graphics cards.
If some one does this, drop me a line and tell me how you did it.
"The mind works quicker than you think!"
C'mon.. someone has to make a post to point out an obvious problem like that. When I first saw this article there were no posts yet. Would you prefer I just ignore that eyesore?!
It is one place that an OS architecture which makes a clean separation of GUI and kernel would win over the mess of sundry .dlls from the Criminal Monopoly. The other place would have been the ill-fated tablet computer, had it been correctly designed, with the X serevr on the portable bit.
Because simple single-processor relatively high-performance silicon is now very affordable, the time is right to go back to parallelism, dedicated I/O and graphics processors, etc, to get even better performance.
It would be nice to have a GPU compiler to run ordinary code, such as X, but the compiler would be different for each architecture, not like AMD vs Intel, where you can use the same compiler with just the optimisations tweaked. But my thinking is to replicate a full CPU in the GPU chip or at least on the graphics card. You could put a Pentium/Athlon there, feeding the gPU as usual, fed itself from the AGP bus or its successor via a big FIFO.
But whatever way things go, I do think we are in for some big steps forward in graphics processing, at least. I am not into shaders and so on, I don't need fast 3-D or anything like that, but I know that many people do, and not just for games. But if it offloads things from my main CPU, I would find immediate benefit.
I'm going to say the obvious here, but the biggest problem is that it is metacode. There is no separation between code and data. The only way you could load shaders dynamically is if you compiled the shader into a DLL and loaded that at runtime. I work in the games industry and we use and have coded inhouse tools that let the artists and level designers make and tweak shaders. It would be a total nightmare for us devs if they were to use this to create shaders as opposed to something like Cg or HLSL.
We have experimented with a few dynamic shaders (mainly to create specialized ones for LOD and to reduce the number of light/shadow passes), ones that you build with string concatenations and send to the shader to compile at runtime. I'd prefer doing it that way as opposed to Sh still because we can offload that sort of stuff to our embedded scripting language which makes working with strings a bit easier and more natural than C++.
It's an impressive hack, but not something I would use for creating a real world app.
Get over it. The name comes from the "Sh" prefix used on all the types, and (originally) was short for "shader".
Uh, no. *nix users use sh a lot. The whole OS is basically started with the Bourne shell language. There's a precedent for the Unix sh language. going all the way back to the 1970's.
You're posting to Slashdot of all places and defending that misnomer?! How 'bout you broaden your horizons from the Windows world?
How long will it be before we see a modded GPU graphics card with a power supply being the only hard used to make a computer?
Just to pick up on a little bit from your comment:
The other place would have been the ill-fated tablet computer, had it been correctly designed, with the X serevr on the portable bit.
I thought about this a couple of months ago - how great it'd be to have a tablet PC that was literally just an X/VNC/RDC/Citrix server. With a GPU that most of the hard work could be dedicated to, and possibly something like a Transmeta/C3 etc type CPU for networking, device management etc - which wouldn't require much work.
I did some searching on it a while back but only found some Windows CE (or something similar, Tablet edition possibly?) powered tablets that were somehow designed to use RDC normally... I don't want to run an fully-fledged operating system when I'm logged into a remote server! Save the battery power for the display and get rid of that big CPU, it isn't needed.
You could probably make them smaller, consume much less power (or make it last even longer). Combined with systems where you can detach your session at your desktop PC and move it to your tablet remote client, it'd be an excellent tool.
Surely somebody's thinking about doing this or already has done? As I said, the only ones I've found run Windows in the background.
I'm glad that I wasn't the only one that thought that this meant finding a vertex meant using 'grep'....
Call it "shlang" if it makes you happy. Also easier to pronounce ;-). But it's not really a language; it's really a library. The website is http://libsh.org/, so calling it "libsh" is also acceptable if you would like to avoid confusion.
A lot of other shading languages don't even really have names. The OpenGL shading language is called... the OpenGL Shading Language. The Microsoft shading language is called... the High-Level Shading Language. More of a marketing statement, really ;-). The Renderman Shading Language is called... the Renderman Shading Language. The Stanford Real-Time Shading Language is called... Ok, so Cg has a real name. The exception ;-) The bottom line is that it's really hard to come up with names that are meaningful and haven't been taken.
I have to say that I'm not well versed in the specifics of how a normal window manager works. From what I've understood of Avalon the idea there is to put as much as possible in the OS, and let the OS delegate stuff to the GPU as it sees fit. So your app would write stuff to a buffer but the OS handles double buffering and all things like that.
Putting all of X on a GPU would probably not be a good idea however. (For reasons to be mentioned later.) And while you can free up your CPU from the specifics of GUI handling even on my old 233MHz Pentium X and Fluxbox only use a percent or so of CPU power. We're not talking a significant amount of saving here. The main benefits would be lots more flash (some even useful) and perhaps things like really nicely rendered text.
Running general code on a GPU is not something you want to do though. The entire idea of having a processor optimized for parallel processing is to NOT run sequential code on it. Furthermore a standard GPU has very long pipelines (on the order of several hundred stages, compared to 20'ies for a CPU with long pipelines) this means that branching is expensive. Currently you can't even do real branching on GPUs, that stuff is still handled by the CPU.
Furthermore a GPU is only fast if you can use parallelism. Most common programs have very little parallelism, and even the most advanced compiler algorithms are hard pressed to extract what little parallelism there exist. To make things even worse GPUs want to execute in SIMD structure, so it uses the same general instruction but on many sets of data. Typical example is doing the same calculation on every pixel in an image, that is very parallel even if all the individual pixels may be different. Doing a histogram (where you sum all individual instances of each pixel value) is something which a CPU will be better at doing.
You could naturally spend a lot of time to make a GPU general enough to execute code like a CPU but then you'd only end up with another CPU. That's pretty stupid since it's much cheaper and efficient to just add one in SMP or SMT (or even hyper threading) manner.
And FYI all modern GPUs can run ARB shaders, which are general. (Well, in reality the drivers translate it to internal shaders, but the programmer doesn't have to care.) So you don't have to compile separately for each GPU. Much like how the internal micro-code on CPUs differ but the exposed assembly is x86 style.
Currently the biggest problem with General-GPU applications is that the AGP is pretty slow at reading data back from the card. Future standards will hopefully help us there though.
All that said, I recommend you and others to play around some with shaders on modern GPUs. It's quite fantastic what you can pull off with little effort.
Yeah, nobody would ever confuse the two, except perhaps, I dunno, SEARCH ENGINES.
Tards.
In college, my prof made us write a game in LISP just to prove that some languages are bad at certain things.
Just a data point: Naughty Dog is well-known for the heavy use of Lisp (an in-house dialect called GOAL) in their games, including the Crash Bandicoot and Jak and Daxter series.
But, we figured no-one would be silly enough to confuse a C++ library with a scripting language
If I were you, I'd be a wee bit more careful with calling half the software professionals in the world "silly". Look at the title of this article, think of the titles of other articles and books that would be written, think of the many graphics programmers who'll get calls by recruiters offering them Unix admin jobs...
Get over it.
Fuck you asshole.
Check it out.
http://pygame.org/
http://pyopengl.sourceforge.net/
"Chapter three contains a quite interesting sample shader that uses constructive solid geometry techniques and metaprogramming in Sh to render text." Which means it can do one of the most complicated sounding "Hello World" programs of any language!
AB HOC POSSUM VIDERE DOMUM TUUM
You are suggesting that the CPU and GPU - which are very different beasts, as other posts mention - try to work as effectively a multi-processor system.
The only problem with that is that when there is a lot of work, they are often both working full-out already. I agree it would be nice if GPUs could also do less specialized (i.e. completely different) parallel processes, but I am sure someone will be able to hack even the current generation to do say weather modelling if they really want to.
Anyway, to digress as promised: I think that for the near future, asymmetric multi-processing might have some promise. By this I mean a slow processor, a fast processor, and a parallel (graphics) processor - perhaps multiple of the latter two.
The point of this would be to allow the entire system to run... without the 'CPU' or GPU even being powered up - and nor, for that matter, all the memory either, necessarily.
So you would have the efficiency of mobile chips combined with the available power (kWh and MHz) of the newest and greatest as and when required.
Now the 'slow' CPU is actually the master. As such, it runs the core OS, I/O - including screen refreshes if and when necessary, and also simpler programs.
The 'fast CPU' kicks in when needed or asked to, to run heavier tasks, such as a compile cycle. When it has no threads left, it returns to dormancy, and low power.
Similarly, the GPU only runs when needed. Typically this would be for games or other graphically intensive applications. As I mentioned, if they could be made able to cope with other parallel chores too, then they might be used just for that too.
Once the infrastructure exists on the motherboard to have three disimilar processors working together, there is no reason not to extend this concept to multiple 'fast' processors.
For example, two fast CPUs and two fast GPUs. This might be a standard home system for a couple or family: no more expensive than two seperate systems, yet much more flexible. Can run as a server at low power, or have two hungry games at the same time, or one DoomIV, using the two GPUs for half the work each.
Also overclocking and other such risks on such a system would be far less of a problem. At worst, the expensive process crashes - but the slow CPU takes over straight away.
Of course the slow CPU does have to run a genuine real-time OS, and be stable.
The only problems I can see are overcomeable. For example, utterly different processors might mean that some kind of byte-code is preferable - or you have to use the lowest common denominator. Similarly switching a program to the fast processor from the slow when needed would require state to be saved and then reloaded etc. - less of a problem for games than office work.
To return to graphics: this kind of architecture would allow lots/dozens/bazillions of GPUs to work in parallel. Just allow each a certain amount of screen/wall. Merging results at edges would take care of some alias-type problems, I think - that is to say, if each 'tile' were responsible for 120x120 pixels, it could actually render 128x128 - leaving 8 on each side of the border to be balanced according to a quick weighting scheme.
As I said - a digression.
There have been systems like this using DSPs for years; I've worked with some of them in the mid-late-80s. The Bell Labs DSP supercomputer had a tree-structured network of DSPs, and I think a more general-purpose processor at the root, back when 25 MFLOPS was blazingly fast for a single floating-point DSP, and the box had 127 of them, producing up to about 2 GFLOPS on applications like FFTs. It was one of the fastest ray-tracers around.
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks