Skip to content

Implement write_texture#666

Merged
kvark merged 6 commits intogfx-rs:masterfrom
kvark:write-texture
May 26, 2020
Merged

Implement write_texture#666
kvark merged 6 commits intogfx-rs:masterfrom
kvark:write-texture

Conversation

@kvark
Copy link
Copy Markdown
Member

@kvark kvark commented May 23, 2020

TODO:

@kvark kvark mentioned this pull request May 23, 2020
@kvark
Copy link
Copy Markdown
Member Author

kvark commented May 24, 2020

@grovesNL
One controversial point here is that the BufferCopyView structure is removed, while WebGPU upstream uses inheritance of it from TextureDataLayout. I'm open to re-introduce it if you feel it's useful.

@grovesNL
Copy link
Copy Markdown
Collaborator

I'm open to re-introduce it if you feel it's useful.

Yeah I don't think it's a big deal either way since it's only a couple values.

I'd slightly prefer to keep the types/function signatures as close to the spec as possible (except places where we might intentionally diverge to improve ergonomics in Rust, e.g. futures) so we could eventually refer to the relevant WebGPU docs directly in our doc comments. For example, users might be confused trying to find BufferCopyView in wgpu-rs if they're reading the WebGPU spec/TypeScript examples.

@kvark
Copy link
Copy Markdown
Member Author

kvark commented May 25, 2020

@grovesNL alright, BufferCopyView is back :)

Copy link
Copy Markdown
Collaborator

@grovesNL grovesNL left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!

@kvark kvark marked this pull request as ready for review May 26, 2020 04:15
@kvark kvark merged commit e4659b6 into gfx-rs:master May 26, 2020
@kvark kvark deleted the write-texture branch May 26, 2020 04:15
bors bot added a commit to gfx-rs/wgpu-rs that referenced this pull request May 26, 2020
321: Update wgpu and use write_texture r=grovesNL a=kvark

Depends on gfx-rs/wgpu#666

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
bors bot added a commit that referenced this pull request Jun 1, 2020
679: Enforce copy buffer-texture alignment r=cwfitzgerald a=kvark

**Connections**
This is a follow-up to #666 

**Description**
We are now enforcing the `bytes_per_row` on copy-texture copies to `COPY_BYTES_PER_ROW_ALIGNMENT`.
We allow it being non-aligned for `write_texture`, which now has the code to properly align the staging space it uses, and to copy the rows one by one with proper alignment.

We are also moving `BufferSize` to wgpu-types, because it's required for wgpu-rs to build.

**Testing**
Testing this needs gfx-rs/wgpu-rs#328, which is blocked by gfx-rs/wgpu-rs#323


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
bors bot added a commit that referenced this pull request Jun 15, 2020
720: Fix validation errors + panics on empty buffers r=kvark a=rukai

**Description**
My previous PR left a vulkan validation error when creating an empty buffer.
This PR fixes that and also fixes a panic preventing the compute-example from running with no elements.

**Testing**
Unit test added in wgpu-rs PR. gfx-rs/wgpu-rs#373
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Rukai <rubickent@gmail.com>
bors bot added a commit that referenced this pull request Jun 15, 2020
720: Fix validation errors + panics on empty buffers r=kvark a=rukai

**Description**
My previous PR left a vulkan validation error when creating an empty buffer.
This PR fixes that and also fixes a panic preventing the compute-example from running with no elements.

**Testing**
Unit test added in wgpu-rs PR. gfx-rs/wgpu-rs#373
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Rukai <rubickent@gmail.com>
bors bot added a commit that referenced this pull request Jun 18, 2020
730: Move backend selection to `Instance::new()` r=kvark a=Kimundi

**Connections**
Addresses gfx-rs/wgpu-rs#337
Corresponding wgpu-rs PR: gfx-rs/wgpu-rs#385

**Description**
This makes early backend selection possible in `Instance::new`, by only attempting to instantiate requested backends. The actual selection in `pick_adapter()` (necessarily) remains unchanged, and can be used to further restrict the request.

**Testing**
Unsure what to do here
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Marvin Löbel <loebel.marvin@gmail.com>
bors bot added a commit that referenced this pull request Jun 22, 2020
743: Derive Serialize and Deserialize for HostMap r=kvark a=kunalmohan

**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_

**Description**
_Describe what problem this is solving, and how it's solved._
Also a switch from `f32::MAX` to `std::f32::MAX`

**Testing**
_Explain how this change is tested._
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
bors bot added a commit that referenced this pull request Jun 24, 2020
747: Custom implement Debug for RenderCommand and ComputeCommand r=kvark a=kunalmohan

This would avoid unnecessarily long debug logs for Render and Compute passes to some extent. I am not sure if it would be helpful to print `dynamic_offsets` and `string_data` under `BasePass` without the content of related `Compute/Render Command`.
<!--**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_

**Description**
_Describe what problem this is solving, and how it's solved._
This would avoid 
**Testing**
_Explain how this change is tested._

Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
bors bot added a commit that referenced this pull request Jul 11, 2020
782: Add check while trying to remove uninserted Ids r=kvark a=kunalmohan

**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_
An attempt to fix #781 
regression from #776 

**Description**
_Describe what problem this is solving, and how it's solved._
When we used `VecMap`, it simply returned `None` for even out of bounds access to the map (We depended on it returning `None`). After #776 , we get a panic. So adding a simple index check before accessing it fixes this issue.

**Testing**
_Explain how this change is tested._
Tested on wgpu-rs examples with the changes in gfx-rs/wgpu-rs#430. All examples run fine except the `cube` which segfaults.
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
bors bot added a commit that referenced this pull request Jul 16, 2020
799: Derive Hash on BindGroupLayoutEntry r=kvark a=kunalmohan

**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_

**Description**
_Describe what problem this is solving, and how it's solved._
Required in Servo.

**Testing**
_Explain how this change is tested._
Not tested.
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
bors bot added a commit that referenced this pull request Jul 29, 2020
844: Add mip level count and array layer count validation to texture_create_view r=kvark a=kunalmohan

**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_

**Description**
_Describe what problem this is solving, and how it's solved._
Catches the error when `mip_level_count = 0` and `base_mip_level > texture.mip_level_count` (same with `array_layer_count`)

**Testing**
_Explain how this change is tested._
Haven't been tested yet
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
bors bot added a commit that referenced this pull request Jul 30, 2020
854: Replace NonZeroU32 with u32 in TextureViewDescriptor r=kvark a=kunalmohan

**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_

**Description**
_Describe what problem this is solving, and how it's solved._

**Testing**
_Explain how this change is tested._
Not yet tested
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->

r?@kvark


Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
bors bot added a commit that referenced this pull request Aug 2, 2020
856: Implementation of the builder pattern r=kvark a=Andful

**Connections**
This pull request addresses the issue #851 

**Description**
Add a builder for wgpu types.

**Testing**
TODO
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Andrea Nardi <buongiorno19972@gmail.com>
bors bot added a commit that referenced this pull request Aug 5, 2020
865: Replace u32 with NonZeroU32 in TextureView r=kvark a=kunalmohan

**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_

**Description**
_Describe what problem this is solving, and how it's solved._
We now expose separate methods under `Global` to register error/invalid resources. So the check for `mip_level_count = 0` and `array_layer_count = 0` can be made on the client-side in Servo, and directly register an error resource instead of trying to create a real one.

**Testing**
_Explain how this change is tested._
Not yet tested. Will be done wgpu-rs examples.
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
bors bot added a commit that referenced this pull request Aug 17, 2020
877: Add image cube array feature. r=kvark a=StarArawn

**Connections**
None

**Description**
Enable `IMAGE_CUBE_ARRAY` in vulkan and dx12. Note: Currently this will cause metal to break as the `available_features` from the physical device will never include `IMAGE_CUBE_ARRAY`. Thus I'm opening this as a draft until gfx-hal metal can check and pass the feature on.

**Testing**
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->
I can test this with my repo using wgpu-rs here which uses cube arrays:
https://github.com/StarArawn/harmony/


Co-authored-by: John Mitchell <toasterthegamer@gmail.com>
bors bot added a commit that referenced this pull request Aug 24, 2020
895: Improve validation in B2B copies and RenderCommands r=kvark a=kunalmohan

**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_

**Description**
_Describe what problem this is solving, and how it's solved._
Validation for the following have been added-
- Validate all parameters in B2B copy even if `copy_size == 0`.
- Check for copy operations issued within same buffer.
- `RenderPass.setViewport()`
- `RenderPass.setScissorRect()`

**Testing**
_Explain how this change is tested._
Tested with CTS in Servo. More tests pass now. Will test on wgpu-rs now.
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
bors bot added a commit that referenced this pull request Sep 22, 2020
936: Prevent an invalid texture from being registered in device_create_texture r=kvark a=kunalmohan

**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_

**Description**
_Describe what problem this is solving, and how it's solved._
Since we checked the usage of a `Feature` in `device_create_texture()` after registering the new `Id`, there could be a case where it returns an error after registering the texture as a valid one, which further panics when the client tries to register it as an `error_id`.

To solve this, the check for the usage of a `Feature` is now done before registering the new `Id`.

**Testing**
_Explain how this change is tested._
Tested with wgpu-rs examples and CTS in Servo.
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
bors bot added a commit that referenced this pull request Nov 5, 2020
907: Implement OpenGL Backend For Unix Platforms r=kvark a=zicklag

**Connections**
Requires: gfx-rs/gfx#3340 ( merged )
Should be merged first: #910
Works towards: #450

**Description**
Integrates the GFX GL backend for Unix platforms

**Testing**
Runs the basic cube and triangle examples  for wgpu-rs, but not without rendering artifacts on the cube.
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Zicklag <zicklag@katharostech.com>
bors bot added a commit that referenced this pull request Nov 5, 2020
907: Implement OpenGL Backend For Unix Platforms r=kvark a=zicklag

**Connections**
Requires: gfx-rs/gfx#3340 ( merged )
Should be merged first: #910
Works towards: #450

**Description**
Integrates the GFX GL backend for Unix platforms

**Testing**
Runs the basic cube and triangle examples  for wgpu-rs, but not without rendering artifacts on the cube.
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Zicklag <zicklag@katharostech.com>
bors bot added a commit that referenced this pull request Nov 26, 2020
1048: Make VertexFormat::size a const fn r=kvark a=Imberflur

**Connections**
Addresses #836 

**Description**
The `vertex_attr_array!` macro uses this function. This change enables the macro to be used in `const` contexts and for instance allows returning a `VertexBufferDescriptor` constructed in function without having the difficulties of ensuring the array from `vertex_attr_array!` lives long enough.

**Testing**
I don't believe testing is needed for this.
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Imbris <imbrisf@gmail.com>
bors bot added a commit that referenced this pull request Dec 19, 2020
1099: Pass DEPTH_CLAMPING feature request to gfx-hal r=cwfitzgerald a=Imberflur

**Connections**
Fixes #1087 

**Description**
The request for the depth clamping feature was not being passed down to `gfx-hal`. This led to a warning from the vulkan backend when attempting to use this feature.

**Testing**
ran `wgpu-rs` shadow example and the warning no longer appears
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Imbris <imbrisf@gmail.com>
bors bot added a commit that referenced this pull request Feb 28, 2021
1239: Avoid panic when requesting to unmap a buffer that is pending mapping r=kvark a=Imberflur

**Connections**
Fix for #1238 

**Description**
This might not be the cleanest fix but it is quite minimal. I'm not sure what the exact intent is with the organization of things and with the async status enum, would be happy to hear critiques.

**Testing**
Tested against example in #1238 
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Imbris <imbrisf@gmail.com>
bors bot added a commit that referenced this pull request Mar 1, 2021
1240: Fix issue with multiple queued mappings where the last one is not cancelled r=kvark a=Imberflur


**Connections**
Follow up from #1239

**Description**
In #1239 I missed the case where there are multiple rounds of mapping/unmapping with the last map not being cancelled. In practice it doesn't occur very often, but I did encounter it with settings/a scene that created a heavy GPU load.

Sorry for not catching this earlier!

**Testing**
Using `wgpu-rs` capture example, after the first `map_async` I added in an `unmap` followed by another `map_async`.
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Imbris <imbrisf@gmail.com>
bors bot added a commit that referenced this pull request Apr 6, 2021
1310: Updated `gpu-alloc` to rev 2cd1ad6 r=kvark a=francesco-cattoglio

**Connections**
Updated gpu-alloc to include the commit that fixed zakarumych/gpu-alloc#41

**Description**
It is a simple update of a dependency.

**Testing**
I have not tested this change, I just made sure that everything was still compiling correctly.
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Franz <francesco.cattoglio@gmail.com>
bors bot added a commit that referenced this pull request Apr 29, 2021
1315: Add buffer arrays r=kvark a=csnewman

**Connections**
gfx-rs/wgpu-rs#850

**Description**
Adds buffer array bindings

**Testing**
TODO
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See #666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Chandler Newman <chandler2newman@hotmail.co.uk>
kvark added a commit to kvark/wgpu that referenced this pull request Jun 3, 2021
321: Update wgpu and use write_texture r=grovesNL a=kvark

Depends on gfx-rs#666

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
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