This CL adds the type determination code for the GLSL determinant call.
Change-Id: I46bc57f4fd5f4f43021b20ee511b0b8fc809f4f8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23360
Reviewed-by: David Neto <dneto@google.com>
Currently we will attempt to extract composite values for constant
constructors which may happen outside of a function. This causes issues
as the extract requires us to be in a function.
Change-Id: I5724987542cc7d9d86493363ed4d9a44a391a52f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23221
Reviewed-by: David Neto <dneto@google.com>
Device shouldn't be used until after DeviceBase::Initialize so we need
to move the NextSerial call to after Device Initialization is completed.
Bug: chromium:1094477
Change-Id: I2ab317c1d75f853c022faac3fc0bbd66fbd7c14e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23261
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Retrieval filter was receiving errors that shouldn't be
stored or not storing new errors. Since these errors are
never reaching the storage filter or being stored without
being filtered, this workaround removes the storage
filter entirely and filters them upon being retrieved.
After the change, two new E2E tests fail
backend validation and require further investigation.
Bug: dawn:460
Change-Id: I92d8c55c71832064b94e8ff0307e7af57ea81fda
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23144
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Fuzzer recently started sometimes injecting errors with
CheckHRESULT returning E_FAKE_ERROR_FOR_TESTING, which needs to also be ignored
in AssertAndIgnoreDeviceLossError so that we can continue with destruction.
Rename AssertAndIgnoreDeviceLossError to IgnoreErrors
This CL also adds Austin's pretty printing of HRESULT results as hex values
and adds printing of "E_FAKE_ERROR_FOR_TESTING" error.
Bug: chromium:1094448
Change-Id: I6715a5eec02919a3e3b4c86d493b3f7e84c5e206
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23241
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This is needed to allow users to actually use tint/tint.h
BUG=tint:87
Change-Id: I70c9397a0497feca88ccf8879a3d0e8a03ab8471
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23260
Reviewed-by: dan sinclair <dsinclair@google.com>
When the fuzzer passes the command DeviceLoseForTesting, the
DawnWireServerFuzzer will hang forever when waiting for a fence signal
because the device was lost. This commit sets a callback on device loss
which gives an extra condition to break the hang.
Bug: dawn:444
Change-Id: I0157358ed6da39cc6fcab7e1be8a3d5fde74266f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23141
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Natasha Lee <natlee@microsoft.com>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
This CL cleans up various formatting and lint errors.
Change-Id: Ieee14db90e36acc8b469d58abb84fcf3595321bb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23224
Reviewed-by: David Neto <dneto@google.com>
This patch does several clean-ups in CopyTests as a preparation of
supporting buffer-to-texture and texture-to-buffer copies with multiple
texture array layers.
1. Remove the zero-initialization of textures in CopyTests_B2T
2. Use a big buffer that contains the pixel data in all the texture
array layers instead of several small ones that only contains one
texture array layer.
3. Make CopyTests_T2T::DoTest() also use CopyTests::TextureSpec as its
input parameter.
4. Add tests for the copies with multiple texture array layers. In this
patch we just copy the data once per texture array layer, while in
the next patch we will be able to copy the data for all the related
texture array layers in one copy command.
5. Move some helper functions for copy tests to WGPUHelpers.cpp
BUG=dawn:453
TEST=dawn_end2end_tests
Change-Id: Ia0150a6c55fffce3e24dda2cd45fd920b0873dc9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23120
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reland after a refactor of how the extension handling work in the Vulkan
backend.
The original author is David Turner <david.turner.dev@gmail.com>.
This CL ensures that, on architectures with a varying subgroup size,
compute shaders are always compiled with a fixed subgroup size to
avoid consistency issues when one shader writes data in a subgroup-size
dependent layout to GPU memory, to be read by another shader in a
future dispatch.
At the moment, only Intel ICDs are known to implement this [1],
and the code uses a heuristics to chose the size of 16, which seems to
be the sweet spot according to Intel engineers.
+ Update the PNextChainBuilder class to deal with the fact that
VkComputePipelineCreateInfo::pNext is defined as a const void*,
which created compiler errors in the previous implementation.
[1] https://bugs.freedesktop.org/show_bug.cgi?id=108875
Bug: dawn:464
Change-Id: I035ee06084fcc964742f0bff4c54cff257c742ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23202
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reland after a refactor of how the extension handling work in the Vulkan
backend.
The original author is David Turner <david.turner.dev@gmail.com>.
Certain Vulkan ICDs (Intel ones notably) will compile SPIR-V
shaders with an liberal, compiler-selected, subgroup size (i.e.
either 8, 16 or 32). For more context, see [1].
This can be a problem for compute, when one shader stores data
in device memory using a subgroup-size dependent layout, to be
consumed by a another shader. Problems arise when the compiler
decides to compile both shaders with different subgroup sizes.
To work-around this, the VK_EXT_subgroup_size_control device
extension was introduced recently: it allows the device to
report the min/max subgroup sizes it provides, and allows
the Vulkan program to control the subgroup size precisely
if it wants to.
This patch adds support to the Vulkan backend to report and
enable the extension if it is available. Note that:
- This changes the definition of VulkanDeviceKnobs to
make room for the required pNext-linked chains of
extensions.
- A helper class, PNextChainBuilder is also provided in
UtilsVulkan.h to make it easy to build pNext-linked
extension struct chains at runtime, as required when
probing device propertires/features, or when
creating a new VkDevice handle.
- This modifies VulkanDeviceInfo::GatherDeviceInfo() to
use PNextChainBuilder to query extension features and properties
in a single call to vkGetPhysicalDevice{Properties,Features}2.
Apart from that, there is no change in behaviour in this CL.
I.e. a later CL might force a specific subgroup size for
consistency, or introduce a new API to let Dawn clients
select a fixed subgroup size.
[1] https://bugs.freedesktop.org/show_bug.cgi?id=108875
Bug: dawn:464
Change-Id: I01e5c28e7dac66f0a57bf35532eb192912b254fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23201
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
All existing tests and samples are updated and deprecation tests added.
CommandEncoder still encodes using arrayLayers so the backends are
unchanged. They will be handled in a follow-up CL.
Bug: dawn:22
Change-Id: Ib5346b46eb04d97349cab8f32ef8da5034726ca8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23104
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Add a guard variable for flow control within that if-selection.
Also, the premerge blocks are always surrounded by an if-selection,
to ensure we cause reconvergence at the end of the original if-selection
construct, just like in the original SPIR-V.
Bug: tint:3
Change-Id: I614c6840e539bf9a338058beb5b6f70484e3320a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23182
Reviewed-by: dan sinclair <dsinclair@google.com>
We've already written those tests.
Bug: tint:3
Change-Id: Ic836be43b5f1220e3563e4d27abd9b5e2ab54460
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23180
Reviewed-by: dan sinclair <dsinclair@google.com>
This CL checks buffer sizes before creating map read/write handles.
It is an error to map a buffer that can't be addressed on the CPU.
It also changes client-side synchronous errors on mapAsync to be
normal map failures, and not device lost errors. These should be
recoverable.
The CL adds additional testing for really large, but not UINT64_MAX
buffers, and fixes a VVL warning when buffer allocations exceed the
size of their memory heap.
Bug: dawn:450, dawn:398, chromium:1014740
Change-Id: Ieb34c04c3d01c429b7e3b7810729d5e91ecb6270
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22626
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This CL adds the ability to attach a stride to an array type and have it
emitted during SPIR-V generation.
Bug: tint:5
Change-Id: I9c0f0a6afef6ae6662b64f4da2c150ba3f8da29f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23223
Reviewed-by: David Neto <dneto@google.com>
This CL updates the type determination code to determine the types of
module scoped variable constructors.
Bug: tint:89
Change-Id: Icd5d65409fcf17a0cbf0b34b9919f8d9e1577354
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23220
Reviewed-by: David Neto <dneto@google.com>
If a texture's old states of all subresources are the same, and its
new states are the same too, then we can use one barrier to transit
states for all subresources. We don't need to use one barrier per
each subresource.
This change can reduce barriers we dispatched, in order to improve
performance for particular situations.
Bug: dawn:441
Change-Id: I9fe9dabda725e05d4ce5a8e69ee7b40e6724a22a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23145
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This patch put subresource related variables like baseMipLevel,
levelCount, baseArrayLayer, layerCount into a single struct at
backends.
Bug: dawn:157
Change-Id: I50c6bb0ed8ae7a184506c23cab4b64a472bbd75e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23163
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This makes the tracking in TextureBase match the shape of
wgpu::TextureDescriptor.
GetSize() becomes a bit more surprising because the depth can sometimes
be the array size, so new getters GetWidth(), GetHeight() and GetDepth()
are added.
Some simplifications to the backend texture creation code are included
that will make it less error prone to add support for 1D / 3D textures.
Bug: dawn:22
Change-Id: I33b6ca99af9d58fc88f5f626cfd5e2e62a8b45cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23103
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This updates CL:
- Adds a deprecation warning to use size.depth instead of
arrayLayerCount.
- Changes all tests and samples to use size.depth.
- Adds deprecation tests for the change.
In particular the state tracking in TextureBase isn't changed yet
because it requires non-trivial changes in the backends. It will be done
in a follow-up CL.
Bug:dawn:22
Change-Id: Ic02dfb5baaba8d5b06cd339ce988e9b1d16cb5e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23101
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch enables nonzero_clear_resources_on_creation_for_testing
toggle on buffer on OpenGL backends as a preparation of supporting
buffer lazy-initialization in Dawn.
BUG=dawn:414
TEST=dawn_end2end_tests
Change-Id: Ib49ad17a5d89e14dbdb08d2eb8d6441fadb68f10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23143
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This patch enables nonzero_clear_resources_on_creation_for_testing
toggle on buffer on D3D12 backends as a preparation of supporting
buffer lazy-initialization in Dawn.
BUG=dawn:414
TEST=dawn_end2end_tests
Change-Id: Id4f45ff5ccf906692c3855451b120aa56f68c7a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23142
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Prevents the d3d12 fuzzer from building on non-windows platforms.
bug: dawn:444
bug: chromium:1094230
Change-Id: I3ce20c645b3fe99b51e06b493ced34308d7cc21e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23162
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
When we do transition barriers for a texture view outside of a pass
(say copy, clear, initialization), if the texture view can cover all
subresources, and its old usages across all subresources are the
same, then we can use one transition barrier. We don't need to use
separate barrier per each subresource.
This patch can reduce barrier we delivered, and improve performance
for particular situations.
Bug: dawn:441
Change-Id: I2ae9b39793915553cbaaceacaf58bf87c9ba3bc6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23129
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This is preparatory change for a subsequent CL that will deprecate
TextureDescriptor::arrayLayerCount in favor of size.depth.
Bug: dawn:157
Bug: dawn:22
Change-Id: Id64556dc81056fbe7751073ffe9872026c145e77
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23102
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This supports the extended instructions used by the compute_boids
example.
Bug: tint:3
Change-Id: I364c343217139e489377dd2a9330058114023caa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23126
Reviewed-by: dan sinclair <dsinclair@google.com>
The checks for dependencies of Device extensions were incomplete, makes
sure the transitive dependencies of the extensions we care about are all
known so they can participate in the dependency check.
Also removes a workaround for surprising Vulkan behavior with instance
extensions getting promoted as device functions. This should be handled
correctly now as DeviceExt contains the physical device extensions as
well.
Bug: dawn:457
Change-Id: I4b79729d809c9edfedcb075a0e6aa5b4dd473ab3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22942
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Fixes bug where a newly allocated ShaderVisibleDescriptorHeap would be
untracked in the residency LRU upon allocation, causing Dawn's residency
manager to become out of sync with D3D12's internal residency refcount
by calling MakeResident once more than needed.
Bug: dawn:193
Change-Id: I47804471b41df476db989634e50bded6006e05aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23125
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Moves last TickImpl call during ShutDown to only be called if the
device was fully created.
Bug: dawn:400, chromium:1093639
Change-Id: I25437e3b33d0fc57f21e82c63bfb0fd4d9384175
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23123
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch put subresource related variables like baseMipLevel,
levelCount, baseArrayLayer, layerCount into a single struct at
front-end. We have a lot more at backend too, a following patch
will do that.
Bug: dawn:157
Change-Id: Iab5633a4246b6ae89b80c39f5672dbb31d7a3e78
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22704
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
- Avoid redundant switch-break.
WGSL does an implicit break at the end of a switch case, because
it has fallthrough.
TODO: Emit fallthrough
Bug: tint:3
Change-Id: Ida44b13181a01a2c1459c0447dac496ba5b97ffc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22961
Reviewed-by: dan sinclair <dsinclair@google.com>
tint.h selectively includes headers depending on what features are enabled. It
is based off of the original sample code, so should give users access to all of
the functionality demonstrated in there.
This is located in include/tint/, so that users can have a pretty include of
tint/tint.h.
BUG=tint:87
Change-Id: I8659c789c154349e4e8e7730dc334da4fb6eba70
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23124
Reviewed-by: dan sinclair <dsinclair@google.com>
D3D/VK driver may return a size larger than requested and could cause
PowerOfTwo() to overflow. This change adds a check to ensure the size
is within the limit before attempting sub-allocation.
BUG=dawn:27
Change-Id: I2b2ce727abff953642a69b65c8f30be8e53e562d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23060
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
In BlockInfo, remove the backpointers from true-head, false-head, and
premerge-head to the if-selection header block.
Convert the forward references from if-selection to its internal heads
from pointers to IDs.
Bug: tint:3
Change-Id: Ic931df519795e14374bff4f60ad37a4b32f79c91
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/23140
Reviewed-by: dan sinclair <dsinclair@google.com>
Similarly to the CL for Instance extensions, it makes each device
extension linked to an enum class and a bitset. Logic surrounding device
extensions is changed to take advantage of this to be more programmatic
and less error prone when adding support for a new extension.
Bug: dawn:457
Change-Id: Iecf623c40b890b7e00ba972d5eac0712866692b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22941
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
If a texture follow this rule:
* old usages of all subresources are the same
* new usages of all subresources are the same
Then we can use one barrier to transit states for all subresources.
We don't need to use one barrier per each subresource.
This patch adds a flag at front-end to capture many (but not all)
situations which follow the rule above, then we don't need to loop
over every subresource at Vulkan backend.
Bug: dawn:441
Change-Id: I6124ee2cb09c9142fefd8f057dc6d2659301e2d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22702
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Adds harness for fuzzing the d3d12 backend with a WARP device.
Bug: dawn:444
Change-Id: I3e5ca325b19eb8b6cfe53e4d833c5acbbd293a26
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22880
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>