Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Getting eye parameters requires memory allocation #42

Open
asajeffrey opened this issue Jan 25, 2019 · 0 comments
Open

Getting eye parameters requires memory allocation #42

asajeffrey opened this issue Jan 25, 2019 · 0 comments

Comments

@asajeffrey
Copy link
Member

One of the webvr issues in Servo is that we freeze the eye parameters for a VRDisplay when the object is created, so if they change then the changes don't get seen by JS. servo/servo#22758

The obvious fix for this is to get the eye parameters from rust-webvr, but unfortunately the API for that is to get the VRDisplayData

/// Returns the current display data.
fn data(&self) -> VRDisplayData;

and the display data includes the display_name as a String

pub struct VRDisplayData {
pub display_id: u32,
pub display_name: String,
pub connected: bool,
pub capabilities: VRDisplayCapabilities,
pub stage_parameters: Option<VRStageParameters>,
pub left_eye_parameters: VREyeParameters,
pub right_eye_parameters: VREyeParameters,
}

Since the name is a String, it has to be freshly allocated each time the display data is accessed, which is wasteful.

Possible fixes: separate out the eye parameters from the display data, or make the display_name a &'static str or Cow<'static, str> rather than a String.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant