Commit graph

146 commits

Author SHA1 Message Date
Eric Anholt
cc294fffcc webgl: Update the match for WebGLError's new InvalidFramebufferOperation. 2016-09-21 08:05:45 +10:00
UK992
93a103ba73 Reorder use statements 2016-09-09 04:55:19 +02:00
Anthony Ramine
6e1523f4ae Compile WebIDL return type "object" to NonZero<*mut JSObject> 2016-08-30 19:07:13 +02:00
Anthony Ramine
2400b91d05 Don't bother with the global in ImageData::get_image_data 2016-08-30 19:06:41 +02:00
bors-servo
d37d4d697a Auto merge of #13102 - anholt:webgl-is-program, r=emilio
webgl: Add isProgram() support.

<!-- Please describe your changes on the following line: -->
webgl: Add isProgram() support.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

There's one failure still, where a deleted program should still be
considered to be a program until it's unbound.  However, I recently
made it so that we unbind at delete time, and we may need to partially
back that change out.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13102)
<!-- Reviewable:end -->
2016-08-28 21:23:59 -05:00
bors-servo
11e8e42fd8 Auto merge of #13060 - anholt:webgl-invalid-passed-params, r=emilio
webgl: Do validation of glScissor/glViewport(width, height) on the DOM side

<!-- Please describe your changes on the following line: -->
webgl: Do validation of glScissor/glViewport(width, height) on the DOM side

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

Avoids testcase CRASHes due to unexpected GL errors.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13060)
<!-- Reviewable:end -->
2016-08-28 20:10:47 -05:00
Eric Anholt
847ab63de6 webgl: Add isProgram() support.
There's one failure still, where a deleted program should still be
considered to be a program until it's unbound.  However, I recently
made it so that we unbind at delete time, and we may need to partially
back that change out.
2016-08-28 17:18:09 -07:00
Eric Anholt
e8b5f70429 webgl: Add getters for other GL_*_BINDING enums.
Fixes many subcases of object-deletion-behaviour.html.
2016-08-26 14:04:21 -07:00
Eric Anholt
db9fe23903 webgl: Remove objects from binding points on object deletion.
We keep bindings that shadow what's mapped in the GL state currently,
and so we need to remove the objects from our binding points when they
get implicitly removed from the GL binding points during object deletion.
2016-08-26 14:04:20 -07:00
Eric Anholt
6ec2c41df8 webgl: Protect against GL error on glBindRenderbuffer(deleted rbo).
On a GLES or compatibility underlying GL context, we were fine because
an underlying renderbuffer object would just get re-created, and
nothing too bad happened because we aren't tracking the currently
bound renderbuffer at the DOM level.  However, on a desktop GL core
context, binding non-genned or deleted names is an error.

Fixes a crash in object-deletion-behavior.html.
2016-08-26 14:04:19 -07:00
Eric Anholt
b8b74e4b37 webgl: Do validation of glScissor/glViewport(width, height) on the DOM side.
Avoids testcase CRASHes due to unexpected GL errors.
2016-08-26 12:58:51 -07:00
Eric Anholt
15fa1a5a7d webgl: Fix validation of drawElements()'s type argument.
Fixes crash due to unexpected GL errors in gl-drawelements.html.
2016-08-26 01:37:39 -07:00
Eric Anholt
6651db8b56 webgl: Add support for getParameter(GL_FRAMEBUFFER_BINDING).
To do this, we need to keep a map of GL names (encapsulated as
WebGLFramebufferId) to WebGLFramebuffer objects so that we can return
the right type.

Fixes #12852
2016-08-14 00:49:41 -07:00
Eric Anholt
a21bbb78c4 webgl: Fix a typo in VertexAttrib1fv handling.
The VertexAttrib[234]fv compare to the same size as in their function
name.  This wasn't noticed becacuse this function isn't connected from
the .webidl yet.
2016-08-13 17:25:32 -07:00
Eric Anholt
12a96caaf1 webgl: Validate that depthRange near <= far.
Fixes a subtest of webgl-specific.html.
2016-08-10 00:05:02 -07:00
bors-servo
3b0dadda52 Auto merge of #12224 - nox:die-util-die, r=Ms2ger
Remove some stuff from util

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12224)
<!-- Reviewable:end -->
2016-07-04 12:57:00 -07:00
Eduard Burtescu
0db1faf876 Switch to using the new rooted!/RootedGuard API for rooting. 2016-07-04 20:59:01 +03:00
Anthony Ramine
e77efb93c1 Move util::vec::byte_swap to canvas_traits 2016-07-04 16:48:15 +02:00
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
Emilio Cobos Álvarez
46c14aced2
webgl: Refactor texture validations to take advantage of rust type system
This commit introduces the `WebGLValidator` trait, and uses it for multiple
validations in the texture-related WebGL code, to move that logic out of the
already bloated `webglrenderingcontext.rs` file.

It also creates a type-safe wrapper for some WebGL types, removing all the
`unreachable!`s there, and introduces a macro for generating them conveniently.

This partially addresses #10693, pending refactor more code to use this
infrastructure, and (possibly?) introducing an `AsGLError` trait for the errors
to make the error handling happen in `WebGLContext`.
2016-06-25 00:03:15 +02:00
Daosheng Mu
9f563e9e43 Implement texSubImage2D API 2016-06-10 01:15:55 +01:00
bors-servo
b11648903b Auto merge of #11426 - DDEFISHER:master, r=emilio
Implement IsBuffer, IsFramebuffer and IsRenderbuffer for WebGLRenderingContext

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy --faster` does not report any errors
- [X] These changes fix #11357
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11426)
<!-- Reviewable:end -->
2016-05-29 20:03:56 -05:00
Daniel
c017438428 Implement IsBuffer, IsFramebuffer and IsRenderbuffer for WebGLRenderingContext 2016-05-29 17:08:10 -04:00
bors-servo
2f9796fa69 Auto merge of #11329 - c-rhodes:11320, r=jdm
Report use statements that use {} with only one entry

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [X ] `./mach build -d` does not report any errors
- [X ] `./mach test-tidy --faster` does not report any errors
- [X ] These changes fix #11320  (github issue number if applicable).

Either:
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11329)
<!-- Reviewable:end -->
2016-05-27 07:11:17 -05:00
Cullen Rhodes
40acd24e8f Report use statements that use {} with only one entry 2016-05-27 10:18:44 +01:00
Kosov Eugene
94ad5aef62 add log2(u32) and use it to prevent casting to and from float to int 2016-05-27 10:15:37 +03:00
Anthony Ramine
cdc7bca944 Move DOMString back to script
This entirely removes the 'non-geckolib' feature of the util crate.
2016-05-24 10:54:57 +02:00
bors-servo
846517342b Auto merge of #11147 - danlrobertson:webgl-tex, r=emilio
Impl copyTexImage2D and copyTexSubImage2D

- [X] `./mach build` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes

Implement copyTexImage2D and copyTexSubImage2D for WebGLRenderingContext. Feedback would be appreciated. I did my best to follow the [spec](https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8). Please let me know if I missed anything. I couldn't find tests for this. Let me know if I should create one. I'm more than happy to do so. As always any feedback, comments,or critiques are very welcome 😄

Part of #10209

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11147)
<!-- Reviewable:end -->
2016-05-23 20:07:52 -07:00
Daniel Robertson
867cd9be29 Impl copyTexImage2D and copyTexSubImage2D
Implement copyTexImage2D and copyTexSubImage2D for
WebGLRenderingContext.
2016-05-23 22:29:23 -04:00
David Zbarsky
abfbeca670 Implement SampleCoverage 2016-05-22 00:23:29 -07:00
Ms2ger
cc2b2b50a7 Remove ConstellationChan.
It's a pointless abstraction that propagates the obsolete chan terminology,
swaps the order in which the sender and receiver are returned, and hides a
source of panics.
2016-05-19 17:13:44 +02:00
bors-servo
fe116b4bd7 Auto merge of #10776 - dzbarsky:getVertexAttrib, r=emilio
Implement GetVertexAttrib

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10776)
<!-- Reviewable:end -->
2016-05-18 14:40:32 -07:00
David Zbarsky
2bf016ff14 Implement GetVertexAttrib 2016-05-12 23:56:10 -07:00
David Zbarsky
2f416baa11 Implement ReadPixels 2016-05-12 23:50:36 -07:00
Daniel
8a5b0b8972 Implement IsShader fn and IsTexture fn for WebGLRenderingContext 2016-05-09 20:54:57 -04:00
Patrick Walton
91907f563b compositing: Send mouse events to the right pipeline when using
WebRender.

Fixes mouse events in browser.html.

Requires servo/webrender_traits#47 and servo/webrender#272.
2016-05-04 11:40:15 -07:00
Keith Yeung
2946fbef77 Implement stencil fns for WebGLRenderingContext 2016-04-24 02:40:22 -04:00
bors-servo
f1defb446e Auto merge of #10443 - emilio:webgl-teximage2d-overload, r=jdm
webgl: Implement the pending texImage2D overload, and add more validation

This is a large-ish refactor of the Texture2D code, but it should be
easier to read and of course more correct.

I tried to annotate every error condition with a spec paragraph.

I made just a reftest to ensure this works as intended, since I expect #10373 to land pretty soon.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10443)
<!-- Reviewable:end -->
2016-04-22 11:25:29 -07:00
Emilio Cobos Álvarez
f6f1e37b29
webgl: Fix a few typos in comments 2016-04-20 20:30:05 +02:00
Emilio Cobos Álvarez
d152c7fe88
webgl: texture: Make initialize only mark as initialized the current face
Also refactor a bit the code, and remove the unused `is_initialized`
flag.
2016-04-20 20:27:37 +02:00
Emilio Cobos Álvarez
21e2f97cfa
webgl: Fix filling a non-zero level
You can fill a level > 0 as long as the width and height values are
power of two, so the previous test was bogus.
2016-04-20 20:24:56 +02:00
Emilio Cobos Álvarez
1ad7f73caf
webgl: Reset bound buffer when appropiate in BufferData
This makes the test bufferDataBadArgs pass appropiately.
2016-04-20 19:22:05 +02:00
Emilio Cobos Álvarez
bc08762414
webgl: Rename UniformType to UniformSetterType and hoist to the bottom 2016-04-19 20:25:30 +02:00
Emilio Cobos Álvarez
6a15c2f245
webgl: Remove active_uniform related validation.
It's broken for uniform arrays, since uniform.id() stops being the index
then.

We need to add a more complex integration with angle for this to ever
be correct.

Unfortunately the ANGLE part that we should touch is C++, and it has
destructors, so we need to hook destructors there, and I can't do it
right now.
2016-04-19 13:27:19 +02:00
Emilio Cobos Álvarez
c807cab300
webgl: Validate that the texture should be power of two if the level is
greater than 1
2016-04-19 13:25:44 +02:00
Emilio Cobos Álvarez
87e112dea7
webgl: Implement the pending texImage2D overload, and add more validation
This is a large-ish refactor of the Texture2D code, but it should be
easier to read and of course more correct.

I tried to annotate every error condition with a spec paragraph.
2016-04-19 13:25:40 +02:00
David Zbarsky
a67a744057 Prevent use of reserved names in BindAttribLocation 2016-04-17 11:52:40 -07:00
Adrian Utrilla
89c432b2d2
Added remaining uniforms 2016-04-14 07:42:14 +02:00
David Zbarsky
34644401c6 Implement GetActiveAttrib 2016-04-11 23:12:04 -07:00
bors-servo
f0014bd9cd Auto merge of #10224 - emilio:shader-type-validations, r=jdm
webgl: Add attribute validations and other nits

Fixes https://github.com/servo/servo/issues/9958

Depends on a bunch of prs, and needs a test.

r? @jdm

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10224)
<!-- Reviewable:end -->
2016-04-12 05:18:49 +05:30