Bug 155475 - Add a basic WebGL test to Animometer
Summary: Add a basic WebGL test to Animometer
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dean Jackson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-03-14 17:01 PDT by Dean Jackson
Modified: 2016-03-18 13:48 PDT (History)
5 users (show)

See Also:


Attachments
Patch (9.97 KB, patch)
2016-03-14 17:03 PDT, Dean Jackson
no flags Details | Formatted Diff | Diff
Patch (10.43 KB, patch)
2016-03-18 13:31 PDT, Dean Jackson
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dean Jackson 2016-03-14 17:01:46 PDT
Add a basic WebGL test to Animometer
Comment 1 Dean Jackson 2016-03-14 17:03:50 PDT
Created attachment 274055 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2016-03-14 17:06:01 PDT
<rdar://problem/25156860>
Comment 3 Radar WebKit Bug Importer 2016-03-14 17:06:32 PDT
<rdar://problem/25156869>
Comment 4 Jon Lee 2016-03-14 17:58:58 PDT
Comment on attachment 274055 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=274055&action=review

Nice!

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:51
> +].join("\n");

Is there a benefit to doing it this way instead of just putting it in the .html?

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:64
> +            this._numTriangles = 1000;

This should be initialized to 0.

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:150
> +                this._uniformData[i * 6 + 0] = Stage.random(0.2, 0.4);

Instead of doing this calculation, maintain a separate variable that just increments as it travels along the buffer?

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:160
> +        {

You should include an early exit if count == 0.

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:161
> +            this._numTriangles += count * 10;

Did the ramp controller stop too early, and is why you need to scale everything by 10? This shouldn't be necessary.

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:164
> +            this._reset();

Might be better to try to follow the logic of some of the other tests which maintain a separate index, to avoid having to recreate the uniform data every time the controller tunes.

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:175
> +            var elapsed = (Date.now() - this._startTime) / 1000;

There is Stage.dateCounterValue(1000)

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:181
> +                gl.uniform1f(this._uScale, this._uniformData[i * 6 + 0]);

Instead of doing this calculation, maintain a separate variable that just increments as it travels along the buffer?

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:194
> +                gl.drawArrays(gl.TRIANGLES, 0, 3);

Would it be more realistic to just do this all in one go instead of drawing each triangle separately?

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:201
> +            return this._numTriangles / 10;

Seems better to track the actual number.
Comment 5 Dean Jackson 2016-03-18 13:31:11 PDT
Created attachment 274450 [details]
Patch
Comment 6 Dean Jackson 2016-03-18 13:31:24 PDT
Comment on attachment 274055 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=274055&action=review

>> PerformanceTests/Animometer/tests/3d/resources/webgl.js:51
>> +].join("\n");
> 
> Is there a benefit to doing it this way instead of just putting it in the .html?

I moved this into a <script> tag.

>> PerformanceTests/Animometer/tests/3d/resources/webgl.js:64
>> +            this._numTriangles = 1000;
> 
> This should be initialized to 0.

Fixed.

>> PerformanceTests/Animometer/tests/3d/resources/webgl.js:160
>> +        {
> 
> You should include an early exit if count == 0.

Done.

>> PerformanceTests/Animometer/tests/3d/resources/webgl.js:161
>> +            this._numTriangles += count * 10;
> 
> Did the ramp controller stop too early, and is why you need to scale everything by 10? This shouldn't be necessary.

No, this was just my misunderstanding. Fixed.

>> PerformanceTests/Animometer/tests/3d/resources/webgl.js:164
>> +            this._reset();
> 
> Might be better to try to follow the logic of some of the other tests which maintain a separate index, to avoid having to recreate the uniform data every time the controller tunes.

I've done this.

>> PerformanceTests/Animometer/tests/3d/resources/webgl.js:175
>> +            var elapsed = (Date.now() - this._startTime) / 1000;
> 
> There is Stage.dateCounterValue(1000)

Done.

>> PerformanceTests/Animometer/tests/3d/resources/webgl.js:181
>> +                gl.uniform1f(this._uScale, this._uniformData[i * 6 + 0]);
> 
> Instead of doing this calculation, maintain a separate variable that just increments as it travels along the buffer?

Done.

>> PerformanceTests/Animometer/tests/3d/resources/webgl.js:194
>> +                gl.drawArrays(gl.TRIANGLES, 0, 3);
> 
> Would it be more realistic to just do this all in one go instead of drawing each triangle separately?

Yes. But I'm trying to test raw throughput. I'll add another test that draws everything at once.

>> PerformanceTests/Animometer/tests/3d/resources/webgl.js:201
>> +            return this._numTriangles / 10;
> 
> Seems better to track the actual number.

Fixed.
Comment 7 Simon Fraser (smfr) 2016-03-18 13:43:48 PDT
Comment on attachment 274450 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=274450&action=review

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:38
> +

Blank line here and not above.

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:80
> +                0, 0.1, 0, 1,
> +                -0.1, -0.1, 0, 1,
> +                0.1, -0.1, 0, 1

I would line these up with spaces.

> PerformanceTests/Animometer/tests/3d/resources/webgl.js:101
> +            var scriptElement = document.getElementById(id);
> +            return scriptElement.text;

No need for scriptElement
Comment 8 Dean Jackson 2016-03-18 13:48:57 PDT
Committed r198442: <http://trac.webkit.org/changeset/198442>