|
12 | 12 | <br /> Prefix sum performance comparisons.
|
13 | 13 | <br /> Each display loops through initialization, sum, and validation steps.
|
14 | 14 | <br/>
|
15 |
| - <div id="local_swap" style=" |
| 15 | + <div id="left_side" style=" |
16 | 16 | position: absolute;
|
17 | 17 | top: 150px;
|
18 | 18 | left: 0;
|
|
25 | 25 | pointer-events: none;
|
26 | 26 | text-align: left;
|
27 | 27 | "></div>
|
28 |
| - <div id="global_swap" style=" |
| 28 | + <div id="right_side" style=" |
29 | 29 | position: absolute;
|
30 | 30 | top: 150px;
|
31 | 31 | right: 0;
|
|
66 | 66 | rightGridDim: uniform( Math.sqrt( maxElements ) ),
|
67 | 67 | validate: uniform( 0 ),
|
68 | 68 | // Algorithm being displayed
|
69 |
| - 'Left Method Name': 'Fake Prefix', |
| 69 | + 'Left Method Name': 'Fake', |
70 | 70 | 'Right Method Name': 'Kogge-Stone',
|
71 | 71 | };
|
72 | 72 |
|
73 | 73 | const algorithms = [
|
74 | 74 | 'Sklansky',
|
75 | 75 | 'Kogge-Stone',
|
76 |
| - 'Fake Prefix', |
| 76 | + 'Fake', |
77 | 77 | 'Incorrect'
|
78 | 78 | ];
|
79 | 79 |
|
80 | 80 | const gui = new GUI();
|
81 |
| - |
82 | 81 | gui.add( effectController, 'Left Method Name', algorithms );
|
83 |
| - |
84 | 82 | gui.add( effectController, 'Right Method Name', algorithms );
|
85 | 83 |
|
| 84 | + const timestamps = { |
| 85 | + left_side: document.getElementById( 'left_side' ), |
| 86 | + right_side: document.getElementById( 'right_side' ) |
| 87 | + }; |
| 88 | + |
86 | 89 | // Initialize Two Views
|
87 | 90 | init( false );
|
88 | 91 | init( true );
|
|
134 | 137 | // Emulates a prefix sum by manually assigning the instanceIndex to the storage buffer.
|
135 | 138 | // This method should only be used to validate the correctness of new algorithms, and not as
|
136 | 139 | // a yardstick for performance.
|
137 |
| - 'Fake Prefix': { |
| 140 | + 'Fake': { |
138 | 141 | threads: [ maxElements ],
|
139 | 142 | runMethod: ( currentElements ) => {
|
140 | 143 |
|
|
373 | 376 | }
|
374 | 377 |
|
375 | 378 | let stepType = 'Init';
|
| 379 | + renderer.info.autoReset = false; |
376 | 380 |
|
377 | 381 | const stepAnimation = async function () {
|
378 | 382 |
|
| 383 | + renderer.info.reset(); |
| 384 | + |
379 | 385 | const methodName = rightSide ?
|
380 | 386 | effectController[ 'Right Method Name' ] :
|
381 | 387 | effectController[ 'Left Method Name' ];
|
|
404 | 410 | case 'Validate': {
|
405 | 411 |
|
406 | 412 | const currentElements = new Uint32Array( await renderer.getArrayBufferAsync( currentElementsBuffer ) );
|
407 |
| - //console.log( currentElements ); |
408 | 413 |
|
409 | 414 | effectController.validate.value = 1;
|
410 | 415 | stepType = 'Init';
|
|
415 | 420 |
|
416 | 421 | case 'Init': {
|
417 | 422 |
|
| 423 | + effectController.validate.value = 0; |
| 424 | + |
418 | 425 | renderer.compute( method.initFunction );
|
419 | 426 |
|
420 | 427 | stepType = 'Run';
|
|
429 | 436 |
|
430 | 437 | renderer.render( scene, camera );
|
431 | 438 |
|
432 |
| - effectController.validate.value = 0; |
| 439 | + console.log( renderer.info ); |
| 440 | + |
| 441 | + timestamps[ rightSide ? 'right_side' : 'left_side' ].innerHTML = ` |
| 442 | +
|
| 443 | + Compute ${rightSide ? effectController[ 'Right Method Name' ] : effectController[ 'Left Method Name' ]} Prefix Sum: ${renderer.info.compute.frameCalls} pass in ${renderer.info.compute.timestamp.toFixed( 6 )}ms<br> |
| 444 | + Draw ${renderer.info.render.drawCalls} pass in ${renderer.info.render.timestamp.toFixed( 6 )}ms |
| 445 | + `; |
| 446 | + |
433 | 447 |
|
434 | 448 | setTimeout( stepAnimation, 1000 );
|
435 | 449 |
|
|
0 commit comments