OpenCL PDF from SIGGRAPH

http://s08.idav.ucdavis.edu/munshi-opencl.pdf

page 59:

•Sharing OpenGL Resources
■OpenCL is designed to efficiently share with OpenGL
■ Textures, Buffer Objects and Renderbuffers
■ Data is shared, not copied

Cool, thanks for posting the slides!

Yet another API designed to favour the C language clique over every other language on earth.

Even my own little game will let the user write their own scripts in any of 3 different languages.
Language neutrality is really not that hard, you dont need to do it all yourself, just make it possible for someone else to link in their own parser, ever heard of plugins?

Maybe if i write up an OpenST (Syntax Tree) standard and get Khronos to publish it?
Then anyone could write their own language parser and the OpenCL/OpenGL driver could compile the resulting language-neutral syntax tree instead of C source.

Yet another API designed to favour the C language clique over every other language on earth.

I’m sorry, what?

OpenCL is actually two separate things, and you weren’t entirely clear about what you were protest.

On the one had, you could have been talking about the fact that the API (the thing you use to load and execute OpenCL programs) is written in C.

C is programmer’s Lingua Franca. It would not be unreasonable to say that if you are on a system that can’t run C, you aren’t on a system worthy of having programs run on it.

Not to mention that, every language worth its salt has some degree of compatibility with C. C++ is C (or close enough to compile most C code). Java and C# have interfaces that allow you to add functions and .dll that are written in C. Every scripting language has, at a minimum, some ability for you to extend it with functions written in, yes you guessed it, C.

Complaining that the API is written in C is asinine.

Now, you may have been complaining that the OpenCL language is based on C. You said:

Language neutrality is really not that hard, you dont need to do it all yourself, just make it possible for someone else to link in their own parser, ever heard of plugins?

That’s the most ridiculous thing I’ve ever heard. OpenCL’s language is designed for very explicit specifications, so that the OpenCL runtime can compile and execute it on some fairly restrictive hardware. An arbitrary parse tree isn’t going to work for that kind of language. You need a language designed specifically for low-level work; you can’t shove Python through this with its expectations of garbage collecting and so forth. If you didn’t notice, OpenCL’s language doesn’t even support recursion; you need to be very careful about what kind of code you feed it.

And if you want to program in another language, fine; you can “compile” that language yourself into OpenCL’s native language. It isn’t that hard.

An API is a specification written around a calling convention and data types, not a language.
It can be StdCall,Safecall,CDecl,Pascal,This,Register and many others but this is a specification of how parameters are pushed to the stack or passed in registers, it has nothing to do with a particular language.
Any language that supports the calling convention used in the specification can be used as either the application or to impliment the API.
You cant say that an API is ‘written’ in a particular language.
If someone impliments a CDecl API with a DLL compiled from pascal and it is called from a Fortan program, then where’s the C?
Import/Header files may be provided in a particular language to make it easier to link to the DLL, but it can just as easily be provided in dozens of different languages.
I already have software to translate C header files into other languages so i have no problem at all with the import library being in C.

Now, you may have been complaining that the OpenCL language is based on C.
OpenCL’s language is designed for very explicit specifications, so that the OpenCL runtime can compile and execute it on some fairly restrictive hardware.
OpenCL’s language doesn’t even support recursion; you need to be very careful about what kind of code you feed it.
I understand that whatever language is used you need to limit what the programmer is allowed to do.
My point is that most procedural languages use exactly the same IF/Case/While/For branching, the same concept of functions, the same basic data types etc., they just express it with a different syntax.
OpenCL doesnt allow some language features and adds new constructs for parallel processing, but that just means that you cant translate an arbritrary program, you should still be able to program in any language as long as you write the program to that specification.
An arbitrary parse tree may not work, but OpenCL could define a very explicit parse-tree specification that does not allow recursion and requires precisly formatted parallel processing constructs.
Kronos could then provide a C parser and leave it to others to provide the parsers for other languages.
It would be up to them to write a parser that conforms to all the OpenCL rules to generate a proper syntax-tree file.

C is programmer’s Lingua Franca
Isn’t that the same as saying that OpenGL shouldn’t be provided on Linux, Mac, or Vista because most people still use XP?
C is used for a lot of microcontrollers because its designed for low-level hardware control, but almost all PC applications are now written with object oriented languages such as C++.
The really serious large business applications (where one bug can mean misplacing thousands of dollars) are all written in strongly typed languages, usually Delphi Pascal.

You need a language designed specifically for low-level work
Since when was a multi-threaded parallel processing program “Low-Level”.
C is OK for a few simple functions, but if i was writing something complex like a physics engine then i would want strong typing and OOP.

I have nothing against either C or C programmers, everyone has the right to use whatever language they are most comfortable with.
My own scripting engine originally used pascal, but to help people more familiar with other languages i now allow any script to be edited as either Basic, Pascal or C.
All i’m asking for is the same courtesy, i’ll even volunteer to write the parser.

you can “compile” that language yourself into OpenCL’s native language
I already did this with GLSL to convert between 4 different shader languages.
Yes we can do this, but it does double the amount of work for everyone that does (unless someone provided a common Syntax-tree to C decompiler).
The main problem i have with it is that its just so messy and unnecisarily complex.
It means you are doing:
LanguageX -> SyntaxTree -> C -> SyntaxTree -> MachineLanguage
This is twice as many conversions as is necisary.

Simon, you can use OpenCL and OpenGL with any programming language… so I don’t understand your problem. It is true that the shading (or kernel) language is based on C, and while I think it is not the best choice, it is still acceptable. The data and code complexity of shaders(and kernels) is much lower then the complexity of CPU applications, which makes basically any programing language suitable. The kernel language is not C, in reality it is more Pascal then C, it just uses C-like syntax: and C-syntax… well, the majority of programmers are used to it, so it is a good marketing move.

you should still be able to program in any language as long as you write the program to that specification.

And you still can. All you have to do is compile your “other language” into this C-like language.

It is a common modern conceit that C is the new assembly language. Everything supports it.

C is used for a lot of microcontrollers because its designed for low-level hardware control, but almost all PC applications are now written with object oriented languages such as C++.

It’s funny; the things that would be run on OpenCL are low-level. Therefore, it makes sense to use a language that is designed for “low-level hardware control.”

It means you are doing:
LanguageX -> SyntaxTree -> C -> SyntaxTree -> MachineLanguage
This is twice as many conversions as is necisary.

Tough. You’re the one who said, “I’m too cool for school, so I don’t want to use the language they provided.” Most other people will directly use OpenCL’s language, and they’ll be just fine with it.

A good API looks at what is best for the most people. And most people will use the language they’re given.

I hate to ask impertinent off-topic questions. Does anyone know how to invert the colors when printing [a PDF] - so I can print this very pertinent, on-topic document (without wasting gallons of toner)? Thanks.