Commit Graph
3491 Commits
Author SHA1 Message Date
Dzmitry Malyshau 0735ba6d28 [rs] Update wgpu with gpu-alloc fixes 2020-11-24 09:56:09 -05:00
bors[bot]andDzmitry Malyshau 549ea0022b Merge #1041
1041: Update gpu-alloc and naga with linear allocation fixes r=kvark a=kvark

**Connections**
Fixes #1038

**Description**
Includes https://github.com/zakarumych/gpu-alloc/commit/b807b5fb41dc1a102d5ed5f8506265192c7a1c5e

**Testing**
Tested on the API trace

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-11-24 14:41:38 +00:00
Dzmitry Malyshau 2f55c708b8 Update gpu-alloc and naga with linear allocation fixes 2020-11-24 09:40:36 -05:00
bors[bot]andJoshua Groves e578fce5cd [rs] Merge #615
615: Update web bindings r=kvark a=grovesNL

- Use newer buffer mapping API everywhere and remove polyfill.
  - There's a weird thing here where we hand out `&[u8]`/`&mut [u8]`s for users to write into, but later have to copy back into the browser-provided `ArrayBuffer`. It's done during `Drop` here but open to some other ideas.
- Add in `web_sys::GpuTextureComponentType::DepthComparison` though it looks like we don't have it in Gecko yet:
  > GPUDevice.createBindGroupLayout: 'depth-comparison' (value of 'textureComponentType' member of GPUBindGroupLayoutEntry) is not a valid value for enumeration GPUTextureComponentType.
- `mipmap` fails because `layout` is still required in Gecko:
  > GPUDevice.createRenderPipeline: Missing required 'layout' member of GPUPipelineDescriptorBase.
- Add in some parts that we can implement now, including labels, debug markers, render bundles, and `get_bind_group_layout`

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2020-11-24 04:25:00 +00:00
Joshua Groves 6a6f4c139a [rs] Add get_bind_group_layout to web backend 2020-11-24 00:11:26 -03:30
Joshua Groves 92b52a4610 [rs] Add more labels and debug markers to web backend 2020-11-24 00:11:26 -03:30
Joshua Groves ff1a348862 [rs] Add render bundles to web backend 2020-11-24 00:11:26 -03:30
Joshua Groves f79845e777 [rs] Update web bindings 2020-11-24 00:11:16 -03:30
bors[bot]andDzmitry Malyshau 6f712d59bd [rs] Merge #633
633: Port to the updated wgpu error model r=scoopr a=kvark

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

I removed most of the helping sugar we had before, in exchange for simple `match` and a `handle_error` function.
I believe this way it's easier to maintain and debug (stepping through closures is a pain today).

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-11-23 23:04:54 +00:00
Dzmitry Malyshau 0adcfdd3ad [rs] Port to the updated wgpu error model 2020-11-23 17:59:21 -05:00
bors[bot]andDzmitry Malyshau 385ee9fecf Merge #1034
1034: Fearless object creation r=kvark a=kvark

**Connections**
Fixes #977
Fixes #1032

**Description**
Requiring a separate `xxx_error()` is very convenient for `wgpu-core`, but getting repetitive and complicated for all the users of the API. This PR changes it so we return an object ID unconditionally, and sometimes it's an error. The actual error is passed on the side.

**Testing**
Tested on https://github.com/gfx-rs/wgpu-rs/pull/633

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-11-23 17:06:37 +00:00
Dzmitry Malyshau c6bc37dbde [error] render bundles 2020-11-23 12:00:47 -05:00
Dzmitry Malyshau 6307294e2b [error] pipeline creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau ad824de268 [error] bind groups and layouts creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau fccbca28bd [error] shader module creation, separate descriptor 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau e96e5f917c [error] sampler creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau 8287464855 [error] texture view creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau bedd037517 [error] buffer creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau eb4f633e39 [error] texture creation 2020-11-23 11:57:32 -05:00
bors[bot]andMikko Lehtonen f22356329c [rs] Merge #632
632: Improve error messages r=kvark a=scoopr

Improve error messages
depends on gfx-rs/wgpu#1037


Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-11-23 15:50:23 +00:00
Mikko Lehtonen add09fb33c [rs] Handle PassErrorScope Ids 2020-11-23 08:23:43 +02:00
bors[bot]andMikko Lehtonen feac96d315 Merge #1037
1037: Add Ids to PassErrorScope r=kvark a=scoopr

Also makes it pub, and the places it is used.
Tweak some error messages.


Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-11-22 19:40:57 +00:00
Mikko Lehtonen dc61d7fb22 [rs] Add label for render pass context error
Also made the label key settable
2020-11-21 23:47:07 +02:00
Mikko Lehtonen 459e835250 Add Ids to PassErrorScope
Also makes it pub, and the places it is used.
Tweak some error messages.
2020-11-21 23:39:05 +02:00
bors[bot]andDzmitry Malyshau be398d6e2a Merge #1036
1036: Stop using Borrow<RefCount> r=scoopr a=kvark

**Connections**
Follow-up to #931

**Description**
Takes advantage of the new `trait Resource` in the state tracker, reducing the code.

**Testing**
Not tested outside of `cargo test`

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-11-21 17:50:44 +00:00
Dzmitry Malyshau 46b87e220c Stop using Borrow<RefCount> 2020-11-21 10:38:20 -05:00
bors[bot]andJoshua Groves db82edb31e [rs] Merge #631
631: Temporarily use `BackendBit::PRIMARY` in examples r=kvark a=grovesNL

`BackendBit::all()` allows GL/surfman to be used on macOS which appears to prevent rendering with Metal (e.g. hello-triangle displays an empty window).

surfman will be removed in later versions of gfx, which will allow us to switch back to `BackendBit::all()` in the examples.

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2020-11-21 03:54:15 +00:00
Joshua Groves de83824617 [rs] Fix typo 2020-11-21 00:07:57 -03:30
Joshua Groves dc9a3096f5 [rs] Temporarily use BackendBit::PRIMARY in examples
`BackendBit::all()` allows GL/surfman to be used on macOS which appears
to prevent rendering with Metal (e.g. hello-triangle displays an empty
window).

surfman will be removed in later versions of gfx, which will allow us
to switch back to `BackendBit::all()` in the examples.
2020-11-20 23:33:10 -03:30
Dzmitry Malyshau dfcf840b2b Architecture diagram 2020-11-19 21:11:19 -05:00
bors[bot]andMikko Lehtonen 9e1a62112a [rs] Merge #617
617: Add labels for some error messages r=kvark a=scoopr

This places some pieces on how to transform the ids in the errors to a label, and adds them to the validation message.

This changes the formatting of the validation error to happen when constructing the error, rather than in the unhandled error handler.
It also requires some code for all the error variants for extracting the ids.

Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-11-19 22:42:41 +00:00
Mikko Lehtonen daa15a853f [rs] Add labels for some error messages
This adds transforms for the ids in the errors to a label,
and adds them to the validation error message.

This changes the formatting of the validation error to happen when
constructing the error, rather than in the unhandled error handler.
It also requires some code for all the error variants for extracting the ids.
2020-11-20 00:36:29 +02:00
Mikko Lehtonen 581674efb3 [rs] Update wgpu-core 2020-11-20 00:36:29 +02:00
bors[bot]andMikko Lehtonen 9d35aea08e Merge #1033
1033: Missing label queries r=kvark a=scoopr

I missed few bits needed for labeling the resources in the errors.

Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-11-19 22:25:04 +00:00
Mikko Lehtonen 48e64fc8c6 Add missing label query methods 2020-11-19 23:37:59 +02:00
Mikko Lehtonen a41f7ea78f Make inner errors pub 2020-11-19 23:37:36 +02:00
bors[bot]andMikko Lehtonen 98bd3033f6 [rs] Merge #630
630: Update wgpu-core r=kvark a=scoopr

Pass label to error id creation methods.

Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-11-19 15:10:37 +00:00
Mikko Lehtonen dd7f1735f3 [rs] Update wgpu-core
Pass label to error id creation methods.
2020-11-19 01:21:09 +02:00
bors[bot]andMikko Lehtonen 19b4ec58ae Merge #931
931: Retain labels for resources r=kvark a=scoopr

This is wip, mostly a conversation starter.

I've attempted to have some labels show up in the errors, outside of only creation errors.
Steps to do that include,
1. Retain the label in the underlying struct (here, `Buffer`). It is guarded by `debug_assertions`
2. Add the label option to the error variant, and show it
3. Add label option to the `Element::Error` variant, so that invalid ids retain the label also. Didn't guard it with `debug_assertions` yet, but probably should. `buffer_error` now takes the label option.
4. Added a query for invalid id labels
5. Add `Global::buffer_label` for returning the label from the struct, or the invalid id.
6. Change the error variants to query the `buffer_label` when creating the error

with that (and little bit of fudging to get in to the error state), I can get
```
wgpu error: Validation error

Caused by:
    In CommandEncoder::copy_buffer_to_buffer
    buffer (0, 1, Metal) (label: Some("Staging buffer")) is invalid
```
instead of 
```
wgpu error: Validation error

Caused by:
    In CommandEncoder::copy_buffer_to_buffer
    buffer (0, 1, Metal) is invalid
```

Some of the hub handling etc. is a bit iffy for me, I really have no idea what I'm doing.

The point would be to massage this to the point that there would be a simple steps to follow on how to decorate all the errors with labels to whatever they refer to.

Other ideas I had, included trying to have `impl Debug for Id<BufferId>` to print out the label (from the struct, wouldn't work for invalid ids), but in that context I don't think I have access to the Global, so I'm not sure how resolve the id to anything useful. I suppose there could a whole separate singleton storage for id to label maps which could be easier to access in any context. Then the errors could just store the Id, and not have a separate label field.




Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-11-18 22:47:02 +00:00
Mikko Lehtonen 4498f172cc Retain labels for resources
As a braking api change, adds also label for the error id generation,
for labeling invalid ids too.

Also adds query methods the label.
2020-11-19 00:09:21 +02:00
bors[bot]andDzmitry Malyshau ed96a4218f [rs] Merge #629
629: Update wgpu, work around surface validation r=straightforward a=kvark

Works around https://github.com/gfx-rs/wgpu/issues/1030
Includes https://github.com/zakarumych/gpu-alloc/pull/24

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-11-18 15:07:30 +00:00
Dzmitry Malyshau a14c253e6a [rs] Update wgpu, work around surface validation 2020-11-18 10:05:20 -05:00
bors[bot]andDzmitry Malyshau 5e1226995c Merge #1031
1031: Update gpu-alloc and naga r=straightforward a=kvark

**Connections**
includes critical https://github.com/zakarumych/gpu-alloc/pull/24

**Description**
Updates Naga and gpu-alloc deps

**Testing**
Tested on wgpu-rs

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-11-18 14:26:07 +00:00
Dzmitry Malyshau b48764728d Update gpu-alloc and naga 2020-11-18 09:24:43 -05:00
bors[bot]andinfinitesnow c56340fb62 [rs] Merge #627
627: Fixed size in "boids" example r=kvark a=infinitesnow

Buffer size is specified in number of items instead of bytes and fails validation against compiled SPIR-V

Co-authored-by: infinitesnow <3xplosive.g@gmail.com>
2020-11-17 22:15:54 +00:00
infinitesnow ca15e7c1a3 [rs] Fixed size in "boids" example 2020-11-17 21:26:35 +01:00
bors[bot]andDzmitry Malyshau 8675a0cf5e [rs] Merge #621
621: Drop for surfaces and adapters r=grovesNL a=kvark

Based on https://github.com/gfx-rs/wgpu/pull/1023

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-11-16 21:48:14 +00:00
Dzmitry Malyshau edbe112d23 [rs] Drop for surfaces and adapters 2020-11-16 16:47:21 -05:00
bors[bot]andTimo de Kort dff98ac2a8 [rs] Merge #624
624: Remove implicit conversion hello-triangle shader.vert r=kvark a=Napokue

Remove implicit conversion to float, and change it to explicit conversion. Reason for this change is to prepare the hello-triangle example for Naga glsl-spirv path.

Co-authored-by: Timo de Kort <dekort.timo@gmail.com>
2020-11-15 23:36:30 +00:00
d3cc2dc511 Merge #1025
1025: Don't install Android NDK r=msiglreith a=kvark

Follows https://github.com/gfx-rs/gfx/pull/3474

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
Co-authored-by: msiglreith <m.siglreith@gmail.com>
2020-11-15 23:35:47 +00:00