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

Degenerification part 1/3: wgpu-hal DynDevice & friends #6098

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7f4cf4f
introduce DynResource & DynBuffer as first user
Wumpf Jul 10, 2024
eddab98
Buffer bindings no longer depend on hal api struct, but directly on b…
Wumpf Jul 14, 2024
f9d47ec
BufferBarrier no longer depend on hal api struct, but directly on buf…
Wumpf Jul 14, 2024
880e5a9
Introduce DynCommandEncoder, implement index & vertex buffer ops on it
Wumpf Jul 14, 2024
6f8ef5c
DynCommandEncoder implement begin/end encoding, debug markers, variou…
Wumpf Jul 15, 2024
debe041
introduce DynQuerySet, associated DynCommandEncoder methods
Wumpf Jul 15, 2024
233d2ba
Introduce DynPipelineLayout & DynBindGroup
Wumpf Jul 15, 2024
6576838
Introduce DynComputePipeline & DynRenderPipeline
Wumpf Jul 15, 2024
7548973
fold ComputePassTimestampWrites & RenderPassTimestampWrites and make …
Wumpf Jul 15, 2024
ff49edc
introduce DynTexture & DynTextureView
Wumpf Jul 17, 2024
15748cb
render/compute pass descriptors work now with dyn types
Wumpf Jul 17, 2024
c19659b
implement begin/end render/computepass for dyncommandencoder
Wumpf Jul 20, 2024
1ee9d4b
implement transition_textures for DynCommandEncoder
Wumpf Jul 20, 2024
8bb009e
buffer / texture copy operations for DynCommandEncoder
Wumpf Jul 20, 2024
5719e38
texture & buffer transitioning always uses DynCommandEncoder now
Wumpf Jul 20, 2024
2502283
Introduce DynDevice
Wumpf Jul 20, 2024
7b25389
add most remaining dyn type traits
Wumpf Jul 20, 2024
b662e71
impl DynShaderModule for all backends
Wumpf Jul 20, 2024
e9860f7
impl DynCommandBuffer
Wumpf Jul 21, 2024
8595a1c
Device now has to implement DynResource
Wumpf Jul 21, 2024
e4744df
impl DynFence for all fences
Wumpf Jul 21, 2024
d94e465
impl DynSurfaceTexture for all surface textures
Wumpf Jul 21, 2024
39b214a
introduce DynSurface
Wumpf Jul 21, 2024
24bd6e0
introduce DynQueue
Wumpf Jul 21, 2024
d685660
DynDevice buffer operations
Wumpf Jul 21, 2024
9dd24e0
DynDevice create/destroy for texture/textureview/sampler
Wumpf Jul 24, 2024
3217d43
DynDevice create/destroy command encoder
Wumpf Jul 27, 2024
38c9031
DynDevice create/destroy bind group layout
Wumpf Jul 27, 2024
ba06be2
DynDevice create/destroy pipeline layout
Wumpf Jul 27, 2024
f37a871
DynDevice create/destroy bind group
Wumpf Jul 27, 2024
533def2
DynDevice create/destroy ShaderModule
Wumpf Jul 27, 2024
bf1bf41
DynDevice create/destroy compute/render pipeline
Wumpf Jul 28, 2024
7d8f753
DynDevice pipeline cache
Wumpf Jul 28, 2024
af35846
DynDevice create/destroy query set
Wumpf Jul 28, 2024
96914ea
DynDevice fence
Wumpf Jul 28, 2024
3bf21ab
DynDevice wait/capture/pipeline_cache_get_data
Wumpf Jul 28, 2024
afd32e0
DynDevice acceleration structure handling
Wumpf Jul 28, 2024
666d2fa
DynDevice exit, counters, report
Wumpf Jul 28, 2024
4c30ef5
DynCommandencoder end_encoding, reset_all
Wumpf Jul 28, 2024
7981855
DynCommandEncoder acceleration structure building
Wumpf Jul 28, 2024
34fe670
remove unnecessary debug constraints from Api (handled by Dyn traits)
Wumpf Jul 28, 2024
2eb9c73
introduce DynAdapter
Wumpf Aug 4, 2024
75aaa13
introduce DynInstance
Wumpf Aug 4, 2024
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
13 changes: 13 additions & 0 deletions wgpu-hal/src/dynamic/device.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use crate::{Device, DynBuffer};

use super::DynResourceExt;

pub trait DynDevice {
unsafe fn destroy_buffer(&self, buffer: Box<dyn DynBuffer>);
}

impl<D: Device> DynDevice for D {
unsafe fn destroy_buffer(&self, buffer: Box<dyn DynBuffer>) {
unsafe { D::destroy_buffer(self, buffer.unbox()) };
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: We don't document a safety contract or adherence thereto for these methods. We should do this.

2 changes: 2 additions & 0 deletions wgpu-hal/src/dynamic/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
mod command;
mod device;

pub use self::command::DynCommandEncoder;
pub use self::device::DynDevice;

use std::any::Any;

Expand Down
4 changes: 2 additions & 2 deletions wgpu-hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ mod dynamic;

pub(crate) use dynamic::impl_dyn_resource;
pub use dynamic::{
DynBindGroup, DynBuffer, DynCommandEncoder, DynComputePipeline, DynPipelineLayout, DynQuerySet,
DynRenderPipeline, DynResource, DynTexture, DynTextureView,
DynBindGroup, DynBuffer, DynCommandEncoder, DynComputePipeline, DynDevice, DynPipelineLayout,
DynQuerySet, DynRenderPipeline, DynResource, DynTexture, DynTextureView,
};

use std::{
Expand Down