Commit Graph

19 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
Corentin Wallez 858ccc8a0c Make GetCurrentTextureView use an internal GetCurrentTexture
This is a small refactor in preparation for exposing GetCurrentTexture
on the SwapChain.

Bug: dawn:1551
Change-Id: I7cc8ec4a9042f48c4af7b2cc2126b1d9248a2003
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133462
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-05-23 12:30:36 +00:00
Stephen White fed6b6b35b Turn AdapterBase into a wrapper class.
Change AdapterBase from an alias to PhysicalDeviceBase to a thin
wrapper class holding a ref to a PhysicalDeviceBase. This way,
mutiple AdapterBases can point at the same PhysicalDeviceBase.

For now, InstanceBase wraps all PhysicalDeviceBases discovered by a
backend in a single AdapterBase. In the future, this relationship will
become many-to-one.

Since Devices now maintain a ref on the AdapterBase wrapper (in order to
query toggles, etc), PhysicalDeviceBase::CreateDeviceImpl() now takes
the AdapterBase as an argument, so that the PhysicalDeviceBase knows
which AdapterBase to vend a Device for.

Note that the Toggles also still remain on the PhysicalDeviceBase, to
be moved up to the AdapterBase in a future change.

Bug: dawn:1774
Change-Id: Idef5d24fbd66d8552959230e246e453abddcc736
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131001
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-03 01:29:44 +00:00
Stephen White e4877b7e68 Rename AdapterBase -> PhysicalDeviceBase.
AdapterBase will become a (thin) wrapper class in an upcoming patch,
allowing a single PhysicalDeviceBase to be wrapped in multiple AdapterBases,
each with different toggles and flags.

For now, alias AdapterBase to PhysicalDeviceBase.

Design doc: https://docs.google.com/document/d/1Ag3UAD6D1OVt9-MwKltzLefVhwKRdX0RqML2etrYVS4/edit

Change-Id: Ie77e99508be5285b651aa24ccb412bc9ff8b0111
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130300
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-01 16:39:04 +00:00
Le Hoang Quyen 335573116c Add Device::GetSupportedSurfaceUsage() method.
This method will return supported usage flags that can be used to create
a swap chain.

Bug: dawn:1760
Change-Id: I7699c2c4ef7142c6bd06e72239d6e4f9112f15a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127440
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-20 20:42:05 +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 1226684b09 Merge NewSwapChainBase in SwapChainBase
Bug: dawn:269
Change-Id: I514c210f88e2bf1f501e2d814f8ab931c5ed724f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126423
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-07 13:30:50 +00:00
Corentin Wallez 8a6ed63809 Remove OldSwapChain*
Bug: dawn:269
Change-Id: I5bc6f5f8b98a88c5d0bd69e0d2eaf1e4bbd12e2b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126422
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-04-05 10:13:01 +00:00
Loko Kung d81aca7106 Make ConsumedError require handling the returned bool.
This change makes it harder to misuse ConsumedError which can cause
device loss. When it is a known error, instead use HandleError to
bypass the "unlikely" if clause.

Bug: dawn:1336
Change-Id: I3052db343fe4080b257f1c2f9535f743a0e78526
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120384
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-02 01:24:03 +00:00
Loko Kung 18dfc4797c Track TextureViews in Textures so that they can be chain-destroyed.
- Adds Prepend function to LinkedList to avoid directly using the
  insert functions on the LinkNodes. (And tests for this as well.)
- Adds ApiObjectList class for tracking lists of objects for
  destruction.
- Renames and virtualizes some tracking interfaces so that they can be
  overriden for the TextureView/Texture cases.
- Removes explicit destroying of TextureViews from Device since
  destroying Textures will destroy TextureViews now.

Fixed: dawn:1355
Change-Id: I3522383ea7724d6e41ac0c805793a6c34d9bec27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101762
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-15 21:06:51 +00:00
Corentin Wallez 1105ec78fe Merge DAWN_FORMAT_VALIDATION_ERROR in DAWN_VALIDATION_ERROR.
Done with changes to Error.h and the following command:
git grep -l DAWN_FORMAT_VALIDATION_ERROR | xargs sed -i "" "s/DAWN_FORMAT_VALIDATION_ERROR/DAWN_VALIDATION_ERROR/"
then fixing compilation errors in ErrorTests.cpp, Pipeline.cpp and
CommandEncoder.cpp.

Bug: dawn:563
Change-Id: I081a514d662e81f4842b6d7fadfcea67c12720d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100468
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-08-30 13:39:47 +00:00
Shrek Shao 7e74c21873 DAWN_PLATFORM and DAWN_COMPILER macro improvements
Change #if DAWN_PLATFORM_XXX to #if DAWN_PLATFORM_IS(XXX)
To prevent #ifdef usage and reference without including
dawn/common/Platform.h

Also change #if DAWN_COMPILER_XXX to # if DAWN_COMPILER_IS(XXX)

Bug: dawn:1447
Change-Id: If6c9dab15fd2676f9a087507f5efcceeff468d33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92625
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-06-08 19:52:42 +00:00
Yunchao He 7bfcdca419 Rename GetMipLevelSize
Functions GetMipLevel*Size() are somehow unclear and misleading on
whether the array layers are counted into the z-axis of the returned
Extent3D (Extent3D.depthOrArrayLayers).

This change renames them to GetMipLevelSingleSubresource*Size(),
making it clear that array layers are not included in its z-axis.
Because different array layers are different subreources, they are
not in a single subresource. However, depth slices in 3D textures can
be in a single subresource and can be counted.

Bug: dawn:1288
Change-Id: Ifa1776befa863d0f5a11999cab4099e2e7e5996a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92124
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-06-02 19:07:41 +00:00
Austin Eng 6b52f9d1d4 Return an error surface if surface creation fails
Fixes an ASSERT checking the created surface is non-null.

Fixed: chromium:1330113
Change-Id: Iebbcd6e69042abea5b424953d78e294a92ce5c82
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-05-31 20:55:39 +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 d53cb2ae67 Fixup explicit on some constructors.
This CL adds explicit to various single argument constructors. The
explicit is removed from zero argument constructors. None of these
changes required call sites to change.

Bug: dawn:1339
Change-Id: I7dfcf1b393e7dd379e29cd9bc613cb0626a9a967
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86365
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-04-12 17:44:41 +00:00
Corentin Wallez e690a6654a Make SwapChain use a CreateView() instead of APICreateView()
This simplifies reference management and make the swapchain's reentrant
code avoid APIEntryPoints.

Bug: dawn:723
Change-Id: I6c456b9ec349c73d783dbb12a284f322d0be4e1a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84763
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-03-29 09:35:53 +00:00
Alexander Vestin f2556ab35c Initial Android surface
Bug: dawn:286

Change-Id: I50b45706f031254ac5beba5c07c3c4c3d7f9ea12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84200
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-03-25 13:18:46 +00:00
Ben Clayton 818001d32e tint->dawn: Move src/dawn_native -> src/dawn/native
Bug: dawn:1275
Change-Id: Ic60a00107a015bc677ff929c492f1085ffc38482
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79083
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-02-04 17:07:46 +00:00