Commit Graph
195 Commits
Author SHA1 Message Date
Dzmitry Malyshau 91df157462 Refactor downlevel support a bit, implement blending for hal/gles 2021-06-30 02:29:28 -04:00
Dzmitry Malyshau 5083f56149 Add more downlevel flags, implement device opening on Gles 2021-06-30 02:29:26 -04:00
Andreas Reich 9aa251c675 fix conservative rasterization for vulkan 2021-06-28 21:08:06 +02:00
Alex S b4b3dd720c Reorder & reassign flags to group up the binding flags together. 2021-06-28 14:44:08 +03:00
Alex S 2828100143 Reduce feature flag surface for descriptor arrays.
DYNAMIC_INDEXING is checked by default, since WGPU doesn't allow
for any kind of specialization constants and constant indexing is
nigh useless.

STORAGE_RESOURCE_BINDING_ARRAY is enabled iff the device supports:
- both or neither of uniform and buffer arrays with dynamic indexing;
- both or neither of sampled and storage images with dynamic indexing.

NONUNIFORM_INDEXING is enabled iff for ALL types of descriptor arrays
*that are supported for dynamic indexing*, nonuniform indexing is
also allowed.

These flags have a limitation in that some platforms
(eg.
https://vulkan.gpuinfo.org/displayreport.php?id=11692#features_core_12)
may support a strange subset of those features (example device
supporting non-uniform indexing for textures and storage buffers,
but NOT for storage textures or uniform buffers). In that case feature
will be reported as missing, even though it is partially present.

In the author's opinion, this flag set is convenient for the
users to query; however, due to aforementioned limitations, it would be
desirable to obtain statistics about "edge-case" platforms and what
percentage of reports they comprise.
2021-06-28 14:44:00 +03:00
Connor Fitzgerald 9377149e85 Remove holes from wgpu-info 2021-06-23 21:29:44 -04:00
Connor Fitzgerald b060bf1afe Assorted touchups 2021-06-23 20:23:19 -04:00
bors[bot]andAlex S 96dbd06a1f Merge #1525
1525: Add Naga bypass to allow feeding raw SPIR-V shader data to the backend. r=kvark a=ElectronicRU

**Connections**
Fixes #1520 .

**Description**
While Naga checking is undoubtedly very useful, it currently lags behind
what is possible in SPIR-V and even what is promised by WGPU (ie binding
arrays). This adds an unsafe method to wgpu::Device to allow feeding
raw SPIR-V data into the backend, and adds a feature flag to request a
backend supporting this operation.

**Testing**
`texture_arrays` example is runnable now, which uncovers an additional bug in Vulkan backend - binding arrays are instead treated like sole bindings, and indices shift, too. Lots of errors from validation layer ensue.


Co-authored-by: Alex S <alex0player@gmail.com>
2021-06-20 16:13:53 +00:00
Alex S 7cd7b18560 Code review:
- Remove Cow from wgpu-hal API surface. You graze on in our hearts.
- Rename feature flag to SPIRV_SHADER_PASSTHROUGH in anticipation
  of crate feature `spirv` to reduce confusion.
- Add some more documentation about behaviour and intended avenues of
  use to the feature.
2021-06-20 15:22:04 +03:00
Dzmitry Malyshau e72bf3e10c Fix wgpu downlevel check 2021-06-20 01:24:44 -04:00
Alex S 8bfa949261 Code review:
- rename ShaderInput variants
- rename feature flag
- hard error on Metal backend trying to compile SPIR-V
- fix test failing because of feature flag bits changing
2021-06-20 06:22:59 +03:00
Alex S 3d6cda100a Fix unfortunate flag duplication. (I wish bitflags would catch that). 2021-06-20 05:05:33 +03:00
Alex S 6d2e6e5a56 Add Naga bypass to allow feeding raw SPIR-V shader data to the backend.
While Naga checking is undoubtedly very useful, it currently lags behind
what is possible in SPIR-V and even what is promised by WGPU (ie binding
arrays). This adds an unsafe method to wgpu::Device to allow feeding
raw SPIR-V data into the backend, and adds a feature flag to request a
backend supporting this operation.
2021-06-19 23:32:44 +03:00
Gordon-F 2873ac32d9 Remove MPL 2.0 header in files 2021-06-19 21:06:08 +03:00
bors[bot]andAlex S 1d2efb43bc Merge #1511
1511: Added storage texture array support. r=kvark a=ElectronicRU

**Description**
Arrays of storage images (*f*image*n*D in GLSL parlance) should now be supported.
I also took the liberty to refactor texture format checking a bit,
and tighten up sampled texture support detection for Metal as well.

**Testing**
Not completely sure what's the proper testing approach here, open to suggestions.


Co-authored-by: Alex S <alex0player@gmail.com>
2021-06-18 21:38:54 +00:00
Connor Fitzgerald 74d2becb18 Relicense to MIT/Apache 2021-06-18 13:40:31 -04:00
Alex S 52fab481e6 Added storage texture array support.
I also took the liberty to refactor texture format checking a bit,
and tighten up sampled texture support detection for Metal as well.
2021-06-18 19:20:37 +03:00
bors[bot]andDzmitry Malyshau 0c76819ef7 Merge #1471
1471: Hardware Abstraction Layer r=msiglreith a=kvark

**Connections**
Closes #1423

**Description**
Prototyping the new hardware abstraction layer for wgpu, which replaces gfx-rs dependencies.
The central piece is "wgpu-hal/src/lib.rs".

### Metrics
| what                     | wgpu-core, LOC | graphics, LOC | Total | Build time |
| ----------------- | ----------------- | -------------- | ---- | ---------- |
| Old: _gfx-hal_      | 23K                       | 28K                 | **51K**  | 62s   |
| New: _wgpu-hal_ | 20.5K                    | 10.5K               | **31K** | 48s   |

### TODO:
- [x] wgpu-hal API
- [x] internal example/bench
- [x] Metal
- [x] Vulkan

**Testing**
examples


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-06-17 18:28:48 +00:00
Dzmitry Malyshau c53addac8a hal/vk: draws and dispatches. Refactor query set descriptor 2021-06-16 14:17:37 -04:00
Dzmitry Malyshau 78d21beb58 Update default storage limits 2021-06-14 18:18:05 -04:00
Dzmitry Malyshau dc340421c4 hal/vk: instance and adapter 2021-06-11 02:09:29 -04:00
Dzmitry Malyshau 75b6ecea58 hal: Fix iOS build 2021-06-10 17:09:46 -04:00
Dzmitry Malyshau bdaf57dbed hal/mtl: pipelines and fences 2021-06-09 23:38:48 -04:00
Dzmitry Malyshau 9f904700ee hal/mtl: creation of bind groups 2021-06-09 17:06:43 -04:00
Dzmitry Malyshau 3475d839f9 hal/metal: instance,adapter, and surface 2021-06-09 00:55:49 -04:00
Dzmitry Malyshau 0a82c232ba hal: port the rest of wgpu-core 2021-06-08 00:46:08 -04:00
Dzmitry Malyshau c61ee1262b hal: transfer operations 2021-06-08 00:46:08 -04:00
Dzmitry Malyshau 569cd0cdd6 WIP new wgpu-hal 2021-06-08 00:46:08 -04:00
Dzmitry Malyshau beb88b0a88 Skip the cube compatibility on a downlevel flag 2021-06-01 08:29:44 -04:00
Wumpf f62d0d5edc Native Extension: Expose fill buffer & clear image (#1335)
* Add command buffer fill buffer method

* Added test for buffer fill

* Added image clear + test

* image/buffer clear methods are now pure clear to zero

* fix cargo clippy & int type issues

* clear buffer alignment is now given by COPY_BUFFER_ALIGNMENT

* joined buffer/image clear player tests

* ImageSubresourceRange is now used in TextureViewDescriptor
2021-05-30 11:03:33 -04:00
Dzmitry Malyshau e24e8f643c Fix dynamic stencil reference for Replace ops 2021-05-17 18:42:42 -04:00
bors[bot]andDzmitry Malyshau 13f2ca571c Merge #1391
1391: Simplify features r=cwfitzgerald a=kvark

**Connections**
Fixes #1390
Makes vertex writable storage optional (native-only for now)
Fixes the follow-up to #891 

**Description**
Refactors the code so that adding new features and maintaining current ones is much easier.
Refactors the way missing features are checked and reported, DRY way.

**Testing**
Not really tested

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-05-17 19:03:59 +00:00
Dzmitry Malyshau f0a145d0fa Add VERTEX_WRITABLE_STORAGE feature, refactor the sample border 2021-05-17 14:09:02 -04:00
Conner Bryan eda7031f35 fix typo in PowerPreference::LowPower description 2021-05-11 19:10:06 -04:00
Dzmitry Malyshau e5ddb94be0 Version bump to 0.8 2021-04-29 11:57:22 -04:00
Chandler Newman 904ec7a5ee Add uniform and storage buffer arrays 2021-04-29 00:38:04 -04:00
Dzmitry Malyshau c744582052 Update blending API names 2021-04-15 11:25:04 -04:00
adamnemecek 687bc81fac derive copy for DeviceType, BlendComponent, BlendState, PrimitiveState, MultisampleState, DepthBiasState, StencilFaceState, VertexAttribute, ImageDataLayout, BindGroupLayoutEntry, DrawIndirectArgs, DrawIndexedIndirectArgs, DispatchIndirectArgs 2021-04-14 12:09:35 -07:00
Aaron Housh c820cc8e73 Add Map Alignment type (#1322)
* Add Map Alignment type

* Fix clippy warnings

* Make buffer_map_async compare range start to MAP_ALIGNMENT
2021-04-12 13:28:46 -04:00
Dzmitry Malyshau 4d324bc38d Move depth clamping to primitive state 2021-04-05 16:01:23 -04:00
adamnemecek d91ad13482 framecapture 2021-04-01 12:51:50 -07:00
Connor Fitzgerald 3073a454ff Update to flag-based downlevel bools 2021-04-01 11:48:09 -04:00
Connor Fitzgerald 4db9a4522e Add downlevel infrastructure 2021-03-31 01:08:48 -04:00
Connor Fitzgerald 0616a08c65 Add color blend modes 2021-03-30 13:37:43 -04:00
bors[bot]andJoshua Groves fb0288a377 Merge #1279
1279: Fix some typos r=kvark a=grovesNL

**Description**
Fix a few small typos in doc comments

**Testing**
None

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2021-03-23 06:44:11 +00:00
Joshua Groves 306eaf3969 Fix some typos 2021-03-23 01:01:32 -02:30
Joshua Groves 9058f3ba62 Rename copy views and layout to match spec 2021-03-23 00:48:42 -02:30
Andreas Reich 50043875e5 rows_per_image & rows_per_image are now optional
Fixes #988
2021-03-20 12:33:28 +01:00
Wumpf 717c2d73e7 Add CONSERVATIVE_RASTERIZATION native feature (#1263)
* Add CONSERVATIVE_RASTERIZATION native feature

* update gfx to cd3042d8c02d9dc7fc74ac8c292099c9789f6d43

* error for polygon mode not fill +conservative raster
2021-03-14 20:43:02 -04:00
Dzmitry Malyshau 231bba03a1 Lint all the things 2021-03-12 12:39:04 -05:00