Execution warning is produced from D3D12 validation layers for noop
dispatches, which leads to device lost. The skip noop dispatch handling
was added to the front-end before, and moved to Metal backend due
to it gets in the way of a validation change in the follow-up CL. We
also need to add it to D3D12 backend now.
Bug: dawn:1028
Change-Id: I364f6f1e0ac79679a43c064cb402874f1e959537
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59960
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This patch enables VkPhysicalDeviceFeatures.sampleRateShading as is required
by the SPIR-V Capability (SampleRateShading) for the implementation of
WGSL built-in variable [[sample_index]] (gl_SampleID). Without enabling
smapleRateShading on the creation of VkDevice the Vulkan validation layer
will generate below error message:
Warning: Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-01091 ]
Object 0: handle = xxx, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xa7bb8db6 |
vkCreateShaderModule(): The SPIR-V Capability (SampleRateShading) was declared,
but none of the requirements were met to use it. The Vulkan spec states: If
pCode declares any of the capabilities listed in the SPIR-V Environment appendix,
one of the corresponding requirements must be satisfied.
BUG=tint:471, dawn:802
TEST=dawn_end2end_tests
Change-Id: Id0c91fa48dfae37b2548ee9f3922d93dfa1da5d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Dawn currently allows sampling depth textures this way, but it is
not in the WebGPU spec, and the behavior is not guaranteed with the
Metal API.
This commit also updates the stencil sampling tests to expect
(s, s, s, s) or (s, 0, 0, 1).
Bug: dawn:1021
Change-Id: I9210a2a3ff1655747a202a51f46f38faa35c85d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59320
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This chained struct can be used for internally adding usages to
Dawn textures. It will affect how the texture is allocated, but
not affect frontend validation.
One use case for this is so that Chromium can use an internal
copyTextureToTexture command to implement copies from a WebGPU
texture-backed canvas to other Web platform primitives when the
swapchain texture was not explicitly created with CopySrc usage
in Javascript.
Usage:
wgpu::DawnTextureInternalUsageDescriptor internalDesc = {};
internalDesc.internalUsage = wgpu::TextureUsage::CopySrc;
wgpu::TextureDescriptor desc = {};
// set properties of desc.
desc.nextInChain = &internalDesc;
device.createTexture(&desc);
Fixed: dawn:1027
Change-Id: Id4d08b5588d4960d150d559aa11502c69f40a674
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/58140
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Simplify the buffer clear logic, and tolerate clear twice when resolving
unavailable queries if the destination buffer is not initialized and not
fully written.
Bug: dawn:973
Change-Id: Iaaf16acfd789787cb2f3eb18cd324c60d5f720b1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59680
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
Now resolving unavailable queries is undefined behaviour on D3D12, it
might cause device hangs or removal. Update to just resolve available
part like Vulkan did, and clear the destination buffer to 0s for the
unavailable part.
Bug: dawn:973
Change-Id: I7cf6808d67179425b4883e8847c76daaf8444dc2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59420
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This patch implements the inter-stage variable matching rules on
the attributes 'location', 'base type' and 'composition type'.
In the next patch we will implement the matching rules on the
'interpoliation type' and 'interpoliation sampling'.
BUG=dawn:802
TEST=dawn_unittests
Change-Id: Ic0a273e01dced301d437add83bad3d0c7d94a133
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/58363
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
See https://github.com/gpuweb/gpuweb/pull/1927
Adds a typedef to make a gradual deprecation.
Bug: dawn:1023
Change-Id: Ic81a933a95556fbf5726056530788dde017a1449
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59442
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
FirstIndexOffset must happen after BindingRemapper otherwise some
invalid AST is produced after FirstIndexOffset.
This was found running a CTS test on Windows:
validation,vertex_state:vertex_shader_type_matches_attribute_format
Also adds a regression test.
Bug: dawn:1014
Change-Id: Icbe4b3adb5e5844ffc8435e0e67056c7dff23970
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59281
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
After discussion with driver team, there is no need to differentiate new
driver and legacy driver for build number, so the last 2 fields are used
consistently.
Bug: None
Change-Id: I43ac2b484f84ed209d46dd9283830930908b05ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59121
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yang Gu <yang.gu@intel.com>
This replaces multiple switches with a single indexing into a data
table, and also adds information about the VertexFormatBaseType for
later validation.
Bug: dawn:1008
Change-Id: Ic3f564b0dc571cc0008a54785613f962ce223452
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59030
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Note that this is for direct dispatch calls only. Indirect dispatch
calls are still not validated.
Bug: dawn:1006
Change-Id: I061c15208a01dfb803923823ba4afd38667cad22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59122
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
We define hard limits on these attributes for compute stages. This
enforces them.
BUG: dawn:322
Change-Id: I9b279774e877b5d40d912cb9f812f23d61c20a42
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/56806
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
For Dawn/Chrome interop, Chrome OS differs from Linux as it uses the
NativePixmap-based SharedImageBacking which stores image memory as
dma-bufs as opposed to opaque FDs. Likewise, for synchronization,
Chrome OS wants to use sync obj FDs as opposed to opaque FDs for
more flexibility.
The motivating difference between sync obj FDs and their opaque
counterparts is how they are created. As their name suggests, Opaque
FDs are mostly meaningless outside of the Vulkan ecosystem and must
be created from a VkDevice. As a result, Linux’s
ExternalVkImageBacking needs the Vulkan implementation to create the
FD even when accessing the SharedImage as a GL texture [1]. On Chrome
OS, however, we don’t guarantee Vulkan outside of Dawn, so we aren’t
able to create the opaque FD directly in Chrome.
Instead, we are always able to create sync objs (e.g. via a
fence [2]) which can be imported as VkSemaphores by simply changing
VkImportSemaphoreFdInfoKHR::handleType. Similarly, we can export
signal VkSemaphores as sync objs as well by updating
VkSemaphoreGetFdInfoKHR::handleType.
This CL adds conditional support for using SYNC_FDs on Chrome OS
when importing/exporting VkSemaphores and renames
SemaphoreServiceOpaqueFD accordingly. With this, we can properly
wait on reads/writes on a GL SharedImage representation before
accessing the same memory in Dawn [3].
[1] https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/service/external_vk_image_gl_representation.cc;l=75;drc=f887797b3b527feabd5dfe9b3f2cc7f6deade49f
[2] https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/service/shared_image_backing_gl_image.cc;l=681;drc=f887797b3b527feabd5dfe9b3f2cc7f6deade49f
[3] https://chromium-review.googlesource.com/c/chromium/src/+/3042460
BUG=b:172208313
Change-Id: I5357847fea40e41d1b982054e3573d363e17530c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59080
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Ho <hob@chromium.org>
--disable_workgroup_init will disable the workgroup memory zero initiailization. Useful for benchmarking.
--disable_symbol_renaming will disable tint's symbol renamer. Useful for debugging output.
Bug: tint:1003
Fixed: dawn:1016
Change-Id: I92486ef88a2c1112d9ccb40f7920947bd2011c70
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/58861
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This requires restructuring the logic around MTLCommandBuffer allocation
so that GetPendingCommandContext is guaranteed to never fail. Logic in
the Metal backend is now similar to the Vulkan backend: the
MTLCommandBuffer is prepared at device initialization time, or after a
submission, such that it is always valid.
A new mUsed boolean is added to CommandRecordingContext to say whether
any commands have been recording. Previously mCommandBuffer was used for
that purpose, but it is now always non-null.
Bug: dawn:801
Change-Id: I5dc6747d1e6d538054010cc50533a03a49af921a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/58720
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
It seems the tweaks to always force "cmd" to be the shell seemingly changes the way single quotes are handled. ¯\_(ツ)_/¯
Change-Id: I434066591c968fdfc055a75fa22b7f4c2585b482
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/59029
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This includes OOM as well as internal driver failures when
creating a view of an MTLTexture. This required changing the code to use
the Create-Initialize pattern used everywhere else.
Bug: dawn:801
Change-Id: Ib8a8dec74141aacfa58a55bb8201a83351b3b739
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/58721
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
1. Trigger all deferred callback tasks before registering a new
device-level callback function, making sure that these tasks won't be
invalided due to callback function changing;
2. Fix the end to end testsuit DeviceLostTests, setting the device lost
callback at the beginning of each test so that callback tasks created
during the test will not be triggered unexpectedly.
Bug: chromium:1223390
Bug: chromium:1223603
Bug: chromium:1228134
Change-Id: I2530e938d8fbb2920f3cc6fc78baa01c5d18ad5d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/56040
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This patch adds the validation rules on the maximum inter-shader
stage variable locations. According to Vulkan SPEC, "Each effective
Location must have a value less than the number of location avaiable for
the given interface", and according to Table 18 "Shader Input and Output
Locations", the number of available vertex output locations is
maxVertexOutputComponents / 4, and the number of available fragment input
locations is maxFragmentInputComponents / 4.
BUG=dawn:802
TEST=dawn_unittests
Change-Id: I73a66ad69c808fbd0b128abaed1ca84f19a7925d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/58640
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>