diff --git a/examples/hello_triangle_rust/main.rs b/examples/hello_triangle_rust/main.rs index 83cd28dd76..6958bd8adb 100644 --- a/examples/hello_triangle_rust/main.rs +++ b/examples/hello_triangle_rust/main.rs @@ -40,7 +40,7 @@ fn main() { cull_mode: wgpu::CullMode::None, depth_bias: 0, depth_bias_slope_scale: 0.0, - depth_bias_clamp: wgpu::MAX_DEPTH_BIAS_CLAMP, + depth_bias_clamp: 0.0, }, primitive_topology: wgpu::PrimitiveTopology::TriangleList, color_states: &[ diff --git a/gfx-examples/src/cube.rs b/gfx-examples/src/cube.rs index ab6529f22c..fd38702d1c 100644 --- a/gfx-examples/src/cube.rs +++ b/gfx-examples/src/cube.rs @@ -280,7 +280,7 @@ impl framework::Example for Example { cull_mode: wgpu::CullMode::Back, depth_bias: 0, depth_bias_slope_scale: 0.0, - depth_bias_clamp: wgpu::MAX_DEPTH_BIAS_CLAMP, + depth_bias_clamp: 0.0, }, primitive_topology: wgpu::PrimitiveTopology::TriangleList, color_states: &[ diff --git a/gfx-examples/src/shadow.rs b/gfx-examples/src/shadow.rs index ca2b8fad6c..001a5012bf 100644 --- a/gfx-examples/src/shadow.rs +++ b/gfx-examples/src/shadow.rs @@ -219,7 +219,7 @@ impl framework::Example for Example { }); let local_bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { - bindings: &[ + bindings: &[ wgpu::BindGroupLayoutBinding { binding: 0, visibility: wgpu::ShaderStageFlags::VERTEX | wgpu::ShaderStageFlags::FRAGMENT, @@ -380,7 +380,7 @@ impl framework::Example for Example { let light_uniform_size = (Self::MAX_LIGHTS * mem::size_of::()) as u32; let light_uniform_buf = device.create_buffer(&wgpu::BufferDescriptor { size: light_uniform_size, - usage: wgpu::BufferUsageFlags::UNIFORM | wgpu::BufferUsageFlags::TRANSFER_DST, + usage: wgpu::BufferUsageFlags::UNIFORM | wgpu::BufferUsageFlags::TRANSFER_SRC | wgpu::BufferUsageFlags::TRANSFER_DST, }); let vb_desc = wgpu::VertexBufferDescriptor { @@ -459,7 +459,7 @@ impl framework::Example for Example { cull_mode: wgpu::CullMode::Back, depth_bias: 2, // corresponds to bilinear filtering depth_bias_slope_scale: 2.0, - depth_bias_clamp: wgpu::MAX_DEPTH_BIAS_CLAMP, + depth_bias_clamp: 0.0, }, primitive_topology: wgpu::PrimitiveTopology::TriangleList, color_states: &[], @@ -579,7 +579,7 @@ impl framework::Example for Example { cull_mode: wgpu::CullMode::Back, depth_bias: 0, depth_bias_slope_scale: 0.0, - depth_bias_clamp: wgpu::MAX_DEPTH_BIAS_CLAMP, + depth_bias_clamp: 0.0, }, primitive_topology: wgpu::PrimitiveTopology::TriangleList, color_states: &[ diff --git a/wgpu-bindings/wgpu.h b/wgpu-bindings/wgpu.h index d23fd06ba5..9e92ee01cd 100644 --- a/wgpu-bindings/wgpu.h +++ b/wgpu-bindings/wgpu.h @@ -5,8 +5,6 @@ #define WGPUBITS_PER_BYTE 8 -#define WGPUMAX_DEPTH_BIAS_CLAMP 16 - typedef enum { WGPUAddressMode_ClampToEdge = 0, WGPUAddressMode_Repeat = 1, @@ -169,6 +167,8 @@ typedef struct { WGPUExtensions extensions; } WGPUDeviceDescriptor; +typedef WGPUId WGPUBindGroupId; + typedef WGPUId WGPUBufferId; typedef void (*WGPUBufferMapReadCallback)(WGPUBufferMapAsyncStatus status, const uint8_t *data, uint8_t *userdata); @@ -243,8 +243,6 @@ typedef struct { const WGPURenderPassDepthStencilAttachmentDescriptor_TextureViewId *depth_stencil_attachment; } WGPURenderPassDescriptor; -typedef WGPUId WGPUBindGroupId; - typedef WGPUId WGPUComputePipelineId; typedef WGPUId WGPUInstanceId; @@ -557,6 +555,8 @@ typedef struct { WGPUDeviceId wgpu_adapter_create_device(WGPUAdapterId adapter_id, const WGPUDeviceDescriptor *desc); +void wgpu_bind_group_destroy(WGPUBindGroupId bind_group_id); + void wgpu_buffer_destroy(WGPUBufferId buffer_id); void wgpu_buffer_map_read_async(WGPUBufferId buffer_id, diff --git a/wgpu-native/src/conv.rs b/wgpu-native/src/conv.rs index 182dc7b666..01e7b3d1c0 100644 --- a/wgpu-native/src/conv.rs +++ b/wgpu-native/src/conv.rs @@ -1,7 +1,6 @@ use crate::{ binding_model, command, pipeline, resource, Color, Extent3d, Origin3d, - MAX_DEPTH_BIAS_CLAMP, }; @@ -491,7 +490,7 @@ pub fn map_rasterization_state_descriptor( pipeline::FrontFace::Ccw => hal::pso::FrontFace::CounterClockwise, pipeline::FrontFace::Cw => hal::pso::FrontFace::Clockwise, }, - depth_bias: if desc.depth_bias != 0 || desc.depth_bias_slope_scale != 0.0 || desc.depth_bias_clamp < MAX_DEPTH_BIAS_CLAMP { + depth_bias: if desc.depth_bias != 0 || desc.depth_bias_slope_scale != 0.0 || desc.depth_bias_clamp != 0.0 { Some(hal::pso::State::Static(hal::pso::DepthBias { const_factor: desc.depth_bias as f32, slope_factor: desc.depth_bias_slope_scale, diff --git a/wgpu-native/src/lib.rs b/wgpu-native/src/lib.rs index d8e395a943..7a1afcf474 100644 --- a/wgpu-native/src/lib.rs +++ b/wgpu-native/src/lib.rs @@ -44,7 +44,6 @@ pub use self::hub::{HUB, Id, IdentityManager, Registry}; use std::ptr; use std::sync::atomic::{AtomicUsize, Ordering}; -pub const MAX_DEPTH_BIAS_CLAMP: f32 = 16.0; type SubmissionIndex = usize; //TODO: make it private. Currently used for swapchain creation impl. diff --git a/wgpu-rs/src/lib.rs b/wgpu-rs/src/lib.rs index 4ed2bcb30c..3cac17352f 100644 --- a/wgpu-rs/src/lib.rs +++ b/wgpu-rs/src/lib.rs @@ -10,7 +10,6 @@ use std::slice; pub use wgn::winit; pub use wgn::{ - MAX_DEPTH_BIAS_CLAMP, AdapterDescriptor, BindGroupLayoutBinding, BindingType, BlendDescriptor, BlendOperation, BlendFactor, BufferMapAsyncStatus, ColorWriteFlags, RasterizationStateDescriptor, CullMode, FrontFace, @@ -253,7 +252,7 @@ impl Instance { id: wgn::wgpu_instance_create_surface_from_winit(self.id, window), } } - + #[cfg(feature = "metal")] pub fn create_surface_with_metal_layer(&self, window: *mut std::ffi::c_void) -> Surface { Surface {