Closed Bug 934813 Opened 11 years ago Closed 11 years ago

Gallery: ImageProcessor.prototype.draw should not call bufferData everytime

Categories

(Firefox OS Graveyard :: Gaia::Gallery, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bjacob, Assigned: bjacob)

References

Details

Attachments

(2 files)

This is quite similar to bug 934790. Less critical, because a small WebGL buffer is cheaper to allocate than a larger WebGL texture, but still. There is no reason to reallocate the WebGL buffer storing the drawing geometry everytime. It also shouldn't depend on the parameters passed to draw(). Instead, just create once and for all a dummy buffer with the geometry of a dummy rectangle, and use uniforms to control its actual position and dimensions.
Also, only one buffer is needed instead of two, and it only needs 4 vertices with a TRIANGLE_STRIP, not 6.
Jeff: please review from WebGL correctness perspective. This patch should not make any rendering difference; if it somehow can, that's a bug.

David: please review from Gallery perspective: this patch should not change anything in Gallery app besides how it uses WebGL.
Attachment #827786 - Flags: review?(jgilbert)
Attachment #827786 - Flags: review?(dflanagan)
Comment on attachment 827786 [details] [diff] [review]
Don't upload buffers on every draw

Review of attachment 827786 [details] [diff] [review]:
-----------------------------------------------------------------

::: apps/gallery/js/ImageEditor.js
@@ +1347,5 @@
>  
>    // Create buffers to hold the input and output rectangles
> +  this.rectangleBuffer = gl.createBuffer();
> +  gl.bindBuffer(gl.ARRAY_BUFFER, this.rectangleBuffer);
> +  gl.disable(gl.CULL_FACE);

Why do you disable CULL_FACE here in the middle of buffer stuff?
Attachment #827786 - Flags: review?(jgilbert) → review+
Oops, that was of course a remnant from debugging, sorry.
Removed the unwanted gl.disable(gl.CULL_FACE);
Attachment #8340644 - Flags: review+
Attachment #827786 - Flags: review?(dflanagan)
Attachment #8340644 - Flags: review?(dflanagan)
Rolled this patch up with two others and resolved it in the parent bug.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Attachment #8340644 - Flags: review?(dflanagan)
Assignee: nobody → bjacob
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: