Skip to content

Commit

Permalink
Implement unclipped_depth (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbinBernhardssonARM authored Jun 28, 2023
1 parent 87361be commit 1ce7c34
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,18 @@ pub fn map_stencil_face_state(
}
}

#[inline]
pub fn map_primitive_state(
_ : &native::WGPUPrimitiveState,
depth_clip_control : Option<&native::WGPUPrimitiveDepthClipControl>
) -> bool {
if let Some(depth_clip_control) = depth_clip_control {
return depth_clip_control.unclippedDepth;
}

false
}

#[inline]
pub fn map_storage_report(report: wgc::hub::StorageReport) -> native::WGPUStorageReport {
native::WGPUStorageReport {
Expand Down
9 changes: 7 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use conv::{
map_adapter_options, map_device_descriptor, map_instance_backend_flags,
map_instance_descriptor, map_pipeline_layout_descriptor, map_shader_module, map_surface,
map_swapchain_descriptor, write_limits_struct, CreateSurfaceParams,
map_swapchain_descriptor, map_primitive_state, write_limits_struct, CreateSurfaceParams,
};
use std::{
borrow::Cow,
Expand Down Expand Up @@ -1839,7 +1839,12 @@ pub unsafe extern "C" fn wgpuDeviceCreateRenderPipeline(
native::WGPUCullMode_Back => Some(wgt::Face::Back),
_ => panic!("invalid cull mode for primitive state"),
},
unclipped_depth: false, // todo: fill this via extras
unclipped_depth: follow_chain!(
map_primitive_state(
&descriptor.primitive,
WGPUSType_PrimitiveDepthClipControl => native::WGPUPrimitiveDepthClipControl
)
),
polygon_mode: wgt::PolygonMode::Fill,
conservative: false,
},
Expand Down

0 comments on commit 1ce7c34

Please sign in to comment.