forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add blink_perf stories for WebGL bindBuffer and bufferSubData
This CL adds stories that exercise gl.bindBuffer and gl.bufferSubData to the existing blink_perf.webgl_fast_call benchmark suite. Bug: chromium:1155348 Change-Id: I7e84e07835fcf2924377f837ba46b4d465988264 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2874607 Commit-Queue: Maya Lekova <mslekova@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Cr-Commit-Position: refs/heads/master@{#882947}
- Loading branch information
1 parent
6e89607
commit 34a0d15
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
third_party/blink/perf_tests/webgl/binding-bind-buffer.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title> | ||
Test CPU performance of the WebGLRenderingContext.bindBuffer binding | ||
</title> | ||
<script src="../resources/runner.js"></script> | ||
</head> | ||
|
||
<body> | ||
<canvas id="canvas" width=400 height=400></canvas> | ||
<script> | ||
const canvas = document.getElementById('canvas'); | ||
const gl = canvas.getContext('webgl'); | ||
|
||
const vertexBuffer1 = gl.createBuffer(); | ||
const vertexBuffer2 = gl.createBuffer(); | ||
|
||
const iterations = 10000; | ||
PerfTestRunner.measureInnerRAFTime({ | ||
description: `CPU time for ${iterations*3} calls to WebGLRenderingContext.bindBuffer`, | ||
warmUpCount: 10, | ||
run() { | ||
for (let i = 0; i < iterations; ++i) { | ||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer1); | ||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer2); | ||
gl.bindBuffer(gl.ARRAY_BUFFER, null); | ||
} | ||
} | ||
}); | ||
</script> | ||
</body> | ||
|
||
</html> |
49 changes: 49 additions & 0 deletions
49
third_party/blink/perf_tests/webgl/binding-buffer-sub-data.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title> | ||
Test CPU performance of the WebGLRenderingContext.bufferSubData binding | ||
</title> | ||
<script src="../resources/runner.js"></script> | ||
</head> | ||
|
||
<body> | ||
<canvas id="canvas" width=400 height=400></canvas> | ||
<script> | ||
const canvas = document.getElementById('canvas'); | ||
const gl = canvas.getContext('webgl'); | ||
|
||
const vertexBuffer = gl.createBuffer(); | ||
|
||
const data = new Float32Array([ | ||
0.0, 0.5, 0.0, | ||
-0.5, -0.5, 0.0, | ||
0.5, -0.5, 0.0, | ||
]); | ||
const dataCopy = new Float32Array([ | ||
0.0, 0.5, 0.0, | ||
-0.5, -0.5, 0.0, | ||
0.5, -0.5, 0.0, | ||
]); | ||
const sizeInBytes = data.length * data.BYTES_PER_ELEMENT; | ||
|
||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); | ||
// Ensure twice the size of `data`. | ||
gl.bufferData(gl.ARRAY_BUFFER, sizeInBytes * 2, gl.STATIC_DRAW); | ||
|
||
const iterations = 10000; | ||
PerfTestRunner.measureInnerRAFTime({ | ||
description: `CPU time for ${iterations * 2} calls to WebGLRenderingContext.bufferSubData`, | ||
warmUpCount: 10, | ||
run() { | ||
for (let i = 0; i < iterations; ++i) { | ||
gl.bufferSubData(gl.ARRAY_BUFFER, 0, data); | ||
gl.bufferSubData(gl.ARRAY_BUFFER, sizeInBytes, dataCopy); | ||
} | ||
} | ||
}); | ||
</script> | ||
</body> | ||
|
||
</html> |