From 3de73d70bb370f48c88502693bfb2f71fd3fbc26 Mon Sep 17 00:00:00 2001 From: AlbinBernhardssonARM Date: Mon, 26 Jun 2023 12:21:51 +0200 Subject: [PATCH] Implement unclipped_depth --- src/conv.rs | 12 ++++++++++++ src/lib.rs | 9 +++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/conv.rs b/src/conv.rs index 47f6b984..bc5f97a7 100644 --- a/src/conv.rs +++ b/src/conv.rs @@ -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 { diff --git a/src/lib.rs b/src/lib.rs index 9b55b275..93b92068 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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, @@ -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, },