Skip to content

Instantly share code, notes, and snippets.

Imanol Fernandez MortimerGoro

Block or report user

Report or block MortimerGoro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MortimerGoro
MortimerGoro / WebGLContext.cpp
Last active Jun 29, 2018
WebGLContext patch
View WebGLContext.cpp
#define VRB_LOG(format, ...) __android_log_print(ANDROID_LOG_INFO, "VRB", format, ##__VA_ARGS__);
static already_AddRefed<SharedSurfaceTextureClient>
CloneSurface(gl::SharedSurface* src, gl::SurfaceFactory* factory)
{
RefPtr<SharedSurfaceTextureClient> dest = factory->NewTexClient(src->mSize);
if (!dest) {
return nullptr;
}
@MortimerGoro
MortimerGoro / OVRService.java
Last active Aug 7, 2017
Gear VR SurfaceView
View OVRService.java
// Android SurfaceView initialization example
void init(final Activity activity) {
mSurfaceView = new SurfaceView(activity);
mSurfaceView.getHolder().addCallback(OVRService.this);
// Enabling setZOrderOnTop is very important! If not enabled a single swap_buffers
// on the NativeActivity's window will make the SurfaceView invisible.
mSurfaceView.setZOrderOnTop(true);
activity.getApplication().registerActivityLifecycleCallbacks(OVRService.this);
}
@MortimerGoro
MortimerGoro / gearvr_display.rs
Last active Aug 7, 2017
Gear VR submit frame
View gearvr_display.rs
fn submit_frame(&mut self, layer: &VRLayer) {
let mut frame_params = ovr::helpers::vrapi_DefaultFrameParms(self.render_ovr_java.handle(),
ovr::ovrFrameInit::VRAPI_FRAME_INIT_DEFAULT,
self.predicted_display_time,
ptr::null_mut());
frame_params.FrameIndex = self.frame_index;
let eye_projection = self.eye_projection.get();
for (i, eye) in self.eye_framebuffers.iter_mut().enumerate() {
let swap_chain_index = (self.frame_index % eye.swap_chain_length as i64) as i32;
@MortimerGoro
MortimerGoro / crash.txt
Created Apr 28, 2017
crash android chould've computed the final hint and handled later_siblings already
View crash.txt
This file has been truncated, but you can view the full file.
--------- beginning of system
07-03 16:58:41.761 447 455 I QISL : QSEE Interrupt Service Listener Thread is started
07-03 16:58:41.762 447 455 I QISL : QSEE Interrupt Service Listener was activated successfully
07-03 16:58:43.880 545 545 I vold : Vold 3.0 (the awakening) firing up
07-03 16:58:43.888 545 545 V vold : Detected support for: ext4 vfat
07-03 16:58:43.942 545 552 I vold : e4crypt_initialize_global_de
07-03 16:58:44.149 545 552 D vold : Added key 353542628 (ext4:5a0dc95cb48db9de) to keyring 936389460 in process 545
07-03 16:58:44.204 545 552 D vold : e4crypt_init_user0
07-03 16:58:44.204 545 552 D vold : Preparing: /data/misc/vold/user_keys
View gamepad_traits.rs
pub trait VRGamepad {
fn id(&self) -> u32;
// Constant data for the gamepad.
fn data(&self) -> VRGamepadData;
// Data that should be polled every frame.
fn state(&self) -> VRGamepadState;
}
pub struct VRGamepadState {
pub connected: bool,
View gvr_blitframebuffer.rs
if self.fbo_texture != layer.texture_id {
// Attach external texture to the used later in BlitFramebuffer.
gl::BindFramebuffer(gl::FRAMEBUFFER, self.fbo_id);
gl::FramebufferTexture2D(gl::FRAMEBUFFER, gl::COLOR_ATTACHMENT0, gl::TEXTURE_2D, layer.texture_id, 0);
self.fbo_texture = layer.texture_id;
}
let texture_size = layer.texture_size.unwrap_or_else(|| {
(self.render_size.width as u32, self.render_size.height as u32)
});
View NativeActivity.java
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().takeSurface(null);
FrameLayout layout = new FrameLayout(this);
layout.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
SurfaceView nativeSurface = new SurfaceView(this);
nativeSurface.getHolder().addCallback(this);
layout.addView(nativeSurface, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
@MortimerGoro
MortimerGoro / TypedArrays.rs
Created Nov 23, 2016
TypedArrays example for blogpost
View TypedArrays.rs
/// Creates a typed JS array from a Rust slice
pub fn slice_to_array_buffer_view<T>(cx: *mut JSContext, data: &[T]) -> *mut JSObject
where T: ArrayBufferViewContents
{
unsafe {
let js_object = T::new(cx, data.len() as u32);
assert!(!js_object.is_null());
update_array_buffer_view(js_object, data);
js_object
}
@MortimerGoro
MortimerGoro / VRDisplay.rs
Last active Nov 23, 2016
VRDisplay DOM struct example
View VRDisplay.rs
#[dom_struct]
pub struct VRDisplay {
eventtarget: EventTarget,
#[ignore_heap_size_of = "Defined in rust-webvr"]
display: DOMRefCell<WebVRDisplayData>,
depth_near: Cell<f64>,
depth_far: Cell<f64>,
presenting: Cell<bool>,
left_eye_params: MutHeap<JS<VREyeParameters>>,
right_eye_params: MutHeap<JS<VREyeParameters>>,
@MortimerGoro
MortimerGoro / VRCompositorCommand.rs
Created Nov 23, 2016
VRCompositorCommand for blogpost
View VRCompositorCommand.rs
pub enum VRCompositorCommand {
Create(VRCompositorId),
SyncPoses(VRCompositorId, f64, f64, IpcSender<Result<Vec<u8>,()>>),
SubmitFrame(VRCompositorId, [f32; 4], [f32; 4]),
Release(VRCompositorId)
}
You can’t perform that action at this time.