Commit Graph

97 Commits

Author SHA1 Message Date
teoxoy
5266bd1f08 change prepare_staging_buffer to return a non null u8 pointer 2024-07-09 10:48:52 +02:00
Nicolas Silva
4c6318c0d2
Expose gpu allocation configuration options (#5875)
* Expose gpu allocation configuration options

This commit adds hints to control memory allocations strategies to the configuration options. These hints allow for automatic profiles such as optimizing for performance (the default, makes sense for a game), optimizing for memory usage (typically more useful for a web browser or UI library) and specifying settings manually.

The details of gpu allocation are still in flux. The goal is to switch vulkan and metal to gpu_allocator which is currently used with d3d12. gpu_allocator will also likely receive more configuration options, in particular the ability to start with smaller memory block sizes and progressively grow the block size. So the manual settings already provision for this upcoming option. Another approach could be to wait and add the manual option after the dust settles.

The reason for providing presets and defining values in the backends is that I am convinced that optimal fonigurations should take hardware capabilities into consideration. It's a deep rabbithole, though, so that will be an exercise for later.

* changelog

* Update CHANGELOG.md

Co-authored-by: Andreas Reich <r_andreas2@web.de>

* Add a comment about not entirely knowing what we are doing

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-07-08 14:49:44 +02:00
Brad Werth
9b7a965667 Add an experimental vertex pulling flag to Metal pipelines.
This proves a flag in msl::PipelineOptions that attempts to write all
Metal vertex entry points to use a vertex pulling technique. It does
this by:

1) Forcing the _buffer_sizes structure to be generated for all vertex
entry points. The structure has additional buffer_size members that
contain the byte sizes of the vertex buffers.
2) Adding new args to vertex entry points for the vertex id and/or
the instance id and for the bound buffers. If there is an existing
@builtin(vertex_index) or @builtin(instance_index) param, then no
duplicate arg is created.
3) Adding code at the beginning of the function for vertex entry points
to compare the vertex id or instance id against the lengths of all the
bound buffers, and force an early-exit if the bounds are violated.
4) Extracting the raw bytes from the vertex buffer(s) and unpacking
those bytes into the bound attributes with the expected types.
5) Replacing the varyings input and instead using the unpacked
attributes to fill any structs-as-args that are rebuilt in the entry
point.

A new naga test is added which exercises this flag and demonstrates the
effect of the transform. The msl generated by this test passes
validation.

Eventually this transformation will be the default, always-on behavior
for Metal pipelines, though the flag may remain so that naga
translation tests can be run with and without the tranformation.
2024-05-30 13:08:59 +02:00
Daniel McNab
965b00c06b
Allow configuring whether workgroup memory is zero initialised (#5508) 2024-04-17 15:50:31 -04:00
Jim Blandy
03db77cb8c
[core] Replace id transmute method with explicit functions. (#5509)
Replace the `wgpu_core:🆔:Id::transmute` method, the `transmute`
private module, and the `Transmute` sealed trait with some associated
functions with obvious names.
2024-04-08 21:51:30 -04:00
teoxoy
3bda381812 add pipeline constants plumbing 2024-04-05 18:07:41 +02:00
Erich Gubler
d365927903 test(player): don't specify shader entry points
This is done to exercise the prior change.
2024-02-27 13:57:17 -05:00
Erich Gubler
023b0e063f feat!: make ProgrammableStage::entry_point optional in wgpu-core 2024-02-27 13:57:17 -05:00
andristarr
3028972817
buffer_map_async should use offset + size (#5185) 2024-02-09 09:48:00 +01:00
John-John Tedro
950d765a4d
Remove G parameter in Global<G> and generic IdentityHandlerFactory (#5159) 2024-01-29 15:37:57 +01:00
John-John Tedro
dec6ea5ea4
Improve the consistency of identifiers (#5108) 2024-01-29 10:56:04 +01:00
vero
0003db18c4
Refactor tests to be feature flag bit-width agnostic (#5155) 2024-01-28 01:42:02 +00:00
Connor Fitzgerald
ad625f433f
Convert Tests to Use Async Poll (#5053)
* Convert Tests to Use Async Poll

* Update examples/src/repeated_compute/mod.rs

Co-authored-by: Andreas Reich <r_andreas2@web.de>

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-01-13 17:34:51 +00:00
Valaphee The Meerkat
a1fafe394f
Remove DX11 backend (#4828) 2023-12-06 15:12:46 -05:00
teoxoy
da73522720 rename DeviceDescriptor.limits to DeviceDescriptor.required_limits 2023-11-29 19:55:18 +01:00
teoxoy
9be6c8890f rename DeviceDescriptor.features to DeviceDescriptor.required_features 2023-11-29 19:55:18 +01:00
Mauro Gentile
6e21f7a929
Arcanization of wgpu core resources (#3626)
Arcanization of wgpu_core resources

---------

Co-authored-by: Elabajaba <Elabajaba@users.noreply.github.com>
Co-authored-by: Niklas Korz <niklas@niklaskorz.de>
Co-authored-by: grovesNL <josh@joshgroves.com>
Co-authored-by: Jim Blandy <jimb@red-bean.com>
Co-authored-by: Mauro Gentile <Mauro.Gentile@ubisoft.com>
Co-authored-by: Sludge <96552222+SludgePhD@users.noreply.github.com>
2023-11-20 08:41:52 +01:00
Teodor Tanasoaia
858d7d590e
Fix features of player tests (#4232) 2023-10-11 17:11:47 -04:00
Nicolas Silva
f95d1c55e3
Expose Instance flags (#4230)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-11 17:39:04 +00:00
Leo Kettmeir
d0a7f46e3a
update deno and spec (#4143)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-04 04:25:56 +00:00
Pieter-Jan Briers
e973a06268
Allow specifying minor GLES3 version (#3998) 2023-08-16 11:51:56 -04:00
Aaron Hill
fd5550cc89
Make RequestAdapterOptions.power_preference optional (#3903)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-07-19 21:04:31 +00:00
Connor Fitzgerald
10172e1f38
Move Examples and Tests to Their Own Crates (#3841)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-06-10 18:35:46 +00:00
Connor Fitzgerald
1d2a667b71
Fix trying to use a renderpass inside a compute pass (#3828)
* Fix trying to use a renderpass inside a compute pass

* Fix pipeline statistics test on mac

* Changelog
2023-06-05 09:05:59 -04:00
Jim Blandy
29914b308f wgpu-core: Move identity code to new identity module. 2023-05-24 09:54:03 -07:00
Jim Blandy
f00e6b70ea wgpu-core: Move Global to new global module. 2023-05-24 09:54:03 -07:00
Elabajaba
81569dd6c3
Updated Dxc integration for DX12 backend (#3356)
Co-authored-by: unknown <alimilhim5@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Closes https://github.com/gfx-rs/wgpu/issues/2722
closes https://github.com/gfx-rs/wgpu/pull/3147
2023-01-18 21:25:56 +00:00
Jinlei Li
0849e78600
Add view_formats in TextureDescriptor (#3237)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Closes https://github.com/gfx-rs/wgpu/issues/3030
2023-01-18 16:03:56 -05:00
Nicolas Silva
d1ff3838b8
Expose the full Result type to the rust map_async callback (#2939) 2022-10-13 15:41:52 -04:00
Leo Kettmeir
26f223964e
use custom ser/de impl for TextureFormat (#2908)
Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>
2022-09-29 13:43:50 -04:00
Imbris
41006d7a88
Buffer usages mismatch check and documentation for mapped_at_creation size requirement. (#3023)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-09-19 04:41:29 +00:00
Jinlei Li
61796b1d59
Relax render pass color_attachments validation (#2778)
* Make the color attachments `Option`-al in render pipelines, render passes, and render bundles

* vk:  `Option`-al color attachments support

* dx12: sparse color_attachments support

* Only non-hole attachments is supported on wasm target and gl backend

* deno_webgpu: `Option`-al color attachments support

* Follow all suggestions
2022-06-27 16:10:18 -07:00
Connor Fitzgerald
5bd0a6c4ac
Implement submission indexes (#2700)
* Implement submission indexes

* Write some unit tests for poll

* Update wgpu/src/lib.rs

Co-authored-by: Jim Blandy <jimb@red-bean.com>

* Unify Maintain in both wgc and wgpu

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2022-06-05 17:22:25 -04:00
Connor Fitzgerald
32af4f5607
Convert map_async from being async to being callback based (#2698) 2022-05-31 11:22:21 -04:00
Jinlei Li
8063edc648
Add DEPTH24UNORM_STENCIL8 feature (#2689) 2022-05-30 15:29:12 -04:00
Jinlei Li
0c1233b834
Move TEXTURE_COMPRESSION_ETC2 | ASTC_LDR to web section to match spec (#2671) 2022-05-18 12:38:53 -04:00
Jinlei Li
26f96c7dfe
Add DEPTH32FLOAT_STENCIL8 featue (#2664) 2022-05-17 02:11:05 -04:00
Connor Fitzgerald
e54a36ee78
Move texture-array example over to wgsl (#2618) 2022-04-25 18:32:53 +00:00
Jim Blandy
579f809573 Avoid new WGSL reserved words in wgpu examples. 2022-04-17 21:33:55 -07:00
Igor Shaposhnik
eff50436f5 Update to Naga rev 1720725 2022-04-15 22:22:48 +03:00
Samuel Hurel
3e0305d27d
Allow non struct buffers in wgsl (#2451)
* Bump naga

* Update examples
2022-02-05 09:53:04 -05:00
João Capucho
dcd07f0391 Update to upstream naga 2022-01-22 18:36:26 -05:00
Dzmitry Malyshau
3960658529
Remove block decorations (#2292) 2021-12-15 12:29:37 -05:00
Dzmitry Malyshau
cdf948b920 Fix and re-enable player tests 2021-12-03 17:11:26 -05:00
Wumpf
988716943f
Zero init textures (#1688)
* Added tests for texture zero init
sadly, they are typically passing even if texture zero init isn't doing its job
However, they form nice isolated examples for testing out texture initialization
It could be possible to dirty texture memory prior to ensure zero init did the job

* texture init tracker

* tracking texture init requirements for bind group, transfer and rendertarget

* texture clears for texture init
* queue submit
* write_texture

* Enforce presence of either render target or copy_dst flag

* clear render targets also with using buffer copies
enforce COPY_DST usage now on all textures

* adjust ImageSubresourceRange.layer_range calculation for 3D textures

init_tracker has now a `discard` function to get single data points back to uninitialized

use new standardized partition_point function

* track init state for discarded textures from renderpasses

missing:
* init on the fly if discarded is found within command buffer
* handle discarding only stencil or only depth

* added tests for zero init after discard

* tracking discarded surfaces now in separate struct, piping all inits through utility function
allows to resolve discard/init_action interactions

* Move various memory init code to separate mod
CommandBufferTextureMemoryActions is now fully encapsulated

* implemented discard init fixups for everything but renderpass

* render passes also cause now discard fixups

* fixup_discarded_surfaces takes now an iterator instead of Drain

* Add memory init test for discarding depth targets

* handle divergently discarded depth/stencil target

* comment & clippy fixes

* fix collect_zero_buffer_copies_for_clear_texture yielding block breaking copies

* [pr feedback] minor cleanup in zero_init_texture_after_discard, `use` hygenie

* [pr feedback] fix bug in ImageSubresourceRange range utils

* [pr feedback] fix texture tracker check, bundle transition_texture on init, cleanups

* Implemented drop for InitTrackerDrain

* remove incorrect comment about extents in add_pass_texture_init_actions

* Fix unit test & clippy issues in init_tracker
2021-10-28 09:15:53 -04:00
Dzmitry Malyshau
713f7fd7f2 Changelog update for 0.11 2021-10-07 19:15:49 -04:00
Dzmitry Malyshau
1ee6036f44 Implement software adapter selection 2021-10-01 17:22:51 -04:00
Dzmitry Malyshau
97d6db4d18 Allow if/panic in wgpu-hal 2021-10-01 16:22:51 -04: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
Dzmitry Malyshau
f2a18ee57c Update naga to 1907a92 2021-08-12 23:58:19 -04:00