Chromium always sends arrayLayer instead of origin.depth since
the migration hasn't been finished yet. This wasn't caught
in Dawn's testing since we are using origin.depth everywhere.
Bug: dawn:483
Change-Id: I13b1ccfb016eea01a3291ca439457db09966e9a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26160
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
The value 0 is the default value for default-constructed C descriptors
and should be allowed.
Bug: dawn:22
Change-Id: I876ec4d9c6d70a798b0d6cea5c2ccecaad850eff
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26100
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This patch fixes a bug on the clear of color attachments with signed or
unsigned integer formats on Vulkan and OpenGL by using the correct APIs
to set the clear color for signed/unsigned integer formats.
BUG=dawn:497
Change-Id: If1bc9858875e6384e71c15bb6770fbbb10045037
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26041
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Allocates shader-visible descriptor heaps at a much
smaller size then pool-allocates them upon reaching
the max size. This strategy avoids always wasting memory
for lighter users while still maximizing performance for
heavy users.
BUG=dawn:155
Change-Id: I0519235c901d0283b98ee824eeb0cda6de70b210
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25620
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Format::aspect should be a mask so that it is easier to iterate over
and test if an aspect is present.
This CL also re-exports wgpu's EnumClassBitMask helpers in dawn_native.
It also adds an EnumMaskIterator which wraps BitSetIterator to allow
iterating over the enums in an enum mask.
Bug: dawn:439
Change-Id: I08180a45b27c6031e2f80b0fa1801716677fd813
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24682
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Emscripten's headers live at <webgpu/*>; this makes it so projects don't
have to ifdef which #include path to use.
Bug: dawn:160
Change-Id: I39efee44447470551a78db0abd062f4a2fe9083a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26020
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Dawn apps using debug builds may hang due to
GBV being always on by default. This change turns
on GBV for correctness tests only.
BUG=dawn:490
Change-Id: I2728d834ed53f9acc7556f8d1178d718c0b49457
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25421
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reland with a fix for narrowing of uint64_t to size_t of the buffer size
in 32 bit mode.
This inverts the shimming to have the old mapping at creation method
be implemented on top of the new method..
Also updates Wire tests to use mappedAtCreation instead of
CreateBufferMapped.
TBR=senorblanco@chromium.org
Bug: dawn:445
Change-Id: I89fe84b6e0b5d0d4a5c6a2db7b38cb7d6cd063f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25981
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Added the alphaToCoverage functionality with some
end2end tests. There is no validation for disabling alphaToCoverage
mode if SV_Coverage is statically used by the shader yet.
Bug: dawn:494
Change-Id: I9df15b35697ea05a064b092edae9d5d20f73c4d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25761
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This reverts commit 0811ecc775.
Reason for revert: Makes the Dawn roll fail.
Original change's description:
> dawn_wire: Implement CreateBufferMapped on top of mappedAtCreation
>
> This inverts the shimming to have the old mapping at creation method
> be implemented on top of the new method..
>
> Also updates Wire tests to use mappedAtCreation instead of
> CreateBufferMapped.
>
> Bug: dawn:445
>
> Change-Id: I77dcfe72040e5bf187c41fe99c8dd785d5156a07
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25701
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
TBR=cwallez@chromium.org,senorblanco@chromium.org,enga@chromium.org
Change-Id: Ied940d505fdf576860697dee8df2548c73581eba
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:445
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25980
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Hopefully works around an issue where some Metal drivers treat warnings
as errors.
Bug: dawn:493
Change-Id: Ia535502a14fd4215ff74eee2662dfbde7e01bc4b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25841
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This inverts the shimming to have the old mapping at creation method
be implemented on top of the new method..
Also updates Wire tests to use mappedAtCreation instead of
CreateBufferMapped.
Bug: dawn:445
Change-Id: I77dcfe72040e5bf187c41fe99c8dd785d5156a07
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25701
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This inverts the shimming to have the old mapping entrypoints be
implemented on top of the new mapping entrypoint.
Bug: dawn:445
Change-Id: I98c81b2873d506790b1b19048c5289c62d1b83ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25700
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This is a temporary change to unblock Tensorflow.js until we
expose querying and setting GPULimits.
Bug: none
Change-Id: Iad851b2be260e9fade7c326bc7fcde39b46cf7fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25840
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
E2E tests fail to pass with backend validation. Disable these tests
until there is resolution from the investigation.
BUG=dawn:462
Change-Id: I0325bafb31cc706be122a601ecfe154bf8880b5b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25680
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Some tests are not enabled in D3D12 yet because SPIRV-Cross lacks
support for gl_SampleMask.
Bug: dawn:491
Change-Id: I6cce56b5d0ab883f39b8d58987246c08a23b6410
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25580
Reviewed-by: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Added the sampleMask functionality in Vulkan with some
end2end tests including tests for the shader-output
mask.
Bug: dawn:491
Change-Id: Ib39682d8857729adb4776bc2f2d8e759bf75677b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25340
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Set apiVersion to Vulkan 1.0 if the instance only supports
Vulkan 1.0. Otherwise set apiVersion to Vulkan 1.2, treat
1.2 as the highest API version dawn targets.
Bug: dawn:426
Change-Id: I322eaa0a93a518df36b86717c2ed5a98c5d056ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25065
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
This patch adds the check and implementations of buffer lazy
initialization before CopyBufferToTexture().
The support of buffer lazy initialization before CopyTextureToBuffer()
is much more complicated than what we do for CopyBufferToTexture(), so
we decide to put it in another CL instead of writing them together with
CopyBufferToTexture().
BUG=dawn:414
TEST=dawn_end2end_tests
Change-Id: I45fdcdde2c9a0dafff23623815fc35c877990ef1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25140
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
The CL that added offset/size args landed about the same time
as the CL that adding zero init mapping tests (without the args).
Tbr=cwallez@chromium.org
Bug: dawn:445, dawn:414
Change-Id: I388399d425c3a3c12be79b160686caaf3d81a89c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25162
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This should not be necessary as the command pool should own the
memory if it was created without the creation flag
VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT. However, some drivers
leak memory if vkFreeCommandBuffers is not called.
Bug: chromium:1082181
Change-Id: Ia437fc17b2a304a248b9227b43cfff1868f9f10e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25062
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Depth texture values outside the 0-1 range are not supported without
an extension.
Bug: dawn:413, dawn:367
Change-Id: I75e7f0de054d6f9a4bac7c6b955c65db810fe36e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24681
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Projects using Dawn that are compiled with Emscripten may use some
of our common headers and utilities. ex.) creating a ShaderModule
from SPIR-V. Add handling for __EMSCRIPTEN__ to Platform.h so
compiling to WASM works.
Also, implement GetExecutablePath on Emscripten as unreachable.
This is only ever used to search native paths in the Vulkan backend.
Bug: none
Change-Id: I5d9d6e27e287cb34e7af3214add1c4bc8c6a0f70
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25064
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Added an additional alignment on the staging buffer offset in
WriteTexture on Vulkan to match
VkPhysicalDeviceLimits::optimalBufferCopyOffsetAlignment.
We now allocate some additional memory in the staging buffer for that
purpose.
Bug: dawn:483
Change-Id: Ic5b95aa57f6c241e0ab9f9853b4c3152e52e5630
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24982
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Changed the order of validation blocks in ValidateLinearTextureData.
It doesn't match the order in spec now, but for the algorithm to
compute required bytes in copy we need the conditions which come
after the ones relating to it. Also switched the order of
ValidateLinearTextureData and ValidateTextureCopyRange for similar
reasons.
Bug: dawn:483
Change-Id: If00ae769d170ea12494258721916ec55d79e2880
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25041
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch implements buffer lazy initialization beffor MapAsync() and
buffer creation with BufferDescriptor.mappedAtCreation == true.
Note that this patch doesn't initialize buffers in MapReadAsyc() and
MapWriteAsync() because they are deprecated and will be removed soon.
BUG=dawn:414
TEST=dawn_end2end_tests
Change-Id: Ifea99833897081f599c45797e0829c57de1ac926
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24687
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Fixing an earlier TODO about aligning bytesPerRow in WriteTextureImpl
to VkPhysicalDeviceLimits::optimalBufferCopyRowPitch.
Bug: dawn:483
Change-Id: Ided2d367177f2f886a84f232c77f1f9f0d50d05d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24981
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This changes the format of the server->client callback for async mapping
to match MapAsync. Previously there were two callbacks, one for
MapReadAsync and one for MapWriteAsync.
Bug: dawn:445
Change-Id: I3330c07ac8bb6d1fa9019563e9c946875e852639
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24821
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
vkCreateImage when bound to imported memory, must also have
a VkExternalImageCreateInfo struct in its pNext chain that
has VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA
as a handleType.
This was discovered when tests started failing after a roll
of the Vulkan validation layers.
Bug: none
Change-Id: Ic7fc95f963062c8740e714a490adf6a020fed220
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25100
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
WebGPU currently allows as many as 108 view descriptors per bind
group. This is too many to have one descriptor allocator per size,
so we need to bucket them by size.
Bug: dawn:443, dawn:488
Change-Id: I4fc8cf7cd0dc8292bb6a8488fd2ceb7575e1e5f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24787
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Austin Eng <enga@chromium.org>
This changes the format of the client->server command for async mapping
to match MapAsync and updates the doer on the server to implement it via
MapAsync. Previously the command had an isWrite boolean that routed to
either MapReadAsync or MapWriteAsync.
Also updates the Wire tests using mock_webgpu.h for the new server-side
traces.
Bug: dawn:445
Change-Id: I673cbe5e08b7c71539e8678dbb07b4043a9fadb2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24820
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Also removes suppressions for tests that pass after
https://swiftshader-review.googlesource.com/c/SwiftShader/+/46509https://swiftshader.googlesource.com/SwiftShader/+log/ad65826a2ab1..e8dd233c7a85
$ git log ad65826a2..e8dd233c7 --date=short --no-merges --format='%ad %ae %s'
2020-07-16 cwallez Fix B<->T copies of multiple array layers and unpacked rowpitch
2020-07-15 bclayton Regres: Collate and add new documentation for Regres
2020-04-08 natsu Support Gralloc3 in SwiftShader
2020-07-14 swiftshader.regress Regres: Update test lists @ cd0af645
2020-07-13 capn Undefine Bool after the headers that define them
2020-07-11 capn Remove dead ASTC code for GLES
2020-07-09 capn Rename command classes to match API calls
2020-06-04 srisser Add decoder for BC6h
2020-06-15 sugoi Image dirtiness
2020-07-09 amaiorano Android: build against llvm-10 instead of llvm-7
Created with:
roll-dep third_party/swiftshader
Bug: None
Change-Id: Ife6dcf9f832e4aaab40de3bdb62d4b1eb258d2f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25042
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This gives Chromium the option to give Dawn the correct dxgi adapter to use
Bug: chromium:1036711
Change-Id: Ica544d2e76d1c300038fa07b5b639a35c43f60b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24761
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Added implementation of writeTexture in Metal. It's using a
staging buffer instead of writing directly from the CPU to
the texture, because Dawn uses the private storage mode for
most of the Metal textures.
Bug: dawn:483
Change-Id: I6b85ee8bbe343881337bdb203a122dc1f1523177
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24581
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
GN recently added support for Apple frameworks to link, rather than
overloading the libs lists. This pulls .frameworks out of the libs
lists, so that GN can stop supporting .frameworks in libs in the
future.
Bug: chromium:1052560
Change-Id: I0b57a3c4c995887a57937317db30b67cf7a7f0f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24281
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This patch optimizes the implementation of buffer-to-texture and
texture-to-buffer computations on D3D12 backends by computing
TextureCopySplits once for all the 2D texture array layers in the
copy instead of computing it once per layer. You can see the
comments in the function D3D12::ComputeTextureCopySplits() for more
details.
BUG=dawn:453
TEST=dawn_end2end_tests
Change-Id: I1b66d24d2418147957fbe03e2c25144bd043a62e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24643
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
kMaxBindingsPerGroup is not a real WebGPU limit. Code in Dawn that
uses it now uses dynamically sized vectors, optimistic stack_vecs or
a different limit like kMaxDynamicBuffersPerPipelineLayout.
The CL introduces kMaxOptimalBindingsPerGroup=32 which is used to size
the static portion of stack_vecs, but the value is tentative.
Bug: dawn:443
Change-Id: I08e06bed6531bed8b4365f36cf2fc0579ac5f180
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23502
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
MapAsync in dawn_native is fully implemented and only missing
a couple cleanups that can be done once MapRead/WriteAsync are
removed.
MapAsync in dawn_wire is left as a pure shim on top of
MapRead/WriteAsync and will be transitioned to its own commands
in follow-ups.
All MapRead/WriteAsync end2end and validation tests are duplicated
for MapAsync.
Bug: dawn:445
Change-Id: Ib1430b9257149917be19a84f13e0ddd2a8eccc32
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24260
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
In order to remove the kMaxBindingsPerGroup limit in Dawn, some static
ityp::arrays need to be made dynamically sized. This CL adds ityp::vector
wrapping std::vector.
This CL also fixes the assumption that ityp::stack_vec iterators are pointers
Bug: dawn:442, dawn:443
Change-Id: I8698cbba3ea80ac063ab918a77f223c527720d08
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24480
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This CL adds per-stage and per-pipeline-layout limits according
to the WebGPU spec. It also slightly increases kMaxBindingsPerGroup
from 16 to 24 so that these limits can be effectively tested
without hitting kMaxBindingsPerGroup. kMaxBindingsPerGroup is not a
real WebGPU limit and will be removed in future patches.
Bug: dawn:443
Change-Id: I72be062cd31dea4ebd851f2d9f8274a77f286846
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24481
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Adds RenderPassDescriptor.occlusionQuerySet for struct compatibility
with upstream webgpu.h, and validation errors that it's not used (since
it's not implemented).
Bug: dawn:22
Change-Id: I05ac75105038a0d7569cc720170e55f35b0f80d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24620
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
binding index >= kMaxBindingsPerGroup is actually valid.
Bug: none
Change-Id: Idfba743d50013b7115f125b6441fd49732dffc96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24700
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Implements validation for RenderPassDepthStencilAttachmentDescriptor depthReadOnly and
stencilReadOnly flags to match WebGPU specification. Includes corresponding unit tests.
bug: dawn:485
Change-Id: I21e624850d5a393469569417f102fb979dbfdf27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24602
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Adds WARP to known vendor/device Ids so
tests can detect when MBR is being used.
BUG=dawn:463
TEST=dawn_end2end_tests
Change-Id: I19f16dfeb4839c5a7c0a993bab94d2b6ca4ca36d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24680
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Done by:
- Appending an extra newline at the end of src/**/*.{cpp,h,mm,gn}
except src/tests/*
- Running git cl format --full to format the full contents of every
changed file
Bug: none
Change-Id: Id88fc5ed0c5efbbc93b2c6a305c2f98465fe646d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24641
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
In order to remove a warning in the D3D debug layer, this patch passes
an empty range CPU written range to calls of Unmap on READBACK
buffers.
Bug: dawn:419
Change-Id: Ic4dcbf31beb3a257c3d88896f4bb97e19caf0cc6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24301
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Added validation tests for CommandEncoder::CopyB2T, CommandEncoder::CopyT2B and
Queue::WriteTexture which involve copying or writing to multiple layers
of a 2d-array texture.
Bug: dawn:483
Change-Id: I23f580dff86cd2512a94b41c9c0ce795122a045e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24443
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
This patch implements buffer lazy initialization before
CopyBufferToBuffer() behind the toggle LazyClearBufferOnFirstUse.
- If the source buffer is not initialized, it will be cleared to 0
before CopyBufferToBuffer().
- If the destination buffer is not initialized and the copy doesn't
overwrite the whole buffer, it will be cleared to 0 before
CopyBufferToBuffer(), otherwise the buffer shouldn't be cleared.
BUG=dawn:414
TEST=dawn_end2end_tests
Change-Id: I3d0512c6376a1ed8928e86f8e56fefebc16910fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24360
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
It is breaking the roll of Dawn in Chromium because on ChromeOS the
macro is defined on the command-line, causing the compilation to fail
because of a macro redefinition.
Bug: None
TBR=enga@chromium.org
Change-Id: I13eebb9b40f2a5f7c1eed4e3572de3eda2db8bb6
Change-Id: I4797211f4d9ff122d992d78aeac83fd4f0585ff6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24580
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
In the validation tests, we relied on Queue.Submit(0, nullptr) to
resolve mapping operations. This is fragile so we replace it with a
FlushMappingOperations() function that uses device.Tick() instead.
This allows removing the mapSerial argument from
Buffer::MapRead/WriteAsyncImpl (which was the actual goal of this CL).
Bug: dawn:445
Change-Id: Id98822287370c371bebb83afb8e290e17f3c1b55
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24381
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
In order to lift Dawn's restriction on the number of bindings
per bind group, static sized arays need to be converted to
dynamically sized vectors. This CL adds Chromium's StackVector
class which behaves like std::vector but provides a stack allocator
to allocate small vectors on the stack. Dawn can use this to avoid
making separate heap allocations for a smaller, realistic binding
counts.
The CL also adds an ityp::stack_vec class to support using
a StackVector with TypedInteger indices.
Bug: dawn:442, dawn:443
Change-Id: I7604c02b3ea52cd63990a2e8b45ed238a5d52232
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23681
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This required changing DeviceBase::CreateBufferImpl to return
ResultOrError<Ref<BufferBase>>
Bug: chromium:1103154
Change-Id: I1a5811d293333b6ef29c988a08f2f1f84ac65702
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24500
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
- Fix a struct vs. class in forward declaration of std::hash
- Fix an unsigned vs. signed compare in BitSetIterator
- Fix the assumption that std::array::[const_]iterator is a pointer.
- Fix for reinterpret_cast from uint64_t to uint64_t not being allowed
for vulkan_platform.h
- Fix for a 32bit shift being expanded to 64bit.
Bug: None
Change-Id: I5f2bf8745aa1ef1eba9916fcf6ff7801b48f61cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24501
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Added Queue::WriteTexture with validation but no actual
implementation. Tests were mostly taken from validation tests
for copying buffer to texture. Validation tests for CopyB2T
and WriteTexture do not cover 2d-array textures yet.
Bug: dawn:483
Change-Id: I9027eb615c02fe2265cde912f6ba17a235b94728
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
Adding zero as the optimized clear value to silence a warning in
the D3D12 debug layer. Warning will still occur under non-zero
clears.
Bug: dawn:418
Change-Id: Idada948950f28130618834d966b237dcc39460c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24300
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Skip re-binding samplers since sampler heap
allocations are cached and the pipeline would
redundantly get set every draw. This is
particularly important for draw heavy scenarios.
After the change:
+3% in RendererPerfTest/1.* via SkiaDawn
+100% for Forest Demo FPS (55ms vs 28ms)
BUG=dawn:479
Change-Id: I93cbca4e365d6ff89ec86fc15eaccf70b49ea916
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24161
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
This CL:
- Adds mappedAtCreation to dawn.json
- Changes dawn_native to implement CreateBufferMapped in terms of
mappedAtCreation.
- Duplicates all the CreateBufferMappedTests to mappedAtCreation tests
(both validation and end2end).
- Implements dawn_wire's mappedAtCreation in terms of
CreateBufferMapped. The reversal in dawn_wire will be done in a
follow-up CL.
Bug: dawn:445
Change-Id: I70b9fa729b1402524a6b993c3f288987eb65c6c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24083
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Moved some of the validation helper functions from CommandEncoder.cpp
to CommandValidation.cpp. This will make them accessible for
Queue::WriteTexture. Also introduced ValidateLinearTextureData
and ValidateTextureCopyRange which combine already implemented
checks in a way that's defined in WebGPU spec.
Bug: dawn:483
Change-Id: I04304c5e4906f3745c6adf75758fae179c6ffcfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24283
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
- Move wgpu::TextureUsage::Storage at the end of the enum.
- Reorder some methods of device to be in alphabetical order.
- Reorder members of wgpu::QuerySetDescriptor.
- Change SurfaceDescriptorFromHTMLCanvasID to
SurfaceDescriptorFromCanvasHTMLDescriptor.
Bug: dawn:22
Change-Id: Ib18fbaf153ad2969b0d0c4e49682e8736b00776c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
GetMappedRange never produces errors and instead returns nullptr when it
is disallowed. When in a correct state, should return a valid pointer as
much as possible, even if the buffer is an error or if the device is
lost.
Adds tests for error buffers and device loss, and modify existing tests
to not expect a device error.
Also removes some dead code in the Vulkan backend and adds a fix for
missing deallocation of VkMemory on device shutdown.
Bug: dawn:445
Change-Id: Ia844ee3493cdaf75083424743dd194fa94faf591
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24160
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
True FP16 is only supported in DXC through Shader Model 6.2, also
check the value of the Native16BitShaderOpsSupported member of
D3D12_FEATURE_DATA_D3D12_OPTIONS4 to view whether hardware actually
supports FP16 operations.
BUG=dawn:426
TEST=dawn_end2end_tests
Change-Id: If675f7ba650cb1bd8c792928b70619b9ccda048a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23243
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Xinghua Cao <xinghua.cao@intel.com>
This patch implements buffer lazy initialization before writeBuffer():
if the buffer is not initialized and writeBuffer() doesn't cover the
whole buffer, the buffer will be cleared to 0, otherwise the buffer
shouldn't be cleared.
This patch also introduces a toggle LazyClearBufferOnFirstUse for the
development of buffer lazy initialization: before buffer lazy
initialization being completely supported, all the related code will
only be enabled behind this toggle to prevent the buffers with valid
content being unexpectedly cleared.
BUG=dawn:414
TEST=dawn_end2end_tests
Change-Id: I99a2aa98ca4b9b21d69c6b32080afb525e2c4ad3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24041
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Currently the Chromium build defines a wrapper build target
for Dawn (//chrome/test:dawn_perf_tests) that seems to exist
only to specify some extra data dependencies. By moving this
data dependencies onto the Dawn dawn_perf_tests itself, this
removes a problematic target in Chromium that would otherwise
block my planned changes for crbug.com/816629.
Bug: chromium:816629
Change-Id: I428698fe164bd1aad09c8dba14e57a4b7acebb1c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24302
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This patch fixes two bugs in the copy commands with BC formats and
multiple array layers on D3D12 and OpenGL and adds two end2end tests as
the regression tests.
This patch also removes "viewArrayLayer" in the struct CopyConfig used
in CompressedTextureBCFormatTest and sets the base array layer into
CopyConfig.copyOrigin3D.z instead.
BUG=dawn:453
TEST=dawn_end2end_tests
Change-Id: I1c2e6b79fb7c44fc996655ab5a908e27ba8c4729
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24183
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
vkCreateImage when bound to imported memory, must also have
a VkExternalImageCreateInfo struct in its pNext chain that
has VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT as a
handleType.
This was discovered when tests started failing after a roll
of the Vulkan validation layers.
Tbr=cwallez@chromium.org, senorblanco@chromium.com
Bug: none
Change-Id: I4692d650af27b9325342baeda34a0d982fc49041
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24200
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This unblocks a roll into Skia.
Allow comparison against type limits that might be tautological on
32bit or 64bit systems. Without this the following produces an error
on 64bit:
if (myUint64 > std::numeric_limits<size_t>::max()) {...}
Bug: None
Change-Id: I31fc579738b6fb85b40cfeac8f30936161a15da1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24162
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Added a constraint in ValidateBufferBinding function checking for too
large uniform buffer bindings. Added MaxUniformBufferBindingSize
test in BindGroupValidationTest.
Bug: dawn:436
Change-Id: I31c6e2236ce928d5e81c43455eb18cf4eacdc0f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24081
Commit-Queue: Tomek Ponitka <tommek@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
The stress test is causing timeouts on slower GPUs
due to the TDR threshold being hit. This halves the
number of writes required to complete the test.
BUG=dawn:228
Change-Id: I18dfa68b39a2c079b89eeadc78a69675e5c3269f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24100
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
SetSubData's count is a uint64_t while Queue::WriteBuffer's is a size_t
so we add a small validation check that no narrowing will occur.
No test is added because SetSubData will be removed soon, and it will be
hard to test because of the Null backend's artificial OOM.
This was found while debugging an unrelated fuzzer issue.
Bug: chromium:1099621
Change-Id: I27a9da2b94f51e889c5573f88d4a0a73fea5985c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23961
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
In the client code, we often need to translate between WGPUObject (the
API type) to Object* (the internal client type). This added a bunch of
reinterpret_casts that make the code less readable and more fragile.
This CL adds FromAPI and ToAPI helpers in the autogenerated
ApiObjects_autogen.h header, that convert between API and internal types
in a type-safe way.
Bug: dawn:445
Change-Id: Ia1bf624f0315ced496b95cb660adf88abd916d71
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24063
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This header was only used to call DeviceCreateErrorBuffer and
DeviceInjectError that are used in some handwritten client commands.
We remove the need for the header by making these two commands
handwritten.
This also improves readability, previously injecting errors read:
ClientDeviceInjectError(reinterpret_cast<WGPUDevice>(device),
WGPUErrorType_Validation,
"Some validation message");
And now reads:
device->InjectError(WGPUErrorType_Validation, "Some validation message");
Bug: dawn:445
Change-Id: Ie11570aacf3036e13abd174d91670ecb84661226
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24080
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This CL modifies code generation so that the generated client procs call
the handwritten methods on client objects directly.
Previously the flow was:
- wgpuBarDoStuff
- ClientBarDoStuff
- ClientHandwrittenBarDoStuff
- client::Bar::DoStuff
With this CL the flow is:
- wgpuBarDoStuff
- ClientBarDoStuff
- client::Bar::DoStuff
This required adding Buffer creation methods on client::Device instead
of calling client::Buffer static methods directly.
Bug: dawn:445
Change-Id: I1b332b71ac7a03685afcf8fd0617d3d27da468cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24062
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This CL only moves code, renames client::Fence members, and introduces
client::Queue. Additional fence methods are added for the interaction
with the queue. There are no functional changes.
With this ApiProcs.cpp is almost passthrough and will be removed in a
follow-up CL.
Bug: dawn:445
Change-Id: I65544ef76b54614452cf7c74a948a96cb35a4cfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24061
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This also removes the reliance on BufferBase::IsMapped to know whether
to unmap on destroy. This call was confusing because it was used by the
D3D12 backend to know if its own storage was mapped, but semantically
seemed to check for Buffer::State::Mapped (and not MappedAtCreation).
Bug: dawn:445
Change-Id: I3d6fde1d2996798d53264d5643545f0efb90551a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24060
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <brandon1.jones@intel.com>
This CL adds GetMappedRange reusing the existing GetMappedPointerImpl
call in dawn_native. In dawn_wire tracking is added to keep a
Buffer::mMappedData around.
Tests are added to test the result of Get[|Const]MappedRange in all
buffer states.
Bug: dawn:445
Change-Id: I3737dc4d36f31d392839952da0b5c0d10c7c8a88
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23861
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
In a follow-up CL we need to know if the buffer is in the
MappedAtCreation state for validation of GetMappedRange. Having the
state not 100% reflect the state in the spec meant that validation if
GetMappedRange would fail for buffers mapped at creation for which
IsMapWritable is true.
Bug: dawn:445
Change-Id: I4a64335a708b838526da8d65f907b21c782816e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23981
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This CL only moves code, renames client::Buffer members and does
additional casts where needed. No functional changes.
Bug: dawn:445
Change-Id: I2bf83ecc1c9b36d5965d0365360dd981fcd41aac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23860
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Otherwise on 32-bit platforms, creation of a buffer bigger than the max
size_t would overflow the check and no OOM would be produced.
Bug: chromium:1099621
Change-Id: I987a338b150d10c0eabc3eb5fb3b815a5c2a5ca2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23960
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
In a render/compute pass, if a texture is used as the same usages
across its subresources, and it is also used as different usages
across its subresources. We should mark that it is not used as the
same usages across its subresources for this pass, and we need to
visit every single subresource to track its usages transition.
Bug: dawn:462
Change-Id: Ide0770db62a3b7b85664757b21eb3280a0bb646c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23300
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Added Device::GetOrCreateEmptyBindGroupLayout which caches the result
after being run and modified PipelineBase::getBindGroupLayout to use
that instead of creating a new empty bind group layout each time.
Bug: dawn:466
Change-Id: I70a5719265784eb8f60c2eedf6db7596462b21bd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23980
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
Also fix a misuse of VkBufferImageCopy that caused some Swiftshader
failures.
Bug: dawn:22
Change-Id: Ie812a590d70c7561dfcf2f78ce6c530187610e65
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23200
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This patch moves the computation of TextureBufferCopySplit outside of
the loop over each copy texture array layer so that we only need to do
the computation once for each B2T and T2B copy command.
BUG=dawn:453
TEST=dawn_end2end_tests
Change-Id: I1fcfc972504f845467af92a77bc37870ed7b52a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23720
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This patch adds the support of copying with multiple texture array
layers in one buffer-to-texture and texture-to-buffer copy command.
BUG=dawn:453
TEST=dawn_end2end_tests
Change-Id: If009dbb29f2b0ef0667715eed0d66053b1491fd4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23248
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Bug: dawn:442
Change-Id: I889a943cbaf2d349c31a15fdf126d66964bdd0a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23247
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This patch fixes a bug in buffer-to-texture and texture-to-buffer copies
when copySize.height == 0 or copySize.depth == 0. Previously we miss the
checks if either copySize.height or copySize.depth is 0 before doing
(copySize.height / blockHeight - 1) and (copySize.depth - 1) thus we
will get incorrect results because of arithmetic overflows.
This patch fixes this bug by adding the missed check and adds the
related regression tests in dawn_unittests
BUG=dawn:453
TEST=dawn_unittests
Change-Id: I970e420c0fa7f0b61c656365bef079c123a59e6a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23520
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
|MTLDevice maxBufferLength| is not available until 10.14, so on
lower versions of macOS, try using |recommendedMaxWorkingSetSize|
Bug: dawn:450
Change-Id: I52dc4211cf3d7014771d580a9af9c72abe92a375
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23263
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
ASAN throws when hitting OOM conditions which these tests intentionally
try to create.
Bug: dawn:450
Change-Id: I635480ae329cd5ace55287d77e2b79e663174f49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23246
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This CL adds support for multisampled sampling on the D3D12 backend.
This was already working on other backends. It also adds tests that all
of the sample locations are correct.
Bug: dawn:431
Change-Id: I6849e5e2d708ad4824e6db2665d668d43a4ef5ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23245
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Change mTailPtr to mCurrent that's a VkBaseOutStructure*.
Bug: dawn:464
Change-Id: Ic10a0abc95e279e1537786601d006cf18305687a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23540
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
All the querying of extensions was correctly handled for the WebGPU
ShaderFloat16 extensions, except that we forgot to request it when
creating the VkDevice.
In practice this doesn't crash as most drivers won't check if the
extension is enabled, and just compile the shader code correctly.
However the Vulkan Validation Layers complain. This CL fixes it by
requesting the features on device creation.
Bug: dawn:426
Change-Id: Id7307bb4f1d08a10bec9fc7bf0500c5761f96ff7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23203
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
TypedInteger.h didn't include <functional> which made the reference to
std::hash cause a compilation failure. Fix this by moving TypedInteger
hashing to HashUtils.h so that TypedInteger doesn't include <functional>
in all of its users.
Bug: dawn:442
Change-Id: I5a0271bb187682616eb5ef3a13bb7f6271203453
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This CL adds a TypedInteger helper which provides additional type
safety in Dawn. It is a compile-time restriction that prevents integers
of different types from being used interchangably in Debug builds.
It also adds ityp::{array,bitset,span} as helper classes to wrap std::
versions (not span). These accept a template paramter as the Index type
so that typed integers, or enum classes, may be used as a type-safe
index.
For now, bind group layout binding indices use TypedInteger. Future
CLs will convert other indices to be type-safe as well.
Bug: dawn:442
Change-Id: I5b63b1e4f6154322db0227a7788a4e9b8303410e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19902
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
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>
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 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>
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>
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>
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>