Commit Graph

9013 Commits

Author SHA1 Message Date
Capucho
dd5021234d [glsl-out] Reworked the backend
The backend now works in a similar way to the msl backend
Should require less loops, allocations and backtracking
Overall just better to work with it

Added a build script which reads a file with the glsl keywords and
generates a slice to be used in the Namer

Added a way to build a call graph
2020-11-22 14:45:12 -05:00
bors[bot]
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]
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]
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
23b1e4dd76 [spv-out] fix generation of OpConvert 2020-11-20 12:30:02 -05:00
Dzmitry Malyshau
1b8b3845be [mtl] Add 'kernel' and 'using' keywords 2020-11-20 10:57:59 -05:00
Pelle Johnsen
0f98357223 [glsl-in] Skip gl_PerVertex 2020-11-20 09:54:01 +01:00
Dzmitry Malyshau
7c7702c9d8 [mtl] move writer into a separate module 2020-11-19 23:19:26 -05:00
Dzmitry Malyshau
fa36ef194c [mtl] move keywords into a separate file 2020-11-19 23:19:26 -05:00
Dzmitry Malyshau
0f7b6e3e76 [mtl] dont include the std namespace 2020-11-19 23:19:26 -05:00
Dzmitry Malyshau
36bc6b8596 [mtl] populate reserved words more 2020-11-19 23:19:26 -05:00
Dzmitry Malyshau
d0f3450564 [msl make backend a folder module 2020-11-19 23:19:26 -05:00
Dzmitry Malyshau
c19bcbe89c Allow manual strip for clippy, temporarily 2020-11-19 23:19:10 -05:00
Dzmitry Malyshau
4ed91330cf Derive PartialEq for validation errors 2020-11-19 23:19:10 -05:00
Dzmitry Malyshau
dfcf840b2b Architecture diagram 2020-11-19 21:11:19 -05:00
bors[bot]
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]
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]
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]
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
Timo de Kort
929e07ff0c [spv-out] Add support for vector with vector multiplication 2020-11-18 17:37:52 +01:00
bors[bot]
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]
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]
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
Timo de Kort
27ec95a238 [spv-out] Load variables when using CompositeConstruct (#284) 2020-11-16 16:52:51 -05:00
Timo de Kort
820dc51e2f [spv-out] Fix annotations not getting added to output (#281) 2020-11-16 16:49:35 -05:00
bors[bot]
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
Pelle Johnsen
437b33d536 [glsl-in] use TypeInner::scalar_kind for casts (#279)
* [glsl-in] use TypeInner::scalar_kind for casts

* [glsl-in] Use .ok_or for casts
2020-11-16 11:57:34 -05:00
Pelle Johnsen
9041cd4b10 [glsl-in] Handle simple casts 2020-11-16 12:58:19 +01:00
bors[bot]
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
bors[bot]
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
msiglreith
b09027a74a export ndk toolchain path 2020-11-15 18:34:55 -05:00
Timo de Kort
25b7cea64c [rs] Remove implicit conversion hello-triangle shader.vert 2020-11-15 23:13:53 +01:00
Timo de Kort
022b42c44b [spv-out] Reduce BinaryOperator::Multiply indentation 2020-11-15 13:05:21 -05:00
Dzmitry Malyshau
c7273b03d6 Don't install Android NDK 2020-11-14 20:07:50 -05:00
Timo de Kort
d0de2faa73 [spv-out] Add and implement bitwise_and 2020-11-14 12:40:02 -05:00