diff --git a/Cargo.lock b/Cargo.lock index b4f4fffee..3e156bc1f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -206,6 +206,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "examples" version = "0.1.0" dependencies = [ + "wgpu 0.1.0", "wgpu-native 0.1.0", ] diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 46722a509..4d4a5bf8c 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -20,3 +20,4 @@ vulkan = ["wgpu-native/gfx-backend-vulkan"] [dependencies] wgpu-native = { path = "../wgpu-native" } +wgpu = { path = "../wgpu-rs" } diff --git a/examples/hello_triangle_rust/main.rs b/examples/hello_triangle_rust/main.rs index 313e68029..c6d078691 100644 --- a/examples/hello_triangle_rust/main.rs +++ b/examples/hello_triangle_rust/main.rs @@ -1,40 +1,20 @@ -extern crate wgpu_native; -use wgpu_native::*; - +extern crate wgpu; fn main() { - let instance = wgpu_create_instance(); - let adapter = wgpu_instance_get_adapter( - instance, - AdapterDescriptor { - power_preference: PowerPreference::LowPower, + let instance = wgpu::Instance::new(); + let adapter = instance.get_adapter( + wgpu::AdapterDescriptor { + power_preference: wgpu::PowerPreference::LowPower, }, ); - let device = wgpu_adapter_create_device( - adapter, - DeviceDescriptor { - extensions: Extensions { + let device = adapter.create_device( + wgpu::DeviceDescriptor { + extensions: wgpu::Extensions { anisotropic_filtering: false, }, }, ); let vs_bytes = include_bytes!("./../data/hello_triangle.vert.spv"); - let _vs = wgpu_device_create_shader_module( - device, - ShaderModuleDescriptor { - code: ByteArray { - bytes: vs_bytes.as_ptr(), - length: vs_bytes.len(), - }, - }, - ); + let _vs = device.create_shader_module(vs_bytes); let fs_bytes = include_bytes!("./../data/hello_triangle.frag.spv"); - let _fs = wgpu_device_create_shader_module( - device, - ShaderModuleDescriptor { - code: ByteArray { - bytes: fs_bytes.as_ptr(), - length: fs_bytes.len(), - }, - }, - ); + let _fs = device.create_shader_module(fs_bytes); } diff --git a/wgpu-rs/src/lib.rs b/wgpu-rs/src/lib.rs index 383a1b8f1..e8305c6bf 100644 --- a/wgpu-rs/src/lib.rs +++ b/wgpu-rs/src/lib.rs @@ -2,7 +2,7 @@ extern crate wgpu_native as wgn; pub use wgn::{ Color, Origin3d, Extent3d, - AdapterDescriptor, Extensions, DeviceDescriptor, + AdapterDescriptor, Extensions, DeviceDescriptor, PowerPreference, ShaderModuleDescriptor, };