From 7d1005faad0404f4c36a996fecc7aee0184b665b Mon Sep 17 00:00:00 2001 From: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> Date: Wed, 4 Oct 2023 14:27:27 +0200 Subject: [PATCH] [WebGPU] validate polygon mode (#4196) --- CHANGELOG.md | 1 + wgpu/src/backend/web.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf05a41e37..850522ac2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -161,6 +161,7 @@ By @teoxoy in [#4185](https://github.com/gfx-rs/wgpu/pull/4185) #### WebGPU - Ensure that limit requests and reporting is done correctly. By @OptimisticPeach in [#4107](https://github.com/gfx-rs/wgpu/pull/4107) +- Validate usage of polygon mode. By @teoxoy in [#4196](https://github.com/gfx-rs/wgpu/pull/4196) #### Testing diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index 131b18976b..5e3fc01767 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -343,6 +343,18 @@ fn map_primitive_state(primitive: &wgt::PrimitiveState) -> web_sys::GpuPrimitive //TODO: //mapped.unclipped_depth(primitive.unclipped_depth); + match primitive.polygon_mode { + wgt::PolygonMode::Fill => {} + wgt::PolygonMode::Line => panic!( + "{:?} is not enabled for this backend", + wgt::Features::POLYGON_MODE_LINE + ), + wgt::PolygonMode::Point => panic!( + "{:?} is not enabled for this backend", + wgt::Features::POLYGON_MODE_POINT + ), + } + mapped }