Skip to content

Commit

Permalink
Properly support gl_PointSize and gl_PointCoord
Browse files Browse the repository at this point in the history
Fixes #21719.
Fixes #20993.
Fixes #20992.
Fixes #21007.
Fixes #20979.
  • Loading branch information
nox committed Oct 17, 2018
1 parent aa95911 commit 55742c2
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 219 deletions.
11 changes: 11 additions & 0 deletions components/canvas/webgl_thread.rs
Expand Up @@ -122,6 +122,17 @@ impl<VR: WebVRRenderHandler + 'static> WebGLThread<VR> {
.expect("WebGLContext not found");
let glsl_version = Self::get_glsl_version(&data.ctx);

// FIXME(nox): Should probably be done by offscreen_gl_context.
if glsl_version.major < 2 {
// FIXME(nox): Should be gl::POINT_SPRITE but gleam only
// generates bindings for core profile stuff and this has
// been removed from core profile.
data.ctx.gl().enable(0x8861);
}
if !is_gles() {
data.ctx.gl().enable(gl::PROGRAM_POINT_SIZE);
}

WebGLCreateContextResult {
sender: WebGLMsgSender::new(id, webgl_chan.clone()),
limits,
Expand Down
6 changes: 6 additions & 0 deletions components/canvas_traits/webgl.rs
Expand Up @@ -605,3 +605,9 @@ parameters! {
}),
}
}

pub fn is_gles() -> bool {
// TODO: align this with the actual kind of graphics context in use, rather than
// making assumptions based on platform
cfg!(any(target_os = "android", target_os = "ios"))
}
Expand Up @@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use canvas_traits::webgl::WebGLVersion;
use canvas_traits::webgl::{WebGLVersion, is_gles};
use dom::bindings::codegen::Bindings::EXTShaderTextureLodBinding;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::DomRoot;
use dom::webglrenderingcontext::{WebGLRenderingContext, is_gles};
use dom::webglrenderingcontext::WebGLRenderingContext;
use dom_struct::dom_struct;
use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec};

Expand Down
Expand Up @@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use canvas_traits::webgl::WebGLVersion;
use canvas_traits::webgl::{WebGLVersion, is_gles};
use dom::bindings::codegen::Bindings::OESElementIndexUintBinding;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::DomRoot;
use dom::webglrenderingcontext::{WebGLRenderingContext, is_gles};
use dom::webglrenderingcontext::WebGLRenderingContext;
use dom_struct::dom_struct;
use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec};

Expand Down
Expand Up @@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use canvas_traits::webgl::WebGLVersion;
use canvas_traits::webgl::{WebGLVersion, is_gles};
use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding;
use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::DomRoot;
use dom::webglrenderingcontext::{WebGLRenderingContext, is_gles};
use dom::webglrenderingcontext::WebGLRenderingContext;
use dom_struct::dom_struct;
use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec};

Expand Down
4 changes: 2 additions & 2 deletions components/script/dom/webglrenderbuffer.rs
Expand Up @@ -3,15 +3,15 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError, WebGLRenderbufferId, WebGLResult};
use canvas_traits::webgl::{WebGLCommand, WebGLError, WebGLRenderbufferId, WebGLResult, is_gles, webgl_channel};
use dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as WebGl2Constants;
use dom::bindings::codegen::Bindings::WebGLRenderbufferBinding;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::inheritance::Castable;
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::root::DomRoot;
use dom::webglobject::WebGLObject;
use dom::webglrenderingcontext::{WebGLRenderingContext, is_gles};
use dom::webglrenderingcontext::WebGLRenderingContext;
use dom_struct::dom_struct;
use std::cell::Cell;

Expand Down
6 changes: 0 additions & 6 deletions components/script/dom/webglrenderingcontext.rs
Expand Up @@ -73,12 +73,6 @@ use std::cmp;
use std::ptr::{self, NonNull};
use webrender_api;

pub fn is_gles() -> bool {
// TODO: align this with the actual kind of graphics context in use, rather than
// making assumptions based on platform
cfg!(any(target_os = "android", target_os = "ios"))
}

// From the GLES 2.0.25 spec, page 85:
//
// "If a texture that is currently bound to one of the targets
Expand Down
194 changes: 0 additions & 194 deletions tests/wpt/webgl/meta/conformance/glsl/variables/gl-pointcoord.html.ini

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 55742c2

Please sign in to comment.