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

Implicitly add COPY_DST when using create_texture_with_data #1622

Merged
merged 2 commits into from
Jul 13, 2021

Conversation

HalfVoxel
Copy link
Contributor

Connections
Fixes: #1621

Description

The documentation for device.create_texture_with_data doesn't mention that the usage must contain COPY_DST, but it also doesn't implicitly add that flag. I think it should either mention that COPY_DST is required or add it implicitly. Not sure which is the desired way to go though.

It feels kinda ugly to have to clone the descriptor. It's not a big deal performance-wise, but still.
An alternative to this would be a nicer validation error message.

@cwfitzgerald
Copy link
Member

Hmmm. I wonder if we should just take the descriptor by value if we're just going to clone it anyway.

@HalfVoxel
Copy link
Contributor Author

But that would be a breaking change, and it would go against the current wgpu convention, wouldn't it? I don't think there's any other place where a descriptor is passed by value?

@kocsis1david
Copy link
Contributor

kocsis1david commented Jul 10, 2021

Wouldn't it be possible to only copy the descriptor? like let mut desc = *desc;

@cwfitzgerald
Copy link
Member

cwfitzgerald commented Jul 10, 2021

@HalfVoxel it would be a breaking change, but we don't really mind that here. There isn't, which is what makes this a hard call. @kvark I hearby summon thee.

@kocsis1david it's not Copy.

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Thank you!

wgpu/src/util/device.rs Outdated Show resolved Hide resolved
@HalfVoxel
Copy link
Contributor Author

I simplified the code to always do the clone. However, I left the parameter as a reference to keep the api following the wgpu conventions.

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Thank you!

@kvark kvark merged commit c434b94 into gfx-rs:master Jul 13, 2021
zarik5 pushed a commit to zarik5/wgpu that referenced this pull request Jul 17, 2021
…rs#1622)

* Implicitly add `COPY_DST` when using `create_texture_with_data`

* Always clone texture descriptor
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.

device.create_texture_with_data implicitly requires COPY_DST
4 participants