#[macro_use] extern crate gfx; pub use gfx::format as fm; #[derive(Clone, Debug, PartialEq)] pub struct Rg16; gfx_format!(Rg16: R16_G16 = Vec2); gfx_defines!{ vertex Vertex { _x: i8 = "x", _y: f32 = "y", } vertex Instance { pos: [f32; 2] = "pos", color: [f32; 3] = "color", } constant Local { pos: [u32; 4] = "pos", } constant LocalMeta { pos: [u32; 4] = "pos_meta", } pipeline testpipe { vertex: gfx::VertexBuffer = (), instance: gfx::InstanceBuffer = (), const_locals: gfx::ConstantBuffer = "Locals", global: gfx::Global<[f32; 4]> = "Global", tex_diffuse: gfx::ShaderResource<[f32; 4]> = "Diffuse", sampler_linear: gfx::Sampler = "Linear", buf_frequency: gfx::UnorderedAccess<[f32; 4]> = "Frequency", pixel_color: gfx::RenderTarget = "Color", blend_target: gfx::BlendTarget = ("o_Color1", gfx::state::ColorMask::all(), gfx::preset::blend::ADD), depth: gfx::DepthTarget = gfx::preset::depth::LESS_EQUAL_TEST, blend_ref: gfx::BlendRef = (), scissor: gfx::Scissor = (), } } fn _test_pso(factory: &mut F) -> gfx::PipelineState where R: gfx::Resources, F: gfx::traits::FactoryExt, { factory.create_pipeline_simple(&[], &[], testpipe::new()).unwrap() } gfx_pipeline_base!( testraw { vertex: gfx::RawVertexBuffer, cbuf: gfx::RawConstantBuffer, tex: gfx::RawShaderResource, target: gfx::RawRenderTarget, }); fn _test_raw(factory: &mut F) -> gfx::PipelineState where R: gfx::Resources, F: gfx::traits::FactoryExt, { let special = gfx::pso::buffer::Element { format: fm::Format(fm::SurfaceType::R32, fm::ChannelType::Float), offset: 0, }; let init = testraw::Init { vertex: (&[("a_Special", special)], 12, 0), cbuf: "Locals", tex: "Specular", target: ("o_Color2", fm::Format(fm::SurfaceType::R8_G8_B8_A8, fm::ChannelType::Unorm), gfx::state::ColorMask::all(), None), }; factory.create_pipeline_simple(&[], &[], init).unwrap() }