Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Unified Diff: content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html

Issue 2594843002: Implementing promise-based commit for driving OffscreenCanvas animations (Closed)
Patch Set: test fix Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html
diff --git a/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html b/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html
index 292500ea9b39392e52a27e2ab9aa960d5fb866c0..1dfa64189dfcd568fd4e1f6fc5104e10b1498b85 100644
--- a/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html
+++ b/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html
@@ -15,9 +15,12 @@ that the baseline images are regenerated on the next run.
}
</style>
<script id="myWorker" type="text/worker">
-function drawTriangle(canvas)
+
+var g_frameNumber = 0;
+var gl;
+
+function drawTriangle()
{
- var gl = canvas.getContext("webgl");
gl.clearColor(0, 1, 0, 1);
gl.clear(gl.COLOR_BUFFER_BIT);
@@ -60,10 +63,29 @@ function drawTriangle(canvas)
gl.commit();
}
+function drawLoop()
+{
+ if (g_frameNumber < 3) {
+ gl.clearColor(1, 0, 0, 1);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ g_frameNumber++;
+ gl.commit().then(drawLoop);
+ } else {
+ drawTriangle(offscreenCanvas);
+ gl.commit();
+
+ // The following clear is never committed
+ gl.clearColor(0, 0, 1, 1);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+
+ self.postMessage("");
+ }
+}
+
self.onmessage = function(e) {
var transferredOffscreenCanvas = e.data;
- drawTriangle(transferredOffscreenCanvas);
- self.postMessage("");
+ gl = transferredOffscreenCanvas.getContext("webgl");
+ drawLoop();
};
</script>
<script>

Powered by Google App Engine
This is Rietveld 408576698