Commit Graph

535 Commits

Author SHA1 Message Date
Dzmitry Malyshau
e707c920cb hal/metal: allow unused private caps 2021-12-02 12:15:52 -05:00
Igor Shaposhnik
c6d1491bb1 Update raw-window-handle to 0.4 2021-12-01 15:59:05 -05:00
Dzmitry Malyshau
fbbce25230 hal/vk: fix app_version for Vulkan 1.1 2021-11-30 18:35:07 -05:00
Dzmitry Malyshau
09bea3c5f0 hal/vk: fix vulkan-1.2 caps check, again 2021-11-30 13:51:24 -05:00
Dzmitry Malyshau
20e1d4d170 hal/gles: don't expose VERTEX_STORAGE if there is no storage 2021-11-30 13:51:24 -05:00
Dzmitry Malyshau
fa4d86b167 hal/gles: error on given context below 3.0 2021-11-30 13:51:24 -05:00
Dzmitry Malyshau
28ba9d86eb hal/vk: check for optimus in addition to NV adapter 2021-11-29 13:32:08 -05:00
Dzmitry Malyshau
4abbc95911 hal/vk: fix adapter vulkan version check when requesting 1.2 capabilities 2021-11-29 13:32:08 -05:00
Dzmitry Malyshau
57b28cb90f hal/vk: use Option::insert() with push_next for adapter features 2021-11-29 12:09:48 -05:00
Dzmitry Malyshau
b6d5281d4c hal/vk: use more ergonomic GetPhysicalDeviceProperties2 2021-11-29 12:09:48 -05:00
Dzmitry Malyshau
480ab26ded hal/vk: require storage buffer class as the device extension, not instance 2021-11-29 12:09:48 -05:00
João Capucho
90b2949fb3
hal/vulkan: Enable depth clip if available (#2218)
This wasn't being done even if the VK_EXT_depth_clip_enable was present
causing validation errors when requesting DEPTH_CLIP_CONTROL in the
device.

Strangely this was being done for raw calls to `wgpu_hal::Adapter::open`
because it calls `physical_device_features` and then
`from_extensions_and_requested_features`.
2021-11-29 11:31:43 -05:00
Dzmitry Malyshau
b32dcbb041
hal/gles: force unbind samplers (#2226) 2021-11-29 10:08:11 -05:00
Dzmitry Malyshau
62b036b55b
hal/gles: fix setting filtering on integer textures (#2222) 2021-11-28 23:04:43 -05:00
Dzmitry Malyshau
5f6c067815
hal/vulkan: use multiple semaphores in a relay (#2212) 2021-11-25 15:44:33 -05:00
Xiaopeng Li
f4d51451fa
Unique HalManagedMetalLayerDelegate class (#2209)
* Unique HalManagedMetalLayerDelegate class

* Remove once-cell dependency
2021-11-25 11:23:26 -05:00
Mariusz Kryński
dde73ed236
use native webgl2 buffers for MAP_READ usage (#2201)
* use native gl buffers for map_read

* Buffer refactor

* lint
2021-11-23 17:16:26 -05:00
Dzmitry Malyshau
5864b776a4
Refactor command buffer states to ensure proper cleanup on errors (#2208) 2021-11-23 15:57:13 -05:00
Dzmitry Malyshau
2b38439f65
Add INDIRECT_FIRST_INSTANCE feature (#2206) 2021-11-23 10:01:07 -05:00
Layl
2ef72b9313
Add multiview support (#2187)
Co-authored-by: Layl Bongers <2385329-layl@users.noreply.gitlab.com>
2021-11-19 10:56:48 -05:00
Xiaopeng Li
39f3f08b55
Add Device::as_hal and always assume texture from hal is initialized (#2180)
* Add Device::as_hal, create_texture_from_hal_initialized

* Add Safety doc

* Always assume that the texture from hal is initialized
2021-11-18 17:34:01 -05:00
Boris-Chengbiao Zhou
3545a4fdd5
Introduce SamplerBindingType enum and fix bug in validation (#2181)
* Introduce SamplerBindingType enum and fix bug in validation

This matches the WebGPU spec more closely and also lets us implement the
validation as it's written in the spec[1]. This fixes a bug which
previously prevented the "shadow" example from running in Firefox.

Previously the validation would check whether the filtering was
appropiate even if it was a comparison sampler. This didn't matter when
running the shadow example natively since the example was setting
`filtering: true` in addition to `comparison: true`. But this failed
when running through a browser since there the used WebIDL has the
proper enum representation and eventually resulted in `filtering: false`
being passed to wgpu-core which would then fail validation.[2]

[1]: https://gpuweb.github.io/gpuweb/#bind-group-creation
[2]: 674b6582ba/dom/webgpu/ipc/WebGPUChild.cpp (L502-L513)

* Fix remaining examples

* Fix deno_webgpu
2021-11-16 23:08:03 -05:00
Dzmitry Malyshau
f25a45f4e2
Evolve depth clamping into clip control (#2171) 2021-11-10 16:55:27 -05:00
Dzmitry Malyshau
27aae2a2a2
Update naga to eda078d (#2172) 2021-11-10 16:06:32 -05:00
Mariusz Kryński
cf2fb0b665
do not query work group params on gles < 3.1 (#2166)
* do not query work group params on gles < 3.1

* address reviewer comment
2021-11-10 08:21:27 -05:00
Markus Siglreithmaier
6fc0587b2d
hal/vk: add physical device features for extensions (#2167) 2021-11-09 09:59:41 -05:00
Mariusz Kryński
9a5dec2cf0
gles backend: unbind PIXEL_UNPACK_BUFFER (#2162) 2021-11-09 09:32:40 -05:00
Dzmitry Malyshau
2755cd08eb
Add clippy non_send_fields_in_send_ty (#2156) 2021-11-05 08:57:09 -04:00
Dzmitry Malyshau
ca7ca749cd
Update naga to 323999f, report pretty errors in shader validation (#2141) 2021-11-01 16:57:33 -04:00
Jasper St. Pierre
8a76920349
queue: Another attempt at cube map rendering (#2143)
The last one was wrong, because I misread
a confusing line in the GL ES spec.
2021-11-01 14:06:10 -04:00
Dzmitry Malyshau
07b02e694d
Update naga to 9d2b357 (#2140) 2021-10-31 23:29:49 -04:00
Jasper St. Pierre
191a8efae6
gles: Fix rendering to cubemap faces (#2139) 2021-11-01 03:00:01 +00:00
Jerónimo Sánchez
939d54f88d
Compute max workgroup size limits (#2133)
* Creation of max compute workgroup size limits
* Implemented for Vulkan and Dx12

* Follow up of gfx-rs/wgpu#1808

* Check if current dispatch operation is under the limit

* Typos and some forgotten fixes

* Port to GLES

* Port to Metal with default limits

* Change Vulkan max_workroup_size_per_dims to pick the min of the reported dimensions

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-10-31 22:32:10 -04:00
Inseok Lee
8ce9ae9b25
Fix invalid Rgba16Float format on gles 2021-10-30 17:31:55 +09:00
Inseok Lee
5f1b3e56bc
Unset existing vertex attributes on gles set_render_pipeline (#2131) 2021-10-29 23:46:04 -04:00
xiaopengli89
cd9498d447 Add texture_from_raw method for metal/dx12 device 2021-10-28 09:14:15 -04:00
Mariusz Kryński
8568188558
WebGL backend: memory-only staging buffers (#2112)
* webgl2 buffers

* use bitflags::intersects, linting

* address reviewer comments: s/RawBuffer/BufferInner/

* bugfixes

* cargo fmt

* cargo clippy

* cargo fmt again
2021-10-27 01:16:31 +00:00
Riccardo Zaglia
d46c39af1d FIx raw Vulkan API 2021-10-22 21:53:20 -04:00
Dzmitry Malyshau
29282a3981
hal/egl: don't assume EGL-1.5 if upcast works (#2105) 2021-10-22 09:45:51 -04:00
Nicklas Warming Jacobsen
ea0c974bed
webgl2: recreate surface texture in fn configure (#2067)
Currently the configure function reuses the surface texture if it
already exist, and will call Glow::Context::tex_storage_2d to
reconfigure the texture. However doing so on an already configured
texture will cause the browser warning:
WebGL warning: texStorage(Multisample)?: Specified texture is immutable.
and will NOT apply the new configuration such as new dimensions.

Co-authored-by: Nicklas Warming Jacobsen <nwj@skybox.gg>
2021-10-22 12:58:24 +00:00
Dzmitry Malyshau
721875798f
hal/gles: allow presenting with Android emulator (#2097) 2021-10-21 22:00:18 -04:00
Inseok Lee
82cf1972af
GLES 3.0 fix (#2078) 2021-10-21 16:07:07 +00:00
Dzmitry Malyshau
003b83f6ac
hal/mtl: disable fragment r/w buffers in fragment shaders on macOS 10.11 (#2102) 2021-10-21 11:53:57 -04:00
Xiaopeng Li
a59a627f12
Fix memory leak on macOS (#2092)
* Fix memory RenderCommandEncoder, BlitCommandEncoder, label leak on macOS

* Don't wrap autoreleasepool when blit command encoder is already active

* Revert wrap set_label, instead focus on gfx-rs/metal-rs#218
2021-10-20 08:52:00 -04:00
Dzmitry Malyshau
f8ecebb43d hal/gles: properly check for buffer allocation 2021-10-16 10:45:35 -04:00
Dzmitry Malyshau
d9df69ec29 hal/egl: request ALPHA_SIZE for srgb, move shaders into a folder 2021-10-15 15:02:49 -04:00
Dzmitry Malyshau
47fb0efb2c
ETC2 texture format refactor (#2064) 2021-10-13 13:42:44 -04:00
Wumpf
a28c52873f
Move clear_texture impl from wgpu-hal to wgpu-core (#2046)
* new test for clearing textures of all formats

* clear_texture is now always implemented in wgpu-core instead of wgpu-hal

* add 1D/array/volume texture to clear_texture test

* set mip_level_count to 1 for D1 textures in clear_texture test

* fix warning & clippy lints

* Fix web build

* [pr feedback] fix potentially skipped resource transition, fix wrong mip size for texture clear

* collect_zero_buffer_copies_for_clear_texture aligns rows now properly
2021-10-13 13:42:13 -04:00
Dzmitry Malyshau
5441556988 Release wgpu-hal-0.11.2 2021-10-12 12:22:49 -04:00
Dzmitry Malyshau
c5244c9ffc hal/dx12: fix cube array views 2021-10-12 12:22:49 -04:00
Dzmitry Malyshau
2c9a7dfc2a hal/gl: fix vertex buffers with non-zero first instance 2021-10-12 10:00:34 -04:00
Dzmitry Malyshau
60bb2aaa6b hal/gles: work around the clear shader bug 2021-10-09 16:33:45 -04:00
Dzmitry Malyshau
d48bc62826 hal/vk: check for NV optimus 2021-10-09 16:33:45 -04:00
Dzmitry Malyshau
44f488efed gles: fix querying storage limits 2021-10-09 16:33:45 -04:00
Connor Fitzgerald
7320ca33c8 [gles] Fix indirect compute 2021-10-09 15:15:35 -04:00
Dzmitry Malyshau
016b319b38 Manifests update for 0.11 2021-10-07 19:15:49 -04:00
Dzmitry Malyshau
85fbbbbbf3
Cargo lock update, limits fix (#2033) 2021-10-07 16:57:33 -04:00
Zicklag
312828f12f
Implement WebGL2 Backend (#1686)
* Implement WebGL Backend

* Add WebGL Fixes by @mrk-its

* Update Limits for WASM and Examples

* Address Review Points
2021-10-07 16:18:09 -04:00
Connor Fitzgerald
6df5f95b67 Update naga to 2e7d629 2021-10-07 16:09:13 -04:00
Dzmitry Malyshau
dfa4948033 Update naga to 0e3fbc8 2021-10-07 08:32:01 -04:00
Connor Fitzgerald
647f6ee9f2 Disable partially bound arrays on intel/windows 2021-10-05 08:57:33 -04:00
Connor Fitzgerald
c3d906856f Add spans to provide more information profile gaps 2021-10-03 22:54:15 -04:00
Dzmitry Malyshau
97d6db4d18 Allow if/panic in wgpu-hal 2021-10-01 16:22:51 -04:00
Connor Fitzgerald
b679342d9e Support descriptor arrays shorter than binding length 2021-09-30 14:11:51 -04:00
Dzmitry Malyshau
8fa3ca731b hal/gl: disable presentation on intel+nv 2021-09-29 13:32:09 -04:00
João Capucho
9bc5908492
Add method to create shader modules without runtime checks (#1978)
* Add method to create shader modules without runtime checks

* Use opaque struct to represent shader bound checks
2021-09-27 19:51:44 +00:00
Connor Fitzgerald
ff8f258b95
Fix VK and GL renderdoc captures 2021-09-21 18:41:16 -04:00
Dzmitry Malyshau
87c8680ffd hal/vk: Enable image robustness where available 2021-09-19 15:18:37 -04:00
Dzmitry Malyshau
c8436de1ec Force point size output on Vulkan 2021-09-15 19:15:23 -04:00
Connor Fitzgerald
7766ed194b
Improve CI testing code 2021-09-14 13:34:07 -04:00
Dzmitry Malyshau
392f904465 hal/metal: bump the maximum command buffer count 2021-09-14 09:12:00 -04:00
Dzmitry Malyshau
447d612f88 hal/metal: fix the back-face stencil state 2021-09-13 10:17:19 -04:00
Dzmitry Malyshau
3afeb9a53f hal/metal: fix storage binding size units 2021-09-12 17:41:46 -04:00
xacrimon
fc1cb5eb20 feedback 2021-09-12 11:03:05 -04:00
Dzmitry Malyshau
abe41ccf9c Fix stencil ops 2021-09-12 10:37:17 -04:00
João Capucho
bf29ceaf10 Update naga to latest 2021-09-11 11:44:27 -04:00
xacrimon
e013daadc8
please rustfmt 2021-09-10 21:46:21 +02:00
xacrimon
a1bfbbbfab
fix lint 2021-09-10 21:44:35 +02:00
xacrimon
da849115b5
return appropriate error when failing to allocate drawable on metal 2021-09-10 21:30:30 +02:00
Geert Bleyen
cc91b38301
Do MTL feature check for Depth Clamping (#1933)
* Do MTL feature check for Depth Clamping

(cherry picked from commit ae6e83c3b2e695918ffcd8bbf7ce3a1b32e2b36e)

# Conflicts:
#	wgpu-hal/src/metal/adapter.rs

* make feature support check conform

* clean code

* avoid same featureset checks multiple times

* cargo fmt'ed
2021-09-10 13:45:25 +00:00
Dzmitry Malyshau
180dc27144 Work around Adreno's OpName bug 2021-09-08 22:24:27 -04:00
Connor Fitzgerald
809909137c
Merge pull request #1919 from kvark/spv
vulkan: compile shader modules at pipeline creation time
2021-09-08 17:25:50 -04:00
Dzmitry Malyshau
797c9c83d6
Fix solaris build (#1924) 2021-09-08 17:22:23 -04:00
Luke Street
76bcd9c494
Implement min_{uniform,storage}_buffer_offset_alignment limits (#1923)
* Implement min_{uniform,storage}_buffer_offset_alignment limits

* Add Limits::using_alignment

* Update docs & examples

* Create binding_model::buffer_binding_type_alignment fn
2021-09-08 13:53:02 -04:00
Luke Street
5d00867f47
hal/dx12: fix offsets into storage buffer bindings (#1921) 2021-09-08 13:01:26 +00:00
Dzmitry Malyshau
e00bfac6cf vulkan: compile shader modules at pipeline creation time 2021-09-07 20:06:16 -04:00
Dzmitry Malyshau
076031c1ba
hal: switch texture copies to expect physical sizes (#1908) 2021-09-07 13:13:11 +00:00
Zhixing Zhang
66979eb68d
add missing capability (#1911) 2021-09-07 01:30:50 +00:00
Wumpf
df2a686c29
Reintroduce clear_texture Metal/Vulkan/DX12 (#1905)
* enable CLEAR_COMMANDS feature for all adapters

* replaced fill_buffer with clear_buffer (minus variable value)

* Improve clear buffer/texture test
and remove unused clear-buffer.ron test

* renamed clear_image to clear_texture

* skeleton for new wgpu-hal clear_texture

* clear_texture implementation for vulkan

* clear_texture now restricts usage

* clear_texture implementation for dx12

* Implemented clear_texture for Metal backend

* Clean up GLES clear_buffer and leave note on how to implement clear_texture in the future

* fix linux compilation & formatting issues

* comment & namespace fixes

* Extent3d has now a simple mipmap calculating function

Fix incorrect use of texture.size in clear_texture for metal/dx12
Fix incorrect mip/layer ranges in clear_texture for metal/dx12
2021-09-06 21:14:40 -04:00
Connor Fitzgerald
938c069608
Properly implement timestamp periods (#1907) 2021-09-04 22:24:15 -04:00
Dzmitry Malyshau
663f64c571 Fix read-write buffer barrier 2021-09-02 16:39:55 -04:00
Dzmitry Malyshau
d23288e455 hal/linux: Work around Intel+Nvidia presentation conflict 2021-09-02 14:50:05 -04:00
Igor Shaposhnik
792fbc17e5 [dx12] Fix compiler warning 2021-09-02 14:06:18 +03:00
Dzmitry Malyshau
3ced8bf892 hal/vk: always request StorageImageExtendedFormats in SPIR-V 2021-09-01 19:08:01 -04:00
Connor Fitzgerald
90778c3a43 Implement compressed textures in DX12 2021-09-01 18:45:35 -04:00
Connor Fitzgerald
5b438de8e8
Merge pull request #1893 from cwfitzgerald/debug-labels
Implement render pass labels in Vulkan
2021-09-01 16:47:57 -04:00
Connor Fitzgerald
10daa83162
Merge pull request #1876 from kvark/gl-stride
hal/gles: fix the VB stride limit
2021-09-01 16:47:36 -04:00
Connor Fitzgerald
41c96a6574
Implement Debug Markers for Vulkan 2021-09-01 16:32:49 -04:00
Christofer Nolander
06316c1bac
hal/metal: support Features::NON_FILL_POLYGON_MODE (#1885)
* hal/metal: support Features::NON_FILL_POLYGON_MODE

* Document Metal support for NON_FILL_POLYGON_MODE

* Split Features::NON_FILL_POLYGON_MODE in two

Adds two new features: `LINE_POLYGON_MODE` and `POINT_POLYGON_MODE`.

Allows metal to support `PolygonMode::Line` while not being required to
support `PolygonMode::Point`.

* Formatting

* Rename {LINE,POINT}_POLYGON_MODE to POLYGON_MODE_{LINE,POINT}
2021-08-31 16:20:38 +00:00
Riccardo Zaglia
0a2be6099c Add Texture::as_hal() 2021-08-31 10:30:23 -04:00
Dzmitry Malyshau
43872d4544 hal/gles: fix the VB stride limit 2021-08-30 16:49:54 -04:00
Dzmitry Malyshau
c3de161dd2 hal/metal: inherit scaling from NSView 2021-08-27 13:39:13 -04:00
Dzmitry Malyshau
5fd4fffdde hal/dx12: don't assume D3DCompile error is some 2021-08-26 17:14:58 -04:00
Riccardo Zaglia
1c086a51ff hal/vk: Allow non-owned Instance and Device from raw; allow owned Texture from raw 2021-08-25 00:34:19 -04:00
Dzmitry Malyshau
590ef1d8cf
Switch naga to latest on git (#1858) 2021-08-24 18:20:44 -04:00
Dzmitry Malyshau
0e65b9323a
hal/dx12: do not reverse the pipeline layout (#1857) 2021-08-24 01:39:44 -04:00
Dzmitry Malyshau
a296cf6e9e [metal] set threadgroup memory sizes reflected from the shader 2021-08-19 13:25:04 -04:00
Dzmitry Malyshau
9da5c1d3a0
Release v0.10 (#1820)
* Release v0.10

* hal/gles: update glow handles logic
2021-08-18 19:06:21 +00:00
Dzmitry Malyshau
9b85882ff8 [dx12] implement num_workgroups 2021-08-18 00:14:44 -04:00
Adam Gausmann
ee3b85928e Fix panic in GLES shader processing
The backend panics while trying to process uniform global variables
when the variable's name is not found in the emitted ReflectionInfo.
This patch converts the panicking line into an explicit check, and
ignores the corresponding global variable if the name iis not found.

Resolves #1803
2021-08-16 16:00:23 -04:00
Dzmitry Malyshau
4dc5546a17 Naga update to 69b70f8 2021-08-16 01:35:19 -04:00
Dzmitry Malyshau
a222e6eb11 hal/egl: defer surface initialization to configure() time 2021-08-14 12:33:12 -04:00
Dzmitry Malyshau
c9fdaef3e1 dx12: switch root parameter updates from eager to lazy 2021-08-14 00:40:41 -04:00
Dzmitry Malyshau
1e7d86b655 Update Naga to 69b70f8 2021-08-13 02:09:43 -04:00
Dzmitry Malyshau
f2a18ee57c Update naga to 1907a92 2021-08-12 23:58:19 -04:00
Connor Fitzgerald
3afab9c5aa
Splits non-uniform indexing into two different features (#1785) 2021-08-10 22:43:08 -04:00
Agorgianitis Loukas
5bc42843cf Add downlevel flag for storage buffers in vertex shaders 2021-08-06 21:22:16 +03:00
Agorgianitis Loukas
dd24b48b11
Fix scissor test leak when presenting gles backend (#1772)
* Fix scissor test leak when presenting gles backend

* Set color mask before presenting gles backend to avoid potential leak
2021-08-06 10:54:09 -04:00
Zicklag
9310f264f1
Update Naga With New Storage Classes API (#1766) 2021-08-05 13:50:51 -04:00
Dzmitry Malyshau
50da3f33ba
Merge pull request #1758 from kvark/windows-error
Fix error with resolver=1 on non-Windows
2021-08-03 11:52:54 -04:00
Zicklag
07cd75a36b Fix New Clippy Lints From Rust 1.54.0
Fixes a number of new lints introduce in the updated clippy that
CI is now using.
2021-07-29 16:29:46 -05:00
Dzmitry Malyshau
3a004ecf9a hal/dx12: fix depth formats and pipeline layout 2021-07-29 01:13:37 -04:00
Zicklag
fd460fa1e4 Use Bitshift Style for All Bitflag Consts
This makes existing bitflags easier to read and makes it eaiser to add
new flags later.
2021-07-28 11:28:54 -05:00
Dzmitry Malyshau
552a5f138e Rename texture usage names 2021-07-28 00:17:54 -04:00
Zicklag
671e393fa1 Handle Multi-threaded EGL Context Access
Implements the synchronization necessary to use the GL backend from
multiple threads.
2021-07-27 14:02:39 -05:00
bors[bot]
9ce884c384
Merge #1732
1732: Fix Tests on DX12/GL r=kvark a=cwfitzgerald

**Connections**

Marks #1730 as known failure

Closes #1695

**Description**

This fixes up tests on both DX12 and GL

**Testing**

Tests


Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2021-07-27 13:10:45 +00:00
Dzmitry Malyshau
69f808c54a hal/dx12: support base vertex/instance 2021-07-27 08:59:41 -04:00
Connor Fitzgerald
d6a8ab7b34
Allow vertex_storage_textures to be 0 2021-07-27 02:37:15 -04:00
Dzmitry Malyshau
405cf57955 hal/dx12: compact register allocation, naga update 2021-07-26 02:01:14 -04:00
bors[bot]
3eb3eed8cf
Merge #1609
1609: [Vulkan] Initialize wgpu objects from raw handles r=kvark a=zarik5

**Connections**
This PR is a successor of https://github.com/gfx-rs/gfx/pull/3762

**Description**
The `handle_is_external` flag mechanism was not enough to ensure safety, when for example the Instance is wrapped in `Arc<>` and a library cannot keep track of all its clones. This is the case with the bevy render rewrite. The solution was to let wgpu be in charge of destroying the handles, but it also has to keep a reference to a "drop guard" which is always dropped after the handle is destroyed. For the OpenXR integration, this drop guard will be `xr::Instance`.

For now this is just a proof of concept. Only instance creation is handled, and there is even type error in `wgc::Instance::from_hal()`.

I have a few concerns:
* Is it ok to expose `hal::Instance` from the wgpu crate? Or should the user pass all the parameters so `hal::Instance` can be constructed internally? This second options is more disruptive, since the wgpu-types crate would need to import all platform-specific crates to define the structure/enum to hold the raw handles.
* Without counting the call to create the `hal::Instance`, there are 4 indirection calls to save the raw instance. Can this be optimized in any way?

Do you think it is possible to merge wgpu-hal into wgpu-core? This could help with reducing the distance from the surface level API to the platform specific APIs even more.

**Testing**
Vulkan/Android (Oculus Quest) using [this sample](https://github.com/zarik5/openxrs/blob/wgpu-test/openxr/examples/vulkan.rs).


Co-authored-by: Riccardo Zaglia <riccardo.zaglia5@gmail.com>
2021-07-26 05:03:13 +00:00
bors[bot]
ee9e1452d5
Merge #1717
1717: Work Around Fastclear Bug for Web and Native GL r=cwfitzgerald,kvark a=zicklag

**Connections**
Resolves #1627 

**Description**
Works around Mesa fastclear bug by doing a manual shader clear on effected platforms

**Testing**
Tested on Mesa Intel(R) UHD Graphics (CML GT2) (Gl)


Co-authored-by: Zicklag <zicklag@katharostech.com>
2021-07-26 04:57:17 +00:00
Riccardo Zaglia
2657849977 [Vulkan] Initialize wgpu objects from raw handles 2021-07-25 21:51:40 +02:00
Zicklag
0a66eef822 Work Around Fastclear Bug for Web and Native GL 2021-07-24 15:36:49 -05:00
Dzmitry Malyshau
2158cdd43b hal/dx12: pass null to mapping rects 2021-07-23 12:19:59 -04:00
bors[bot]
35896df3b7
Merge #1716
1716: Update winit to 0.25 r=kvark a=Gordon-F

**Connections**


**Description**
Update winit to 0.25

**Testing**
Examples


Co-authored-by: Gordon-F <ishaposhnik@icloud.com>
2021-07-23 15:05:45 +00:00
Dzmitry Malyshau
8dc4942431 Update naga to bbfa9a0, tweak DX12 debug output 2021-07-23 10:48:32 -04:00
Gordon-F
f0b1d5a673 Update winit to 0.25 2021-07-23 14:30:38 +03:00
Dzmitry Malyshau
2c45796d9c Update Naga to cc91c77 2021-07-23 02:19:42 -04:00
bors[bot]
1f7d60d065
Merge #1713
1713: hal/dx12: rewrite view creation, use arrays more aggressively r=kvark a=kvark

**Connections**

**Description**
D3D12 has this thing where you can't create a 2D view with non-zero base array index.
So we have special logic now to fall back to 2D array views in these cases.

**Testing**
Tested on the Shadow example.


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-07-23 06:07:18 +00:00
Dzmitry Malyshau
726cf4f614 hal/dx12: rewrite view creation, use arrays more aggressively 2021-07-23 00:07:23 -04:00
munrocket
f909a8e631 update naga revision 2021-07-22 20:52:26 +04:00
Connor Fitzgerald
683d03a8e4 Add Rgb9e5Ufloat 2021-07-21 23:54:46 -04:00
Dzmitry Malyshau
1a9a855ea9 Rename InputStepMode to VertexStepMode 2021-07-21 17:48:00 -04:00
Dzmitry Malyshau
8a971fcf2e hal/vk: use actual view usage for imageless framebuffers 2021-07-21 12:14:20 -04:00
Dzmitry Malyshau
e9a2a1e438 hal/dx12: reset command pool 2021-07-20 10:39:40 -04:00
Dzmitry Malyshau
be13fe3048 hal/dx12: fix the binding model 2021-07-20 10:07:40 -04:00
Dzmitry Malyshau
35145615bf Update naga, use binding map in DX12 2021-07-18 12:03:14 -04:00
initial-algebra
0db00e9657 Implement Feature::SHADER_PRIMITIVE_INDEX on Vulkan 2021-07-17 15:31:35 -03:00
Dzmitry Malyshau
5419947095 hal/vk: relay semaphore 2021-07-16 17:55:03 -04:00
Connor Fitzgerald
0f84c7cf6e Use EGL_KHR_gl_colorspace for srgb if available 2021-07-16 01:03:18 -04:00
xiaopengli89
6e63964e51 fix: readWriteTextureSupport is support on macOS 10.13+ / iOS 11.0 2021-07-15 14:40:05 +08:00
Dzmitry Malyshau
b98cba9bfd hal/dx12: reset scissor and viewport 2021-07-15 02:10:28 -04:00
Dzmitry Malyshau
e2bd9c935c hal/dx12: flip the root signature upside down 2021-07-15 01:37:49 -04:00
Dzmitry Malyshau
22fff526ab dx12/hal: invalidate root elements on signature change 2021-07-14 23:13:08 -04:00
Dzmitry Malyshau
d85e8c6011 Clippy fixes 2021-07-14 16:17:39 -04:00
Dzmitry Malyshau
509b683e6b hal: renderdoc integration 2021-07-14 16:17:39 -04:00
Boris-Chengbiao Zhou
1ecb48db80 hal/vulkan: Respect swapchain's minImageCount 2021-07-14 19:20:17 +02:00
Dzmitry Malyshau
8cd17aafe3 Switch read-only storage textures to be exclusive and behind a feature 2021-07-14 01:04:37 -04:00
Zicklag
2896a6e5f3 Fix Vulkan Backend Texture Format Mapping
Fixes the Bgra8UnormSrgb texture format.

Resolves #1646.
2021-07-13 20:21:47 -05:00
bors[bot]
0f784bb3c0
Merge #1602
1602: New DX12 backend (unfinished) r=kvark a=kvark

**Connections**
Continuation of #1471

**Description**
Mostly fresh implementation on DX12 backend for wgpu-hal
Core changes:
  - texture usage is filtered before passing to `create_texture_view`, so that wgpu-hal can assume every bit is important.
  - all the copies involving textures are limited to one array layer at a time
  - remove render pass boundary usages

**Testing**
Examples (not running yet)


Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-07-13 22:26:44 +00:00
Zicklag
f0c7e990f7 Disable Intel Fastclear in GL Backend
This works around a Mesa bug on Intel cards:

- https://gitlab.freedesktop.org/mesa/mesa/-/issues/2565
- https://github.com/gfx-rs/wgpu/issues/1627#issuecomment-877854185
2021-07-13 11:21:06 -05:00
Dzmitry Malyshau
0df804e9c2 hal/dx12: bunch of validation fixes 2021-07-13 02:54:37 -04:00
Dzmitry Malyshau
7fb0315700 hal/dx12: build fixes for the new arrayvec 2021-07-13 01:11:47 -04:00
Dzmitry Malyshau
450e5dc08b hal/dx12: queue operations 2021-07-13 01:04:08 -04:00
Dzmitry Malyshau
8163dc7b47 hal/dx12: pipeline creation 2021-07-13 01:04:07 -04:00
Dzmitry Malyshau
0a609e74c0 hal/dx12: compute pipelines, update naga 2021-07-13 01:04:06 -04:00
Dzmitry Malyshau
040a602b69 hal/dx12: bind group creation 2021-07-13 01:03:45 -04:00
Dzmitry Malyshau
7d29a3b70e hal/dx12: binding resources and index/vertex buffers 2021-07-13 01:03:44 -04:00
Dzmitry Malyshau
c0432761d9 hal/dx12: use range-alloc for descriptor heaps 2021-07-13 01:03:15 -04:00
Dzmitry Malyshau
ba1bff58ed hal/dx12: attachment clears and resolvess 2021-07-13 01:03:14 -04:00
Dzmitry Malyshau
00859b9e0c Stop using render pass boundary usages for resource transitions 2021-07-13 01:02:42 -04:00
Dzmitry Malyshau
12bc3eb3fc hal/dx12: set render targets 2021-07-13 01:01:31 -04:00
Dzmitry Malyshau
81f31f5555 hal: change blend color argument 2021-07-13 01:01:30 -04:00
Dzmitry Malyshau
1f91c5f297 hal/dx12: debug markers 2021-07-13 01:01:30 -04:00
Dzmitry Malyshau
27b8085048 hal/dx12: queries 2021-07-13 01:01:29 -04:00
Dzmitry Malyshau
b818157f67 hal/dx12: draws and dispatches 2021-07-13 01:01:28 -04:00
Dzmitry Malyshau
9069c2301f hal/dx12: implement fill_buffer with zero 2021-07-13 01:01:28 -04:00
Dzmitry Malyshau
2c76b0e656 hal/dx12: clippy fixes, buffer-texture copies 2021-07-13 01:01:27 -04:00
Dzmitry Malyshau
35ee65707f hal: make copy to work on one array layer at a time 2021-07-13 01:01:26 -04:00
Dzmitry Malyshau
f79c3781c3 hal/dx12: buffer-buffer and texture-texture copies 2021-07-13 01:01:25 -04:00
Dzmitry Malyshau
4f6812fc36 hal/dx12: resource barriers 2021-07-13 01:01:25 -04:00
Dzmitry Malyshau
43a39a229e hal/dx12: command pooling 2021-07-13 01:01:24 -04:00
Dzmitry Malyshau
e128021aee hal/dx12: pipeline layout 2021-07-13 01:01:23 -04:00
Dzmitry Malyshau
904621ee19 hal/dx12: sampler and query set creation 2021-07-13 01:01:23 -04:00
Dzmitry Malyshau
04ca3212de hal/dx12: intercept debug output 2021-07-13 01:01:22 -04:00
Dzmitry Malyshau
855689462c hal/dx12: fences 2021-07-13 01:01:21 -04:00
Dzmitry Malyshau
c7519432ee Filter texture usages on view creation 2021-07-13 01:01:21 -04:00
Dzmitry Malyshau
925ece8b40 hal/dx12: creation of RTV/DSV/UAV 2021-07-13 01:01:20 -04:00
Dzmitry Malyshau
23615aa55d hal/dx12: texture and view creation 2021-07-13 01:01:19 -04:00
Dzmitry Malyshau
c01f6a557e hal/dx12: enable the backend in wgpu-core 2021-07-13 01:01:19 -04:00
Dzmitry Malyshau
971aee0e1c hal/dx12: buffer creation, device idling 2021-07-13 01:01:18 -04:00
Dzmitry Malyshau
0942fb1346 hal/dx12: swap chain configuration 2021-07-13 01:01:17 -04:00
Dzmitry Malyshau
eb565a59f7 hal/dx12: move device and encoder into modules 2021-07-13 01:01:17 -04:00
Dzmitry Malyshau
3a2bbfd563 hal/dx12: adapter initialization 2021-07-13 01:01:16 -04:00
Zicklag
7e837ffcdc Enable VK_KHR_timeline_semaphore On Vulkan < 1.2 2021-07-12 18:51:38 -05:00
Connor Fitzgerald
6c1dd5e153 Always use EXT Robustness 2021-07-11 22:28:45 -04:00
bors[bot]
4781d9da7b
Merge #1607
1607: Fix Downlevel Vertex Stage Storage Buffer Check r=kvark a=cwfitzgerald

**Connections**

Fixes a bug in #1599. Also follows up on #1583 marking all of hello-compute as a failure.

**Testing**

Tests now pass on rpi4.


Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2021-07-07 14:01:37 +00:00
Connor Fitzgerald
8ded21862e Fix downlevel vertex stage storage buffer check 2021-07-06 21:43:47 -04:00
bors[bot]
d2a27e0c4e
Merge #1604
1604: Upgrade `arrayvec` to 0.7 r=kvark a=a1phyr

Upgrade `arrayvec` to version 0.7 (using const generics).

Co-authored-by: Benoît du Garreau <bdgdlm@outlook.com>
2021-07-06 05:31:22 +00:00
Dzmitry Malyshau
2efccb2bf8 hal/vk: fix indirect stage flag 2021-07-06 00:56:43 -04:00
Mikko Lehtonen
7e277c2ed9 Fix macos build 2021-07-06 02:08:19 +03:00
Benoît du Garreau
e7269e72f3 Upgrade arrayvec to 0.7 2021-07-06 00:45:24 +02:00
bors[bot]
118cf2cdba
Merge #1599
1599: Fix Limits for lava/llvmpipe and re-enable and re-work CI r=kvark,groves,wumpf a=cwfitzgerald

**Connections**

No longer fixes #1551.

**Description**

This PR has a couple things going on at once.

- Fixes limits for llvmpipe, lavapipe, and rpi4.
- Added a downlevel limit to express that RPI4 does not allow storage buffers in vertex shaders on GL.
- Added a `Limits::downlevel_default()` that takes minimum limits from GLES and adds some more documentation on how to choose limits.
- Moved all examples to the new downlevel limits
- Reworks CI to re-enable software testing and unify instructions.

**Testing**

It is

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2021-07-04 19:23:23 +00:00
Connor Fitzgerald
130ddcf561 Unify CI and testing 2021-07-04 15:22:51 -04:00
Dzmitry Malyshau
3de1681eb0 hal/vk: enable timeline semaphores 2021-07-04 00:50:05 -04:00
Dzmitry Malyshau
8ae7d51c82 hal/vk: request timeline semaphores if available 2021-07-04 00:50:05 -04:00
Connor Fitzgerald
26f3c03150 Add downlevel limit for vertex shader access to SSBO 2021-07-03 22:15:16 -04:00
bors[bot]
762cdb3953
Merge #1589
1589: [GL] Fix min_storage_buffer_offset_alignment param r=kvark a=Gordon-F

**Connections**
Android Emulator (11) error:
```
2021-07-02 14:49:12.500 8292-8317/rust.example.cube E/emuglGLESv2_enc: device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetIntegerv:876 GL error 0x500
```

**Description**
As a workaround set this parameter to default value.


Co-authored-by: Gordon-F <ishaposhnik@icloud.com>
2021-07-04 00:33:32 +00:00
Dzmitry Malyshau
a4a4d541b8 hal/metal: bump storage limits 2021-07-03 20:26:15 -04:00
Gordon-F
a077102457 [GL] Fix min_storage_buffer_offset_alignment param 2021-07-03 22:45:45 +03:00
bors[bot]
edbe3b33fa
Merge #1593
1593: Fix VVL on halmark example r=kvark a=kvark

**Connections**
We have a bunch of VVL related to resource destruction on the halmark example.
It also seems to leak memory quite a ton and eventually hang the system.

**Description**
This PR fixes the logic of changing the command pools in halmark, its initialization sequence, and its destruction.

**Testing**
Tested on halmark and others


Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2021-07-03 05:13:18 +00:00
Dzmitry Malyshau
e2f97ea659 hal/gles: detect llvmpipe instead of lavapipe 2021-07-03 01:09:39 -04:00
Dzmitry Malyshau
497c6647ee hal/vulkan: fix instance destruction logic 2021-07-03 01:07:21 -04:00
Dzmitry Malyshau
b15f1ebfb7 halmark: fix the command pool recycling policy 2021-07-03 00:23:11 -04:00
Dzmitry Malyshau
81b382f5cd Readme and clippy fixes 2021-07-02 20:43:01 -04:00
Clayton Walker
25c452cbdd Add metal layer back in 2021-07-02 15:51:11 -06:00
bors[bot]
df2b0b5843
Merge #1585
1585: hal/egl fix support for context extensions r=cwfitzgerald a=kvark

**Connections**
Follow-up to #1584
Closes  #1577

**Description**
TIL that EGL extensions work differently from the EGL-1.5 stuff, and we are now treating them properly.

**Testing**
Basic testing on AMD


Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2021-07-02 19:29:15 +00:00
Dzmitry Malyshau
67625b2a54 hal/egl fix support for context extensions 2021-07-02 15:23:06 -04:00
bors[bot]
43c26e57e0
Merge #1588
1588: Update naga to 0b9af95 r=kvark a=kvark

**Connections**
Picks up https://github.com/gfx-rs/naga/pull/1060 for #1581

**Description**
Naga update

**Testing**
Untested


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-07-02 06:00:13 +00:00
Dzmitry Malyshau
ba8fcb937d Update naga to 0b9af95 2021-07-02 01:58:19 -04:00
Dzmitry Malyshau
34389396f9 hal/metal: mark buffer immutability 2021-07-02 01:52:28 -04:00
bors[bot]
871cbed18a
Merge #1584
1584: Update testing limits for rpi4 r=kvark a=cwfitzgerald

**Connections**

Related to #1574. Exposed #1583.

**Description**

Changes the reftesting limits to be tolerant of how the RPI4 renders. Fixes the debug half of #1577. 

Fixes some naming issues as well.

**Testing**

It is


Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2021-07-02 04:34:55 +00:00
Connor Fitzgerald
f76200e725 Update testing limits for rpi4 2021-07-02 00:13:33 -04:00
Dzmitry Malyshau
579de425e5 hal/vk: fix sampler default LOD range 2021-07-02 00:05:36 -04:00
Dzmitry Malyshau
ba006cfaa7 Rename ColorWrite, TextureUsage, and BufferUsage 2021-06-30 14:57:38 -04:00
Dzmitry Malyshau
568ac3fa24 Switch all bitflag names to plural 2021-06-30 14:43:36 -04:00
Dzmitry Malyshau
6f13eebb7b hal/gles: compressed ETC2 texture support 2021-06-30 12:06:59 -04:00
Dzmitry Malyshau
45074b2939 hal: more implementation comments 2021-06-30 02:31:13 -04:00
Dzmitry Malyshau
4be8864b38 hal/gles: totally rework the vertex data binding 2021-06-30 02:31:13 -04:00
Dzmitry Malyshau
40e2c33c6f hal/gles: hack around cubemap support 2021-06-30 02:29:30 -04:00
Dzmitry Malyshau
582c128520 Pick up naga's GLSL continuing and Y-flip fixes 2021-06-30 02:29:30 -04:00
Dzmitry Malyshau
3a796c2244 hal/gles: fix buffer mapping 2021-06-30 02:29:30 -04:00
Dzmitry Malyshau
6025a8d25e hal/gles: enable robust access by default 2021-06-30 02:29:29 -04:00
Dzmitry Malyshau
25ec7447e2 hal/gles: improve the exposed limits 2021-06-30 02:29:29 -04:00
Dzmitry Malyshau
e4aee90341 hal/gles: object labels, view dimensions, and buffer clears 2021-06-30 02:29:29 -04:00
Dzmitry Malyshau
403ff6faf8 hal/gles: Update glow and fill up the missing methods 2021-06-30 02:29:29 -04:00
Dzmitry Malyshau
bf61908824 hal/gles: primitive state and framebuffer operations 2021-06-30 02:29:29 -04:00
Dzmitry Malyshau
952173efde Enable Gles backend, add checks for downlevel flags 2021-06-30 02:29:28 -04:00
Dzmitry Malyshau
cf10138c64 hal/egl: add coherence preference, hook up EGL_KHR_debug message callbacks 2021-06-30 02:29:28 -04:00
Dzmitry Malyshau
8fd6b36e6c hal/egl: add coherence preference, hook up EGL_KHR_debug message callbacks 2021-06-30 02:29:28 -04:00
Dzmitry Malyshau
c7356e124e hal/gles: storage texture bindings 2021-06-30 02:29:28 -04:00
Dzmitry Malyshau
673ec60396 hal/gles: resource binding 2021-06-30 02:29:28 -04:00
Dzmitry Malyshau
91df157462 Refactor downlevel support a bit, implement blending for hal/gles 2021-06-30 02:29:28 -04:00
Dzmitry Malyshau
13b0a61dc8 hal/gles: stencil and vertex state 2021-06-30 02:29:27 -04:00
Dzmitry Malyshau
205327d3aa hal/gles: barriers 2021-06-30 02:29:27 -04:00
Dzmitry Malyshau
51dd90b1ab hal/gles: render passes 2021-06-30 02:29:27 -04:00
Dzmitry Malyshau
24ff58c6c1 hal/gles: present, texture format caps 2021-06-30 02:29:27 -04:00
Dzmitry Malyshau
91f9806831 hal/gles: fences and queries 2021-06-30 02:29:27 -04:00
Dzmitry Malyshau
d3d2ed5a9e hal/gles: pipeline creation 2021-06-30 02:29:27 -04:00
Dzmitry Malyshau
d29c450ec3 hal/gles: bind group creation 2021-06-30 02:29:26 -04:00