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

Remove Peek-Poke #739

Merged
merged 1 commit into from
Jun 20, 2020
Merged

Remove Peek-Poke #739

merged 1 commit into from
Jun 20, 2020

Conversation

kvark
Copy link
Member

@kvark kvark commented Jun 19, 2020

Connections
Related to #738
Related to djg/peek-poke#10

Description
As of #726 , the buffers have a minimum binding size that has to include the shader struct size. It, therefore, can't be zero.
We can remove the hacks we had previously and switch fully to the idiomatic Option<NonZeroU64>.

Peek-poke doesn't NonZeroU64 and friends, so this made me reconsider the user of it entirely. Today, render bundles as well as the Player already represent command streams using a much rustier method. I tried to move everything to this method now, and I think this is going to work much better, and safer.

Testing
wgpu-rs works - gfx-rs/wgpu-rs#396

@kvark kvark changed the title Switch BufferSize to Option<NonZero> Remove Peek-Poke Jun 20, 2020
There was a lot of highly unsafe use of serialization based on peek-poke that we
weren't entirely happy with. It's replaced by just serializing the passes now.
Also, switch BufferSize to Option<NonZero>.
@kvark kvark marked this pull request as ready for review June 20, 2020 04:41
@kvark
Copy link
Member Author

kvark commented Jun 20, 2020

@cwfitzgerald this is ready for reviewing! Do you think you can rebase on top of this?

Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

LVGTM! This is amazing, so much unsafe code, vanished into the ether!
bors r+

@bors
Copy link
Contributor

bors bot commented Jun 20, 2020

@bors bors bot merged commit c7be940 into gfx-rs:master Jun 20, 2020
@kvark kvark deleted the size branch June 20, 2020 21:07
bors bot added a commit to gfx-rs/wgpu-rs that referenced this pull request Jun 20, 2020
396: Update wgpu without peek-poke r=cwfitzgerald a=kvark

Depends on gfx-rs/wgpu#739
Everything works, however I think it's worth changing the render pass color/depth/stencil descriptors to be more rusty, e.g.
```rust
struct ColorAttachmentDescriptor {
  attachment: &'a TextureView,
  resolve_target: Option<&'a TextureView>,
  clear_color: Option<Color>,
  store_result: bool,
}

enum DepthStencilChannel<T> {
  ReadOnly,
  Mutable { clear_value: Option<T>, store_result: bool },
}
struct DepthStencilAttachmentDescriptor {
}
```
This would also involve wgpu-type/wgpu-core changes, but can be done as a follow-up (don't want to block on them).

There is a value in doing it in this PR, so that end users don't get multiple disruptions, but we need to find a proper shape first.

Co-authored-by: Dzmitry Malyshau <[email protected]>
kvark added a commit to kvark/wgpu that referenced this pull request Jun 3, 2021
396: Update wgpu without peek-poke r=cwfitzgerald a=kvark

Depends on gfx-rs#739
Everything works, however I think it's worth changing the render pass color/depth/stencil descriptors to be more rusty, e.g.
```rust
struct ColorAttachmentDescriptor {
  attachment: &'a TextureView,
  resolve_target: Option<&'a TextureView>,
  clear_color: Option<Color>,
  store_result: bool,
}

enum DepthStencilChannel<T> {
  ReadOnly,
  Mutable { clear_value: Option<T>, store_result: bool },
}
struct DepthStencilAttachmentDescriptor {
}
```
This would also involve wgpu-type/wgpu-core changes, but can be done as a follow-up (don't want to block on them).

There is a value in doing it in this PR, so that end users don't get multiple disruptions, but we need to find a proper shape first.

Co-authored-by: Dzmitry Malyshau <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants