If the copy region generated from 2D texture copy splitter has an
empty first row due to alignment adjustment and we simply extend
it to all copied depth slices, the copy region will be incorrect
for 3D texture copy.
If there is an empty first row and the copy height is odd, we can
split the copy region into two:
- copy0: copy the first depth slice
- copy1: copy the rest depth slices because there is no empty
row after alignment adjustment
This method resolves the remaining problem when copy height is 1.
It also is an optimization for other odd copy height cases, say
copy height is 3, 5, 7, etc.
This change implements the special situation when the copy region
generated from 2D texture copy splitter has an empty first row and
its copy height is odd.
Bug: dawn:547
Change-Id: Idf4f4a9b87f783c5328463e0f4182429a7e809f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53885
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Deprecates the computeStage member of the descriptor in favor of compute
as described by the spec. In order to support both variants without
breaking backwards compatibility some code had to be manually added to
the wire client to copy from the deprecated member to the new one and
visa versa.
Change-Id: I9d5c2fc9c446c927c5792c9af9ed56c90060b65b
Bug: dawn:800
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53884
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
The change implements copy non-zero mip level for 3D textures
on D3D12 when the texture has multiple mip levels. The texture
size on level 0 can be either 256-byte aligned or 256-byte
unaligned(its size is non-power-of-two).
Bug: dawn:547
Change-Id: I8ed74fa587cfd814e7f526173dcb653d0a252a1e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51201
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
- Pipeline statistics query is not fully implemented, disallow its
creation as unsafe
- Add pipeline statistics creation in UnsafeAPIsTest, because it needs
enable extension, add a separate test class for it.
BUG: chromium:1177506
Change-Id: Ic77e04c9c854b396e7240674bd9deb0caf97a513
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53889
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
On macOS 10.15 on AMD GPU, WriteTimestamp cannot be called without any
copy commands on MTLBlitCommandEncoder, otherwise crash occurs. But this
issue is not reproduced on macOS 11.0, just disable timestamp query on
the bad version on AMD.
BUG: dawn:545
Change-Id: I69a012b2091b8ccd251d23ddb26b72e06c07492f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53581
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This allows the client to specify a different release key for the keyed
mutex than the default of acquire key + 1. If the release key is the
sentinel value of UINT64_MAX, it's set to acquire key + 1. Once Chromium
transitions to always specifying the release key, it will be made a
required parameter and the default behavior will be removed.
Bug: chromium:1213977
Change-Id: I327f7157bb7ff23cf216e43043568ce7c6f38a60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53880
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Implements two basic binding tests requested in a previous review. Moves
ExternalTextureState enum to be private.
Bug: dawn:798
Change-Id: I9e5ac31a92bab26b7d68568802db1fa988e849a9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53700
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones (Intel) <brandon1.jones@intel.com>
If there is an empty row at the beginning of a copy region due to
alignment adjustment, this copy region split by 2D texture splitter
will be definitely incorrect for 3D textures because every depth
slice (except the first slice) will wrongly skip one row. We need
to recompute this copy region via modifying this copy region and
adding a couple more copy regions for the empty first row issue.
The idea of recomputation is:
- modify this copy region and don't copy the last row in order to
make its bufferSize.height not exceed rowsPerImage,
- use one more copy region to handle the last row of each depth
slice except the last depth slice,
- use another copy region to handle the last row of the last depth
slice.
Bug: dawn:547
Change-Id: Ib2f6019963ed29d62a9f13d7316b5f04801db8c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/52341
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
The unavailable queries are allowed in ResolveQuerySet and resolved to
0s, which has been fixed in
https://dawn-review.googlesource.com/c/dawn/+/48320.
BUG: dawn:434
Change-Id: I72b1f0b621fc22a7a0d30c407c7359e59d7b905c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53762
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Add a toggle named "dump_translated_shaders", and when this toggle
is enabled, translated HLSL shaders will be dumped and log via
Device::EmitLog in the kInfo logging level.
BUG: dawn:792
Change-Id: Ia5ccc96019c32b43aa315f080f80a26919b441e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53580
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
There have been some bugs seen with this on some platforms.
Bug: dawn:838
Change-Id: I29fa483eee3c299960d2c998fce90d918ac4dc9d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/52560
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
When we are copying data, we need to offset "rowsPerImage" rows
for each depth slice, even though this is a partial copy whose
copy height is less than rowsPerImage.
In addition, when we copy the original data into expected buffer
for comparison, we don't pack data for T2B copy and T2T copy. We
don't remove paddings during copy. So I renames PackTextureData
to CopyTextureData. For B2T copy, we do pack data. Right now we
name it CopyXXXX and we pack the data during some copies, it is
understandable. But if we name it PackXXXX but don't pack data
sometimes, it is weird. In addition, for B2T copy, we pack the
data, so I shorten the buffer size we allocated for comparison.
This change also renames "slice" to "layer" if it includes multiple
depth slices and actually means a layer, but keep slice as slice if
it means an array layer or a depth slice for different cases.
Bug: dawn:547
Change-Id: I6d82e6c25f50bd4c988b1f65f85b24ad1c191d01
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53501
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Add timestamp query back in Metal supported extensions, and calculate
the timestamp period based on CPU timestamps and GPU timestamps sampled
on device.
There is a crash issue (dawn:545) on macOS 10.15 on AMD devices, but
cannot be reproduced on macOS 11.0+, we can just disable it on AMD with
macOS 10.15 in the following CL.
Bug: dawn:434
Change-Id: Icb4823e7c3115776e64c6a41fd0aea0f6536ccdf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51720
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
If we are copying a partial of rows, the buffer size doesn't need
to be that large of the entire image which has "rowsPerImage" rows.
There was a bug in texture copy splitter. And this workaround was
introduced at https://dawn-review.googlesource.com/c/dawn/+/30741
in order to workaround that bug. D3D12 validation is actually correct.
Now that we have fixed the bug at
https://dawn-review.googlesource.com/c/dawn/+/52680/. The workaround
is not needed.
Bug: dawn:547, dawn:520
Change-Id: I92292c71dc5479fc2ba863eb9f897516bd1a96a0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53360
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Details:
- Add the logging level type WGPULoggingType, including levels verbose,
info, warning, and error,
- Add the API SetLoggingCallback, which bind the callback to deal with
logging string,
- Add the return command DeviceLoggingCallback and related code,
- Add DeviceBase::EmitLog(WGPULoggingType, const char*) , and
DeviceBase::EmitLog(const char*) use WGPULoggingType_info as default,
to post logging from native or server device to bound callback
via CallbackTaskManager.
BUG: dawn:792
Change-Id: I107b9134ff8567a46fa452509799e10b6862b8d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/52200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This patch implements the asynchronous path of CreateComputePipelineAsync
on D3D12 backend with the basic framework of the dawn_unittest
AsyncTaskTest.Basic.
1. Call the constructor of dawn_native::d3d12::ComputePipeline in the main
thread.
2. Execute dawn_native::ComputePipelineBase::Initialize() (a virtual function)
asynchronously.
3. Ensure every operation in dawn_native::d3d12::ComputePipeline::Initialize()
is thread-safe (PersistentCache).
4. Save all the return values (pipeline object or error message, userdata, etc)
in a CreateComputePipelineAsyncWaitableCallbackTask object and insert this
callback task into CallbackTaskManager.
5. In Callback.Finish():
- Insert the pipeline object into the pipeline cache if necessary
- Call WGPUCreateComputePipelineAsyncCallback
Note that as we always handle the front-end pipeline cache in the main thread,
we don't need to make it thread-safe right now.
BUG=dawn:529
TEST=dawn_end2end_tests
Change-Id: I7eba2ce550b32439a94b2a4d1aa7f1b3383aa514
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47900
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This is blocking the Tint roll which adds validation that
textureSampleCompare cannot be used in the compute stage.
Simply disabling this test for now since WGSL discussions seem to
indicate there may be a builtin added with a different name and
semantics.
Change-Id: Iaecf5865c9fb38aea3231c3ae823d783a665984d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53320
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
In every copy region, its bufferSize.height minus rowsPerImage
can be texture format's blockInfo.height (it is 1 for uncompressed
formats) at most, and it appears only if bytesPerRow is 256 and
copySize on height is a full copy.
This change will benefit 3D texture copy splitter via removing
unwanted empty rows issues. Because empty rows in 3D copy splitter
may lead to recompute/modify copy regions and there might be new
copy regions added.
The removed empty row situations are:
1) Partial copy on height: copySize.height < rowsPerImage *
blockInfo.height
2) bytesPerRow is greater than 512. For example, if bytesPerRow
is 512 and data in one row straddles two rows and there is no
empty row at the first part. The second part will have a fake
empty row if we don't recompute its alignedOffset.
3) There are two empty rows in a copy region. For example:
if data in one row straddles two rows and there is an empty row
in the first copy region. Then there will be two empty rows in
the copy region of the second part if we don't recompute the
alignedOffset.
This change also fixes an issue found by Corentin that copy related
argument "rowsPerImage" should not take effect when we are copying
one single depth or array slice.
Bug: dawn:547
Change-Id: I603291d559de1d05e420e5ed1f4cabf53de5a93f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/52680
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Tests are based on the IOSurfaceWrappingTests.
Sampling tests are not implemented, since they would require
support for the samplerExternalOES sampler type in WGSL.
Bug: chromium:1205155
Change-Id: Icc114eaf6efaee93f1b8486e615f0fd307f23080
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/50201
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Instead of having it as a decoration.
The old style is now deprecated and will be removed soon.
See https://github.com/gpuweb/gpuweb/pull/1735 for the WGSL spec change.
Bug: tint:846
Change-Id: Id2fa681ddf7b97cd3fa41d7b5538029d96db7e28
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53082
Reviewed-by: Corentin Wallez <cwallez@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This toggle will be used by Chromium to disallow the unsecured SPIR-V
path such that a renderer process can only use WGSL.
This new toggle will be covered by a test in Chromium that ensures that
in the default configuration SPIR-V is disallowed.
Bug: chromium:1214923
Change-Id: Ia67e0c7466044e1086399d995dc841426fe604c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/52781
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This patch removes the function declarations which don't have their
function bodies.
BUG=None
Change-Id: Id16c2a225319331cdbc3a827ebbabf58c16e1dfd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This patch re-enables the T2T copy workaroudn on Intel Gen9 and Gen
9.5 GPUs because the latest released Intel D3D driver still cannot
handle some copies correctly in some copy shapes.
BUG=chromium:1161355
Change-Id: Ia96fe05c3e027f56a734331de03fe42745754cc3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/52960
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
And fix a bug where the Metal backend hit an ASSERT when
clearing combined depth/stencil textures by copy.
Bug: dawn:780
Change-Id: Idf3061570f63d0abd3e8a41d0c251db4f6dc7e0c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51840
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Expand coverage for these tests by using combinatorial test
parameterization. Covers more cases and expands coverage to
compressed textures. This caught a bug on Vulkan where only the
first region for multi-layer compressed texture copies was cleared.
It also caught a driver bug on some Intel platforms, where clearing
the non-zero mip of a depth texture does not work.
Bug: dawn:780
Change-Id: Ic601bae111c1c2dd150f569d7e02759ca765201e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51680
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This change mainly is a preparation for 3D texture copy splitter,
which will be based on 2D texture copy splitter and then revise
or recompute incorrect copy regions if needed.
The change itself mainly rename some variables and comments and
distiguish 3D texture copies from 2D (array) texture copies. For
example, term slice is changed to layer if it only refers to layer
slices in 2D textures and it is not shared by depth slices in 3D
textures.
Bug: dawn:547
Change-Id: I6f84134a4fbcb90708901a1059b60e78e1a25ca5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This is a header-only utility so it can be easily included and
used anyhere. Include it in DawnTest.h to automatically pick up
definitions to print test parameters.
Also, work around bot limitations for very-long test names.
Bug: none
Change-Id: I940263ab0a4cc415b06fa04749694f16ff08335c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51841
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This patch implements the default implementation of WaitableEvent
(AsyncWaitableEvent) with std::condition_variable instead of
std::future as std::future will always block its destructor until
the async function returns, which makes us unable to clean up all
the execution environment of the async task inside the async
function.
This patch also implements WorkerThreadTaskManager to manage all
the async tasks (inherited from WorkerThreadTask) in the future,
for example all the Create*PipelineAsync() tasks.
This patch also updates the related dawn_unittest WorkerThreadTest.
Basic.
BUG=dawn:529
TEST=dawn_unittests
Change-Id: Ie789ba788789e91128ffc416e7e768923828a367
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51740
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This is the last patch to replace DAWN_SKIP_TEST_IF with
DAWN_SUPPRESS_TEST_IF or DAWN_TEST_UNSUPPORTED_IF. With this patch
DAWN_SKIP_TEST_IF will be completely removed from Dawn.
BUG=dawn:779
Change-Id: I5aec03697877ff9c6fa175f8d16eba951dd94cfa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51806
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Not doing so produces an infinite loop when iterating from begin to end.
Bug: none
Change-Id: I323587a19ba1618d7e9a326de2ee398ae5e0bb7b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51762
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Renames all the RenderPipeline*2 stuff to simple RenderPipeline* but
keeps *2 definitionas around as typedefs and wrappers so that users can
migrate away from it.
Bug: dawn:22
Change-Id: If301d81a829bba0646c3a61068f2279932b191e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51764
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This is the first part to completely replace DAWN_SKIP_TEST_IF
with DAWN_SUPPRESS_TEST_IF or DAWN_TEST_UNSUPPORTED_IF.
BUG=dawn:779
Change-Id: I1795eb4271de08667d43f24b64b42d15ca4b8071
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51721
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Fences are no longer part of the WebGPU spec, and have been removed from
Blink.
Bug: dawn:22
Change-Id: I240c4c4107acfaf9facec88a43a38b5ff327c7a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/50702
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Currently, we use the device maximum supported shader model for DXC
compiler. Meanwhile, we should use HLSL version 2018 or above to support
the maximum shader model. Otherwise, it may report below errors:
Explicit template arguments on intrinsic Load requires HLSL version 2018
or above.
Bug: None
Change-Id: I7b1bfd1c08eb5ad30b2f7d59d280678bb71d1d64
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51460
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
These tests are used to demonstrate that different copy scenarios
will impact how TextureCopySplitter to split copy regions for 3D
textures on D3D12.
Bug: dawn:547
Change-Id: I49947387acaa61f4eacbcd5a18c6cd8db913d2d0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51320
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>