update to gfx 0.13

This commit is contained in:
2016-12-26 15:42:03 -08:00
parent 3a8c0148c8
commit b955d7f1b6
3 changed files with 23 additions and 19 deletions

View File

@@ -11,7 +11,7 @@ use std::collections::BTreeMap;
use std::marker::PhantomData;
use std::time::SystemTime;
use gfx::{self, tex};
use gfx::{self, texture};
use gfx::traits::FactoryExt;
use na::{self, ToHomogeneous};
use num_traits::identities::One;
@@ -164,8 +164,8 @@ impl<D: gfx::Device, F: gfx::Factory<D::Resources>> WorldScene<D, F> {
constants_dirty: true,
locals: factory.create_constant_buffer(1),
atlas: tile::get_tiles::<_, _, view::ColorFormat>(device, factory, aux_command),
sampler: factory.create_sampler(tex::SamplerInfo::new(tex::FilterMethod::Jrd,
tex::WrapMode::Tile)),
sampler: factory.create_sampler(texture::SamplerInfo::new(texture::FilterMethod::Jrd,
texture::WrapMode::Tile)),
f: PhantomData,
vbuf: vertex_buffer,

View File

@@ -4,8 +4,8 @@ use ::std;
use std::io::Read;
use std::path::Path;
use gfx::{self, CommandBuffer, Typed};
use gfx::tex;
use gfx::{self, texture, CommandBuffer};
use gfx::memory::Typed;
const TILEDIM: u16 = 16;
@@ -30,18 +30,21 @@ pub fn get_tiles<D, F, T>(device: &mut D,
let ega_page = ega::decode(&ega_bytes, ega::Compression::Uncompressed, ega::Tiling::Tiled(TILEDIM));
let mipmap = ega_page.mipmap(2);
let tex = factory.create_texture_const_u8::<T>(tex::Kind::D2Array(mipmap.dim as u16,
let tex = factory.create_texture_immutable_u8::<T>(texture::Kind::D2Array(mipmap.dim as u16,
mipmap.dim as u16,
mipmap.len as u16,
tex::AaMode::Single),
texture::AaMode::Single),
&mipmap.slices())
.expect("create tile texture");
{
let mut manager = gfx::handle::Manager::<D::Resources>::new();
// XXX: Find out if Textures need to be/can be fenced like Buffers,
// Seems like I should mark tex.1 as being read/written, but it's not a Buffer?
let access = gfx::pso::AccessInfo::new();
let view = manager.ref_srv(tex.1.raw());
command.generate_mipmap(*view);
device.submit(command);
device.submit(command, &access);
}
tex.1
}

View File

@@ -6,7 +6,8 @@ pub use self::vr::Eye;
pub use self::vr::common::Size;
pub use self::openvr_sys::VRControllerState_t;
use gfx::{self, tex, Factory, Typed};
use gfx::{self, texture, Factory};
use gfx::memory::Typed;
use na::{self, Inverse};
use num_traits::identities::Zero;
use num_traits::identities::One;
@@ -153,15 +154,15 @@ pub fn create_eyebuffer<T, D>(factory: &mut gfx_device_gl::Factory,
where T: gfx::format::RenderFormat + gfx::format::TextureFormat,
D: gfx::format::DepthFormat + gfx::format::TextureFormat {
let tex = factory
.create_texture(tex::Kind::D2(size.width as tex::Size,
size.height as tex::Size,
tex::AaMode::Single),
.create_texture(texture::Kind::D2(size.width as texture::Size,
size.height as texture::Size,
texture::AaMode::Single),
1, // levels
gfx::RENDER_TARGET, // bind
gfx::Usage::GpuOnly, // Usage
gfx::memory::Usage::GpuOnly, // Usage
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)?;
let depth = factory.create_depth_stencil_view_only(size.width as texture::Size,
size.height as texture::Size)?;
Ok(EyeBuffer { tex: tex, target: tgt, depth: depth })
}