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

Use () instead of PhantomData as IdentityManager's Input type. #2972

Merged
merged 3 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ the same every time it is rendered, we now warn if it is missing.
- Added downlevel restriction error message for `InvalidFormatUsages` error by @Seamooo in [#2886](https://github.com/gfx-rs/wgpu/pull/2886)
- Add warning when using CompareFunction::*Equal with vertex shader that is missing @invariant tag by @cwfitzgerald in [#2887](https://github.com/gfx-rs/wgpu/pull/2887)
- Update Winit to version 0.27 and raw-window-handle to 0.5 by @wyatt-herkamp in [#2918](https://github.com/gfx-rs/wgpu/pull/2918)

- Don't use `PhantomData` for `IdentityManager`'s `Input` type. By @jimblandy in [#2972](https://github.com/gfx-rs/wgpu/pull/2972)
#### Metal
- Extract the generic code into `get_metal_layer` by @jinleili in [#2826](https://github.com/gfx-rs/wgpu/pull/2826)

Expand Down
6 changes: 3 additions & 3 deletions deno_webgpu/src/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub fn op_webgpu_create_bind_group_layout(
gfx_put!(device => instance.device_create_bind_group_layout(
device,
&descriptor,
std::marker::PhantomData
()
) => state, WebGpuBindGroupLayout)
}

Expand Down Expand Up @@ -226,7 +226,7 @@ pub fn op_webgpu_create_pipeline_layout(
gfx_put!(device => instance.device_create_pipeline_layout(
device,
&descriptor,
std::marker::PhantomData
()
) => state, super::pipeline::WebGpuPipelineLayout)
}

Expand Down Expand Up @@ -304,6 +304,6 @@ pub fn op_webgpu_create_bind_group(
gfx_put!(device => instance.device_create_bind_group(
device,
&descriptor,
std::marker::PhantomData
()
) => state, WebGpuBindGroup)
}
2 changes: 1 addition & 1 deletion deno_webgpu/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub fn op_webgpu_create_buffer(
gfx_put!(device => instance.device_create_buffer(
device,
&descriptor,
std::marker::PhantomData
()
) => state, WebGpuBuffer)
}

Expand Down
2 changes: 1 addition & 1 deletion deno_webgpu/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn op_webgpu_render_bundle_encoder_finish(
&wgpu_core::command::RenderBundleDescriptor {
label: label.map(Cow::from),
},
std::marker::PhantomData
()
) => state, WebGpuRenderBundle)
}

Expand Down
2 changes: 1 addition & 1 deletion deno_webgpu/src/command_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn op_webgpu_create_command_encoder(
gfx_put!(device => instance.device_create_command_encoder(
device,
&descriptor,
std::marker::PhantomData
()
) => state, WebGpuCommandEncoder)
}

Expand Down
6 changes: 3 additions & 3 deletions deno_webgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pub async fn op_webgpu_request_adapter(
};
let res = instance.request_adapter(
&descriptor,
wgpu_core::instance::AdapterInputs::Mask(backends, |_| std::marker::PhantomData),
wgpu_core::instance::AdapterInputs::Mask(backends, |_| ()),
);

let adapter = match res {
Expand Down Expand Up @@ -413,7 +413,7 @@ pub async fn op_webgpu_request_device(
adapter,
&descriptor,
std::env::var("DENO_WEBGPU_TRACE").ok().as_ref().map(std::path::Path::new),
std::marker::PhantomData
()
));
if let Some(err) = maybe_err {
return Err(DomExceptionOperationError::new(&err.to_string()).into());
Expand Down Expand Up @@ -536,7 +536,7 @@ pub fn op_webgpu_create_query_set(
gfx_put!(device => instance.device_create_query_set(
device,
&descriptor,
std::marker::PhantomData
()
) => state, WebGpuQuerySet)
}

Expand Down
16 changes: 8 additions & 8 deletions deno_webgpu/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@ pub fn op_webgpu_create_compute_pipeline(
GPUPipelineLayoutOrGPUAutoLayoutMode::Layout(_) => None,
GPUPipelineLayoutOrGPUAutoLayoutMode::Auto(GPUAutoLayoutMode::Auto) => {
Some(wgpu_core::device::ImplicitPipelineIds {
root_id: std::marker::PhantomData,
group_ids: &[std::marker::PhantomData; MAX_BIND_GROUPS],
root_id: (),
group_ids: &[(); MAX_BIND_GROUPS],
})
}
};

let (compute_pipeline, maybe_err) = gfx_select!(device => instance.device_create_compute_pipeline(
device,
&descriptor,
std::marker::PhantomData,
(),
implicit_pipelines
));

Expand Down Expand Up @@ -135,7 +135,7 @@ pub fn op_webgpu_compute_pipeline_get_bind_group_layout(
.get::<WebGpuComputePipeline>(compute_pipeline_rid)?;
let compute_pipeline = compute_pipeline_resource.0;

let (bind_group_layout, maybe_err) = gfx_select!(compute_pipeline => instance.compute_pipeline_get_bind_group_layout(compute_pipeline, index, std::marker::PhantomData));
let (bind_group_layout, maybe_err) = gfx_select!(compute_pipeline => instance.compute_pipeline_get_bind_group_layout(compute_pipeline, index, ()));

let label =
gfx_select!(bind_group_layout => instance.bind_group_layout_label(bind_group_layout));
Expand Down Expand Up @@ -364,16 +364,16 @@ pub fn op_webgpu_create_render_pipeline(
GPUPipelineLayoutOrGPUAutoLayoutMode::Layout(_) => None,
GPUPipelineLayoutOrGPUAutoLayoutMode::Auto(GPUAutoLayoutMode::Auto) => {
Some(wgpu_core::device::ImplicitPipelineIds {
root_id: std::marker::PhantomData,
group_ids: &[std::marker::PhantomData; MAX_BIND_GROUPS],
root_id: (),
group_ids: &[(); MAX_BIND_GROUPS],
})
}
};

let (render_pipeline, maybe_err) = gfx_select!(device => instance.device_create_render_pipeline(
device,
&descriptor,
std::marker::PhantomData,
(),
implicit_pipelines
));

Expand All @@ -396,7 +396,7 @@ pub fn op_webgpu_render_pipeline_get_bind_group_layout(
.get::<WebGpuRenderPipeline>(render_pipeline_rid)?;
let render_pipeline = render_pipeline_resource.0;

let (bind_group_layout, maybe_err) = gfx_select!(render_pipeline => instance.render_pipeline_get_bind_group_layout(render_pipeline, index, std::marker::PhantomData));
let (bind_group_layout, maybe_err) = gfx_select!(render_pipeline => instance.render_pipeline_get_bind_group_layout(render_pipeline, index, ()));

let label =
gfx_select!(bind_group_layout => instance.bind_group_layout_label(bind_group_layout));
Expand Down
2 changes: 1 addition & 1 deletion deno_webgpu/src/sampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ pub fn op_webgpu_create_sampler(
gfx_put!(device => instance.device_create_sampler(
device,
&descriptor,
std::marker::PhantomData
()
) => state, WebGpuSampler)
}
2 changes: 1 addition & 1 deletion deno_webgpu/src/shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ pub fn op_webgpu_create_shader_module(
device,
&descriptor,
source,
std::marker::PhantomData
()
) => state, WebGpuShaderModule)
}
4 changes: 2 additions & 2 deletions deno_webgpu/src/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn op_webgpu_create_texture(
gfx_put!(device => instance.device_create_texture(
device,
&descriptor,
std::marker::PhantomData
()
) => state, WebGpuTexture)
}

Expand Down Expand Up @@ -105,6 +105,6 @@ pub fn op_webgpu_create_texture_view(
gfx_put!(texture => instance.texture_create_view(
texture,
&descriptor,
std::marker::PhantomData
()
) => state, WebGpuTextureView)
}
2 changes: 1 addition & 1 deletion wgpu-core/src/hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ pub trait IdentityHandler<I>: Debug {
}

impl<I: id::TypedId + Debug> IdentityHandler<I> for Mutex<IdentityManager> {
type Input = PhantomData<I>;
type Input = ();
fn process(&self, _id: Self::Input, backend: Backend) -> I {
self.lock().alloc(backend)
}
Expand Down
Loading