| 1 | <!DOCTYPE html>
|
| 2 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
|
| 3 | <head>
|
| 4 | <title>WebCL Beispiel 2</title>
|
| 5 | <script type="text/javascript" id="listWebCLDevices">
|
| 6 | "use strict";
|
| 7 | /*global window */ // tells jslint that 'window' is defined!
|
| 8 |
|
| 9 | function listWebCLDevices() {
|
| 10 | var
|
| 11 | outputstring,
|
| 12 | output,
|
| 13 | platforms,
|
| 14 | currentPlatform,
|
| 15 | platformName,
|
| 16 | currentPlatformDevices,
|
| 17 | i, j;
|
| 18 | outputstring = "";
|
| 19 | output = window.document.getElementById("output");
|
| 20 | try {
|
| 21 | if (window.WebCL === undefined) {
|
| 22 | |
| 23 | return false;
|
| 24 | }
|
| 25 |
|
| 26 | |
| 27 | |
| 28 | platforms = window.WebCL.getPlatformIDs();
|
| 29 | outputstring += platforms.length + " WebCL Platform(en) gefunden. <br><br>";
|
| 30 | for (i = 0; i < platforms.length; i = i + 1) {
|
| 31 | currentPlatform = platforms[i];
|
| 32 | platformName = currentPlatform.getPlatformInfo(window.WebCL.CL_PLATFORM_NAME);
|
| 33 | currentPlatformDevices = currentPlatform.getDeviceIDs(window.WebCL.CL_DEVICE_TYPE_ALL);
|
| 34 | outputstring += "[" + i + "] \"<b>" + platformName + "<\/b>\"<br>";
|
| 35 | outputstring += "<div style='padding-left:2em;'>";
|
| 36 | outputstring += "<b>Hersteller:<\/b> " + currentPlatform.getPlatformInfo(window.WebCL.CL_PLATFORM_VENDOR) + "<br \/>";
|
| 37 | outputstring += "<b>Version:<\/b> " + currentPlatform.getPlatformInfo(window.WebCL.CL_PLATFORM_VERSION) + "<br \/> ";
|
| 38 | for (j = 0; j < currentPlatformDevices.length; j = j + 1) {
|
| 39 | outputstring += "[" + j + "] \"<b>" + currentPlatformDevices[j].getDeviceInfo(window.WebCL.CL_DEVICE_NAME) + "<\/b>\"<br \/>";
|
| 40 | }
|
| 41 | outputstring += "<\/div><br \/>";
|
| 42 | }
|
| 43 | output.innerHTML = outputstring + "<br \/>";
|
| 44 | } catch (e) {
|
| 45 | output.innerHTML = outputstring + "<br \/>";
|
| 46 | output.innerHTML += "<b>Error:<\/b> <pre style='color:red;'>" + e.toString() + "<\/pre>";
|
| 47 | throw e;
|
| 48 | }
|
| 49 | }
|
| 50 | window.onload = function () {
|
| 51 | listWebCLDevices();
|
| 52 | };
|
| 53 |
|
| 54 | </script>
|
| 55 | </head>
|
| 56 | <body>
|
| 57 | <h2>lokale WebCL-Devices (Beispiel 2)</h2>
|
| 58 | <div id="output">
|
| 59 | </div>
|
| 60 | <br />
|
| 61 | <i>This example is closely based on the <a href="webcl.nokiaresearch.com/tutorials/tutorial2.html">Nokia WebCL Tutorial</a>.</i>
|
| 62 | </body>
|
| 63 | </html> |