Commit Graph

458 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 06294ba012 Add wgpu::RenderBundle::SetLabel
It was missing on just this object (and adapter/instance but that's
expected).

Bug: None
Change-Id: I865609b8194c872c16ad5590eaf0461751a56eab
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134502
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-25 17:02:50 +00:00
Jiawei Shao daffe42b6a Implement device.CreateErrorShaderModule()
This patch implements device.CreateErrorShaderModule() for Blink to
directly create an error shader module and insert validation and
compilation errors when anything wrong is detected.

Bug: dawn:1345
Test: dawn_unittests
Change-Id: I1415aaf0609febaff49c40ebbfedbbcefa2e5504
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134104
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-05-25 03:32:41 +00:00
Corentin Wallez 47245bc33f Remove wgpu::TextureUsage::Present
This is an internal usage only used for barriers management in some
backends, and doesn't need to be exposed publicly.

Fixed: dawn:1535
Change-Id: I0474977227230acbf7dd3cfa91bf589ffd9464fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133460
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-05-23 08:16:01 +00:00
Corentin Wallez 047bca4306 dawn.json: add tags to not expose Dawn-specificities upstream.
Bug: None
Change-Id: Idfda83227dbc6958f49d824d593026b9fc6d78c0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133101
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-05-19 19:17:22 +00:00
Loko Kung 9fb0eed227 Implements float32-filterable feature.
- Adds the feature and the major backend supports.
- Adds initial validation testing.

Bug: dawn:1664
Change-Id: I9918c3de8cce379319d3d1877e45c51acb388961
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133281
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Jones <bajones@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-18 07:21:11 +00:00
Brandon Jones 112b7fd856 Allow device lost callback to be passed at creation
This change updates the Device descriptor to allow a device lost
callback to be passed in at device creation time. This will be
important for allowing the API to return devices which have
already been lost in a future CL, which is the behavior required
by the spec.

This change does not yet deprecate the old method for setting the
callback, as there's still some tricky scenarios that will need to
be worked around to enable that and this CL is already fairly
large. (The uses in question pass the device or a value created
from the device as the userdata.)

Bug: chromium:1234617
Change-Id: I1adea5ceffdfdcfedff9fff4960f12303abba29c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121041
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2023-05-17 01:52:30 +00:00
Loko Kung 14ed533565 Updates DawnInstanceDescriptor to pass in the Platform.
Notes:
- Separates ChainedStruct to be reusable without cpp header. (Also
  updates native structs to directly use it.)
- Manually implements the descriptor in DawnNative.
- Reworks ChainUtils with mapping from struct to STypes.
- Updates the tests to use either SetPlatformForTesting which is still
  required because DawnTest uses a "global" instance for all tests and
  some tests require setting (and cleaning up) a test specific platform.

Bug: dawn:1374
Change-Id: I078c78f22c5137030cf3cf0e8358fe4373ee9c6c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132268
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-05-16 04:50:32 +00:00
Yunchao He 9924426c94 Unset vertex buffer: validations and unittests
If vertex buffer is null, SetVertexBuffer() actually unset that
buffer slot. This is a new feature in WebGPU. This change adds
validations and unittest in order to support this feature.

Bug: dawn:1675
Change-Id: Ia3e5d4196423590ff5b60ea78cc1e8cdd9c67d15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124842
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2023-05-11 19:26:30 +00:00
Stephen White b9e12716c6 Add FeatureLevel to AdapterBase; implement Compat.
This introduces the notion of FeatureLevel, currently consisting of
Core or Compatibility. Each AdapterBase is now constructed with the
FeatureLevel it supports.

When discovering PhysicalDevices, create an AdapterBase for each of
the FeaturLevels which that PhysicalDevice supports. For most of the
backends, this will mean Core and Compatibility, while OpenGL and
D3D11 support only Compatibility.

Bug: dawn:1796.

Change-Id: I828247ef43e2220805ccf6c08827aa5e2382a026
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-05-06 01:26:25 +00:00
François Beaufort 8cb4581943 Remove WGPUBufferMapAsyncStatus error
Bug: chromium:1431622
Change-Id: I5e779a210d6b4de9f9290f069dd23c0f841212d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131560
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Fr <beaufort.francois@gmail.com>
2023-05-04 13:34:27 +00:00
Loko Kung b27e2bfa71 Adds generation for WGSL descriptor to rename source->code.
- Adds a deprecation warning for the incorrect usage.
- Adds test to verify that the warning is emitted and that the results
  are equal.
- Fixes all existing tests to use the newer code path.

Change-Id: I01bf85137ad1c66966e1aa0259ae03fc5247ba25
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-05-03 02:23:25 +00:00
Austin Eng 7b82609894 Make TextureComponentType an internal enum
Fixed: dawn:1682
Change-Id: Iadbe7e2829805fed9a7f7e3bb0925544f4318380
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130440
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-02 04:34:55 +00:00
Loko Kung 4e9ebeff02 Deprecates PopErrorScope returning a bool.
Bug: dawn:526
Change-Id: Ia4e985fbe4fcb5edb3fe80849f5b0df0190eea00
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130340
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-05-01 19:25:18 +00:00
François Beaufort ad571cfb7c Add new errors to WGPUBufferMapAsyncStatusStatus
This CL adds "mapping already pending", "offset out of range",
"size out of range", and "validation error".
Those errors will be used in future CLs both in Dawn and Blink.

Bug: chromium:1431622

Change-Id: I70121f49542042b47e30f4acc67a8e9a869fc452
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130260
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Fr <beaufort.francois@gmail.com>
2023-04-28 17:07:45 +00:00
Colin Blundell a406959e50 Add transient attachments and initial Metal support
This CL does the following:

* Adds a "transient attachment" bit to texture usage. This bit
  specifies that the created texture will be used only during
  this render pass.
* Adds a TransientAttachments Feature that gates the usage of
  transient attachments.
* Adds support for transient attachments on Metal, where they're
  used to create textures as memoryless.
* Adds validation tests and an E2T test of the feature.

A followup CL will add support in Vulkan.

Bug: dawn:1695
Change-Id: I3c7322dd1e4bee113062aae2e0494d292ee8cbc3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129080
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-27 14:55:09 +00:00
Loko Kung aae9f6bc5f Fully deprecates DawnTogglesDeviceDescriptor.
Change-Id: I81ac6e70e086e1f5839733d2dd35c283ed6eba68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128681
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2023-04-26 17:50:55 +00:00
Loko Kung abfa45baa4 Deprecates use of filter mode for mipmap filters.
Change-Id: I77044ee7f0ce1b066dd8c8a1ee1b34e07f5e9766
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128660
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-26 08:03:20 +00:00
Loko Kung d2aaf76eb9 Removes maxFragmentCombinedOutputResources limit and tests.
Bug: dawn:1756
Change-Id: I1fe73eb7987cdffdb2653e1072c4946b5bc3ef4c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127660
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-04-25 22:46:23 +00:00
Loko Kung 89c89b7640 Removes deprecation period code for renamed APIs (i.e. endPass/dispatch)
- Note that by default these are already errors, not warnings.

Change-Id: If35284041963cd387839fe102efe4dca73e594dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128064
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-04-22 00:33:51 +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
Le Hoang Quyen 7971bfe16f Add an option to enable implicit device synchronization.
1. Auto-generate mutex locking code in DawnNative's ProcTable's
functions. Using a mutex owned by the related Device.
  - Unless the function/class has "no autolock" attribute (new) in
  dawn.json. In which cases, no locking code will be auto-generated.
  - Currently Instance, Adapter, Surface, Encoder classes and
  Reference/Release method have "no autolock".

2. Added Feature::ImplicitDeviceSynchronization to enable Device's
mutex.
  - If this feature is disabled, lock/unlock Device's mutex is no-op.
  Auto-generated locking code will have no effect. This is the default.
  - This approach is used instead of generating two sets of ProcTable
  because it's cleaner and the internal code doesn't need to care about
  whether there is a mutex being locked or not. Furthermore, if there
  were two sets of ProcTable, and user used dawnProcSetProcs() to set
  global ProcTable, it would affect all other modules using different
  Devices. Even though those modules don't need thread safety.

Bug: dawn:1662
Change-Id: I75f0d28959f333318e4159916b259131581f79f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119940
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-05 19:35:07 +00:00
Corentin Wallez a67bbe87b7 Remove WGPU_STRIDE_UNDEFINED
It is no longer used, and WGPU_COPY_STRIDE_UNDEFINED replaces it.

Fixed: dawn:520
Change-Id: I6a52fc9ed26e2e4785b5a2a5a06474108c73331a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126240
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-05 15:19:34 +00:00
Le Hoang Quyen 99b8081e31 Add AdapterBase::APIGetInstance
This method is useful for Chrome to query the Instance from Device
by calling device.GetAdapter().GetInstance(). Then
instance.ProcessEvents() can be used to poll for events instead of
device.Tick().

Bug: dawn:1726
Change-Id: I45b5760bc07869a191ae3fd02ec25b99d78b068b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125360
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-03-24 15:50:50 +00:00
Yan,Shaobo 8150d1cf81 Add natural size in imageCopyExternalTexture
CopyExternalTextureForBrowser() uses external texture visible rect
as source size in previous.

But video frame natural size is the only one developer could get
from HTMLVideoElement and it means the size browser present video
on screen.

This CL add "natural size" in imageCopyExternalTexture and uses this
size as CopyExternalTextureForBrowser() source size.

Bug:dawn:1694

Change-Id: I2a3bfa8e689df11d1d13320d40ad02c7090425e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/123380
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-24 03:43:56 +00:00
Le Hoang Quyen 69e1c4b638 DawnNative: implement Instance::ProcessEvents
Since https://dawn-review.googlesource.com/c/dawn/+/120940, callbacks
will be deferred to be executed in next device.APITick() instead of
immediately.
However, if the device is already destroyed (last ref dropped),
user/wire_server has no chance to call device.APITick() anymore, leading
to the callbacks waiting in queue forever.

This is also possibly the cause of memory leaks in cluserfuzz tests.

This CL attempt to fix it by implementing Instance::ProcessEvents():
In this method, every created device will invoke APITick() even if it is
already lost/externally released.

bug: chromium:1422507
bug: dawn:752
Change-Id: Iec69ad3b547a7e88c6e1a2225b13ad060a501a4f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/123420
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-03-14 19:03:10 +00:00
Loko Kung 4f98dd4706 Add maxFragmentCombinedOutputResources and validation for it.
- Suppresses maxStorageTexturesPerShaderStage CTS test because it needs
  to be modified to adhere to the new limit as well.

Bug: dawn:1665
Change-Id: I66c62bd94b613059633888210ec7e7b42dc3a1dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122461
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-08 02:45:50 +00:00
Zhaoming Jiang c2657b21d5 Dawn: Promote DisallowUnsafeAPIs as instance toggle
This CL add Instance and Adapter toggle stage, and promote
DisallowUnsafeAPIs as an instance toggle, and can be required using
DawnTogglesDescriptor chained in instance descriptor when creating
instance. The instance's toggles state will get inherited to adapters
and devices it create. Related tests are implemented and updated.

Toggles inheritance can be overriden if not forced, so requiring
DisallowUnsafeAPIs when creating device is still available and working
like before.

Note that currently we don't have toggle of adapter stage, and can not
require toggles when creating adapter, until follow up CLs implement it.
Currently the toggles state of a adapter is simply inherited from
instance.

Bug: dawn:1495
Change-Id: I6bf7aa0f950a99451afcc2cab5322c924b7d9520
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122021
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-03-07 02:03:54 +00:00
Corentin Wallez f53010caf9 Mark wgpu::TextureComponentType as Dawn-specific.
It was renamed to wgpu::TextureSampleType in the spec but the enum is
still used in some parts of dawn::native. Tag the enum as internal for
now until we can change Format.h and friends to no longer require the
enum.

Bug: dawn:1682
Change-Id: I673353ff290495777ed1618810daa011b450dff5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122122
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
2023-03-01 16:59:56 +00:00
Takahiro 9754bc42f4 Make properties required
This commit makes depthWriteEnabled and depthCompare required and
makes depthClearValue conditionally required for the spec change
in WebGPU V1.

https://github.com/gpuweb/gpuweb/pull/3849

depthClearValue is required if depthLoadOp is clear and the
attachment has a depth aspect. To simulate it, this commit lets
NAN represent unspecified depthClearValue and lets the default
value of depthClearValue be NAN.

Bug: dawn:1669
Change-Id: I469338e909b1d3c345bc2642ee47daee858909ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120620
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-03-01 13:34:59 +00:00
Yan,Shaobo e958db0490 Add ExternalTexture::Refresh() and ExternalTexture::Expire()
ExternalTexture has active, expired and destroyed states.

Only active state external texture is valid to submit.

Expired state external texture can be refresh to active but
destroyed external texture cannot be refresh.

Bug: chromium:1412338
Change-Id: Ic7f12d274d27b644f19ec3ef8b46c110610afa2b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120982
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2023-02-24 02:09:38 +00:00
Corentin Wallez c713005b14 Reland "Remove wgpu::CreatePipelineAsyncStatus::Error"
This is a reland of commit 9fafbc0a9e

Original change's description:
> Remove wgpu::CreatePipelineAsyncStatus::Error
>
> It is no longer used in Chromium and the ::ValidationError and
> ::InternalError should be used instead.
>
> Fixed: chromium:1404422
> Change-Id: I7ecb1e23cfedc8f16f91431ac8b9ec8a9bbf2933
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119461
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Auto-Submit: Corentin Wallez <cwallez@chromium.org>

Change-Id: I1f6a7d858709babb99f3546273d17f5f58029612
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120383
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-02-17 23:24:43 +00:00
Corentin Wallez 32cb509307 Revert "Remove wgpu::CreatePipelineAsyncStatus::Error"
This reverts commit 9fafbc0a9e.

Reason for revert: Breaks Chromium compilation.

Original change's description:
> Remove wgpu::CreatePipelineAsyncStatus::Error
>
> It is no longer used in Chromium and the ::ValidationError and
> ::InternalError should be used instead.
>
> Fixed: chromium:1404422
> Change-Id: I7ecb1e23cfedc8f16f91431ac8b9ec8a9bbf2933
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119461
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Auto-Submit: Corentin Wallez <cwallez@chromium.org>

TBR=cwallez@chromium.org,enga@chromium.org,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I75dcface5197d6fedd3666c8f7fc694f4fab7c04
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120381
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-02-17 19:46:03 +00:00
Corentin Wallez 9fafbc0a9e Remove wgpu::CreatePipelineAsyncStatus::Error
It is no longer used in Chromium and the ::ValidationError and
::InternalError should be used instead.

Fixed: chromium:1404422
Change-Id: I7ecb1e23cfedc8f16f91431ac8b9ec8a9bbf2933
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119461
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2023-02-17 17:27:35 +00:00
Jiawei Shao f5cee3fadf Enable the optional feature bgra8unorm-storage on Metal
This patch adds the support of the optional feature "bgra8unorm-storage"
and enable it on  Metal.

Bug: dawn:1641
Test: dawn_end2end_tests
Change-Id: Id58cefd8735f46b8d1807376ebcfada10df2890e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111380
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-02-11 02:53:53 +00:00
Loko Kung 0bf516b14b Remove clearColor, clearDepth, and clearStencil from dawn.json.
Change-Id: Id529dcbaee0dceeca4e95e293936fe4741247099
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118024
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
2023-02-10 23:07:41 +00:00
Corentin Wallez e4b4c4737e dawn.json: split pipeline async status error
GPUPipelineError differentiates between validation and internal errors,
so update the async pipeline creation status accordingly. The "error"
enum value is kept temporarily while Chromium is updated.

Bug: chromium:1404422
Change-Id: Iac8174a9a3d15068caa5dcf815123c5b2b99fe5f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119240
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-02-08 19:36:53 +00:00
James Price 132d8c7a7d Add flag to disable derivative_uniformity for SPIR-V ingestion
Add a chained struct for Dawn-specific options for SPIR-V ingestion to
contain this new flag.

Bug: tint:1890
Change-Id: I1332ff20c91f29a84c21550a37f11bc7d9c956ce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118421
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-02-03 19:38:46 +00:00
Zhaoming Jiang a12ff9abd1 Dawn: Deprecate DawnTogglesDeviceDescriptor with DawnTogglesDescriptor
This CL deprecates DawnTogglesDeviceDescriptor and replace it with
DawnTogglesDescriptor, which will be also used to provide instance
and adapter toggles with future CLs.

Bug: dawn:1495
Change-Id: I5f5cfdf38dcbcd237727a7f921462597b9301f1f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117174
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-01-30 09:16:51 +00:00
Corentin Wallez 0963142273 Add wgpu::Device::ValidateTextureDescriptor
Bug: chromium:1266549
Change-Id: Iaef63ca6f4e447450953dfb0633b43931d8c2552
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116294
Reviewed-by: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-01-10 15:17:26 +00:00
Jiawei Shao f7beb85fd1 Count the line pos, offset and size of compilation message in UTF-16
This patch counts the line position, offset and size of the compilation
message in UTF-16 and saves them to WGPUCompilationMessage to align the
latest WebGPU SPEC.

Bug: dawn:1357
Change-Id: If8f4026bd5b4a64a078e100762b6d1f61da50053
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/115640
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-01-10 00:03:24 +00:00
Brandon Jones 713cd86f78 Change External Texture Crop Parameters
Removes the ExternalTextureVisibleRect type in favor of the existing
visibleOrigin/visibleRect parameters.

Bug: dawn:1622
Change-Id: Ifa661392b5541543c1445ce3e1e8e5e9db881be4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116124
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
2023-01-04 21:27:32 +00:00
Takahiro 915e55a0d8 Add Buffer.GetMapState()
Bug: dawn:1521
Change-Id: I68962a4d6b17867cd17cfcb3a17910a2007764fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111924
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Takahiro <hogehoge@gachapin.jp>
2022-12-19 19:06:51 +00:00
Brandon Jones 183df9d24e Implement External Texture Crop Functionality
Adds to the External Texture shader transform to allow cropping. Tests
included.

Bug: chromium:1316671
Change-Id: Id0ec9acac22a0968ba6847d6ead9cf5084eaca88
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113281
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-16 05:41:06 +00:00
Loko Kung e70563ac03 Implements maxColorAttachmentBytesPerSample
- Adds the limit
- Adds relevant format-specific data into format table
- Adds deprecation validations regarding the limit
- Adds deprecation validation unit tests and helpful utils
- Moves deprecated api tests from end2end to unittests, allowing tests
  to be cross-files for ease after deprecation.
- Updates some validation messages to include helpful contexts.

Bug: dawn:1522
Change-Id: Ib05f9adb60808ff4d68061d9646e76c729a23643
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113543
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2022-12-12 20:55:05 +00:00
Brandon Jones 85ceb08d5c Add ExternalTexture Rotate and FlipY Functionality
Adds functionality to Dawn and Tint to rotate and flip-Y external
textures through the shader transform. Tests are included.

Bug: chromium:1316671
Change-Id: I40a6b67eaeb2a348f469e4879eeb585bc40537b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110181
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-30 21:32:26 +00:00
Jiawei Shao 806c58324c Wire: Make validation error prior to OOM if mappedAtCreation == false
This patch updates the validations about CreateBuffer() with dawn_wire
to match the latest WebGPU SPEC.

According to the SPEC, the validations in CreateBuffer() should be
executed in the below order:
1. If mappedAtCreation == true, return nullptr and a RangeError will be
   generated in Chromium.
2. Validate BufferDescriptor and check if there is OOM at device timeline
3. Check if there is OOM at content timeline

Bug: dawn:1586
Change-Id: I97ff5f82a42208442ddf6e46e66381c3b3680450
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109040
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2022-11-23 02:06:11 +00:00
Yan,Shaobo e8dd681f19 Provide origin info for ExternalTexture
Current ExternalTexture visible related info only contains width and height.

But not all the visible rect started at (0, 0). This CL add visibleOrigin to contain origin info and record (width, height) in
visibleSize

Bug: chromium:1361363
Change-Id: I3d8931e490c97740f152653383f07d0a2d984dd3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108024
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2022-11-03 09:03:01 +00:00
Li Hao 74f6bc7e40 Move timestamp query inside compute/render passes to new feature
Feature::TimestampQuery is used for timestamp query in command encoder
and compute/render descriptor to match WebGPU SPEC.

Add a new feature timestamp-query-inside-passes for writeTimestamp API
on compute pass and render pass.

Split timestamp query tests in dawn_end2end_tests and dawn_unit_tests.

Bug: dawn:1193, dawn:1250
Change-Id: I8dd66c1d40939877e37ec2b979a573cc4812c21f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106500
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2022-10-28 04:51:16 +00:00