Commit graph

15 commits

Author SHA1 Message Date
Anthony Ramine
89a0b55c61 Use wrappers for GL IDs
See https://github.com/servo/webrender_traits/pull/62.
2016-06-28 20:11:55 +02:00
Daniel
c017438428 Implement IsBuffer, IsFramebuffer and IsRenderbuffer for WebGLRenderingContext 2016-05-29 17:08:10 -04:00
Jan-Fabian Humann
d778562844 #10211: Stop re-exporting webrender_traits WebGL types from canvas_traits 2016-03-30 20:05:16 +02:00
rohan.prinja
6e774ea6eb merge from master 2015-11-03 19:01:23 +09:00
Emilio Cobos Álvarez
95a0d0584f webgl: Add destructors for texture, program, shader, buffer and framebuffer
This allows to cleanup resources earlier if they stop being used. Right
now all resources were cleaned up when the context was destroyed, this is
a slightly better approach.

We ignore the possible failure of the send() call, since we don't keep
track of these resources from the `WebGLRenderingContext` structure, so
a texture could be destroyed after the context and give us problems.
2015-11-01 13:39:20 +01:00
rohan.prinja
45224028db more refactoring 2015-10-30 20:26:29 +09:00
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
Anthony Ramine
c831c2c0a5 Remove helper traits
Now that JSRef<T> is gone, there is no need to have helper traits.

On components/script/*.rs:

    # Remove imports.
    /^ *use dom::[a-z]+::\{.*Helpers/ {
        s/\{(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers, /\{/
        s/, (Raw[^L]|[^L][^a])[a-zA-Z]+Helpers([,}])/\2/g
        s/\{([a-zA-Z]+)\}/\1/
        /\{\}/d
        s/::self;$/;/
    }
    /^ *use dom::[a-z]+::\{?(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers\}?;$/d

On components/script/dom/*.rs:

    # Ignore layout things.
    /^(pub )?(impl|trait).*Layout.* \{/,/^}$/ { P; D; }

    # Delete helpers traits.
    /^(pub )?trait ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? \{$/,/^\}$/D

    # Patch private helpers.
    /^impl.*Private.*Helpers/,/^\}$/ {
        s/^impl<'a> Private([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for &'a ([^ ]+) \{$/impl \3 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

    # Patch public helpers.
    /^impl.*Helpers/,/^\}$/ {
        s/^impl(<'a>)? ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for (&'a )?([^ ]+) \{$/impl \5 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn .*\(&?self[,)]/s/(unsafe )?fn/pub &/
        /^ *pub (unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

The few error cases were then fixed by hand.
2015-08-27 16:59:02 +02:00
João Oliveira
fd87c8cb3e make dom_struct derive HeapSizeOf,
closes #7357
2015-08-27 01:17:48 +01:00
Bogdan Cuza
45145108da Measure heap memory usage for more types. Fixes #6951 2015-08-13 21:44:41 +03: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
ecoal95
8438db89e1 address review comments 2015-07-06 23:02:51 +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
Michael Wu
675267b782 Upgrade to SM 39 2015-06-19 18:42:48 -04: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