Frederico Schardong
Frederico Schardong

Reputation: 2095

HTML 5 and GPGPU

As we know many HTML 5 renderers use the GPU to draw canvas elements. I'm wondering about using this ability to trigger the GPU to use it for GPGPU. There probably are no native GPGPU functions in the canvas API or HTML 5, but what about a hack to do that?

I was thinking about using something like a texture (2D or 3D array) with the values to be processed and then ask a canvas element to perform some operation on this matrix. This operation has to be a function that I can somehow send to the canvas element. Then we have browser-based GPGPU.

Is such a thing possible? What do you think? Do you have any other ideas of how to implement this?

Upvotes: 3

Views: 963

Answers (2)

aland
aland

Reputation: 5154

There is WebCL standard which is created exactly to give Javascripts running in browser access to GPGPU's computational power (provided client has any). However the list of existing implementations is pretty short.

Successful attempts to harness GPU power for genral-purpose calculations were long before (and lead to) the emergence of CUDA, OpenCL and similar GPGPUs framework. Here is what looks like a good tutorial, and I guess it is portable to WebGL (which has much broader support then WebCL). See @MikkoOhtamaa's answer for good introductory article about WebGL itself

Upvotes: 3

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83348

You probably want to use webGL shaders for your nefarious purposes.

http://www.html5rocks.com/en/tutorials/webgl/shaders/

Shaders provide limited opportunities for parallel computations.

Upvotes: 1

Related Questions