Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement unclipped_depth #270

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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