try! -> ?

This commit is contained in:
2016-10-20 12:45:15 -07:00
parent a66cd3ae64
commit 73ac584ca4

View File

@@ -34,8 +34,8 @@ pub enum Event {
impl VR {
pub fn new() -> Result<VR, vr::Error<openvr_sys::EVRInitError>> {
Ok(VR {
system: try!(vr::init()),
compositor: try!(vr::compositor()),
system: vr::init()?,
compositor: vr::compositor()?,
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>
where T: gfx::format::RenderFormat + gfx::format::TextureFormat,
D: gfx::format::DepthFormat + gfx::format::TextureFormat {
let tex = try!(factory.create_texture(
tex::Kind::D2(size.width as tex::Size, size.height as tex::Size, tex::AaMode::Single),
let tex = factory
.create_texture(tex::Kind::D2(size.width as tex::Size,
size.height as tex::Size,
tex::AaMode::Single),
1, // levels
gfx::RENDER_TARGET, // bind
gfx::Usage::GpuOnly, // Usage
Some(<T::Channel as gfx::format::ChannelTyped>::get_channel_type()))); // hint: format::ChannelType?
let tgt = try!(factory.view_texture_as_render_target(&tex, 0, None));
let depth = try!(factory.create_depth_stencil_view_only(size.width as tex::Size,
size.height as tex::Size));
Some(<T::Channel as gfx::format::ChannelTyped>::get_channel_type()))?; // hint: format::ChannelType?
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 })
}