Commit Graph
2761 Commits
Author SHA1 Message Date
bors[bot]andDzmitry Malyshau 0368bca1dd [rs] Merge #744
744: Demonstrate obj loading in the skybox example r=kvark a=kvark

I wanted to see which example is best suited for `typed-arena` demo... and here I am, implementing a completely different unrelated feature. But I think it's useful, still ;)
Model loading is something everybody needs, and for us depending on `obj` in dev-dependencies cost nothing, especially since I'm basically maintaining it.

<img width="395" alt="screenshot" src="https://user-images.githubusercontent.com/107301/106993149-186c7780-6748-11eb-94ca-7988ef9ee52d.png">


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-13 03:34:39 +00:00
Dzmitry Malyshau 1a9bd4d14b [rs] Stop using vertex attributes in the mipmap example 2021-02-12 22:33:17 -05:00
Dzmitry Malyshau 710901b1aa [rs] Demonstrate obj loading in the skybox example 2021-02-12 22:33:17 -05:00
bors[bot]andDzmitry Malyshau 6442b947cb Merge #1210
1210: Reset the bindings on the push constant change r=wumpf a=kvark

**Connections**
Fixes #1207
(unconfirmed!)

**Description**
I was able to replay the trace in #1207 without validation errors, so I looked deeper into what might have gone wrong.
The code isolated in #1194 looks great. However, the calling code's handling of push constants might have changed a bit.
And I see that the trace uses push constants, so here is what happened, I think:
  - layout A was set, expecting bind group layouts X and Z
  - bind groups X and Y where bound
  - layout B was set, expecting bind group layout X and Y. We see that Y group can now be bound, so we do this. The old logic in this case wasn't considering the push constants in any way, it would only consider them if bind group layouts didn't change, erroneously.
  - layout B has different push constant ranges...

So it's a one-line fix now, which I'm hoping is correct.

**Testing**
Not tested
@Wumpf would you be able to check this?

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2021-02-12 21:10:26 +00:00
bors[bot]andJakob Hellermann 835b374ebb Merge #1214
1214: fix rustdoc warnings r=kvark a=jakobhellermann

**Connections**
fixes #1213 

**Description**
Fixes rustdoc warnings (broken links, `<autourls>`)

**Testing**
`cargo doc` does not complain anymore.

Co-authored-by: Jakob Hellermann <jakob.hellermann@protonmail.com>
2021-02-12 15:04:46 +00:00
Jakob Hellermann b89cb21ce3 fix rustdoc warnings 2021-02-12 13:56:51 +01:00
bors[bot]andChris 218556c953 [rs] Merge #759
759: Correct FragmentState targets comment r=grovesNL a=Systemcluster

Previously the comment was copied verbatim from the `VertexState` `buffers` field. 

Co-authored-by: Chris <me@systemcluster.me>
2021-02-12 03:41:04 +00:00
Chris 795db84f38 [rs] Correct FragmentState targets comment 2021-02-12 04:29:06 +01:00
Dzmitry Malyshau 692e82d521 Reset the bindings on the push constant change 2021-02-11 14:47:35 -05:00
bors[bot]andDzmitry Malyshau c71091b2e6 Merge #1209
1209: Handle player window resizing gracefully r=kvark a=kvark

**Connections**
Deprecates #794 and #793

**Description**
We were often getting this kind of errors when replaying on Linux:
>VALIDATION [VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 (2094043421)] : Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 ] Object 0: handle = 0x56194a357250, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7cd0911d | vkCreateSwapchainKHR() called with imageExtent = (1980,1080), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (800,600), minImageExtent = (800,600), maxImageExtent = (800,600). The Vulkan spec states: imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01274)
object info: (type: DEVICE, hndl: 94666619187792)

It's annoying to work around!

**Testing**
Tested on replaying wgpu-rs stuff.

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2021-02-11 19:19:58 +00:00
Dzmitry Malyshau b3387492a2 Handle player window resizing gracefully 2021-02-11 14:16:56 -05:00
bors[bot]andLachlan Sneff 7a9b622182 [rs] Merge #755
755: Add Instance::poll_all r=kvark a=lachlansneff

`Instance::poll_all` polls all devices. This will be useful for integrating into the winit event loop from a third-party crate.


Co-authored-by: Lachlan Sneff <lachlan.sneff@gmail.com>
2021-02-11 15:52:26 +00:00
bors[bot]andZsolt Bölöny 0542da88c9 [rs] Merge #756
756: Convert `PrimitiveState::cull_mode` to `Option<Face>` r=kvark a=yzsolt

Depends on https://github.com/gfx-rs/wgpu/pull/1206

Co-authored-by: Zsolt Bölöny <bolony.zsolt@gmail.com>
2021-02-11 15:29:30 +00:00
Zsolt Bölöny 7a31e4e333 [rs] Convert PrimitiveState::cull_mode to Option<Face> 2021-02-11 12:59:47 +01:00
bors[bot]andZsolt Bölöny 05a531191d Merge #1206
1206: Convert `PrimitiveState::cull_mode` to `Option<Face>` r=kvark a=yzsolt

**Connections**
Closes #1192 

**Description**
`wgpu::CullMode` was an enum with a `None` variant, which would be more idiomatic as an `Option` in Rust.

**Testing**
- `wgpu-rs` builds with the appropriate changes
- `wgpu-native` needs https://github.com/gfx-rs/wgpu-native/pull/71 merged before it can be updated


Co-authored-by: Zsolt Bölöny <bolony.zsolt@gmail.com>
2021-02-10 20:39:12 +00:00
Zsolt Bölöny 47a45bcaad Convert PrimitiveState::cull_mode to Option<Face> 2021-02-10 11:59:38 +01:00
Lachlan Sneff 5c209e8cfd [rs] Add Instance::poll_all 2021-02-10 02:15:18 -05:00
bors[bot]andDzmitry Malyshau f719dc0752 [rs] Merge #754
754: Update naga to gfx-10 r=kvark a=kvark

See https://github.com/gfx-rs/wgpu/pull/1205

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-09 15:22:59 +00:00
Dzmitry Malyshau 8ff65dce8d [rs] Update naga to gfx-10 2021-02-09 10:21:56 -05:00
bors[bot]andTnze 2dafc7c321 [rs] Merge #753
753: Use max function to ensure that the swapchain size is not less than 1. r=kvark a=Tnze

ATT

Co-authored-by: Tnze <cjd001113@outlook.com>
2021-02-09 15:12:44 +00:00
bors[bot]andDzmitry Malyshau b1b44ca78c Merge #1205
1205: Update naga to gfx-10, add push constants validation r=kvark a=kvark

**Connections**
Picks up https://github.com/gfx-rs/gfx/pull/3632 with a bunch of Naga stuff

**Description**
Update!

**Testing**
Not much

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-09 15:08:45 +00:00
Dzmitry Malyshau 42d3f1f087 Update naga to gfx-10, add push constants validation 2021-02-09 10:06:55 -05:00
Tnze e9d68a332d [rs] Use the "max" function to ensure that the swapchain size is not less than 1. For better readability. 2021-02-09 14:20:22 +08:00
bors[bot]andImbris f72ff5e1ee [rs] Merge #752
752: Expose missing constants from wgpu-types r=cwfitzgerald a=Imberflur



Co-authored-by: Imbris <imbrisf@gmail.com>
2021-02-07 20:11:22 +00:00
Imbris 5a9801d86c [rs] Expose missing constants from wgpu-types 2021-02-07 15:08:17 -05:00
bors[bot]andAndreas Reich dc18ac72e4 Merge #1190
1190: Fix crash on zero init of buffer with no more ref count r=kvark a=Wumpf

**Description**
Previously, if a buffer would no longer have any reference, the zero init step crashed when trying to unwrap its ref_count.

**Testing**
Tested successfully on https://github.com/Wumpf/blub/commit/54a0f4ff13fcd969d87e4469067c6403999f79e2 where this problem would pop up

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2021-02-06 22:15:44 +00:00
bors[bot]andAndreas Reich 9841b9b5dd Merge #1191
1191: Buffer zero init test for binding (and use in a compute shader) r=kvark a=Wumpf

**Connections**
Buffer zero init #1159 
Buffer zero crash on unused buffer fix #1190

**Description**
Tried to create a player ron file repro case for #1190 but didn't work out quite well (test keeps buffers alive even when I tried to go through an indirection via buffer copies). But with a bit of cleanup the test still felt very useful since it gives more coverage to buffer zero init.

Generally zero init is hard to test since the way to get the result is to map it which is one particular case of requiring zero init. But there's a few ways like in this test here where we look at what modifications a compute shader did to a buffer - since the buffer was not explicitly initialized, the outcome would be different if the compute shader would have seen a buffer without zero init.

Given how few tests there are right now this ofc implicitly tests a bunch of other things ;)

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2021-02-06 22:07:22 +00:00
36fde2821b [rs] Merge #710
710: Implement read_buffer r=kvark a=fintelia

I'm not sure about the exact interface that makes sense, but this PR sketches out how read_buffer (and eventually also read_texture) could be implemented. 

Resolves #694

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
Co-authored-by: Jonathan Behrens <fintelia@gmail.com>
2021-02-06 20:53:26 +00:00
Jonathan Behrens 7a02bfca78 [rs] Implement read_buffer utility function 2021-02-06 11:22:37 -05:00
bors[bot]andDzmitry Malyshau 0abcb247ca Merge #1201
1201: Don't check the index format for non-indexed calls r=kvark a=kvark

**Connections**
Fixes #1200

**Description**
Avoid the check that shouldn't be done.

**Testing**
Not tested, but should work.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-06 15:59:27 +00:00
Dzmitry Malyshau d0dcb105f5 Don't check the index format for non-indexed calls 2021-02-06 10:58:46 -05:00
Andreas Reich fd810f839e merged buffer-zero-init-for-binding and buffer-zero-init-for-mapping-and-writing tests 2021-02-06 12:09:38 +01:00
Andreas Reich 3486fde638 Fix crash on zero init of buffer with no more ref count
Previously, if a buffer would no longer have any reference, the zero init step crashed when trying to unwrap its ref_count.
2021-02-06 11:11:10 +01:00
bors[bot]andImbris 21f0e66074 [rs] Merge #745
745: Bump wgpu-core r=kvark a=Imberflur

For the fix of this issue https://github.com/gfx-rs/wgpu/issues/1188

Co-authored-by: Imbris <imbrisf@gmail.com>
2021-02-06 05:16:11 +00:00
Imbris b1e535d2b7 [rs] Bump wgpu-core 2021-02-05 22:02:48 -05:00
Dzmitry Malyshau f9eb133370 [rs] Experimental ReadBuffer structure 2021-02-05 12:59:49 -05:00
bors[bot]andDzmitry Malyshau 3ebe198911 Merge #1198
1198: Fix command allocator race condition with maintenance r=kvark a=kvark

**Connections**
Fixes #1196

**Description**
This was a recent change, where I thought it would be more pure to just prepare the pool but not create anything right away. It looked more elegant, but now we see it was flowed.

**Testing**
Not really tested the concurrent aspect of it, but it should work.
Perhaps, we can hook up Loom in the future for this task?

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-05 05:59:16 +00:00
Dzmitry Malyshau e357e3083a Fix command allocator race condition with maintenance 2021-02-05 00:57:18 -05:00
bors[bot]andDzmitry Malyshau c513bb03a6 Merge #1194
1194: Isolate binding compatibility logic into a separate module r=cwfitzgerald a=kvark

**Connections**
Fixes #1188 

**Description**
The actual problem was the following: when a pipeline changed, we used to go through the binding entries and re-bind only those that *became* compatible. However, we were missing ones that were already compatible, but were not activated because they were behind some previously incompatible ones.

So it's not a very complex fix. However, working with the binding code had me concerned that it wasn't isolated enough. It got quite a few issues discovered in it over the time, which only proven the point that it was way too fragile. So I took this opportunity to bring us closer to the world I want wgpu to be in: the world of semi-independent testable components.

This PR makes the binding compatibility checker one of these components. It's fully isolated, has unit tests, fairly straightforward to reason about, and integrates nicely with the render pass logic (without too many generics!). It's more profitable in the long run, I think, to build this kind of architecture versus integration-testing the thing (even at `wgpu` playtest level).

There is less magic overall now: no binding iterator, no fancy chaining, no complex matching. The logic is straightforward, hopefully. And the 40 LOC saved is a good indication of it.

**Testing**
Tested on wgpu-rs examples.


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-05 02:29:45 +00:00
Dzmitry Malyshau 262d0c6dfc Isolate binding compatibility logic into a separate module 2021-02-04 01:16:40 -05:00
Andreas Reich 52aee1a037 Better error output for player test 2021-02-03 23:44:50 +01:00
Andreas Reich 5e488d4fea Added player test with compute shader reading & writing an uninitialized buffer 2021-02-03 23:44:42 +01:00
bors[bot]andAndreas Reich 780637eec0 Merge #1187
1187: validate for strip_index_format being used with non-strip topology r=kvark a=Wumpf

**Description**
Hit lack of this validation when porting a project to newest wgpu-rs: Accidentally set the strip_index_format for a TriangleList pipeline which left me with a Vulkan validation error (since wgpu decides to set `restart_index` in presence of a `strip_index_format`)

```
VALIDATION [VUID-VkPipelineInputAssemblyStateCreateInfo-topology-00428 (-1077750125)] : Validation Error: [ VUID-VkPipelineInputAssemblyStateCreateInfo-topology-00428 ] Object 0: handle = 0x1ebbfa512a8, type = VK_OBJECT_TYPE_DEVICE; | MessageID 
= 0xbfc2d693 | vkCreateGraphicsPipelines() pCreateInfo[0]: topology is VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST and primitiveRestartEnable is VK_TRUE. It is invalid. The Vulkan spec states: If topology is VK_PRIMITIVE_TOPOLOGY_POINT_LIST, VK_PRIMITIVE_TOPOLOGY_LINE_LIST, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY or VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, primitiveRestartEnable must be VK_FALSE (https://vulkan.lunarg.com/doc/view/1.2.141.0/windows/1.2-extensions/vkspec.html#VUID-VkPipelineInputAssemblyStateCreateInfo-topology-00428)
    object info: (type: DEVICE, hndl: 2112044208808)
```

(arguably wgpu could be more clever about this and just not set `restart_index`, but that leaves the user code in a non-sense state)

**Testing**
One-off test triggering the error through wgpu-rs.

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2021-02-01 21:12:19 +00:00
Andreas Reich 9dd88cb338 validate for strip_index_format being used with non-strip topology 2021-02-01 21:46:24 +01:00
bors[bot]andDaniel Tang aea2af588c Merge #1183
1183: Improve docs language r=cwfitzgerald a=danielzgtg

**Description**

- s/fact culling/face culling/g
- s/are draw /are drawn /g

**Testing**

- There are no code change.
- The documentation should be less confusing


Co-authored-by: Daniel Tang <danielzgtg.opensource@gmail.com>
2021-02-01 08:13:20 +00:00
bors[bot]andConnor Fitzgerald e15eefc718 Merge #1185
1185: [master] Fix Readme Date r=trivial a=cwfitzgerald

Port #1184 to master

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2021-02-01 07:46:17 +00:00
Connor Fitzgerald c43bfaf8e0 Fix readme date 2021-02-01 02:45:31 -05:00
Daniel Tang 07a2c9a712 Improve docs language 2021-02-01 02:19:32 -05:00
bors[bot]andDzmitry Malyshau 75cbc46d6e [rs] Merge #738
738: Update version and dependencies to gfx-9 r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-01 07:17:07 +00:00
Dzmitry Malyshau 9755a464ae [rs] Update version and dependencies to gfx-9 2021-02-01 02:16:31 -05:00