Commit graph

384 commits

Author SHA1 Message Date
Anthony Ramine
d16a73001f Check the bound buffer element array only for count > 0 in gl.drawElements
See https://www.khronos.org/registry/webgl/specs/latest/1.0/#6.2
2018-04-16 16:23:13 +02:00
Anthony Ramine
7f1590dac0 Check mode first in gl.drawElements 2018-04-16 16:23:07 +02:00
Anthony Ramine
ac85d1255d Emit InvalidEnum for invalid targets passed to gl.renderbufferStorage 2018-04-06 11:22:27 +02:00
Anthony Ramine
183cc4c035 Properly check for invalid targets in gl.BindFramebuffer
It should always emit InvalidEnum, not InvalidOperation.
2018-04-06 11:22:27 +02:00
Anthony Ramine
91d07a27db Remove SAMPLE_COVERAGE_INVERT from WebGLRenderingContext::validate_feature_enum
This constant is not mentioned in the docs of glEnable or glIsEnabled.
2018-04-05 09:31:13 +02:00
Anthony Ramine
1881c09a9c Mention #20534 near the enable/disable/isEnabled WebGL methods 2018-04-05 09:31:12 +02:00
Anthony Ramine
fb290e9c9e Properly clamp arguments to WebGLRenderingContext.depthRange 2018-04-05 09:31:09 +02:00
Anthony Ramine
7b4d66b621 Manually clamp the argument of WebGLRenderingContext.clearDepth
Better be safe than to feed stuff to some GPU driver that wouldn't clamp it.
2018-04-05 09:30:21 +02:00
Anthony Ramine
fc6335c01d Properly allow more than FUNC_ADD in blendEquationSeparate 2018-04-04 15:49:21 +02:00
Anthony Ramine
15272d2c3b Properly allow FUNC_SUBTRACT and FUNC_REVERSE_SUBTRACT in blendEquation 2018-04-04 15:43:09 +02:00
Anthony Ramine
ae286a518d Cache BUFFER_USAGE value on the DOM side 2018-04-04 15:41:27 +02:00
Anthony Ramine
bb2b6a7a41 Fix the signature of WebGLRenderingContext::BufferSubData 2018-04-04 13:12:42 +02:00
Anthony Ramine
3c56d2f5a7 Move handle_potential_webgl_error to the dom macros module 2018-04-04 13:12:41 +02:00
Anthony Ramine
e7f716de12 Fix the emitted error for invalid targets in WebGLRenderingContext::BufferData_ 2018-04-04 13:12:41 +02:00
Anthony Ramine
235a7b80c9 Introduce WebGLRenderingContext::bound_buffer 2018-04-04 13:12:40 +02:00
Anthony Ramine
605da95076 Improve WebGLBuffer::buffer_data
It now checks the usage argument itself and use generics for the data vector.
2018-04-04 13:12:39 +02:00
Anthony Ramine
866a523914 Properly use Float32List and Int32List for WebGL uniform methods 2018-04-03 12:22:32 +02:00
Anthony Ramine
088ebcb095 Remove obsolete BufferDataSource 2018-04-03 11:15:54 +02:00
Anthony Ramine
a82164d8a5 Clean up signature of some fallible WebGL methods 2018-04-03 10:51:26 +02:00
Anthony Ramine
ce81420bef Use ByteBuf for the canvas messages
The type Vec<u8> is super unefficient to work with in Serde if all you want
to represent is a simple blob.
2018-03-26 20:48:02 +02:00
Emilio Cobos Álvarez
c2f8b0468a
Update mozjs. 2018-03-25 00:04:43 +01:00
Anthony Ramine
d6ebbd3e17 Implement gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE) 2018-03-24 16:36:19 +01:00
Anthony Ramine
20a309f037 Implement missing WebGLShader checks
Methods compileShader and getShaderParameter should emit an error when
the shader has been deleted.
2018-03-24 15:24:54 +01:00
Anthony Ramine
a62bed82e4 Implement WebGLRenderingContextBase.getAttachedShaders 2018-03-24 13:58:07 +01:00
Anthony Ramine
2befe47384 Implement missing checks in WebGLRenderingContext::GetBufferParameter 2018-03-24 11:44:29 +01:00
bors-servo
72f326b22b
Auto merge of #20400 - servo:webgl, r=emilio
Implement HTMLCanvasElement.toDataURL for WebGL canvas (fixes #19147)

<!-- 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/20400)
<!-- Reviewable:end -->
2018-03-24 00:18:28 -04:00
Igor Matuszewski
80c6891f33 Use safe to_vec() for typed arrays in WebGL bindings 2018-03-23 19:37:25 +01:00
Igor Matuszewski
c42127b683 Fix indentation 2018-03-23 19:25:19 +01:00
Igor Matuszewski
cb85a95478 Fix sanity check in vertex attrib 2018-03-23 19:25:19 +01:00
Igor Matuszewski
daceeb4002 Appease test-tidy 2018-03-23 19:25:19 +01:00
Igor Matuszewski
20f21cb5f8 Adapt uniform[fv] and similar to accept typed array args 2018-03-23 19:25:19 +01:00
Igor Matuszewski
c1c74ed96c Adapt function bodies for usage with typed array args 2018-03-23 19:25:19 +01:00
Igor Matuszewski
36f39ce27a Change WebGL function signatures accepting typed arrays 2018-03-23 19:25:19 +01:00
Anthony Ramine
a77d35b60c Implement HTMLCanvasElement.toDataURL for WebGL canvas (fixes #19147) 2018-03-23 17:32:42 +01:00
Anthony Ramine
838d1305ca Implement OES_element_index_uint (fixes #20384) 2018-03-23 02:47:39 +01:00
Anthony Ramine
8061d8c3d2 Fix some more WebGL methods 2018-03-23 01:23:39 +01:00
Anthony Ramine
e34b19c42c Implement gl.getParameter(gl.VIEWPORT) 2018-03-22 19:17:36 +01:00
Anthony Ramine
cb6fa6e6b0 Implement gl.getParameter(gl.CURRENT_PROGRAM) 2018-03-22 19:17:35 +01:00
Anthony Ramine
f532e79dc1 Make some WebGL parameters non-optional (fixes #8753)
Those parameters aren't optional in the current spec.

The test element-array-buffer-delete-recreate.html now fails because we don't
actually implement gl.getParameter(gl.CURRENT_PROGRAM).
2018-03-22 19:17:35 +01:00
Anthony Ramine
3229c62282 Implement a missing INVALID_OPERATION check in DrawArrays 2018-03-22 18:51:58 +01:00
Anthony Ramine
2a9c2bc8fd Fix an off-by-one error with limits.max_vertex_attribs 2018-03-22 18:51:58 +01:00
Igor Gutorov
ee5bdbbd8b Implement WebGL getFramebufferAttachmentParameter API 2018-03-22 18:26:18 +02:00
Igor Gutorov
bdd53f35af Simplify GetShaderPrecisionFormat 2018-03-21 01:57:44 +02:00
Igor Gutorov
7e5160b79e Simplify BufferParameter 2018-03-20 21:24:10 +02:00
Igor Gutorov
0747853ad0 Simplify VertexAttribOffset 2018-03-20 21:08:28 +02:00
Igor Gutorov
431e3ddf8d Simplify GetTexParameter 2018-03-20 21:00:46 +02:00
Igor Matuszewski
e025bbb079 WIP: Accept typed array arguments in codegen 2018-03-14 18:43:26 +01:00
Emilio Cobos Álvarez
21df4014db
constellation: Make setting up the WebGL state fallible.
This fixes a regression caused by the glutin update.

We now are creating EGL contexts in Linux Wayland, instead of X context, so the
GLContextFactory assumption of one GL back-end per platform is broken.

This just works around it, for now, but in general I think not relying on
available WebGL state is a good thing, and we do that already for WebVR anyway.
2018-03-09 23:27:29 +01:00
Martina Kollarova
288ef50fb7 Add WebGL function glGetTexParameter
Set the expected result of the test `tex-input-validation.html` to CRASH, since
that is caused by unrelated problems. The test was previously not executing
completely, because it stopped when it didn't find the implementation of
getTexParameter.
2018-03-06 15:28:10 +02:00
Simon Sapin
52eda6082f Replace NonNullJSObjectPtr with std::ptr::NonNull<JSObject> 2018-01-22 17:41:25 +01:00