mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #20771 - servo:webgl, r=emilio
Implement most of the unsupported parameters in gl.getParameter() Fixes #20536. Fixes #20537. Fixes #20538. Fixes #20544. Fixes #20545. Fixes #20546. Fixes #20548. Fixes #20549. Fixes #20551. <!-- 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/20771) <!-- Reviewable:end -->
This commit is contained in:
commit
d6c4c743fb
6 changed files with 67 additions and 321 deletions
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue