[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] WebGL benchmarking



I took a look to see what the problem was in Minefield... turns out there were three:

1 - We don't implement TexImage2D from an ImageData object.  This is an oversight, we'll fix it.

2 - Get() with VERSION/RENDERER/etc. currently throws; will be fixed shortly.

3 - There are a few addEventListener calls that don't specify the capture parameter at the end -- adding "false" fixes this.

I've attached a patch that makes things work for now, though the first two issues should be fixed in the next few days.  But for the first problem at least, using a WebGLUnsignedByteArray and calling a normal (non-HTML) TexImage2D might be better... no need to create a 2D canvas just to get a byte array object.

   - Vlad

----- "Thatcher Ulrich" <tu@tulrich.com> wrote:
Thanks for the heads-up!  Safari+webkit should be fixed now.

I see there is an issue with Safari+webkit where the profile script
blocks for a long time and the browser pops a dialog box, throwing off
the timing.  I'll see if I can break up the profile to eliminate that.

Re chromium, I've been working with nightly builds, so there may be
discrepancies with older builds around things like WebGLFloatArray.  I
just verified it works with the most recent chromium nightly, 48040.

Re Minefield, I'll take a look soon.

-T

On Sun, May 23, 2010 at 12:26 PM, Chris Marrin <cmarrin@apple.com> wrote:
>
> On May 21, 2010, at 8:28 PM, Thatcher Ulrich wrote:
>
> FYI I have made a test page to probe the limits of WebGL gpu performance:
> http://tulrich.com/webgl/bench/
>
> It focuses only on unlit diffuse textured trimesh performance but should
> perhaps be extended to test other things.
>
> Comments welcome.
>
> Fails in WebKit TOT:
> Error compiling shader: ERROR: 0:5: 'texture2D' : no matching overloaded
> function found
> ERROR: 0:5: 'assign' :  cannot convert from 'const float' to 'FragColor
> 4-component vector of float'
> webgl/bench/glmath.js:163TypeError: Result of _expression_ 'glm' [undefined]
> is not an object.
>
> -----
> ~Chris
> cmarrin@apple.com
>
>
>
>

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:


--- index.html	2010-05-28 07:40:51 -0700
+++ tulrich_bench.htm	2010-05-28 12:22:11 -0700
@@ -357,16 +357,16 @@
 
   // Generate a texture.
   var TEX_DIM = 128;
-  var im = el('canvas2d').getContext('2d').createImageData(TEX_DIM, TEX_DIM);
+  var im = new WebGLUnsignedByteArray(TEX_DIM*TEX_DIM*4);
   for (var j = 0; j < TEX_DIM; j++) {
     for (var i = 0; i < TEX_DIM; i++) {
       var u = i / (TEX_DIM - 1);
       var v = j / (TEX_DIM - 1);
       var vi = (j * TEX_DIM + i) * 4;
-      im.data[vi + 0] = Math.abs(Math.sin((u * c5 + c8) * 12)) * 255;    // red
-      im.data[vi + 1] = Math.abs(Math.cos((v * c6 + c9) * 16)) * 255;   // green
-      im.data[vi + 2] = Math.cos(((u + c7) * (v + c8) + c10) * 100) * 127 + 128;   // blue
-      im.data[vi + 3] = 255;   // alpha
+      im[vi + 0] = Math.abs(Math.sin((u * c5 + c8) * 12)) * 255;    // red
+      im[vi + 1] = Math.abs(Math.cos((v * c6 + c9) * 16)) * 255;   // green
+      im[vi + 2] = Math.cos(((u + c7) * (v + c8) + c10) * 100) * 127 + 128;   // blue
+      im[vi + 3] = 255;   // alpha
     }
   }
   check_gl_error('init_model 2');
@@ -376,7 +376,7 @@
   gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
   gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
   gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
-  gl.texImage2D(gl.TEXTURE_2D, 0, im);
+  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, TEX_DIM, TEX_DIM, 0, gl.RGBA, gl.UNSIGNED_BYTE, im);
   gl.generateMipmap(gl.TEXTURE_2D);
   gl.bindTexture(gl.TEXTURE_2D, null);
 
@@ -1066,9 +1066,9 @@
 function show_report() {
   var text = '';
   text += 'userAgent = ' + navigator.userAgent + '\n';
-  text += 'gl.VERSION = ' + gl.getString(gl.VERSION) + '\n';
-  text += 'gl.VENDOR = ' + gl.getString(gl.VENDOR) + '\n';
-  text += 'gl.RENDERER = ' + gl.getString(gl.RENDERER) + '\n';
+//  text += 'gl.VERSION = ' + gl.getString(gl.VERSION) + '\n';
+//  text += 'gl.VENDOR = ' + gl.getString(gl.VENDOR) + '\n';
+//  text += 'gl.RENDERER = ' + gl.getString(gl.RENDERER) + '\n';
   text += '+--------+-----+-------+------------+-----------+---------+\n';
   text += '| layers | dim | prim  |  tris/sec  | draws/sec |   dt    |\n';
   text += '+--------+-----+-------+------------+-----------+---------+\n';
@@ -1131,16 +1131,16 @@
     el('sb_depth_x').blur();
     el('sb_prim').blur();
   };
-  el('sb_grid_dim').addEventListener('change', change_params);
-  el('sb_depth_x').addEventListener('change', change_params);
-  el('sb_prim').addEventListener('change', change_params);
+  el('sb_grid_dim').addEventListener('change', change_params, false);
+  el('sb_depth_x').addEventListener('change', change_params, false);
+  el('sb_prim').addEventListener('change', change_params, false);
 
   el('sb_draw_x').addEventListener('change', function(e) {
       draw_repeat_x = parseInt(el('sb_draw_x').value);
       el('sb_draw_x').blur();
     }, false);
 
-  el('gen_report').addEventListener('click', generate_report);
+  el('gen_report').addEventListener('click', generate_report, false);
 
 //   document.getElementById('cb_pause').addEventListener('change', function(e) {
 //       set_paused(this.checked);