Expose create_texture in Rust

This commit is contained in:
Dzmitry Malyshau 2018-10-25 22:35:52 -04:00
parent de4f2b70eb
commit ef4ee9c29d

View File

@ -8,7 +8,7 @@ use std::ffi::CString;
pub use wgn::{ pub use wgn::{
AdapterDescriptor, Color, CommandBufferDescriptor, DeviceDescriptor, Extensions, Extent3d, AdapterDescriptor, Color, CommandBufferDescriptor, DeviceDescriptor, Extensions, Extent3d,
Origin3d, PowerPreference, ShaderModuleDescriptor, ShaderStage, Origin3d, PowerPreference, ShaderModuleDescriptor, ShaderStage,
BindGroupLayoutBinding, BindingType, TextureFormat, BindGroupLayoutBinding, BindingType, TextureDimension, TextureDescriptor, TextureFormat, TextureUsageFlags,
PrimitiveTopology, BlendStateDescriptor, ColorWriteFlags, DepthStencilStateDescriptor, PrimitiveTopology, BlendStateDescriptor, ColorWriteFlags, DepthStencilStateDescriptor,
RenderPassDescriptor, RenderPassColorAttachmentDescriptor, RenderPassDepthStencilAttachmentDescriptor, RenderPassDescriptor, RenderPassColorAttachmentDescriptor, RenderPassDepthStencilAttachmentDescriptor,
LoadOp, StoreOp, LoadOp, StoreOp,
@ -28,6 +28,10 @@ pub struct Device {
id: wgn::DeviceId, id: wgn::DeviceId,
} }
pub struct Texture {
id: wgn::TextureId,
}
pub struct TextureView { pub struct TextureView {
id: wgn::TextureViewId, id: wgn::TextureViewId,
} }
@ -238,6 +242,12 @@ impl Device {
}), }),
} }
} }
pub fn create_texture(&self, desc: TextureDescriptor) -> Texture {
Texture {
id: wgn::wgpu_device_create_texture(self.id, &desc),
}
}
} }
impl CommandBuffer { impl CommandBuffer {