Commit Graph

8203 Commits

Author SHA1 Message Date
Peng Huang ac77863352 d3d: supports more errors in HRESULTAsString()
Bug: dawn:1705
Change-Id: I811ed5867399fa417a0a542f3d4e706e989f0a23
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126660
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-06 17:12:04 +00:00
Le Hoang Quyen b7a3cbe8ca end2end tests: add --enable-implicit-device-sync option.
This option will allow tests to be run with
ImplicitiDeviceSynchronization feature.

Bug: dawn:1662
Change-Id: Ic001b2fa175f63e8d77eeb3b23d4d2cf52bb224e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126580
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-06 16:03:13 +00:00
Le Hoang Quyen c173a0ea88 Fix TRACE_EVENT wasn't thread safe.
TRACE_EVENT uses INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO and
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO reads and writes to a static
variable on multiple threads.

Fix by using std::atomic for the static variable.

Bug: dawn:1700
Change-Id: I914bb73352e400f0adeafb64518d61099276270d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/123680
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-06 08:08:00 +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
Austin Eng 78c496395c Always flush device callbacks when the callbacks are changed
With the wire, callbacks reference device-related data which is
freed when the device is unregistered from the wire. However,
the device that the wire refers to can live longer than this
and have its callbacks invoked at a later time, leading to a
use-after-free. Always flush the callbacks so that when the
wire unregisters a device and clears its callbacks, they are
called immediately and no dangling pointers remain.

Bug: chromium:1430221
Change-Id: Ib753b58cee5e7cb4d90ebd703958a0ddd5873573
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126481
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-05 17:10:58 +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
Corentin Wallez 961f7eae70 Remove all NativeSwapChain*
These were helpers to avoid the need for users of implementation-based
swapchains to implement them themselves. They are no longer used and can
be removed.

Also removes SwapChainuUtils.h that's no longer used.

Bug: dawn:269
Change-Id: I3c563edaf107e9ce04f708e8bacae9d231b0f40d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126421
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-04-05 07:24:44 +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
Yan,Shaobo 2c4847e59a Fix bug about requiring unexpected files when compiling on Android
In MemoryService implementation, Dawn uses DAWN_PLATFORM_IS() to choose
required header files for different OS platform.

On Android platform, both DAWN_PLATFORM_IS(LINUX) and DAWN_PLATFORM_IS(ANDROID) are true. This caused some linux platform header files and implementations has been included unexpected when compiling on Android platform.

This CL strict the macro condition to ensure Android platform include AHardwareBuffer related files only.

Bug:dawn:1593
Change-Id: If64567edf99cd25a3783d8c456a1fc3f6a7dccf2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126323
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2023-04-04 08:57:46 +00:00
Peng Huang 3fcf96dd8c d3d11: add d3d11 backend in end2end tests
Right now, many tests are not passed becasue unimplemented
features in d3d11 backend. HoweverD3D11 backend is disabled on
bots by default, so this CL will not break out bots.

Bug: dawn:1705
Change-Id: I57321b86a404bc245b71c467479fdee0464dee9b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126260
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-04 00:27:36 +00:00
Peng Huang ebfd505d29 d3d11: implement Adaptor, Backend, etc
This CL also moves some comman code in d3d12::Adapter and
d3d11::Backend to d3d::Adapter and d3d::Backend, so it can be
shared with d3d11 backend.

Bug: dawn:1705
Change-Id: Ica3bf33232d3380b7d4799c77bf9b43a8374a66e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-03 21:33:54 +00:00
Stephan Hartmann a7423b3d83 IWYU: add cstdint for uint8_t dawn::native::stream::ByteVectorSink
Bug: chromium:957519
Change-Id: I48436db0e203d793e47d717bfb75977c67145e94
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126120
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephan Hartmann <stha09@googlemail.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-03 13:51:27 +00:00
Le Hoang Quyen 44afd7112f Fix APIGetInstance() didn't increase external ref.
InstanceBase has two seperate ref counts: external & internal.
When we return it to the external user, we need to increase external
ref count as well.

Bug: chromium:1429835
Change-Id: I4b585d04149180418bd620e6e4d86522e033b64e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126080
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-03 10:04:42 +00:00
Yan,Shaobo 07b88f3aef MemoryService Choose Implementation based on ExternalImageType
This CL add supports for MemoryService choosing implementation based on
ExternalImageType in runtime instead of choosing in compile time.

This CL also removes MemoryServiceNull.cpp.

Bug: dawn:1593
Change-Id: Iddec1f5cf03a7d962ef12b8fd6293ffbb7dc064d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-03 02:14:21 +00:00
Peng Huang c00ff7f3c7 [tint] do not emit space for binding group 0
D3D11 only supports HLSL SM5.0 which doesn't support `space`
(binding group in WGSL). So for D3D11, only one binding group will be
used, and tint will not emit `space` for HLSL, so shaders can be used
with D3D11.

Bug: dawn:1705
Change-Id: Ie0e9868137f10762c5243e188d76f5e41879c2bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125080
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2023-03-31 17:55:19 +00:00
Peng Huang 70d8711973 [d3d] Move some texture format convert methods to d3d folder
Bug: dawn:1705
Change-Id: I08a348666785ab25110b179e37b6a2869313d998
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125241
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-31 17:24:31 +00:00
Peng Huang 3f76570d9a Print FPS for sample Animometer
Change-Id: I21ae60077638944258436c4cab14cc1d98e7f169
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125881
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-03-31 16:44:51 +00:00
Antonio Maiorano d8f0f44b54 dawn: enable IEEE strictness for compute pipeline to match render pipeline
This is the only flag we set for FXC compilation of render pipelines that we don't set for compute.

This fixes a (potentially unrelated) bug I've been looking into it (tint:1887

Bug: tint:1887
Change-Id: Iaf67ebe9221cd1d6e4e20afe0bcd3e5aa6e89366
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125820
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-31 12:24:10 +00:00
Antonio Maiorano 51249b83e6 tint/hlsl: don't use min16float to implement quantizeToF16
min16float is not required to convert its input to an 16-bit float.
Instead, use f32tof16, and f16tof32.

This is also required to be able to enable the IEEE strictness option on
FXC, otherwise FXC emits an error X4028: expression has a minimum
precision type and cannot be marked precise

Bug: tint:1887
Change-Id: I2268c9336b8e873b36e6532984838054fe4dedbd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125920
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-31 08:00:33 +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
Le Hoang Quyen 947a7deb99 DawnNative: Add dawn::native::InstanceProcessEvents()
Make this a standalone function instead of a dawn::native::Instance's
member method.

Some code base don't use dawn::native::Instance but instead use
wgpu::Instance. And InstanceProcessEvents() function actually returns
a bool unlike wgpu::Instance::ProcessEvents() which returns void.

Bug: dawn:752
Change-Id: Ia354a4ed5b5568ee23bcc70935c104059a9f6fc8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125660
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-03-29 07:06:18 +00:00
Yan,Shaobo 8e414572be Add ServiceImplementation class in external_memory
This CL introduced ServiceImplementation class. Service class deleate
its work to ServiceImplementation class.

Different platforms inherit ServiceImplementation class and implement
it to support Service class. It helps isolate implementaion and
interface. And it's the base for supporting choosing implementation
in runtime.

Bug: dawn:1593
Change-Id: Ib18dfaa41ef4a1ce9554a5241cac1ef0fede8dd8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125481
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-28 06:33:41 +00:00
Yan,Shaobo ef62a88f89 Rename Service Files in external_memory and external_semaphore
This CL do a pure rename work as the base of External memory
service refactory.

Bug: dawn:1593
Change-Id: If9595e8d8be97f5eb725acff8891e0bd1baf8928
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125480
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2023-03-28 01:17:19 +00:00
Antonio Maiorano 5cf943e797 tint/hlsl: implement trunc in terms of floor/ceil to work around FXC bug
Bug: tint:1883
Change-Id: If6c160da0684353a873428a08063aa91ee7a01c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125420
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2023-03-27 18:55:25 +00:00
Antonio Maiorano deb2ec9785 tint: fix UB const-eval div by zero
Bug: oss-fuzz:56904
Change-Id: I2f47fcfa238b28e1148b0b36ccbe2166445964a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125380
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2023-03-24 18:44:02 +00:00
Ben Clayton aff2b43596 tint/resolver: Fix ICE when using template args with builtin enums
Fixes an 'unreachable AST node' ICE which is otherwise completely harmless.

Bug: chromium:1427389
Change-Id: Id5a75b76ca27e00b9e44336a8dd303abed950333
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125400
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2023-03-24 17:27:42 +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
Peng Huang 35cab288aa [d3d] Move DumpCompiledShader to d3d folder
It will be shared between D3D11 and D3D12.

Bug: dawn:1705
Change-Id: If38122484a9063f158e83d364e2615a4ff10ead7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124884
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-24 00:08:29 +00:00
dan sinclair 5ab6dcb59b Update AST Fuzzers to initialize MultiPlanar transform.
When the fuzzers execute they need to make sure that, if there is data
effecting the MultiPlanar transform that the configuration is provided.
This used to be done by the generator, but is now the requirement of the
caller to initialize.

ThiS CL updates the AST Fuzzer common code to initialize the
`ExternalTextureOptions` with the same logic that is done by the tint
command.

Bug: chromium:1421379
Change-Id: Id957d73fe1317558edfdfcec3c0e2eaee48625bd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125280
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-03-23 19:35:02 +00:00
Peng Huang 88daf92d34 [d3d] Move shader translation and compile code to d3d
So it can be shared between d3d11 and d3d12 backends

Bug: dawn:1705
Change-Id: Iffabe8d77a0ac3713da985c0cac5839299dc2a47
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124883
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-03-23 18:32:00 +00:00
Brendon Tiszka a045643361 Add Dawn Wire Server LPM Fuzzer [2/N]
Add generators for protobuf files.

This CL contains the basic logic required to generate the protobuf
files from dawn.json and the newly added dawn_lpm.json for
libprotobuf-mutator.

Bug: chromium:1374747
Change-Id: I5dd207ed94ecdac365306c26e79b6cc18d3978f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114640
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brendon Tiszka <tiszka@chromium.org>
2023-03-23 16:02:20 +00:00
Le Hoang Quyen de078bad8d Forward callbacks to Instance after Device is destroyed.
When InstanceBase::ProcessEvents() iterates through list of devices, one
device might be being destructed on another thread. Even if we try to
increase ref count of that device inside the ProcessEvents(), the device
might be in the middle of destructor call on another thread, increasing
the ref count is invalid in this case.

This CL attempts to fix this issue by removing the device's pointer
from InstanceBase earlier: when DeviceBase::WillDropLastExternalRef()
is called. After this point, any callback registered to this device will
be forwarded to InstanceBase's callback queue instead.

Bug: dawn:752
Change-Id: I8ae86575e34f753e52a76f5fc774bbb5366a1b85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124281
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-03-23 15:16:46 +00:00
Austin Eng 0dc09c01a4 Workaround empty occlusion queries on Apple GPUs
Fixed: dawn:1707
Change-Id: I73f2b595c57830266e7d34ca9e483d803a00d331
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125180
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2023-03-23 07:15:03 +00:00
Austin Eng fa2d3851a8 Remove D3D12/NVIDIA occlusion query suppressions
This was fixed a while ago in
https://dawn-review.googlesource.com/c/dawn/+/48320
which filled the resolve buffer with 0 and only
resolved the available queries.

Bug: dawn:973
Change-Id: Icf6f83eeca65507ba3e6dda9e9f910d684465622
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
2023-03-23 07:11:23 +00:00
Austin Eng 7605d59518 Add a test that an empty occlusion query is 0 if preceded by non-empty
Bug: dawn:1707
Change-Id: I89910d418780c714975b8b9e237bc9cdedfe91c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125101
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2023-03-22 19:04:35 +00:00
dan sinclair 86216f5180 Add ability to use `{EXPECT|ASSERT}_THAT` with Diagnostics.
This CL adds the ability to use the `EXPECT_THAT` and `ASSERT_THAT`
macros with a `Diagnostics::List` object. The diagnostic string will be
emitted as part of the error message.

The `Resolver` is updated to provide access to the `Diagnostics` and the
`AppendVector` tests are updated to use the resolvers diagnostics
instead of the `error()` method.

Change-Id: I94682311fe6f135b7fceae9ec7a5108379fd32be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125060
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-03-22 16:47:44 +00:00
jchen10 4cd9a62b36 Add VulkanClearGen12TextureWithCCSAmbiguateOnCreation toggle
This works around an Intel Gen12 mesa driver bug by clearing some
R8 textures on creation to mitigate the buggy CCS ambiguates.

Bug: chromium:1361662

Change-Id: I7311275d0c9fc5928985e2a51b4eb7b30459b493
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-22 03:15:27 +00:00
Peng Huang ff023dcc4b Move D3DCompliationRequest struct to d3d folder
So it can be shared between D3D11 and D3D12 backends.

Bug: dawn:1705
Change-Id: Iafd2a1d66a9989229892f86a61a0d4df26f3d672
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124881
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-03-21 17:17:48 +00:00
Austin Eng 9a73375ddd Set depth clear value to 0 if it is unused (load op load)
VVL complains if it is NaN (the default value)

Fixed: dawn:1718
Include-Ci-Only-Tests: true
Change-Id: I397ad15dc7d5c142d7bd29f4301de27331aa7141
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124820
Kokoro: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
2023-03-20 22:37:17 +00:00
James Price 0e22bdbae7 tint/msl: Fix emission of private variables
In order to avoid declaring too many function parameters, we
previously modified this transform to redeclare private variables that
are only used inside a single function as function-scope
variables. This was broken as it meant that their values did not
persist across multiple calls to the same function.

Instead, wrap all private variables in a structure and pass it around
as a pointer.

Fixed: tint:1875
Change-Id: I83f5eb1071d57b9c6af56d6cf21b3a32c6e94260
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124800
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-03-20 21:46:01 +00:00
Zhaoming Jiang 6af073cecc Tint&Dawn: Enable f16 override
This CL enable using f16 override, and also fix related tests in Dawn
and Tint.

Bug: tint:1473, tint:1502
Change-Id: I8336770e8a73e5023c1aba224b7b5f21692fbaa6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124544
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-03-20 10:32:45 +00:00
Jiawei Shao 6b41ccc6ec Vulkan: Disable suballocation for 2D textures in some situation on Intel Mesa
This patch disables resource sub-allocation for the 2D textures with
CopyDst or RenderAttachment usage on Intel Gen12 GPUs using Mesa
driver on Linux and ChromeOS because of the driver issues about rebinding a
VkDeviceMemory from a VkImage to another VkImage.

Bug: dawn:1688
Change-Id: I28bb01a2d641a9024330ed761d27e0145d6b8aad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124382
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-03-18 02:54:58 +00:00
Austin Eng a66fa9b06f d3d12: track graphics/compute state independently
Fixes a bug where Dawn incorrectly did not re-apply state
when transitioning between compute and render passes. If
a compute and render pipeline share the same pipeline layout,
all of the resources for the graphics pipeline need to be rebound
since the graphics state in D3D12 is disjoint from the compute
state.

Fixed: dawn:1689
Change-Id: I7d25a1c7954039c4130e67b682ebc05324353e9a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124540
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-03-17 18:42:52 +00:00
Peng Huang b4c5e0d32a Refactor some common code from d3d12::Device to base d3d::Device
Bug: dawn:1705
Change-Id: Ibb69e4a60f77810b688dbd64d3ccf3b07478bad3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124522
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-03-17 18:14:38 +00:00
dan sinclair 6c34e11e43 Support float values where the zeros change the exponent
When underflow is detected in float parsing, WGSL returns `0.0`.
Currently, if the number of `0`s following a `.` shifts the exponent
from a positive to a negative we were not correctly identify the
underflow and returning 0. This CL updates the float parsing to detect
undeflow in this case and return `0.0` as expected.

Bug: tint:1863
Change-Id: I164063cebf70f825fdf2753dff8a4f016939c38e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124341
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-17 15:08:06 +00:00
Corentin Wallez d6b601790f dawn.node: Remove unnecessary check that TypedArrays are in bounds
This should be done by V8 on the creation of TypedArray anyways.

Bug: None
Change-Id: Ia0eacfe3a0434acf81b7d0d6473db9aa97c78c09
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122121
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-17 10:39:33 +00:00
Antonio Maiorano 52cd8caa07 tint/hlsl: fix frexp always returning positive values for fractional part
Bug: tint:1876
Change-Id: Ic56b37918fd1a2a42442b517985a49f10d85159d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124501
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-16 21:31:15 +00:00
James Price 8cf01eef04 tint: Support @diagnostic on switch body
Bug: tint:1809
Change-Id: I33259080c143b0cf7afe01343a1f179f61078dd3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124520
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-03-16 19:48:20 +00:00
Zhaoming Jiang 981d5a6f08 Dawn: Refactor adapter features, part 1
This CL make adapter base holds it supported features set as private
instead of protected and provide a method to set features enabled. This
CL also rename SetSupportedFeatures in null adapter to
SetSupportedFeaturesForTesting.
This is a pre-CL for implementing UseDXC as instance toggle, which may
require further refactor and adapter features logic to handle the toggles.

Bug: dawn:1495
Change-Id: I0a07e5653b43f18278cb4a2fe90985cc90b66068
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124421
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-03-16 19:06:33 +00:00