mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Return typed arrays from gl.getParameter (fixes #20655)
This commit is contained in:
parent
5aafb5007a
commit
0e6bec65bb
2 changed files with 32 additions and 88 deletions
|
@ -52,9 +52,10 @@ use euclid::Size2D;
|
|||
use fnv::FnvHashMap;
|
||||
use half::f16;
|
||||
use js::jsapi::{JSContext, JSObject, Type};
|
||||
use js::jsval::{BooleanValue, DoubleValue, Int32Value, UInt32Value, JSVal, NullValue, UndefinedValue};
|
||||
use js::jsval::{BooleanValue, DoubleValue, Int32Value, UInt32Value, JSVal};
|
||||
use js::jsval::{ObjectValue, NullValue, UndefinedValue};
|
||||
use js::rust::CustomAutoRooterGuard;
|
||||
use js::typedarray::ArrayBufferView;
|
||||
use js::typedarray::{ArrayBufferView, CreateWith, Float32Array, Int32Array};
|
||||
use net_traits::image::base::PixelFormat;
|
||||
use net_traits::image_cache::ImageResponse;
|
||||
use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
||||
|
@ -63,7 +64,7 @@ use script_layout_interface::HTMLCanvasDataSource;
|
|||
use servo_config::prefs::PREFS;
|
||||
use std::cell::{Cell, Ref};
|
||||
use std::cmp;
|
||||
use std::ptr::NonNull;
|
||||
use std::ptr::{self, NonNull};
|
||||
use webrender_api;
|
||||
|
||||
type ImagePixelResult = Result<(Vec<u8>, Size2D<i32>, bool), ()>;
|
||||
|
@ -1425,10 +1426,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
Parameter::Int4(param) => {
|
||||
let (sender, receiver) = webgl_channel().unwrap();
|
||||
self.send_command(WebGLCommand::GetParameterInt4(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()
|
||||
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
|
||||
let _ = Int32Array::create(
|
||||
cx,
|
||||
CreateWith::Slice(&receiver.recv().unwrap()),
|
||||
rval.handle_mut(),
|
||||
).unwrap();
|
||||
ObjectValue(rval.get())
|
||||
}
|
||||
Parameter::Float(param) => {
|
||||
let (sender, receiver) = webgl_channel().unwrap();
|
||||
|
@ -1438,18 +1442,24 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
Parameter::Float2(param) => {
|
||||
let (sender, receiver) = webgl_channel().unwrap();
|
||||
self.send_command(WebGLCommand::GetParameterFloat2(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()
|
||||
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
|
||||
let _ = Float32Array::create(
|
||||
cx,
|
||||
CreateWith::Slice(&receiver.recv().unwrap()),
|
||||
rval.handle_mut(),
|
||||
).unwrap();
|
||||
ObjectValue(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()
|
||||
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
|
||||
let _ = Float32Array::create(
|
||||
cx,
|
||||
CreateWith::Slice(&receiver.recv().unwrap()),
|
||||
rval.handle_mut(),
|
||||
).unwrap();
|
||||
ObjectValue(rval.get())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2608,10 +2618,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
self.send_command(WebGLCommand::GetCurrentVertexAttrib(index, sender));
|
||||
receiver.recv().unwrap()
|
||||
};
|
||||
// FIXME(nox): https://github.com/servo/servo/issues/20655
|
||||
rooted!(in(cx) let mut result = UndefinedValue());
|
||||
value.to_jsval(cx, result.handle_mut());
|
||||
return result.get();
|
||||
rooted!(in(cx) let mut result = ptr::null_mut::<JSObject>());
|
||||
let _ = Float32Array::create(
|
||||
cx,
|
||||
CreateWith::Slice(&value),
|
||||
result.handle_mut(),
|
||||
).unwrap();
|
||||
return ObjectValue(result.get());
|
||||
}
|
||||
|
||||
match param {
|
||||
|
|
|
@ -1,29 +1,8 @@
|
|||
[gl-get-calls.html]
|
||||
type: testharness
|
||||
[WebGL test #5: context.getParameter(context.ALIASED_LINE_WIDTH_RANGE) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #6: context.getParameter(context.ALIASED_POINT_SIZE_RANGE) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #10: context.getParameter(context.BLEND_COLOR) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #18: context.getParameter(context.COLOR_CLEAR_VALUE) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #20: context.getParameter(context.COMPRESSED_TEXTURE_FORMATS) is not an instance of Uint32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #27: context.getParameter(context.DEPTH_RANGE) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #46: context.getParameter(context.SCISSOR_BOX) is not an instance of function Int32Array() {\n [native code\]\n}]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #88: context.getParameter(context.VIEWPORT) is not an instance of Int32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #99: context.getParameter(context.MAX_VIEWPORT_DIMS)[0\] >= window.screen.width should be true. Threw exception TypeError: context.getParameter(...) is null]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -33,54 +12,6 @@
|
|||
[WebGL test #101: context.getParameter(context.MAX_VIEWPORT_DIMS) is not an instance of Int32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #173: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #182: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #191: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #200: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #209: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #218: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #227: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #236: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #245: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #254: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #263: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #272: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #281: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #290: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #299: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #308: context.getVertexAttrib(ii, context.CURRENT_VERTEX_ATTRIB) is not an instance of Float32Array]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #310: context.getError() should be 0. Was 1280.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue