diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/canvas/webgl_thread.rs | 20 | ||||
-rw-r--r-- | components/canvas_traits/webgl.rs | 20 | ||||
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 15 |
3 files changed, 54 insertions, 1 deletions
diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index 298bacfe860..f6e6981fb14 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -893,6 +893,19 @@ impl WebGLImpl { } sender.send(value[0] != 0).unwrap() } + WebGLCommand::GetParameterBool4(param, sender) => { + let mut value = [0; 4]; + unsafe { + ctx.gl().get_boolean_v(param as u32, &mut value); + } + let value = [ + value[0] != 0, + value[1] != 0, + value[2] != 0, + value[3] != 0, + ]; + sender.send(value).unwrap() + } WebGLCommand::GetParameterInt(param, sender) => { let mut value = [0]; unsafe { @@ -921,6 +934,13 @@ impl WebGLImpl { } sender.send(value).unwrap() } + WebGLCommand::GetParameterFloat4(param, sender) => { + let mut value = [0.; 4]; + unsafe { + ctx.gl().get_float_v(param as u32, &mut value); + } + sender.send(value).unwrap() + } WebGLCommand::GetProgramParameterBool(program, param, sender) => { let mut value = [0]; unsafe { diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs index 1758b20d863..2b3baaa1181 100644 --- a/components/canvas_traits/webgl.rs +++ b/components/canvas_traits/webgl.rs @@ -272,10 +272,12 @@ pub enum WebGLCommand { DeleteVertexArray(WebGLVertexArrayId), BindVertexArray(Option<WebGLVertexArrayId>), GetParameterBool(ParameterBool, WebGLSender<bool>), + GetParameterBool4(ParameterBool4, WebGLSender<[bool; 4]>), GetParameterInt(ParameterInt, WebGLSender<i32>), GetParameterInt4(ParameterInt4, WebGLSender<[i32; 4]>), GetParameterFloat(ParameterFloat, WebGLSender<f32>), GetParameterFloat2(ParameterFloat2, WebGLSender<[f32; 2]>), + GetParameterFloat4(ParameterFloat4, WebGLSender<[f32; 4]>), GetProgramParameterBool(WebGLProgramId, ProgramParameterBool, WebGLSender<bool>), GetProgramParameterInt(WebGLProgramId, ProgramParameterInt, WebGLSender<i32>), GetShaderParameterBool(WebGLShaderId, ShaderParameterBool, WebGLSender<bool>), @@ -535,10 +537,12 @@ impl fmt::Debug for WebGLCommand { DeleteVertexArray(..) => "DeleteVertexArray", BindVertexArray(..) => "BindVertexArray", GetParameterBool(..) => "GetParameterBool", + GetParameterBool4(..) => "GetParameterBool4", GetParameterInt(..) => "GetParameterInt", GetParameterInt4(..) => "GetParameterInt4", GetParameterFloat(..) => "GetParameterFloat", GetParameterFloat2(..) => "GetParameterFloat2", + GetParameterFloat4(..) => "GetParameterFloat4", GetProgramParameterBool(..) => "GetProgramParameterBool", GetProgramParameterInt(..) => "GetProgramParameterInt", GetShaderParameterBool(..) => "GetShaderParameterBool", @@ -592,8 +596,12 @@ parameters! { Dither = gl::DITHER, PolygonOffsetFill = gl::POLYGON_OFFSET_FILL, SampleCoverageInvert = gl::SAMPLE_COVERAGE_INVERT, + ScissorTest = gl::SCISSOR_TEST, StencilTest = gl::STENCIL_TEST, }), + Bool4(ParameterBool4 { + ColorWritemask = gl::COLOR_WRITEMASK, + }), Int(ParameterInt { ActiveTexture = gl::ACTIVE_TEXTURE, AlphaBits = gl::ALPHA_BITS, @@ -607,15 +615,20 @@ parameters! { CullFaceMode = gl::CULL_FACE_MODE, DepthBits = gl::DEPTH_BITS, DepthFunc = gl::DEPTH_FUNC, + FragmentShaderDerivativeHint = gl::FRAGMENT_SHADER_DERIVATIVE_HINT, FrontFace = gl::FRONT_FACE, + GenerateMipmapHint = gl::GENERATE_MIPMAP_HINT, GreenBits = gl::GREEN_BITS, MaxCombinedTextureImageUnits = gl::MAX_COMBINED_TEXTURE_IMAGE_UNITS, MaxCubeMapTextureSize = gl::MAX_CUBE_MAP_TEXTURE_SIZE, + MaxFragmentUniformVectors = gl::MAX_FRAGMENT_UNIFORM_VECTORS, MaxRenderbufferSize = gl::MAX_RENDERBUFFER_SIZE, MaxTextureImageUnits = gl::MAX_TEXTURE_IMAGE_UNITS, MaxTextureSize = gl::MAX_TEXTURE_SIZE, + MaxVaryingVectors = gl::MAX_VARYING_VECTORS, MaxVertexAttribs = gl::MAX_VERTEX_ATTRIBS, MaxVertexTextureImageUnits = gl::MAX_VERTEX_TEXTURE_IMAGE_UNITS, + MaxVertexUniformVectors = gl::MAX_VERTEX_UNIFORM_VECTORS, PackAlignment = gl::PACK_ALIGNMENT, RedBits = gl::RED_BITS, SampleBuffers = gl::SAMPLE_BUFFERS, @@ -638,9 +651,9 @@ parameters! { StencilWritemask = gl::STENCIL_WRITEMASK, SubpixelBits = gl::SUBPIXEL_BITS, UnpackAlignment = gl::UNPACK_ALIGNMENT, - FragmentShaderDerivativeHint = gl::FRAGMENT_SHADER_DERIVATIVE_HINT, }), Int4(ParameterInt4 { + ScissorBox = gl::SCISSOR_BOX, Viewport = gl::VIEWPORT, }), Float(ParameterFloat { @@ -653,6 +666,11 @@ parameters! { Float2(ParameterFloat2 { AliasedPointSizeRange = gl::ALIASED_POINT_SIZE_RANGE, AliasedLineWidthRange = gl::ALIASED_LINE_WIDTH_RANGE, + DepthRange = gl::DEPTH_RANGE, + }), + Float4(ParameterFloat4 { + BlendColor = gl::BLEND_COLOR, + ColorClearValue = gl::COLOR_CLEAR_VALUE, }), } } diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 6617e1b227f..fe46e53f6d8 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -1361,6 +1361,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { self.send_command(WebGLCommand::GetParameterBool(param, sender)); BooleanValue(receiver.recv().unwrap()) } + Parameter::Bool4(param) => { + let (sender, receiver) = webgl_channel().unwrap(); + self.send_command(WebGLCommand::GetParameterBool4(param, sender)); + rooted!(in(cx) let mut rval = UndefinedValue()); + receiver.recv().unwrap().to_jsval(cx, rval.handle_mut()); + rval.get() + } Parameter::Int(param) => { let (sender, receiver) = webgl_channel().unwrap(); self.send_command(WebGLCommand::GetParameterInt(param, sender)); @@ -1387,6 +1394,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { receiver.recv().unwrap().to_jsval(cx, rval.handle_mut()); rval.get() } + Parameter::Float4(param) => { + let (sender, receiver) = webgl_channel().unwrap(); + self.send_command(WebGLCommand::GetParameterFloat4(param, sender)); + // FIXME(nox): https://github.com/servo/servo/issues/20655 + rooted!(in(cx) let mut rval = UndefinedValue()); + receiver.recv().unwrap().to_jsval(cx, rval.handle_mut()); + rval.get() + } } } |