try! -> ?
This commit is contained in:
24
src/vr.rs
24
src/vr.rs
@@ -34,8 +34,8 @@ pub enum Event {
|
|||||||
impl VR {
|
impl VR {
|
||||||
pub fn new() -> Result<VR, vr::Error<openvr_sys::EVRInitError>> {
|
pub fn new() -> Result<VR, vr::Error<openvr_sys::EVRInitError>> {
|
||||||
Ok(VR {
|
Ok(VR {
|
||||||
system: try!(vr::init()),
|
system: vr::init()?,
|
||||||
compositor: try!(vr::compositor()),
|
compositor: vr::compositor()?,
|
||||||
gfx_handles: gfx::handle::Manager::new(),
|
gfx_handles: gfx::handle::Manager::new(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -154,14 +154,16 @@ pub fn create_eyebuffer<T, D>(factory: &mut gfx_device_gl::Factory,
|
|||||||
-> Result<EyeBuffer<T, D>, gfx::CombinedError>
|
-> Result<EyeBuffer<T, D>, gfx::CombinedError>
|
||||||
where T: gfx::format::RenderFormat + gfx::format::TextureFormat,
|
where T: gfx::format::RenderFormat + gfx::format::TextureFormat,
|
||||||
D: gfx::format::DepthFormat + gfx::format::TextureFormat {
|
D: gfx::format::DepthFormat + gfx::format::TextureFormat {
|
||||||
let tex = try!(factory.create_texture(
|
let tex = factory
|
||||||
tex::Kind::D2(size.width as tex::Size, size.height as tex::Size, tex::AaMode::Single),
|
.create_texture(tex::Kind::D2(size.width as tex::Size,
|
||||||
1, // levels
|
size.height as tex::Size,
|
||||||
gfx::RENDER_TARGET, // bind
|
tex::AaMode::Single),
|
||||||
gfx::Usage::GpuOnly, // Usage
|
1, // levels
|
||||||
Some(<T::Channel as gfx::format::ChannelTyped>::get_channel_type()))); // hint: format::ChannelType?
|
gfx::RENDER_TARGET, // bind
|
||||||
let tgt = try!(factory.view_texture_as_render_target(&tex, 0, None));
|
gfx::Usage::GpuOnly, // Usage
|
||||||
let depth = try!(factory.create_depth_stencil_view_only(size.width as tex::Size,
|
Some(<T::Channel as gfx::format::ChannelTyped>::get_channel_type()))?; // hint: format::ChannelType?
|
||||||
size.height as tex::Size));
|
let tgt = factory.view_texture_as_render_target(&tex, 0, None)?;
|
||||||
|
let depth = factory.create_depth_stencil_view_only(size.width as tex::Size,
|
||||||
|
size.height as tex::Size)?;
|
||||||
Ok(EyeBuffer { tex: tex, target: tgt, depth: depth })
|
Ok(EyeBuffer { tex: tex, target: tgt, depth: depth })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user