Commit Graph

14 Commits

Author SHA1 Message Date
Corentin Wallez 943a1a2d7a Add SwapChain::GetCurrentTexture
This is to eventually allow more using swapchain textures as CopySrc and
CopyDst. Note that this commit doesn't add any additional usages.

Because textures can reflect their creation parameters, swapchains now
need to pass in the correct texture descriptor in all code paths. This
requires additional handling in dawn::native error swapchains, and
dawn::wire::client's SwapChain reservation and Device::CreateSwapChain
code.

Tests are added for all of these code paths except
dawn::wire::client::Device::CreateSwapChain because there is no way to
create a Surface in wire tests at the moment (they don't have an
instance).

Bug: dawn:1551
Change-Id: I22d5e909e1e94d48eb52cae57aabff8a7f0c04c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133463
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-05-26 10:32:17 +00:00
Zhaoming Jiang 6663a97b74 Dawn: Deprecate DiscoverAdapters with DiscoverPhysicalDevices
This CL deprecate Discover[Default]Adapters and replace them with
Discover[Default]PhysicalDevices. This help clearify the behavior of
discovering physical devices and requesting / getting adapters, and
prepare for adding adapter toggles in GetAdapters.

Related end-to-end tests AdapterDiscoveryTests are split into
PhysicalDeviceDiscoveryTests and AdapterCreationTests as well.

Bug: dawn:1774, dawn:1495
Change-Id: Iac3d9da3022e5eb3c6dd6b3e3b2224f523792289
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133968
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-25 02:42:27 +00:00
Austin Eng 2731b76ded Namespace dawn/common/ and dawn/utils/ in dawn::
Only Constants.h remains in no namespace; but it may be addressed
in the future as well.

Bug: dawn:302
Change-Id: Ib9b9ab4b974ad1de1bb9f2302f4d24d8216f55e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132841
Kokoro: Austin Eng <enga@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-05-17 18:41:02 +00:00
dan sinclair 0b3fc055d3 Update samples to process events.
This CL updates the `dawn/sample` programs to call the
`dawn::native::InstanceProcessEvents` which allows things like shader
validation errors to be emitted.

Without this change the errors are never displayed.

Change-Id: I054bb4f7177c5d0c110e97409852143b2bef1e02
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-12 13:19:35 +00:00
Corentin Wallez 087deedbc8 dawn.json: remove leftovers from implementation-based swapchains.
This also removes the need for special casing the swapchain creation
proc in the fuzzers because it is no longer possible to have a valid
CreateSwapChain call since the wire can't create a surface (which is no
longer optional).

Bug: dawn:269
Change-Id: Icc6ed5e82c1d5382628d71d212640d238cfba348
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126425
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-04-07 14:59:55 +00:00
Corentin Wallez 974802d17c Remove BackendBinding and its implementations.
These were helpers for implementation-based swapchains that are getting
removed.

Bug: dawn:269
Change-Id: I44b0f9a9d221b9370c3eb2625c68e540b6e2ef46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126420
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-05 07:23:09 +00:00
Peng Huang 151e67b5d1 Support D3D11 backend for dawn samples also add toggle options
Bug: dawn:1705
Change-Id: I192ea2e8f85df8f995855109ef20eaf3bfd1ffa0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125840
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-03-31 01:03:42 +00:00
dan sinclair 52cc4f5d1c Add a target for the GLFW surface helper.
This CL moves the GLFWUtils.cpp into a dawn/glfw/utils.cpp and
GLFWUtils.h into include/webgpu/webgpu_glfw.h. A build target
(`webgpu_glfw` alias to `dawn_glfw`) is added in order to allow
using that target in downstream projects without having to re-implement.

Change-Id: I93e85d5af3f486b3c754f2f854aafbda51901d6d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98700
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-08-14 15:59:25 +00:00
Stephen White 9434949241 GL: implement EGL context creation in Dawn native.
An abstract base class (Device::Context) is used to avoid adding dependencies to Device, with ContextEGL derived from it. This also
leaves open the possibility of supporting other native GL contexts
in the future (e.g., glX). One temporary EGLContext is created by opengl::Backend during Adapter discovery, then one is created for and
owned by each Device.

Contexts for the desktop GL backend are also managed via EGL, which
works for most modern drivers. This also means that GLFW is now
always used in GLFW_NO_API mode.

Since contexts are now per-device, all of the default GL state
setting and debug output setup was moved from Adapter to Device.

Bug: dawn:810
Change-Id: Idfe30939f155d026fcad549787fc167cc43aa3cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93981
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-06-29 15:29:41 +00:00
dan sinclair 41e4d9a34c Consistent formatting for Dawn/Tint.
This CL updates the clang format files to have a single shared format
between Dawn and Tint. The major changes are tabs are 4 spaces, lines
are 100 columns and namespaces are not indented.

Bug: dawn:1339
Change-Id: I4208742c95643998d9fd14e77a9cc558071ded39
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87603
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-05-01 14:40:55 +00:00
dan sinclair 13e9699b1c Fix build/include_what_you_use
This CL adds the needed headers to pass the include what you use lint
check.

Bug: dawn:1339
Change-Id: Ib8df68e51b2c3711169b400e84768d4804568580
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86941
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2022-04-20 00:58:34 +00:00
dan sinclair b02535557e Fixup build/include_order issues in src/dawn.
This Cl moves the cpp includes to above the project includes fixing up
the build/include_order issues and enabling the lint check.

A couple includes are marked as NOLINT as the c header has to come after
the project header due to setting defines.

Bug: dawn:1339
Change-Id: Ia47499c94fff99106397b83f6c5c7fe100c44a0e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86513
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-04-19 20:38:44 +00:00
Corentin Wallez 147da21856 Change Dawn samples to use surface-based swapchains.
This helps people looking at samples on how to use Dawn from getting
confused when implementation-based swapchains break (because they were
just made to be good enough N years ago).

Fixed: dawn:1361
Change-Id: Ia989fca4d0455fb8e0ff754056a3d60eb2958b04
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86531
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-04-13 15:33:06 +00:00
Corentin Wallez 6efd54e2ae Move samples/ under src/dawn/samples/
Bug: dawn:1339
Change-Id: I897df9889da62e4505ea98a780bd481e7855ec73
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86307
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-04-11 16:40:00 +00:00