Commit graph

24 commits

Author SHA1 Message Date
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Mathieu Rheaume
7320433cca Remove 'get_*' on getters as per RFC 0344 on various components 2015-09-12 20:14:01 -04:00
ecoal95
167885707d webgl: Add shader validation and translation
This commit adds angle-based validation and translation to WebGL
shaders.

The changes to the tex_image_2d test is neccessary (it was not valid
GLES 2.0 shader language).
2015-08-30 14:23:14 +02:00
ecoal95
6341c77700 webgl: Implement multiple calls and improve error detection
This commit implements WebGL's:
 * cullFace
 * frontFace
 * enable
 * disable
 * depthMask
 * colorMask
 * clearDepth
 * clearStencil
 * depthFunc
 * depthRange
 * hint
 * lineWidth
 * pixelStorei
 * polygonOffset
 * texParameteri
 * texParameterf
 * texImage2D (partially)

It inlines a lot of OpenGL calls to keep the file
`components/canvas/webgl_paint_task.rs` as small as possible while
keeping readability.

It also improves error detection on previous calls, and sets node damage
on the canvas in the drawing calls.

It adds a `TexImage2D` reftest, even though it's not enabled because:
 * WebGL paints the image when it loads (asynchronously), so the reftest doesn't wait for it and it finishes early
 * If we change the source for the base64 src of the image it works as expected in non-headless mode, but the test harness locks
2015-08-25 17:16:46 +02:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Patrick Walton
bb99b2f3c8 script: Make most of 2D canvas and WebGL run over IPC.
To actually make the multiprocess communication work, we'll need to
reroute the task creation to the pipeline or the compositor. But this
works as a first step.
2015-07-25 00:50:12 -07:00
Patrick Walton
626974994a canvas: Move to shared memory for images and canvas backing stores.
The idea here is to land this before making images and canvas IPC-safe,
because this will shake out bugs relating to the shared memory. There
are currently test timeouts that are preventing multiprocess images and
canvas from landing, and I believe those are due to the inefficiency of
sending large amounts of data in the unoptimized builds we test with. By
moving to shared memory, this should drastically reduce the number of
copies and `serde` serialization.

Under the hood, this uses Mach OOL messages on Mac and temporary
memory-mapped files on Linux.
2015-07-24 16:14:24 -07:00
ecoal95
42bd43a696 webgl: Make bind* calls more spec-compliant 2015-07-06 19:54:06 +02:00
ecoal95
b1765c6882 webgl: Refactor implementation to move logic inside the DOM interfaces
This improves the encapsulation and consistency in our WebGL
implementation.

Also allows to implement new methods such as `getShaderSource()`.

It will also allow us to use `delete()` in the destructors of them (note
that we will want to keep track of them from the context).
2015-07-06 19:54:05 +02:00
ecoal95
8cbfb3482c Use euclid from crates.io 2015-06-19 00:04:24 +02:00
ecoal95
ff568ecc90 webgl: Add multiple WebGL calls (activeTexture + blend*)
* activeTexture
* blendColor
* blendFunc
* blendFuncSeparate
* blendEquation
* blendEquationSeparate

Blocked on gleam.
2015-06-13 23:03:38 +02:00
ecoal95
9f94d39c9e Implement new WebGL interfaces and methods
This commit implements:
* WebGLFramebuffer
* WebGLRenderbuffer
* WebGLTexture

And adds the following methods to `WebGLRenderingContext`:
* create{Texture,Framebuffer,Renderbuffer}
* bind{Texture,Framebuffer,Renderbuffer}
* destroy{Buffer,Texture,Framebuffer,Renderbuffer}

Fixes:
* WebGLUniform location shouldn't inherit from WebGLObject.

Known Issues:
* WebGL objects have to be destroyed on drop, we may want to keep a reference to the context, or maybe a clone of the renderer to achieve this

Also refactors a huge part of the current implementation, to allow
failing on creation of different WebGL objects.

Blocked on https://github.com/servo/gleam/pull/22

A reftest for most of the added functionality is not doable right now,
we need a few more functions in order to upload a texture, for example.
2015-06-06 12:14:01 +02:00
ecoal95
eff2bb4310 WebGLRenderingContext getters and getParameter
This implements the `canvas`, `drawingBufferHeight` and
`drawingBufferWidth` getters to `WebGLRenderingContext`, and an initial
version of `getParameter`.
2015-06-01 16:34:51 +02:00
ecoal95
b3ac346749 Add WebGLContextAttributes support
This commit also:
* Allows to return non-rootable dictionaries from
Codegen.
* Merges the two context types in an enum type.
2015-06-01 15:29:38 +02:00
Corey Farwell
8e3f4bba85 Reduce max line length from 150 to 120 characters
Part of https://github.com/servo/servo/issues/6041
2015-05-24 00:01:49 -04:00
ecoal95
3350522306 Layerize canvas
Note that this keeps using readback right now, `NativeSurface` painting
will be implemented soon.

Also see https://github.com/servo/servo/issues/6142
2015-05-20 19:10:50 +02:00
Ms2ger
5c4d2d7928 Move handling of CanvasWebGLMsgs into WebGLPaintTask::handle_webgl_message.
This clarifies the code flow in WebGLPaintTask::start a bit, and as a bonus,
reduces the line lengths.
2015-05-14 13:09:13 +02:00
ecoal95
a3b0c10381 Remove Glutin dependency for WebGL
Now we have mac support, and since android build is broken, we can
drop glutin from WebGL code.

Went back to upstream
(see: https://github.com/servo/rust-offscreen-rendering-context/pull/1#issuecomment-99234534)

Rebased
2015-05-07 13:31:08 +02:00
Simon Sapin
ef8edd4e87 Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04:00
Diego Marcos
79b8e7aa34 It implements enough WebGL spec to draw a triangle 2015-05-02 19:21:05 -07:00
ecoal95
79a5dae170 WebGL context hardware acceleration + error detection 2015-04-27 04:16:47 +02:00
Ms2ger
9185c3de79 Remove as_mut_slice() calls. 2015-04-26 11:09:03 +02:00
Diego Marcos
c82485874d Kicks off a WebGL implementation 2015-04-20 14:29:39 -07:00