Commit Graph

2629 Commits

Author SHA1 Message Date
Corentin Wallez 3e4b57b77e ShaderModule: Store the tint::Program in the base class.
This is in preparation of removing all the DAWN_ENABLE_WGSL logic: the
ShaderModuleBase will have either mSpirv or mTintProgram set based on
UseTintGenerator.

Also improves the constness of some functions.

Also simplifies a bit ShaderModuleBase::Initialize.

Bug: dawn:706
Change-Id: Ib879e2aec8a004aeb8ac5dc6e1176b1667fc227d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45422
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-22 18:24:16 +00:00
Bryan Bernhart 5ff4978a5d Fix incorrect parsing logic in DawnTest
DawnTest incorrectly reports arguments as unused nor skips over ones
that were already parsed.

Change-Id: Ibd7874419226ca6404e44236c12fbd70132e4551
Bug: None
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45442
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2021-03-22 17:18:46 +00:00
Corentin Wallez 8ac6a481a3 Make CreateRenderPipelineAsync use Descriptor2
Since it isn't used by anyone yet we can make a breaking change to
CreateRenderPipelineAsync to immediately start using
RenderPipelineDescriptor2.

Bug: dawn:1177501
Change-Id: I9f88c6fc1b325b7a9356536e2a071d4f17abd6ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45280
Commit-Queue: Brandon Jones <bajones@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
2021-03-21 23:13:04 +00:00
Corentin Wallez 682f32af32 Revert "CopyTextureForBrowser: Support color format conversion"
This reverts commit f84daa070f.

Reason for revert: Adds static initializers.

Original change's description:
> CopyTextureForBrowser: Support color format conversion
>
> This CL enables blit from RGBA8Unorm soruce texture to dst texture that
> |CopyImageBitmapToTexture| supported dst format.
>
> BUG=dawn:465
>
> Change-Id: I99846cf8dc37bc89e0c168a3d86193bb3a0c0ebb
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44020
> Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>

TBR=cwallez@chromium.org,jiawei.shao@intel.com,shaobo.yan@intel.com,enga@chromium.org

Change-Id: I29a4faf38332995db6bded9f5aead9af28dadfd3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:465
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45420
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-03-19 12:47:05 +00:00
Corentin Wallez 5709060143 Port MultisampledRenderingTests to WGSL.
Bug: dawn:572
Change-Id: I9e76b39c0df705cc3fde5058e618c1ecb2c446f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44761
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-03-19 09:48:11 +00:00
Yan, Shaobo f84daa070f CopyTextureForBrowser: Support color format conversion
This CL enables blit from RGBA8Unorm soruce texture to dst texture that
|CopyImageBitmapToTexture| supported dst format.

BUG=dawn:465

Change-Id: I99846cf8dc37bc89e0c168a3d86193bb3a0c0ebb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44020
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-19 09:46:44 +00:00
Corentin Wallez ad8772dfb2 Fix incorrect WGSL u32 != i32 comparison in a test
Bug: tint:354
Change-Id: I4eef469334072aac606d6ed7384eb066986c2db1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45400
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-03-19 09:41:21 +00:00
Ryan Harrison bbabda3590 Fix Storage Buffers in WGSL tests & examples
Converts var<storage_buffer> to var<storage>

Adds in [[access(read_write)]] when no access qualifier was supplied.

BUG=dawn:699

Change-Id: I9da95366d0bb8734f1d134ee2dc764a7c16ef0cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45300
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-18 17:20:48 +00:00
Corentin Wallez 3e5701c1a4 Skip deprecation warning expectations in RenderPipelineValidationTests
A commit conflict caused this to be included by mistake even if it is
failing.

TBR=bajones@chromium.org
TBR=enga@chromium.org
Bug: None

Change-Id: Ie4352d0b955d34af6f9614f0c6a6dad1e42da826
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45241
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-03-18 12:34:18 +00:00
Brandon Jones bff9d3a357 Updating end-2-end tests to use new RenderPipelineDescriptor format
Bug: dawn:642
Change-Id: Ie38dfe7286b51eb7f3ecd8902e5249321ff63c11
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44980
Auto-Submit: Brandon Jones <bajones@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-03-18 02:54:27 +00:00
Austin Eng 27c4f03de1 Skip create render pipeline deprecation warning expectation in UnsafeAPIValidationTests
The CL that fixed deprecation warning expectations landed at the same
time as the CL which added this expectation and broke CQ.
We shouldn't check deprecation warnings here now because the warnings
for CreateRenderPipeline are temporarily disabled.

Bug: none
Change-Id: I99a8b6643e64f87b2354058dbac9a236c51a2afd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45180
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-03-18 01:28:57 +00:00
Corentin Wallez 3fe857a621 ValidationTest: correctly assert deprecation warnings are emitted.
Bug: dawn:642
Change-Id: If8601c50e4a14b5de5098398381c7a6c5e1f73fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44867
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
2021-03-17 19:10:27 +00:00
Brandon Jones 6e5d47a396 Update majority of unittests to use RenderPipelineDescriptor2
Bug: dawn:642
Change-Id: I437967f590e03b7d85d7eda28400db9e3e5d0745
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44820
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-03-17 17:48:59 +00:00
Ben Clayton c56868420d Migrate all tests over to using Default Struct Layout
The WGSL spec has been updated with 'Default Struct Layouts':
https://github.com/gpuweb/gpuweb/pull/1447

This removes the `[[offset(n)]]` decoration, and replaces it with two optional decorations: `[[size(n)]]` and `[[align(n)]]`, and a sensible set of sizes and alignments for each type.

Most `[[stride(n)]]` decorations have also been removed from arrays.

Bug: tint:626
Bug: tint:629
Change-Id: Ib0d2741f61ea943e6fb99d00cbb5cab2f97ae7be
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44280
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-03-17 09:48:19 +00:00
Jiawei Shao 0008432827 D3D12: Fix crash in the workaround for T2T copy issue on Intel GPUs
This patch fixes a bug in the computation of temporary buffer size in
the implementation of the workaround for the T2T copy issue on Intel
GPUs.

With this tests all the T2T operation tests in WebGPU CTS will be able
to pass on Intel Gen9 and Gen9.5 GPUs.

BUG=chromium:1161355
TEST=dawn_end2end_tests

Change-Id: Ic4fb0c0056cf7b01720e47cc91c37a9f293cd194
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44840
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-03-17 08:20:09 +00:00
Ryan Harrison 3209df5a9c Fix TimestampQueryTests
BUG=dawn:713

Change-Id: Ice1f9d948125daa68de661ad37bb07835ef9bec8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44940
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-03-17 08:03:39 +00:00
Ryan Harrison ed16517e32 Fix VertexStateTests
BUG=dawn:714

Change-Id: Ic9c478ae708d48cf78228edf831badb7c401d131
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44924
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-16 20:56:00 +00:00
Ryan Harrison 322e451a62 Fix CopyTextureForBrowserTests
BUG=dawn:712

Change-Id: Ie8b504a3566fae18a35029b63cf74f55dbe93b0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44922
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-16 20:23:00 +00:00
Ryan Harrison ddc4712609 Fix ComputeStorageBufferBarrierTests
BUG=dawn:711

Change-Id: I566f2631721d10374027cf3959fce7eaf20a85c0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44921
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-16 20:04:10 +00:00
Ryan Harrison f4496c14b7 Fix ComputeDispatchTests
BUG=dawn:710

Change-Id: I47dac524f66f84e2d5e3aa966935bd2ca9d03144
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44920
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-16 19:53:29 +00:00
Ryan Harrison cc84ee24fc Fix ComputeCopyStorageBufferTests tests
BUG=dawn:709

Change-Id: Ib829a834546588a2948179f487fc75b1bf09cf06
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44901
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-16 19:34:41 +00:00
Corentin Wallez 0ed19c6640 Port invalid SPIR-V tests to SPVASM instead of GLSL.
Bug: dawn:572
Change-Id: I4d244d6837f70720a04236ecb751785e27a14d10
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44763
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-03-16 18:09:59 +00:00
Corentin Wallez af607f7f80 Port the MinimumBufferSizeValidationTests to WGSL.
Bug: dawn:572
Change-Id: I24d5e37711aecdef582c33cb4ad55d0e5fb30004
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44860
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-03-16 17:30:04 +00:00
Ben Clayton e76a33b6eb Fix more WGSL vector constructors
Constructor arguments need to match the vector element type.

Tint has new validation that now checks for this.

Bug: tint:632
Change-Id: Ifcb994260c167e326ce5c0776915d44954dd8aa9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44767
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-03-16 12:00:54 +00:00
Ben Clayton 175a7eb826 RenderPipelineValidationTest: Fix vector constructor
Integer literals need to be suffixed with `u` in order to be unsigned. This also includes 0.

Tint has new validation that now checks for this.

Bug: tint:632
Change-Id: I1af07590d93620561df1a0084521eb071d4af7ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44766
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-03-16 10:10:04 +00:00
Corentin Wallez 36f19daa7d Port D3D12 white box tests to WGSL.
Bug: dawn:572
Change-Id: I91cc56847c4970c3f32697738edb799f7468e76f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44760
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-03-16 10:00:44 +00:00
Corentin Wallez debab92fac GN: Use updated path to libtint.
Bug: dawn:706
Change-Id: I39864f75b12272992bd9129a8eeea1ac6479a99e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44764
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-03-16 09:31:44 +00:00
Corentin Wallez a94c9acd01 Fix the vertex attribute offset alignment rule.
Bug: dawn:130
Change-Id: Ib5fa24bf5520cb1ffe1653f1504dff244df928b4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44300
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-03-15 14:52:53 +00:00
Corentin Wallez 693b76bcd5 Remove usage of deprecated std::codecvt
It was causing issues building Dawn in Skia. The error message helpfully
suggests using WideCharToMultiByte instead.

Bug: dawn:706
Change-Id: I87dee1192123f49cc8e7243a29df446389454df4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44560
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-15 12:10:23 +00:00
Jiawei Shao d89814ed7a Enable DepthStencilCopyTests.ToStencilAspect on Windows/Intel/Vulkan
BUG=dawn:439
TEST=dawn_end2end_tests
Change-Id: I49448b201469ea29f7c740656e0f3b0822634e33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44400
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-03-15 01:16:02 +00:00
Ryan Harrison bdc1340449 Add reflection for fragment inputs/outputs from Tint
BUG=dawn:702

Change-Id: I1a75929bbb91411c10dac5a5408e8fc57d67102b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44460
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-03-12 21:33:08 +00:00
Brandon Jones c53ea046a6 Don't use depth offset in TextureCopySplitter
Remove usage of the depth offset in TextureCopySplitter. Because there
is no slice pitch alignment requirement, it is simpler to express the
subresource footprint with just width and height. Fixes incorrect copies
when using WriteTexture on a texture with 64 or less width.

Bug: dawn:573
Change-Id: I51cb73b522a443b8b42d9ba290c69541211be4bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39200
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2021-03-12 17:58:47 +00:00
Jiawei Shao a57308e60b Workaround the compile error when calling std::begin on C arrays
This patch adds a workaround for a compile error when calling
std::begin on C-style arrays when rolling Dawn to Skia.

BUG=chromium:1161355

Change-Id: I6b697c383c0f76866e1d35f75bd1f64b96c5d6c5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44520
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-03-12 08:22:47 +00:00
Bryan Bernhart 2f72aeda4f D3D12: Pass usage to ProduceTexture
Allow external images to specify all allowed texture usages which will
be checked by ProduceTexture. This avoids needing to assume the usage
between multiple calls to ProduceTexture is always the same.

Bug=dawn:625

Change-Id: I9fdb59af23e6c160e939ab1c51de03542248c0c8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44260
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-03-12 02:27:56 +00:00
Brandon Jones 0702b70469 Updating RenderPipelineDescriptor to the newest layout
Currently normalizes anything using the new layout to the old one for
the sake of getting things working as quickly as possible. Follow up
changes will gradually push the new layout through more of the stack.

Bug: dawn:642
Change-Id: Ie92fa9dde21174f62ceba1a1f4866cbc24c5fc6f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38600
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-03-11 21:19:00 +00:00
Jiawei Shao f905e57be2 D3D12: Add workaround for T2T copy issue on Intel GPUs
On Intel Gen9 (SKL) and Gen9.5 (KBL, CFL, CML) GPUs with latest
Intel D3D12 driver (27.20.100.9316), there is a bug in the command
CopyTextureRegion() when we want to do the texture-to-texture copy
with the formats whose texel block size < 4 bytes and source mipmap
level > destination mipmap level.

This patch adds a workaround for this driver bug by implementing
the functionality of the T2T copy with one T2B copy and one B2T
copy.

BUG=chromium:1161355
TEST=dawn_end2end_tests

Change-Id: I688bb8bae277832aaba1be2680012040ee8e1160
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/43860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-03-11 19:34:50 +00:00
Aleksi Sapon 9f6bc4e3a9 CMake fix
Add missing source files to CMakeLists.txt (introduced in e3f10e3d8e).

Change-Id: Iac013e6119e9401a2b94a43220ca8f11d86f82dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/43961
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-03-11 16:27:00 +00:00
Shrek Shao 6fc6fce636 Add tests for zero sized index buffer out of bounds draw test
Bug: dawn:622
Change-Id: I9601a7d6fec246abd7a0941fcfc4253df03376a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44240
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-03-10 18:02:48 +00:00
Ryan Harrison 54c9b8244d Add reflection for used vertex attributes using Tint
BUG=dawn:701

Change-Id: I36e5492cc87afc597d52e5cab9424922fd99dcdc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44200
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-10 16:44:08 +00:00
Ben Clayton 7fe018c065 ShaderModule: Use transform::Renamer
For sanitizing symbols.
Replaces use of Inspector::GetRemappedNameForEntryPoint()

Change-Id: I1e20f719e0e80c04c5c4e4ae52bdb47f8d0572f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/43884
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-03-09 13:58:07 +00:00
Ben Clayton 95034f6528 Enable the BoundArrayAccessors tint transform
Change-Id: I44cbfbeb09dadcf22ae77a85cef0aff3bc79b16b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-03-05 01:51:28 +00:00
Corentin Wallez 80915849ce Rename Buffer/TextureCopyView to ImageCopyBuffer/Texture.
This is to follow the renames in the upstream WebGPU specification.
Typedef are left in places to make a smooth deprecation period.

Bug: dawn:22

Change-Id: I5134b897930c1fa883c49dd80d2665d6684ec022
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/43882
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-03-04 18:13:45 +00:00
Austin Eng 6e62183aa5 Statically link the dawn_end2end_tests
This allows us to enable white_box tests that use Tint. It
fixes linking with symbols from both dawn_native statically
and dynamically.

Bug: dawn:696
Change-Id: I6a002ae5ec55a27b6bf7329c9ba301ce8014d521
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/43840
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-03-04 16:49:35 +00:00
Ben Clayton 3b1a0c6e14 ShaderModule: Use tint::diag::List::str()
Cuts down on the noise

Change-Id: I3904b170a61e5884b4fb1479b885f188b5ea4a24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/43883
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-03-04 14:18:37 +00:00
Rafael Cintron c36a9e8579 Protect Texture::DestroyImpl against multiple calls for D3D12
Calling Texture::DestroyImpl will cause a crash when passing a
nullptr D3D12 resource to the Present method of
ID3D12SharingContract.

Protect against crashes by checking whether the allocation we're
destroying is valid before proceeding.

Change-Id: Ifb68c1f85383db5027006cf435f43c84d1a463d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42580
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2021-03-03 18:42:34 +00:00
Austin Eng 9b5f442c78 Add XlibXcbFunctions to the CMake build
Bug: none
Change-Id: I6987e99822d5a417c1ceac2f0a1f939d1c85cfb8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/43720
Auto-Submit: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-03-03 08:21:47 +00:00
Stephen White 9b9e7b293e Skip SNORM formats on unsupported platforms.
Bug: dawn:447 dawn:667

Change-Id: I66d5a33febeee6a5ea4efd7c4e97461accce22ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/43580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-03-02 17:54:19 +00:00
Ryan Harrison b9eec93172 Add missed level value to textureLoad
Caught by the bots running SwiftShader

BUG=tint:516

Change-Id: I4e93c2f73cf48242b49c8aea1f5f29a21ac6b8e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/43600
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-02 17:53:39 +00:00
Yan, Shaobo fbda46da44 Refactor CopyTextureForBrowserTests to use compute shader
CopyTextureForBrowserTests will cover incoming color format conversion
cases. While it is OK for |unorm| formats to compare their pixel values
on the CPU side, we cannot do such comparisons for the |float| formats
because we may meet the precision issues when comparing a value
generated at the CPU side to the one from the GPU side.

Refactor this test suites by using compute shader and do bit-by-bit
comparison from source texture and destination texture.

BUG=dawn:465

Change-Id: I979fcf1a1d96bbe9f8a4cf2f1a305d488e88b257
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36140
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-02 03:00:27 +00:00
Jiawei Shao 642ec1c30e D3D12: Clear texture with RecordCopyBufferToTextureFromTextureCopySplit
This patch uses RecordCopyBufferToTextureFromTextureCopySplit() to
record the D3D12 commands in Texture::ClearTexture() so that we can
remove some redundant code in that function.

BUG=dawn:145, dawn:693

Change-Id: Ifd0ba319c335fdf13e60bf748163451d71dad962
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42760
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-03-02 02:02:21 +00:00
Bryan Bernhart ec3f482422 D3D12: Fix ASSERT for external image tests
Replaces use of EXPECT_EQ with ASSERT_EQ and allows
ASSERT_EQ to propagate to caller so the test returns
early.

BUG=dawn:625

Change-Id: I6c12aad201f1821fa8c7c1f9a9b735910049cdcf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42940
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2021-03-02 00:56:51 +00:00
Ryan Harrison 8ed0630d35 Add level value to textureLoad
The level-less variants have been removed from the WGSL spec, so will
be removed from Tint soon.

BUG=tint:516

Change-Id: Ic09ffadc2902ca9cdb3198b91f8ad694887258d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42704
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-03-01 20:29:20 +00:00
Stephan Hartmann 6e5edc9a69 IWYU: add missing type_traits for std::is_unsigned
Bug: None
Change-Id: Ib39829c39e800534510afb2fb0651d77ba29a2a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/43440
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephan Hartmann <stha09@googlemail.com>
2021-03-01 20:24:11 +00:00
Jiawei Shao 60d6d0acd6 Add regression test for the Intel D3D12 driver bug about T2T copy
This patch adds a regression test to dawn_end2end_tests for an
Intel D3D12 driver bug about the T2T copies with specific texture
formats when the source mipmap level is greater than 0.

This patch also does several clean-ups in CopyTests.cpp to support
testing arbitrary texture formats:
1. Initialize the source textures with device.WriteTexture().
2. Set default values for TextureSpec.copyLevel (0),
   TextureSpec.levelCount (1) and TextureSpec.copyOrigin ({0, 0, 0}).
3. Add TextureSpec.format and set the default value for it (RGBA8Unorm).
4. Support initializing and comparing the texture data with arbitrary
   texture format instead of RGBA8Unorm only in CopyTests_T2T.
5. Check all the texels in the related destination texture subresources
   instead of only the copied texels.

BUG=chromium:1161355
TEST=dawn_end2end_tests

Change-Id: Ib32aac57dc7bdc9a4c2edc96093afa945aa08a5c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42240
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-03-01 01:23:30 +00:00
Bryan Bernhart 9c3aefa4bd D3D12: Enable external texture reuse
This change allows multiple Dawn textures to be created from the same
D3D11 resource. This avoids re-opening the shared handle by caching the
D3D12 resource outside of the Dawn texture.

Re-opening the handle costs 5-10% of CPU cycles per frame, which far
exceeded syncronization costs.

In a future change, WrapSharedHandle will be depreciated.

BUG=dawn:625

Change-Id: If0d2dc9b7445ec3ae718bc5305164db88057c4ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42140
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-02-26 22:44:48 +00:00
Ben Clayton 4d9f2ca07d tint: Move to new transform API
tint::transform::Transform::Output::diagnostics is deprecated.
Diagnostics are now all in the Output::program.

Use the VertexPulling(const Config&) constructor instead of the setters. These are deprecated.

Change-Id: Icefb84719d4915550c1e554e6d0c6e06ebb05f5c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42266
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-26 20:25:38 +00:00
Xinghua Cao 6cbef93c73 Vulkan: fix validation failure when using fp16 feature
Although VkPhysicalDeviceVulkan11Features::storageBuffer16BitAccess is a subset
of VkPhysicalDeviceVulkan11Features::uniformAndStorageBuffer16BitAccess, when
the SPIR-V Capability (StorageBuffer16BitAccess) was declared, we must enable
the VkPhysicalDeviceVulkan11Features::storageBuffer16BitAccess feature
according to the requirements of the spec.

BUG=dawn:675

Change-Id: I99f9eb4c5f2fd6c6565a51063817efb8bc88216f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42620
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Hao Li <hao.x.li@intel.com>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-02-26 03:03:36 +00:00
Brandon Jones e3f10e3d8e Updated VertexFormat enums
Shifts the older enum values up by 30, but if anyone was using values
rather than the enums themselves they'd land on the right formats
anyway.

Bug: dawn:695
Change-Id: I92a177b427fb1bb14b60d9280f89d030c5941a38
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42561
Commit-Queue: Brandon Jones <bajones@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-02-26 02:20:25 +00:00
Austin Eng 87649ff09d Reject createPipelineAsync callback if unsafe APIs are disabled
Async functions should fail by rejecting the callback instead of
generating a device error. This fixes a leak in the wire where
the allocation for the callback was never delete since it was
never called.

Fixed: chromium:1181627
Change-Id: I840073c1d1b5f1401aa8ed29d3c8f0e1e4fefd35
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42540
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-25 22:06:55 +00:00
Jiawei Shao 7564ae1def D3D12: Add test for the crash issue about T2T copy with Depth32Float
Currently on D3D12 backend a device lost will occur when we do a T2T
copy under the following situations:
1. with Depth32Float
2. only copy one row
3. bufferCopyOffset == 256

This is because in current implementation it is possible for us to do
a copy with D3D12_SUBRESOURCE_FOOTPRINT.Depth > 1, which is not allowed
with DXGI_FORMAT_D32_FLOAT because this format is not supported to be
used as 3D textures.

This patch adds a regression test for this bug and we will fix it
later.

BUG=dawn:693
TEST=dawn_end2end_tests

Change-Id: Ib6fe70988b5b217d5f14d3f32999b3841e5d23b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42600
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-25 22:03:55 +00:00
Corentin Wallez 4165c1cd9c Deprecate fences.
The are replaced by Queue::OnSubmittedWorkDone. Only Queue::CreateFence
is deprecated since all other fence-related calls require a fence to
work.

Also ports a number of uses of fences in test harness to use
Queue::OnSubmittedWorkDone instead.

Bug: chromium:1177476

Change-Id: I479415f72b08158a3484013e00db8facd11e6f33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42660
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
2021-02-25 21:47:15 +00:00
Austin Eng 7124cc4e5d Log a warning if unrecognized args are passed to the test binary
Bug: none
Change-Id: Ic437dc7656613d9a8088dd51f1ed0713f1992415
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42720
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-25 20:38:45 +00:00
Austin Eng bd3f58612f dawn_wire: Move BufferConsumer to it's own file. Unify WIRE_TRY
Bug: dawn:680
Change-Id: I6d57280ab11381649deef51ee7babf5ca73f359b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42340
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-02-25 20:21:25 +00:00
Austin Eng 12827fb805 Skip QueryInternalShaderTests.TimestampComputeShader with Tint
Partial revert of https://dawn-review.googlesource.com/c/dawn/+/42560

Change-Id: Iec7ad3bcb56d38726e9464784dec9c3ba57b87ab
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42740
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-25 19:34:15 +00:00
Austin Eng 36dcb1a51a Un-skip use_tint_generator tests using runtime arrays
This is using the Tint -> SPIRV-Cross path, but Tint supports
the SPIR-V part now, so it works correctly in Dawn's tests.

Bug: tint:400
Change-Id: I6efd9447a9b454fb866467d65fda9350ec772f18
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42560
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-25 16:17:31 +00:00
Austin Eng 584ba432e9 Update ComputeCopyStorageBufferTests to use WGSL
Bug: dawn:572
Change-Id: If5cce116540bd4298824e3801ee48b2197269cd4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32505
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-25 16:14:01 +00:00
Ben Clayton 84fae3d9da Enable BindGroupTests.ReusedUBO for tint generation
This works for the SPIR-V tint backend.
Other backends need to be enabled seperately.

Bug: tint:463
Bug: dawn:571
Change-Id: I4c937eec381a05609b267d36d202844758b13547
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42641
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-02-25 14:09:51 +00:00
Ben Clayton 3b201d122f ShaderModule: Fix transform error message
It was being taken from the pre-transformed program, not the post-transformed program.
If we did get a transform error, the string would be empty.

Also change the signature of RunTransforms() to take a Transform* instead of a Manager*. There's nothing special about Manager anymore - it is just a transform that acts as a group of other transforms.

Change-Id: I4ea6cb022b5967b3c6b8c628517727dc3da3be8e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42640
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-02-25 13:56:31 +00:00
Corentin Wallez c093db250e Implement Queue::OnSubmittedWorkDone
This is the replacement for Fence in the single-queue WebGPU world. To
keep this CL focused, it doesn't deprecate the fences yet.

Bug: chromium:1177476

Change-Id: I09d60732ec67bc1deb49f7a9d57699c049475acf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41723
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-02-25 13:17:01 +00:00
Brandon Jones 0a295c027d Reset Internal D3D12 Device After Test Shutdown
Adds dawn_native::ResetDeviceInternal, which allows us to destroy and
create a new ID3D12Device. The device should be reset after every test
when GPU-based validation is enabled in order to prevent GBV objects
from using a significant amount of memory over time.

Bug: dawn:623
Change-Id: I654d093d993ab0198c6c240bd0f3f843d2762680
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41340
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
2021-02-24 22:09:30 +00:00
dan sinclair 4e6b52a21b Revert "Use upstream SPIRV-Cross GN files."
This reverts commit 9fdbb74072.

Reason for revert: The SPIRV-Cross GN files have a bug which is fixed upstream, but Skia is on an old version of SPIRV-Cross so they don't have the fix. So, the build fails when rolling Dawn into Skia complaining about unknown `-fno-exceptions` on the windows bots. Need Skia to either move to vulkan-deps, or roll their spirv-cross forward before this can re-land.

Original change's description:
> Use upstream SPIRV-Cross GN files.
>
> Previously spirv-cross didn't have its own sources files but this
> changed recently so we should use them. This will ultimately allow
> sharing targets between multiple components in Chromium.
>
> Bug: chromium:1179277
> Change-Id: Ib4bb1884b9ba9c4c3804e96d8adbb8905c60c9a3
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41725
> Auto-Submit: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Peng Huang <penghuang@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>

Bug: chromium:1179277
Change-Id: If1003bafa7b35f502c08b2dab91dd3d416aab077
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42420
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-24 18:34:21 +00:00
Ben Clayton bbc235425b Use tint::transform::Spirv
The new tint::transform::[Spirv,Hlsl,Msl] transforms sanitize the tint::Program for the given backend.

The tint::transform::Spirv transform handles edge cases for sample masks (crbug.com/tint/372). We can now enable these tests.

Rework dawn_native::[opengl,vulkan]::ShaderModule::Initialize() so that transforms are applied *before* calling ShaderModuleBase::InitializeBase(). This is done as InitializeBase() wants to validate the SPIR-V, which requires the pre-processing of tint::transform::Spirv.
InitializeBase() also performs shader reflection which needs to be performed on the post-transformed program for the information to be correct.

Bug: tint:372
Change-Id: I4c96ce89b6ae286972549d8c7efe59e77c469063
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42223
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-02-24 12:50:00 +00:00
shrekshao 232f4d183c No-ops for out of bounds drawIndexed
Store index buffer size in CommandBufferStateTracker and skip
issuing drawIndexed call if it's out of bounds.

Bug: dawn:622
Change-Id: I8f4bd8ba03dea931815dc0db87ffacb9936a123d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-02-23 16:37:29 +00:00
Jiawei Shao 76a94b17be Remove some useless #include files and forward declarations
BUG=chromium:1161355

Change-Id: Ie4d0e5da22f4b7a66591265d101f2fbe75a2e00a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42180
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-23 01:51:06 +00:00
Corentin Wallez 423e3f6896 Mark Create*PipelineAsync as unsafe because it is WIP
Bug: dawn:529
Change-Id: I31c8571d327d1d2b198357eb365706bc8097b12a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41721
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-02-22 19:43:56 +00:00
Corentin Wallez 2d3c2e3553 Rename CreateReady*Pipeline to Create*PipelineAsync
This follows the name change in the upstream WebGPU specification.

Bug: dawn:529
Change-Id: I6d940dcc89f6b75136c642b578cb01bb8e40d681
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41720
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-02-22 18:27:36 +00:00
Stephen White 7e79207ae9 OpenGL ES: implement compressed texture support.
SwANGLE does not support GL_EXT_texture_compression_s3tc.
However, it does support GL_EXT_texture_compression_dxt1,
GL_ANGLE_texture_compression_dxt3 and GL_ANGLE_texture_compression_dxt5,
which should be sufficient for Dawn's purposes.

Note that sRGB formats may be problematic for OpenGL ES in general,
but ANGLE does support them, so we can satisfy the requirements for
Dawn's texture_compression_bc and exercise the codepaths on ES.

glPixelStorei is not only unsupported for CompressedTexSubImage*D()
but causes asserts in ANGLE and validation errors elsewhere. The fix
is to scope the glPixelStorei() calls to the non-compressed codepath.

Bug: dawn:580
Change-Id: I68fa019eda2aee37a097e697cfc87bcdc28c1f12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42120
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-19 18:38:32 +00:00
Austin Eng eea1209b12 Fix Vulkan leak if vkMapMemory fails
This introduces a macro DAWN_TRY_WITH_CLEANUP which allows
some code to be run before the early return.

Bug: chromium:1177332
Change-Id: I529c9ca6f2b0cf6ffd4bf85719a4e2a1c2552d1b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42003
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-02-19 18:31:02 +00:00
Austin Eng ef9e4412f5 Simplify ErrorScopes
In upstream WebGPU, error scopes do not wait for queue operations or
async operations like create*PipelineAsync or mapAsync. This simplifies
the implementation so we don't need to track error scopes by parent
pointers but can instead have a simple stack.

Bug: dawn:22, chromium:1177107
Change-Id: Ic7344cbd96e257cbabc0f414934a5e42a4020a13
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41980
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-02-19 18:17:22 +00:00
Corentin Wallez 9fdbb74072 Use upstream SPIRV-Cross GN files.
Previously spirv-cross didn't have its own sources files but this
changed recently so we should use them. This will ultimately allow
sharing targets between multiple components in Chromium.

Bug: chromium:1179277
Change-Id: Ib4bb1884b9ba9c4c3804e96d8adbb8905c60c9a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41725
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-02-19 10:06:42 +00:00
Austin Eng 76d0e38bd7 Fix the Windows build
Bug: none
Tbr: cwallez@chromium.org
Change-Id: I56e1e5da072e960102db891fe3f11a86f1ffe972
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42005
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-19 05:43:57 +00:00
Yunchao He e9e9ee64f6 Add a validation test for compressed texture with mipmaps
Compressed textures (BC formats) can support full or partial mip chains.
This tiny change adds a validation test to ensure it.

Bug: dawn:558
Change-Id: I584b65b7d049a3f188e3b56ca5c9ff36748151ae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42004
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-02-19 05:15:47 +00:00
Austin Eng f104fea367 Remove size_t from wire transfer structs
This makes the primitives in the serialized wire protocol
the same across platforms and architectures which is better
for both fuzzing and remoting Dawn.

Commands that used size_t are updated to use uint64_t, and
the server-side implementation checks if conversion to
size_t would narrow.

Bug: dawn:680
Change-Id: Icef9dc11a72699685ed7191c34d6a922b652c887
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41582
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-02-18 22:36:19 +00:00
Adrian McCarthy f0f6d2f8e1 Remove obsolete `-Wreturn-std-move-in-c++11`
Clang has retired this diagnostic.

Bug: 1179351
Change-Id: Ie0d5f7b2da88b82deb98e09921c5659ab9366961
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42002
Reviewed-by: Nico Weber <thakis@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-18 22:34:59 +00:00
Corentin Wallez 8c82acd778 Add a Toggle that can be disallowed for timestamp tick->ns conversion.
Bug: dawn:686
Change-Id: If017922ece2d98e95dedc922994807b85ca07397
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41940
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-02-18 18:06:28 +00:00
Austin Eng da70024b08 Fix implicitly deleted default copy assignment operator
Dawn roll broke the Chromium build. See
https://ci.chromium.org/ui/p/chromium/builders/ci/win32-archive-rel/20453/overview

Bug: dawn:680
Change-Id: Id2ebd6a00a80d95f8de163ee71428dda0a327450
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42001
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
2021-02-18 18:06:09 +00:00
Corentin Wallez 16ca1588d1 Move QueueWriteBufferValidationTests to their own file.
They were in QueueSubmitValidationTests which was confusing.

Bug: None
Change-Id: I58406149e9e71feafaf111c35aed255c78b9b642
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41726
Commit-Queue: Stephen White <senorblanco@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-02-18 15:56:48 +00:00
Austin Eng 1b31dc0bb2 Add a BufferConsumer primitive for wire [de]serialization
BufferConsumer wraps a buffer pointer and size and exposes a
limited number of operations to get data while decrementing
the remaining available size. This makes it so that code
reading or writing into a buffer cannot easily consume more
bytes than available.

This CL guards against serialization overflows using
BufferConsumer, and it implements GetPtrFromBuffer
(for deserialization) on top of BufferConsumer. A future patch
will make the rest of the deserialization code use BufferConsumer.

Bug: dawn:680
Change-Id: Ic2bd6e7039e83ce70307c2ff47aaca9891c16d91
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41780
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-02-17 22:14:56 +00:00
Stephen White eb71aaf689 Implement a --backend= flag for DawnTest.
This version renames HasBackendType() -> HasBackendTypeFilter() and
adds a test, similar to HasVendorIdFilter().

Bug: dawn:687
Change-Id: I444d3cb668eb7402ba45f14aaec290390f4c3944
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41900
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-17 17:07:08 +00:00
Austin Eng 0b17eb8e19 Update more Dawn tests to use WGSL
Bug: dawn:572
Change-Id: I0f567da883005d909d498a7a88e9b73137201919
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41820
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-17 15:49:07 +00:00
Stephen White a5ba2827f5 GL: Implement WriteTexture for compressed textures.
Bug: dawn:681

Change-Id: I5d9cd3636a656df1ba9d23964c18011b9cfcf5c0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41440
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-16 22:07:22 +00:00
Bryan Bernhart 536c7aea7d Generalize multi-aspect formats
Removes special casing depth-stencil or multi-planar formats.
Like depth-stencil, NV12 views can be created but not sampled.

BUG=dawn:551

Change-Id: I3cd43d079253f4ee45660d0efd2723e1650f88d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41342
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-02-16 19:55:09 +00:00
Ryan Harrison 6dd34f7e34 Remove GLSL SPIRV-Cross fuzzer
Releasing this configuration is no longer part of the PoR, so no need
to fuzz it.

BUG=dawn:683,chromium:904410

Change-Id: Ic499c68d48b88240361f4ffa937c878b3e3c8526
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41760
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-16 19:19:58 +00:00
Stephen White e9f42997b2 Enable more tests on OpenGL and OpenGL ES backends.
Some of these are skipped by lack of optional feature support,
but at least this brings them on the radar by increasing the
skip counts for the GL backends.

Bug: dawn:580
Change-Id: I3439f41584e70dd51f6d0f7826ef9da7c046020e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41401
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-11 13:09:14 +00:00
Corentin Wallez aa0e1be0e8 Reland "Vulkan: Fallback to XCB for Xlib surfaces"
This is a reland of fb0bf70459

Reland after making libx11-xcb dynamically loaded since it isn't present
on all Linux deployment targets of Chromium. Also includes a couple of
additional cosmetic changes to d3d12/PlatformFunctions noticed while
looking at it for inspiration.

Original change's description:
> Vulkan: Fallback to XCB for Xlib surfaces
>
> Chromium builds the Vulkan loader without support Xlib (because it
> prefers XCB) which caused Xlib wgpu::SwapChain creation to fail on the
> Vulkan backend.
>
> This CL adds a fallback to use VK_KHR_xcb_surface if VK_KHR_xlib_surface
> isn't present.
>
> Bug: dawn:662
> Change-Id: I0e0128ee6b5c75da03998dbae231d17e48bacc81
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41180
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>
> Auto-Submit: Corentin Wallez <cwallez@chromium.org>

Bug: dawn:662
Change-Id: I617fcd1059dddfa05c29ac20d77f891ca6962342
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41380
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-02-11 08:26:38 +00:00
James Price 7e80cce1a9 Remove explicit storage class from samplers/textures
Tint automatically infers a storage class of `handle` for these types
of variable, as per the WGSL spec. Explicitly specifying a storage
class for them will soon become an error.

Bug: tint:332
Change-Id: Ib67e44a5afcdd364470488fd4b456a2b42304daa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41402
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-10 20:17:14 +00:00
Corentin Wallez fb3991e7d2 Lower the maxVertexBuffer limit to 8.
This is to match the upstream WebGPU specification.

Also remove maxVertexAttributeEnd in favor maxVertexBufferStride.

Bug:dawn:678
Change-Id: Ia498ff522ba257d40e9ddd6e145a0ba77f6753ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41182
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-02-10 19:47:13 +00:00
Stephen White 725e03b0c9 Fix bug ID in a couple comments.
Bug: dawn:672 dawn:673
Change-Id: Iabbbc47c93d2ab7ab2ffd8cdf6dd65a3dfdfd9db
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Stephen White <senorblanco@chromium.org>
2021-02-10 15:14:05 +00:00
Hao Li e0a588752c Fix timestamp writing and resolving from different encoders
Currently the queries availability info is only stored on the encoders
where they are written, and we need the info in the compute shader. If
resolving them from a different encoder, 0s are returned because the
queries are not written on resolving encoder.

Besides the encoders, we also need to add availability info to query
set, and use it in compute shader instead.

When resolving query set without any written, we need to reset queries
before resolveQuerySet based on the query set availability on Vulkan.

Added more end2end tests for these cases.


Bug: dawn:645
Change-Id: I09bf1230934aa885587fa4f671925940c1795cd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39740
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2021-02-10 14:01:36 +00:00
Stephen White 02fd17c754 Implement a toggle to disable sample variables.
Sample mask variables and all functionality introduced by GL_OES_sample_variables was not made core until ES 3.2.

Implement a toggle to disable the functionality if not supported by the backend.

Bug: dawn:673
Change-Id: I7a5ec61fb57da343f0f72ffd3b0c69031eaaff8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41142
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-02-10 02:28:17 +00:00
Stephen White 39b478df0c Skip testing of stencil textures where non-readable.
Readback of stencil is not supported on vanilla ES, so we introduce a toggle to disable it. NVidia GLES drivers support NV_stencil_read and NV_depth_stencil_read extensions, so we use those where available.

It turns out ANGLE supports NV_stencil_read but not NV_depth_stencil_read (for reading from the packed depth/stencil buffers which Dawn uses), so that's the extension we check for.

Bug: dawn:667 dawn:634
Change-Id: I136674d3d47fecee2b8b390d5d219bab07e3bb64
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41141
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-10 02:10:08 +00:00
Kai Ninomiya b6b0090b50 Revert "Vulkan: Fallback to XCB for Xlib surfaces"
This reverts commit fb0bf70459.

Reason for revert: Failing build during roll:
https://chromium-review.googlesource.com/c/chromium/src/+/2686267/2

Original change's description:
> Vulkan: Fallback to XCB for Xlib surfaces
>
> Chromium builds the Vulkan loader without support Xlib (because it
> prefers XCB) which caused Xlib wgpu::SwapChain creation to fail on the
> Vulkan backend.
>
> This CL adds a fallback to use VK_KHR_xcb_surface if VK_KHR_xlib_surface
> isn't present.
>
> Bug: dawn:662
> Change-Id: I0e0128ee6b5c75da03998dbae231d17e48bacc81
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41180
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>
> Auto-Submit: Corentin Wallez <cwallez@chromium.org>

TBR=cwallez@chromium.org,jiawei.shao@intel.com,hao.x.li@intel.com,enga@chromium.org

Change-Id: Ia8d2ffb715260b1de490ca04cc76f41bb60b1f61
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:662
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41343
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2021-02-09 23:21:26 +00:00
Austin Eng 4f93a8d47e Dawn wire fuzzer: Fix nullptr dereference
Bug: chromium:1175535, chromium:1175448
Change-Id: I0a13412b43c8d285cf76c774befc98613aedd748
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41243
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-02-09 20:29:23 +00:00
dan sinclair 52e2b90919 Remove the use_tint_inspector toggle.
This CL removes the use_tint_inspector toggle which was deprecated in
favour of the use_tint_generator toggle.

Change-Id: I0d48b0cef4605021e0fcf26b9035faf0da6668f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41241
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-09 20:26:24 +00:00
Corentin Wallez fb0bf70459 Vulkan: Fallback to XCB for Xlib surfaces
Chromium builds the Vulkan loader without support Xlib (because it
prefers XCB) which caused Xlib wgpu::SwapChain creation to fail on the
Vulkan backend.

This CL adds a fallback to use VK_KHR_xcb_surface if VK_KHR_xlib_surface
isn't present.

Bug: dawn:662
Change-Id: I0e0128ee6b5c75da03998dbae231d17e48bacc81
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41180
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-02-09 20:24:42 +00:00
Stephen White b0ca30280a Skip testing of SNORM formats where non-readable.
SNORM textures are non-renderable on vanilla ES, which means they're also
non-readable. Use the EXT_render_snorm extension where available, otherwise
skip the test for now.

Bug: dawn:624 dawn:636 dawn:647 dawn:667
Change-Id: Ic50368032d6168060b6b52889b4ba952ce662f02
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40420
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-09 20:24:04 +00:00
Corentin Wallez 42f28d6914 Fix compilation using CMake on Linux
Bug: None
Change-Id: Ib5049d976eb16c0231516c48c52cde4b0968fd6e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41181
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-09 16:13:51 +00:00
Corentin Wallez ab8e7e5006 Vulkan: VK_EXT_subgroup_size_control should be chained on the stage
Previousl the VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT was
chained on the VkComputePielineCreateInfo when instead it should be
chained on the VkPipelineShaderStageCreateInfo, causing Vulkan
Validation errors.

Fixed: dawn:671
Change-Id: I9cc803a4f9120cf81f4e143818c3be58b73635d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40604
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Hao Li <hao.x.li@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-02-09 11:08:48 +00:00
Stephen White e7e42ebbed Only default ANGLE to swiftshader if envvar empty.
Only set SwiftShader as the default ANGLE backend if the
ANGLE_DEFAULT_PLATFORM environment var is empty. This will allow
devs to set it.

Bug: dawn:447
Change-Id: I49aac4bcb4b0b7c56903eca68248ee22cdf1e6f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-08 21:30:44 +00:00
Bryan Bernhart 2831f05840 D3D12: Log warning if missing SDK layers
Log warning (vs ASSERT) if SDK layers are not installed.

Bug: dawn:460
Change-Id: Idd5266b3d0781b09bda903fa0bc843f6600b2447
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2021-02-06 03:23:05 +00:00
Austin Eng 7fe5aa2eac Remove deprecated Wire APIs
Bug: dawn:565
Change-Id: I577532347c79e64b418a93551027e89910c3ce68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40480
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-02-05 23:36:30 +00:00
Austin Eng 05d9e2cde2 Nuke the ClientMatches hack for same-device validation
The wire now supports more than one device, and Chrome is updated
to use the new code path. This fixes same-device validation for
createReadyPipeline.

Bug: dawn:565
Change-Id: Id05001ed1a7e535690c87f535da6f72a0e794c59
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40460
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-05 21:08:44 +00:00
Corentin Wallez fb2e77106a Remove utils::GetDefaultSamplerDescriptor
This helper is no longer needed now that the descriptor has full
defaults and is even optional in CreateSampler.

Bug: dawn:599
Change-Id: I0d25233ebb1e817ad27f3ddaca988e01e2a5298c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40520
Commit-Queue: Stephen White <senorblanco@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-02-05 20:26:54 +00:00
Bryan Bernhart 14a2398e71 D3D12: Support per plane views with NV12 textures
Adds support for NV12 texture format and per plane view aspects.
Only allows planar sampling of imported DX11 textures. See usage
tests for examples and formats.h for rules.

Bug: dawn:551
Change-Id: I44b89d2c07bb9969638e77ce7c756ef367167f0c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38781
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-05 20:11:24 +00:00
Brandon Jones 2b9707d336 Re-enable Intel D3D12 Validation Tests
Re-enables Intel D3D12 GPU-based validation bots. This comes after the
--enable-backend-validation=partial option was introduced and the bot
configurations were changed to make use of it.

Bug: dawn:598
Change-Id: I9f5c5111340aeefa729e0d2fd26f9f884813eb3a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40481
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-05 00:14:42 +00:00
Stephen White 4846281d36 Don't call glUniform for Storage Texture on OpenGL ES.
Change-Id: I8595fb2c89e45819995748e502b800fb88605f44
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40341
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-04 22:17:52 +00:00
Austin Eng a75b230acf Reject callbacks if the device is destroyed before completion
Callbacks should all reject instead of waiting for the device
to idle on shutdown.

Bug: dawn:652
Change-Id: Id4a9ab2560aa34b8ea574271f61f8a499e15ab3a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40360
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-04 20:38:02 +00:00
Brandon Jones bdbf98afca Add Backend Validation Levels Option to Dawn Tests
Refactors DawnTest's backend validation options to use an enum, as well
as adds the 'partial' option enable backend validation with a
reduced performance overhead to address TDR issues on the bots.

Bug: dawn:598
Change-Id: I759eff03bd117f1f20ad82aa2b71a87834f42b1d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40000
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-02-04 19:32:12 +00:00
Austin Eng ef369b9ffc Fix GetMappedRange unittests on the wire
The tests should wait till the MapAsync operation is complete
before calling GetMappedRange.

Bug: dawn:651
Change-Id: Iec001efaa3c3b76704dc4d926e91d1b1c58901bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40303
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-04 16:10:52 +00:00
Corentin Wallez 6d315daa5d Device: Deprecated GetDefaultQueue in favor of ::GetQueue()
Bug: dawn:22

Change-Id: I103ea933ca5b93f20d8bf11c6671bd9f603d8ff3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40061
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-02-04 15:33:42 +00:00
Hao Li d5a0728b67 Add end2end tests for noop direct and indirect dispatches
- Add more end2end tests for direct and indirect dispatches, including
0x0x0, 0xNxM, Nx0xM, NxMx0
- For direct dispatch, they will cause system crash on Metal backend.

Bug: dawn:640
Change-Id: I77a4bee87df89857b05b713de8d78b0cb1f0ca50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39520
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2021-02-04 03:57:31 +00:00
Hao Li 5ab1ed7e1e Skip noop dispatch in front-end
Workaround for Metal becuase system crashes on 0 dispatches.

Bug: dawn:640
Change-Id: I5bd33b22242ddc31816a16acb019ce2f552808bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39521
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-04 03:10:03 +00:00
Austin Eng 623d80899b Add a Reserved state for dawn_wire ObjectId allocations
Functions like CreateReadyRenderPipeline reserve an
ObjectId for the pipeline created but the Id can not be
used until the callback is called successfully.

Bug: chromium:1172774, chromium:1172775
Change-Id: I145c0f033a2bde7957d15da2da8b9b19c6520ceb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39840
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-03 23:29:43 +00:00
Ryan Harrison 59024a62f6 Re-enable Mac ShaderTests
Issues with log2 on Metal/Intel were actually due to floating point
precision not being guaranteed and the tests not accounting to that.
This has been corrected.

BUG=dawn:663

Change-Id: I401d22898e69ea6b3f96f3d2c57a28b1dc682ed5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40243
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-03 20:26:13 +00:00
Ryan Harrison 88f0ba4e26 Update ComputeLog2 to be more valid
Per https://bugs.chromium.org/p/dawn/issues/detail?id=663#c6 and
https://bugs.chromium.org/p/dawn/issues/detail?id=663#c7

BUG=dawn:663

Change-Id: Id2c0dbd4b029be30691f450af0454b442856c2ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40242
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-02-03 19:42:07 +00:00
Austin Eng c00bc90b7c Always output the wire trace with the injected error format
The fuzzers will be updated to always expect this format. If
the fuzzer doesn't do error injection, it will simply skip
these bytes.

Bug: dawn:629
Change-Id: I894e95ce9c1048eda81593219f7fc5d91e123392
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40121
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-02-03 19:25:02 +00:00
Stephen White 040f140e5f Fix SwANGLE DeviceType and OpenGL ES DeviceType checking.
OpenGL ES drivers (like OpenGL drivers) have DeviceType::Unknown.
We want to allow testing of unknown native GLES drivers,
as we do for GL drivers, so add them to the conditional.

NOTE: this change will enable the OpenGLES backend to run tests on
the CQ and waterfall bots.

Mark SwANGLE as a "CPU" adapter type, rather than unknown, since we
don't want to test it by default.

Difference from https://dawn-review.googlesource.com/c/dawn/+/39920:
Skip EntryPointTests.FragAndVertexSameModule on OpenGL ES.

Bug:dawn:580 dawn:447 dawn:661
Change-Id: I6eafbcf9c45cd8ba6c9c2b906fba7b1b147600df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40260
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-03 17:36:29 +00:00
Ryan Harrison 474680c5c6 Add ComputeLog2 test
BUG=chromium:1046622

Change-Id: Ic554190ed95efbd555472db95cbbd9aed66a950d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39961
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
2021-02-03 16:57:19 +00:00
Yunchao He 1b9bcfc47d Implement 3D textures and views creation on Vulkan/Metal/GL
Bug: dawn:547
Change-Id: I1f800f69d8ecfef5a7cfe9c19c320ea78296c58d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40120
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-02-03 16:36:59 +00:00
Stephen White f2a003d4e9 Revert "Fix SwANGLE DeviceType and OpenGL ES DeviceType checking."
This reverts commit 9bb02dbbc6.

Reason for revert: breaking the Dawn roll into Chrome: https://ci.chromium.org/ui/p/chromium/builders/try/dawn-linux-x64-deps-rel/12478/overview

Original change's description:
> Fix SwANGLE DeviceType and OpenGL ES DeviceType checking.
>
> OpenGL ES drivers (like OpenGL drivers) have DeviceType::Unknown.
> We want to allow testing of unknown native GLES drivers,
> as we do for GL drivers, so add them to the conditional.
>
> NOTE: this change will enable the OpenGLES backend to run tests on
> the CQ and waterfall bots.
>
> Mark SwANGLE as a "CPU" adapter type, rather than unknown, since we
> don't want to test it by default.
>
> Bug:dawn:580 dawn:447 dawn:661
> Change-Id: I21577cb9d1fdec53704433a5db1fe2603bdbeb6d
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39920
> Reviewed-by: Austin Eng <enga@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Stephen White <senorblanco@chromium.org>

TBR=cwallez@chromium.org,senorblanco@chromium.org,enga@chromium.org

Change-Id: I7e454f1da23faa4cfa0cfe737c0d318ecca2bcd8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:580 dawn:447 dawn:661
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40240
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-03 15:06:30 +00:00
Stephen White 9bb02dbbc6 Fix SwANGLE DeviceType and OpenGL ES DeviceType checking.
OpenGL ES drivers (like OpenGL drivers) have DeviceType::Unknown.
We want to allow testing of unknown native GLES drivers,
as we do for GL drivers, so add them to the conditional.

NOTE: this change will enable the OpenGLES backend to run tests on
the CQ and waterfall bots.

Mark SwANGLE as a "CPU" adapter type, rather than unknown, since we
don't want to test it by default.

Bug:dawn:580 dawn:447 dawn:661
Change-Id: I21577cb9d1fdec53704433a5db1fe2603bdbeb6d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39920
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-03 13:02:09 +00:00
Ryan Harrison fd5fd05db0 Enable EntryPointTests
Tint now produces SPIRV that is sufficient for these tests to pass, so
re-enabling them.

The multiple entry point problem for HLSL mentioned in one of the other
skip statements appears to still be a KI, so not removing it.

Change-Id: I47005c815dc3cb9093d293e71caa3152c11bf0ac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39100
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-02 22:01:40 +00:00
Yunchao He 04242a063e Implement 3D textures and views creation on D3D12 backend
This change also adds a very simple end2end test to verify that
we can create 3D textures and views. But we can't do anything
with them (like copy, sampling, rendering, etc) currently.

I will implement 3d textures and views creation on other backend
in one patch if the simple end2end test is OK.

Bug: dawn:547
Change-Id: I1662458de563cc4b47040a8bc3e94d7a8e0109e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39843
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-02-02 18:45:50 +00:00
Ben Clayton 401aad5878 Simplify tint API usage
A whole lot of public API tint changes have been made to simplify usage of the library.
Big changes include:
* Type determination is now implicit
* Generators no longer take ownership of programs, so they don't need to be cloned.

Change-Id: Icac0956ae120ae4e6a9d0290b2478c0fbc3bcf22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39341
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-02 15:38:39 +00:00
Corentin Wallez 199ba447c5 Revert "Suppress RenderPipelineValidationTest.VertexAttribCorrectEntryPoint"
This reverts commit 1b5526457f.

Reason for revert: Tint issue was fixed.

Original change's description:
> Suppress RenderPipelineValidationTest.VertexAttribCorrectEntryPoint
>
> This is failing in the roll of Tint in Dawn because Tint generates
> invalid SPIR-V. This CL suppresses the failure so as to unblock the
> roll.
>
> TBR=enga@chromium.org
> Bug: tint:468
> Change-Id: I2a66fc9a6a9e37098651a0f5cd72d41ecf993a72
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39761
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>

TBR=cwallez@chromium.org,enga@chromium.org,bclayton@google.com

Change-Id: I6da08abf44ca9967f51ae535561e8101c31de8f7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: tint:468
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40060
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-02-02 11:06:11 +00:00
Hao Li d11f4c3d05 Query API: Non-precise occlusion query on Metal
- Add occlusionQuerySet to BeginRenderPassCmd
- Implement BeginOcclusionQuery/EndOcclusionQuery on Metal
- Enable occlusion end2end tests on Metal

Bug: dawn:434
Change-Id: I6c6ed74c77eb7e66f21fc5b8aa97b80eddb1111f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38784
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-02 05:30:50 +00:00
Austin Eng 9a2174a37c Pass the buffer size into DeserializeWGPUDeviceProperties
This allows deserialization to fail if the buffer is not large enough.
Before, we simply assumed the buffer was at least the size of
WGPUDeviceProperties.

Bug: none
Change-Id: I24e1f84c583f48d4e32c35276e5508e257e9f530
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39861
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-02 04:20:09 +00:00
Hao Li 387a597154 Query API: Non-precise occlusion query on Vulkan
- Implement BeginOcclusionQuery/EndOcclusionQuery on Vulkan
- Add compute pipeline to convert non-zero values to 1.

Bug: dawn:434
Change-Id: Ie0238078dfd26334caf36d23ded1d7742dd829a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38221
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2021-02-02 02:38:59 +00:00
Stephen White 71b811b4c9 SkipOpArrayLength.Vertex on all GLES.
This is also failing on Intel (see
https://ci.chromium.org/ui/p/chromium/builders/try/linux-dawn-rel/6628/overview);
generalizing to all GLES.

Bug: dawn:197 dawn:447
Change-Id: I0d26c0fbbccff0da3639df0473f515355775e480
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39922
Commit-Queue: Stephen White <senorblanco@chromium.org>
Auto-Submit: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-01 21:40:28 +00:00
dan sinclair 9023389969 Remove use_tint_inspector flag usage.
The use_tint_inspector and use_tint_generator flags are being merged.
Remove new usages of use_tint_inspector.

Change-Id: I6837d18c0ee79dc8f81ed6949666c3b7e93dcaf2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39960
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-02-01 21:07:48 +00:00
Stephen White 91e737b8f1 Moar testing on OpenGL ES backend.
This CL enables the GLES backend on most the remaining tests for which
the desktop OpenGL backend is enabled.

Skip tests which require glTextureView().
Don't enable NonzeroTextureCreationTests; all are failing.
Skip ANGLE failures on NonRenderableTextureClear*.

Bug: dawn:580, dawn:447
Change-Id: Iac24a3ff89712c0d3bb2ae41455a6e55a6c3a2c8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39921
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-01 20:00:28 +00:00
Yunchao He a32954a4d2 Add validation rules for 3D texture view
3D texture view's baseArrayLayer must be 0, and its arrayLayerCount
must be 1. In addition, 2D/2DArray/Cube/CubeArray (and 1D) views
upon 3D textures are not allowed.

Other behaviors for 3D texture views like default values are similar
to 2D/2DArray views.

This change also adds a test for aspect test against color format for
completeness, in addition to the existing depth/stencil formats.

Bug: dawn:558
Change-Id: I4f5d095b85c9b81e6f41497f1c8a54b569c210bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39600
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
2021-02-01 19:55:58 +00:00
Stephen White fbaa306056 Skip OpArrayLengthTest.Vertex on ANGLE.
Bug: dawn:197 dawn:447
Change-Id: I75e13530d6568e03df97b032517c3fe56d84f0fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39941
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-02-01 19:17:28 +00:00
Austin Eng 65a903bf75 dawn_wire: Gracefully handle all invalid and unknown sTypes
This CL makes the wire gracefully handle all invalid and unknown
sTypes. All unknown sType structs are serialized and deserialized
as the base WGPUChainedStruct with sType Invalid.

Bug: dawn:369, dawn:654
Change-Id: Ia2571df81fc96e2c672d3ea13c03237a2d5fa5c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39460
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-02-01 16:48:18 +00:00
Corentin Wallez 07987ede36 dawn_native: Turn the DisallowUnsafeAPIs toggle on by default.
Bug: chromium:1138528
Change-Id: Iaad55e6776f3e6abcc0983ad05a1f76b0482e14c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39504
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-02-01 16:22:08 +00:00
Corentin Wallez 1b5526457f Suppress RenderPipelineValidationTest.VertexAttribCorrectEntryPoint
This is failing in the roll of Tint in Dawn because Tint generates
invalid SPIR-V. This CL suppresses the failure so as to unblock the
roll.

TBR=enga@chromium.org
Bug: tint:468
Change-Id: I2a66fc9a6a9e37098651a0f5cd72d41ecf993a72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39761
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-02-01 16:20:58 +00:00
Stephen White d7aacdda11 Set the default ANGLE backend to SwiftShader for dawn tests.
This will apply to the bots (once they're running the ES backend) as well as developer builds.

Bug: dawn:580 dawn:447
Change-Id: I0cb7864c094d6bbd636f91734ca299de51a9f0e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39420
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-29 22:39:45 +00:00
Corentin Wallez fc441f97fc Make wgpu::BindGroupLayoutEntry extensible
Bug: dawn:22
Change-Id: Ifce24a0b19fb8d3acb6ac8ab32f3f3e22a248b3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39340
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-29 19:08:15 +00:00
Stephan Hartmann ec53444839 GCC: fix name clash cause of multiple BindingInfo definitions
BindingInfo is declared in BindingInfo.h. However,
ShaderModule.h declares an alias BindingInfo in EntryPointMetadata.
This confuses GCC. Rename the alias to BindingInfoArray.

Bug: chromium:819294
Change-Id: Ia43c9eb8d793a3078faa6340980017236a6adbb3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39502
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-01-29 14:42:54 +00:00
Corentin Wallez 0859e6b1d2 Add missing include for MSVC
std::replace used in WireHelper is in <algorithm>

TBR=enga@chromium.org
Bug: dawn:602
Change-Id: Id618a19e72d5b54701c913470d0f584ce0fa2bec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39501
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-01-29 12:50:36 +00:00
Austin Eng 7aba08e69b Skip validation tests failing with the wire
Bug: dawn:654
Change-Id: Ieeb9a34f3a6ff354107fa65ca496204bb0775129
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39400
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-01-28 21:20:36 +00:00
Stephen White 1b42ad94ba Revert "Moar testing on OpenGL ES backend."
This reverts commit 7bfb3ed2c6.

Reason for revert: Still failing some zero init tests

Original change's description:
> Moar testing on OpenGL ES backend.
>
> This CL enables the GLES backend on all the remaining tests for which
> the desktop OpenGL backend is enabled.
>
> Bug: dawn:580
> Change-Id: Iab0d13299d58d17749a3405d25d27da7ba4077fa
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39320
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Stephen White <senorblanco@chromium.org>

TBR=cwallez@chromium.org,senorblanco@chromium.org,enga@chromium.org

Change-Id: I37bb1438107151f11617e67287fe9f5e0e22fd21
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:580
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39361
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-28 21:11:17 +00:00
Yunchao He 54d0d43e58 Add texture creation validation rules for 3D texture
In order to support 3D texture, new validation rules are added:
- to say that multisample 3D texture is not supported.
- to distinguish 3D texture from 2D array texture via texture type,
  and its impact on max values of size.depth, mipmap levels,
  array layer count, etc.
- to say that 3D compressed texture is not supported.

This change also adds validation tests for zero-sized textures,
in addition to validation tests for the validation rules above.

Bug: dawn:558
Change-Id: Ib7d398fdab49a702eaa798f6353639d3721747e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/34922
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-28 20:37:01 +00:00
Stephen White 7bfb3ed2c6 Moar testing on OpenGL ES backend.
This CL enables the GLES backend on all the remaining tests for which
the desktop OpenGL backend is enabled.

Bug: dawn:580
Change-Id: Iab0d13299d58d17749a3405d25d27da7ba4077fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39320
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-28 19:19:36 +00:00
Stephen White f1e81a87c8 Remove glPixelStore GL_PACK_IMAGE_HEIGHT calls.
This enum is unsupported in OpenGL ES. If this is actually a problem
for WebGPU, we may need to add validation for WebGPU-compat to prevent
reading from a texture to a buffer with a different image stride. I'm not sure
if that's currently possible, and it doesn't seem to be covered by tests.

Change-Id: Ia39d0dae122acfba3c663ae5956a981a0acb5e07
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38740
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-28 19:15:55 +00:00
Ryan Harrison 0228625411 Enable OpArrayLengthTests
arrayLength is well enough supported in Tint that these tests now
pass.

BUG=tint:252

Change-Id: I5d8f00d8ae651a2e075ef33b88a8c4df56895ce8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39140
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
2021-01-28 18:05:46 +00:00
Stephen White 44fef9a928 Don't enable GL_FRAMEBUFFER_SRGB on OpenGL ES.
This enum value is not supported, but the functionality is implied.
Silences a GL error from ANGLE.

Change-Id: Ib3eb242c53d548f7b9648f7037c3178705cbaecd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38800
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-28 15:21:15 +00:00
dan sinclair dc25c98727 Combine tint toggles.
This CL combines the use tint inspector and use tint generator toggles.

Change-Id: Idcfe0ffa1ddbdf0e240dd8d502d0a164018a6e1b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39142
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-28 15:02:35 +00:00
Corentin Wallez 05045e0ad8 dawn_native: Do CommandBufferStateTracker validation at encoding time
This is the last piece of validation that was done in a separate
validation pass so the validation pass is removed.

Bug: dawn:635
Change-Id: I91ce5d5a512ac188f3dd56c90db9e69aee518844
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38845
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-28 14:44:15 +00:00
Kai Ninomiya 57fcd17625 Fix translation of storeOp "clear" on Metal
Previously, resolve was not performed if storeOp was "clear".
Resolve should occur iff a resolveTarget is provided, regardless of
storeOp - storeOp only controls the regular render target.

Test: webgpu:api,operation,render_pass,resolve:render_pass_resolve:*
Test: MultisampledRenderingTest.ResolveInto2DTexture
Bug: dawn:650
Change-Id: Ibeae984be7f82680f182246fabc6ca9a4e1af176
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38880
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-28 07:03:45 +00:00
Stephen White a194a48ba2 Implement depth/stencil texture-to-texture copies for OpenGL ES 3.1.
Bug: dawn:634
Change-Id: I30f0c1496e5443bda9bee1905162eae39ce2461c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38940
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-27 23:58:35 +00:00
Austin Eng 78440d66f3 Update the validation tests to use utils::WireHelper
This enables running the validation uses using the wire with
the command line flag --use-wire

Bug: dawn:654
Change-Id: I17a642a132c8b6321195ec6869e5f86aebdd1c51
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38620
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-01-27 23:02:24 +00:00
Ryan Harrison e37a4b067a Enable ViewportOrientationTests
The blocking issue in Tint has been resolved.

BUG=tint:398

Change-Id: I388b0f818ccba6300c52064a2374d7dde1e72a42
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39141
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-27 22:56:54 +00:00
Austin Eng e58d5a36e1 Factor utils::WireHelper out of DawnTest
This utility will be used to run tests on the wire in both the
end2end tests and the unit tests.

Bug: dawn:654
Change-Id: I5ac0b2385efe32ee1c4af033b01198f890c0f7dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38500
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-01-27 22:54:04 +00:00
Ryan Harrison d7451857dd Update/enable tests in VertexStateTests
One test has the blocking issue updated to what is currently causing
the failure, and another is passing now, so can be fully enabled.

BUG=tint:114,tint:398

Change-Id: I1735349bdff6f0c36990358b43b17df9c2175970
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39180
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-27 22:20:04 +00:00
Ryan Harrison b033c9da8e Enable tests in GpuMemorySynchronizationTests.cpp
The blocking issues in Tint for the tests in this file have been
resolved, so they can be re-enabled.

There is one outstanding TODO related to Tint in the file about
re-writting one of the shaders, which the root issue for is still
open.

BUG=tint:398

Change-Id: Ia173a33d7ea88b6355dff8b02fd8394f2fa61fd7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39120
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-27 22:15:14 +00:00
dan sinclair aae37c2ea3 More WGSL syntax updates
This CL updates more #'s to //'s and a missing set to group.

Change-Id: If417ed019319ed760e3b672770397857c6dfc40c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39065
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-01-27 21:27:54 +00:00
Ryan Harrison e6f58411a9 Enable DepthStencilSamplingTest tests
These tests now pass, since their blocking issue in Tint has been
resolved.

BUG=tint:398

Change-Id: I628bf2be132d2a671ef832951a4798c3c6fef9cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39066
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-27 21:08:04 +00:00
Ryan Harrison 947adcbaaa Enable CreateReadyPipelineTests that now pass
The blocking issue in Tint for these tests has been fixed.

BUG=tint:398

Change-Id: I54715730bdac0de01c5aab47a6559257987943e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39080
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-27 20:02:54 +00:00
Ryan Harrison f3744fb4e7 Update BufferZeroInitTests for Tint current status
Enables a number of tests that were disabled, due to lack of support
in Tint.
Updates the guards on others to be more accurate.

BUG=tint:398,tint:375

Change-Id: I29d56e53862b6274a2d8a19cbf8315c3a687e16a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39063
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-27 19:19:54 +00:00
Corentin Wallez c57be50d9c dawn_native: Make executeBundle of 0 bundles clear state
This was changed in WebGPU to make the behavior more consistent. See
https://github.com/gpuweb/gpuweb/pull/1373

Bug:
Change-Id: Icd5f6964a8bc58fdebe7c1a79d4353e6a1a52231
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38844
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-01-27 18:41:44 +00:00
Ryan Harrison a28c44bf36 Add comment about another KI with BindGroupTests.ReusedUBO
Bug=tint:463

Change-Id: I6d8787b9bac726e1a987581dc8e9268be70d6e98
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39060
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-27 18:37:54 +00:00
Stephen White eb7108c059 Make the OpenGL and OpenGL ES test windows invisible.
It's annoying to have four windows pop up during end2end test runs
(and potentially steal focus). It would be nice to hide them.

Bug: dawn:656

Change-Id: Ifcee65373e00d703bef308aecf1f85d696caa9dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38640
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-27 17:22:44 +00:00
Corentin Wallez 95ff834028 dawn_native: Do attachment state validation at encoding time.
The overarching goal with this CL is to do validation at encoding time
which will help produce SyncScopeResourceUsage in the frontend for
dispatch() calls so that they can be reused by the backends.

Bug: dawn:635
Change-Id: Ifb8b7883abe18089dc3d632baebbcc79b3f324f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38843
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-01-27 17:20:16 +00:00
Corentin Wallez 7ffaa219cb dawn_native: Do debug marker validation at encoding time.
This also adds missing coverage for push/pop debug group in render
bundles. The RenderBundleEncoder didn't validate itself on Finish, so
add a regression test for that too.

The overarching goal with this CL is to do validation at encoding time
which will help produce SyncScopeResourceUsage in the frontend for
dispatch() calls so that they can be reused by the backends.

Bug: dawn:635
Change-Id: Ie5a2d987fda3854b3145ba4b7a34994ea605e820
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38842
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-01-27 16:03:32 +00:00
Corentin Wallez c1d3a66bd2 Immediately call fence and map callbacks on device loss.
This is more in line with what happens in dawn_wire and Blink's WebGPU
implementation. It also allows fixing the Fence-related DeviceLost tests
to destroy the mock fence callback on destruction, which in turns fixes
a crash on dawn_end2end_tests exit on MSVC x64 debug.

Bug: dawn:602

Change-Id: I277e7fa284a573854ed46576602d5f6819db1357
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38526
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-27 15:54:12 +00:00
Ryan Harrison 2df77f4325 Removing old WebGPU SPIR-V behaviour test
This test is attempting to confirm that behaviour from the SPIR-V
WebGPU execution environment will occur. Given that the implementation
of this spec has been removed from SPIRV-Tools and Tint handles this
gracefully, the test will never succeed.

Bug=dawn:57

Change-Id: I0ee071c87a79947cbb63bcc816a7ab1314419b5e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38900
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-01-26 21:52:45 +00:00
dan sinclair 0768cca229 Fixup texture type name.
This CL updates the sampled texture to use the shorter name variant.

Change-Id: Ifb945638ce5ea7db4a23640bd9e79b010d15a1fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38827
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
2021-01-26 21:10:35 +00:00
Stephen White 9806dc6de9 Skip StorageTextureTests.WriteonlyStorageTextureIn*Shader on OpenGL ES.
Bug: dawn:647 dawn:580
Change-Id: I0e31482eba31409711c2465943f8a41f33096ada
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38821
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-26 18:03:01 +00:00
Stephen White 8f0e6ce926 Skip SamplerFilterAnisotropicTest.SlantedPlaneMipmap on OpenGL ES.
Bug: dawn:648
Change-Id: I2f9c110bbe0041c881362cb2a40c4cdcf9b7b6af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38822
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-26 15:45:11 +00:00
Stephen White 032500baa3 Skip failing MultipleWriteThenMultipleReadTests.OneBuffer on OpenGL ES.
Bug: dawn:580 dawn:646
Change-Id: Id8238ab041b6bd969945d6581a1fd2808daf2cdc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38820
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-26 15:01:18 +00:00
Stephen White f9582c8aa5 Skip failing TextureFormat tests on SwANGLE.
Same underlying failure as SwiftShader.

Bug: dawn:580 dawn:147
Change-Id: I57c88ce6afaf7014f3cd4487b04ddab93b248d15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38783
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-26 13:05:14 +00:00
Stephen White d27ed11d0b Fix glFramebufferTextureLayer warnings generated by ANGLE
We shouldn't be using glFramebufferTextureLayer on 2D textures.
Also, the "attachment" was wrong (GL_COLOR vs GL_COLOR_ATTACHMENT0).

BUG: dawn:447

Change-Id: I1e47dfc4e8e88d70d9a1e6585b5d138b82ed3cfe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38782
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-26 12:57:58 +00:00
Stephen White 0315c43517 Skip failing multisampling tests on SwANGLE.
Bug: dawn:580, dawn:644
Change-Id: I46d0baa308e2362f1c3c439b941138448c9f02a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38780
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-26 12:53:38 +00:00
Ben Clayton e0feccacaf Migrate from tint::ast::Module to tint::Program
Depends on: https://dawn-review.googlesource.com/c/tint/+/38556

Bug: tint:390
Change-Id: I12104d80370ddc1a3277770ca051cbd0992b758e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38522
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-26 12:24:48 +00:00
shrekshao b3177d418e Make SamplerDescriptor optional in CreateSampler
Use default SamplerDescriptor if not descriptor is passed in.
Change some createSampler calls to pass nothing in for testing.
The default values for SamplerDescriptor and that from
utils::GetDefaultSamplerDescriptor are different so we may still want to
keep it.

Bug: dawn:599
Change-Id: Ie75d9e1fde608cb19049b50f4613be63802c8719
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38621
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-01-26 02:22:58 +00:00
Stephen White 2a799fe3bf Enable all the tests which were blocked on WriteTexture.
Bug: dawn:483 dawn:643
Change-Id: Id6b6f0d1ff039eda3156bc371e6c722b3c72ac96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38580
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-25 19:42:18 +00:00
Stephen White 988f3daf6e Implement WriteTexture for OpenGL and OpenGL ES.
Bug: dawn:483, dawn:580
Change-Id: I83434211f25372f96b0babe6fbb851d7f114065c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37981
Commit-Queue: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-25 18:16:48 +00:00
Austin Eng 4d66fb2d61 dawn_wire: Implement device-related callbacks for multiple devices
Bug: dawn:565
Change-Id: Ic80a3bc1bbfd479af04e77afa0eb3f4ca3387ecd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38282
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-01-25 08:38:47 +00:00
Corentin Wallez f1f8394de0 dawn_native: Skip more validation if it is disabled.
Also cache the boolean for IsValidationEnabled in the
ProgrammablePassEncoder.

Bug: dawn:635
Change-Id: I5f095d003d28b84eacbc488a7f8f3c346c646187
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38521
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-23 00:07:46 +00:00
Corentin Wallez 045bb95973 Do not track global texture usage in PassResourceUsage.
The global resource usage was used for two things:
 - Validating that the texture had the required usage, but this was
removed in a previous commit in favor of checking the texture's usage at
the encoding entrypoint.
 - Skipping laz-clearing of the texture if it was used as
RenderAttachment. This was incorrect and would skip clearing of all of
the texture's subresource as long as one of them was used as
RenderAttachment.

This commit make PassTextureUsage exactly a
SubresourceStorage<TextureUsage> and fixes the logic for skipping
the clearing or RenderAttachment. It also adds a regression test for the
lazy clearing fix.

Bug: dawn:635
Change-Id: I5d984febb3e5a5f9ae15b632cac68e294555c4e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38382
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-01-22 19:53:46 +00:00
Corentin Wallez 49a1f72a4f Rename leftover references of output attachment to render attachment.
The CL doing the renaming didn't handle comments and the one string
where "output attachment" appeared.

Bug: None
Change-Id: Ie57159da8278970097271fa5706573444bcdaf61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38383
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-01-22 19:51:37 +00:00
Corentin Wallez 2c32fa6476 Make ComboVertexStateDescriptor non-copyable non-movable.
The VertexState tests were failing on MSVC debug x64 because the
ComboVertexStateDescriptor was copied but internal pointer to
itself weren't updated. This commit makes the structure non-movable and
non-copyable so the problem doesn't happen in the future and fixes
compilation errors.

Bug: dawn:602
Change-Id: Idd3a68933920eb47939217362e9e137dd7581014
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38400
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-01-22 17:51:45 +00:00
Austin Eng db1572102b d3d12/vulkan: Skip descriptor update/creation if resource is destroyed
Validation of resource destroy state does not happen on bind group
creation. It happens on queue submit. This means the Vulkan and D3D12
backends need to gracefully handle BindGroup creation with destroyed
resources by skipping the descriptor creation if the resource has
been destroyed.

Bug: dawn:319
Change-Id: I270afba86d1a961e1e4c39f2419d8c34ff889e46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38440
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-01-22 17:10:36 +00:00
Corentin Wallez 72cd1a5e89 dawn_native: Move beginRenderPass texture usage validation into the encoder
In a future CL the PassResourceUsage structure will become a
SyncScopeResourceUsage and will be used to validate at each
synchronization scope. For separation of concerns, the validation that
resource have the correct usage shouldn't be done at the sync scope
level but at each entrypoint that uses the resource.

The validation tests had missing coverage of usage validation for
BeginRenderPass so validation tests are added. (Storage and Sampled
are validated at bindgroup creation and already had validation tests)

Bug: dawn:635
Change-Id: I36488c2d0222c4799476adf06c1c734989b1a158
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38381
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-01-22 11:31:08 +00:00
Corentin Wallez 7479128589 Remove QueueWriteBufferTests.ManyWriteBuffer on Intel Vulkan
This issue has been fixed in the Mesa version that's on the bots.

TBR=enga@chromium.org
Bug: chromium:980737
Change-Id: I5e6ec58344fb065c12ba0ca6a3cad1468dd7df11
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38520
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-01-22 10:13:07 +00:00
Corentin Wallez 310d86f4a0 dawn_native: Move pass validation of buffer usages into the encoder.
In a future CL the PassResourceUsage structure will become a
SyncScopeResourceUsage and will be used to validate at each
synchronization scope. For separation of concerns, the validation that
resource have the correct usage shouldn't be done at the sync scope
level but at each entrypoint that uses the resource.

The validation tests had no coverage of usage validation for pass usage
so validation tests are added for Indirct/Index/Vertex usages. (Uniform
and Storage are validated at bindgroup creation and already had
validation tests)

Bug: dawn:635
Change-Id: I5058ad30eb041809f0f60d9403f3cc2d5d7e7c96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38380
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-01-22 09:57:38 +00:00
Jiawei Shao db383498c5 Allow using DepthOnly aspect on the depth-only formats in T2T copies
This patch allows the use of DepthOnly as the parameter 'aspect' in the
command CopyTextureToTexture() on the depth-only formats (Depth24Plus
and Depth32Float) to match the latest WebGPU SPEC.

BUG=dawn:439
TEST=dawn_unittests

Change-Id: I73c4055bb0a90bed2b5751ce9dff5b319787efca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38340
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-22 01:36:43 +00:00
Austin Eng 45ce1fda88 dawn_wire: Add an API to reclaim reserved devices and textures
Dawn Wire has a way to reserve an ID and generation on the client side,
but if these reservations are never injected on the server, then
it will be impossible to reclaim the in-use ObjectIDs.

Bug: dawn:565
Change-Id: I751fce237c881e8cbdeaba18ad0ec1e124bd7ac2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38281
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-01-22 00:25:05 +00:00
Austin Eng cef68bc8b7 dawn_wire: Fix a bug with multiple injected devices
Device child objects were storing an *unstable* pointer to device
specific tracking information. Fix this by moving the tracking
information to a stable heap allocation.

Bug: dawn:565
Change-Id: I00ad72563ac66e29314603e77698718953fcbf15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38280
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-21 23:15:43 +00:00
Ryan Harrison 001b499275 Adding stage input/output reflection to inspector path
BUG=dawn:578

Change-Id: I15d0c9df81c606ea0def1a2d3fc550224f7dcfd8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38320
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-01-21 16:17:31 +00:00
dan sinclair c2032ea637 Update vertex index decoration names.
This Cl updates the `vertex_idx` to the new `vertex_index` decoration
name.

Change-Id: Ic3688e1af87ed0d570b00ccb72d0e84ac920831b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38142
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-21 15:41:20 +00:00
Corentin Wallez 534517ca63 Vulkan: Enable barrier validation using VK_EXT_validation_features.
This found a couple issues with readonly storage textures and buffers
and will prevent regression in the correctness of barriers in the Vulkan
backend.

Bug: dawn:635

Change-Id: I99f77134eff62c466d010c4f301f7e79de0b4977
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38021
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-21 14:44:20 +00:00
Ben Clayton 7b615af00c TextureFormatUtils: Remove unused functions
GetColorTextureComponent[GLSL,WGSL]TypePrefix() are no longer used.

And also move the two remaining WGSL functions together, and rename for consistency's sake.

Change-Id: If70f195b7185fca9337ec5c12c74efa25ae6ce4c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37901
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-21 14:18:19 +00:00
Ben Clayton 88f7f580bc Convert StorageTextureValidationTests to WGSL
Bug: tint:140
Bug: tint:368
Change-Id: I6593e40db5db4058bf6fdf3303ec7e99c0a3df12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37900
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-21 14:16:09 +00:00
Corentin Wallez 2231fcda56 Vulkan: Add support for layer extensions.
This commit generalizes the way layers are handled to be more like
extensions, and adds support for gathering and enabling layer
extensions.

This is in preparation for using the VK_EXT_validation_features
extension to enable barrier validation.

Also adds logic to use the Fuchsia swapchain layer when it is available.
It seems to have been removed by mistake some time ago.

Bug: dawn:635

Change-Id: I8e5776d546ddd7940238465c7b0f187d8dd3c5bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38104
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-21 13:47:19 +00:00
Corentin Wallez e10e6b0db8 Vulkan: Fix layout of Sampled+ROStorage texture.
Vulkan requires that storage images be in the GENERAL layout, and requires
that we choose a layout at VkDescriptorSet creation. This means that
since Sampled+ROStorage texture may sometimes be used as both usages in
the same pass, they must always be in the GENERAL layout even for
SampledTexture bindings.

Fix this by looking at the texture's creation usage in VulkanImageLayout
for wgpu::TextureUsage::Sampled.

Also add a regression test that triggers a Vulkan Validation Layer error
without this fix.

Bug: dawn:635

Change-Id: I4a5b94e1af20839b3b8cc080d36fca59d79f09bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38107
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-21 12:44:09 +00:00
Corentin Wallez f091fb71f7 Vulkan: Use ityp::bitset for Instance/DeviceExtSet
ityp::bitset allows the creation of a bitset indexed by enums. Use this
instead of our custom wrapper around bitset that only supports .Set and
.Has.

Bug: dawn:635
Change-Id: I6680feb9b1741648d974cf1cef48cb1863aa20af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38103
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-01-21 12:12:59 +00:00
Corentin Wallez ef869c2d01 Use SubresourceStorage to track per-subresource state.
Using this container is a small performance regression in the simple
cases where all subresources are the same, or when the texture has few
subrsources. However it give better performance in the hard subresource
tracking cases of textures with many subresources.

Using SubresourceStorage also makes it easier to work with compressed
storage since the compression is mostly transparent. It reduces code
duplication and prevent bugs from appearing when a developer would
forget to handle compression.

This fixes a state tracking issue in ValidatePassResourceUsage where the
function didn't correctly handle the case where the PassResourceUsage
was compressed.

Also removes the unused vulkan::Texture::TransitionFullUsage.

Also makes SubresourceStorage<T> only require operator== on T and not
operator !=.

Also fixes the texture format's aspect being used to create pipeline
barriers instead of the range's aspects.

Bug: dawn:441

Change-Id: I234b8191f39a09b541c1c63a60cccd6cee970550
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37706
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-01-21 11:07:44 +00:00
Corentin Wallez 738aa17493 EnumMaskIterator: ASSERT when the mask is too big.
This will catch errors when someone updates an enum used with
EnumMaskIterator without updating EnumBitmaskSize. Previously it would
just ignore the extra bits, which produced super confusing bugs.

Bug: dawn:635
Change-Id: Ib0bf3f252db317a1bfdeb687b2426801a79b524d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38260
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-01-21 10:11:54 +00:00
Corentin Wallez 762814bd92 ityp_array: Allow using a T whose underlying type is signed.
When trying to use ityp_array with an enum class whose underlying
type is int, warnings were fired because of a comparison between signed
and unsigned integers. Fix this by explicitly casting Size to `I` using
a constructor cast.

Bug: dawn:635
Change-Id: I5ee0101684e5847ec5ec6f71a9657fcce839a2a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38106
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-20 20:01:08 +00:00
Corentin Wallez 25dc10cee7 Vulkan: Fix texture barriers for readonly storage.
One of the helper methods to compute texture barriers didn't handle the
kReadOnlyStorage usage, which made barriers issued too small.

Issue was caught by running
StorageTextureZeroInitTests.ReadonlyStorageTextureClearsToZeroInRenderPass
with the Vulkan barrier validation enabled.

Also renames kReadonlyStorageTexture to kReadOnlyStorageTexture for
consistency.

Bug: dawn:635
Change-Id: I6e6027c380672dcdaea789c811665536b446003e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38101
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-01-20 19:39:28 +00:00
Corentin Wallez 40422659d4 Vulkan: Fix buffer barriers for readonly storage.
Some of the helper methods to compute buffer barriers didn't handle the
kReadOnlyStorage usage, which made barriers issued too small.

Issue was caught by running the GpuMemorySynchronizationTests with the
Vulkan barrier validation enabled.

Bug: dawn:635
Change-Id: Ice76edd21b2fa1c25cf9922418f65cfa7d802bdb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38100
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-01-20 19:29:38 +00:00
Corentin Wallez f83df90fae Vulkan: use VK_EXT_debug_utils instead of deprecated extensions.
The previous VK_EXT_debug_report and VK_EXT_debug_marker extensions were
both deprecated in favor of VK_EXT_debug_utils. This commit makes Dawn
follow the ecosystem and also adds more detailed reporting of why
vkCreateInstance fails that's now supported in VK_EXT_debug_utils.

Bug: dawn:635

Change-Id: I61c89da1fd55f26d7ccf91723feedfb354efbc16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38020
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2021-01-20 19:19:08 +00:00
Stephen White 55af59b47f Implement a glCopyImageSubData() workaround for OpenGL ES 3.1
This implementation uses glBlitFramebuffer().

Bug: dawn:638

Change-Id: I4ff62967c815a7e4b04348930539b27bddf44580
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38145
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-20 17:27:27 +00:00
Jiawei Shao 064f33e441 Implement WaitableEvent and WorkerTaskPool for multi-threaded tasks
This patch adds the basic implementation of WaitableEvent and
WorkerTaskPool for multi-threaded tasks in Dawn (for example, the
multi-threaded implementation of CreateReady*Pipeline()).

BUG=dawn:529
TEST=dawn_unittests

Change-Id: Ibf84348f4c0f0d26badc19ae94cd536cef89d084
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36360
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-01-20 08:56:07 +00:00
Enrico Galli 311a17a8fe D3D12: Add firstVertex/Instance to vertex/instance_index
Added root constants to emulate the behavior of other APIs under D3D12.
This patch only fixed Draw and DrawIndexed.

Bug: dawn:548
Change-Id: Ic759c22e0db1092f890d45c5db489697b1583827
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37620
Commit-Queue: Enrico Galli <enrico.galli@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-19 20:29:22 +00:00
Austin Eng 8bcde8e394 dawn_wire: Add Reserve/InjectDevice
Now that the wire does enough tracking to prevent a malicious client
from freeing a device before its child objects, and the device is no
longer a "special" object with regard to reference/release, it is
safe to support multiple devices on the wire. The simplest way to
use this in WebGPU (to fix createReadyRenderPipeline validation)
is to add a reserve/inject device API similar to the one we use for
swapchain textures.

Bug: dawn:565
Change-Id: Ie956aff528c5610c9ecc5c189dab2d22185cb572
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37800
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-01-19 19:27:52 +00:00
Stephen White c053b905b5 Open GL ES: implement a fallback path for glClearTexSubImage().
Also enable the CopyTests on OpenGL ES, since they now pass on 3.2.
Enable all tests that are no longer failing due to crbug.com/dawn/581
and update bug references for bugs which are still failing.

Bug: dawn:581, dawn:636
Change-Id: I6b74143f11dd4e1824551720024be174f2eaa003
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38140
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-19 18:34:22 +00:00
Ryan Harrison 1dee9164bf Use Tint to extract local workgroup size
BUG=dawn:578

Change-Id: I7526fdcc3ee96099d1487cd159a7bea9210f2b4e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38143
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-19 18:09:31 +00:00
dan sinclair 0f9c2d7b78 Update Dawn tests to use group instead of set.
This Cl updates the WGSL used by Dawn to use the new `group` decoration
instead of the deprecated `set` decoration.

Change-Id: I145aaff7721dfafff986ddc429c9cdc9389c2110
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38141
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-01-19 14:18:51 +00:00
Stephen White f09a67061e Suppress depth/stencil copy tests failing on ANGLE.
Also implement a way to check for ANGLE.

Bug: dawn:634, dawn:580
Change-Id: I4b361d02247f91250f1ce31cfbfdd0d74b3b3060
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38040
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-01-18 17:47:07 +00:00
Corentin Wallez 5c20f1ec9c Add the SubresourceTrackingPerf perf test.
This is a performance test in preparation of using SubresourceStorage
in dawn_native. On the Vulkan backend with Swiftshader it shows that
SubresourceStorage will bring a small perf regression for simple cases
(<= 10%) but it that complex cases are improved significantly (up to
twice faster).

Also renames a variable to follow the mMemberName convention.

Bug: dawn:441

Change-Id: I3fec80cba39b7d2aaba08fc8fbd8ea913ed5501c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37041
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-01-18 09:28:27 +00:00
Carl Woffenden 1c84a6b160 Missing header for VS1029 (for commit 8c58491d)
This recently broke in VS2019 (weak_ptr and shared_ptr aren't included).

Change-Id: I88edffa3e965c02d0db83e2efd0977cf86c96800
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38023
Commit-Queue: Carl Woffenden <cwoffenden@gmail.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-15 18:44:19 +00:00
Ben Clayton 8268dc3e43 StorageTextureTests: Use textureNumLayers()
Instead of hardcoding the number of array layers

Bug: tint:140
Bug: tint:437
Change-Id: Ic9ea6a0e2853d8dbc29a840deff0e6938ff5e4d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37849
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-15 17:36:39 +00:00
Ben Clayton be28fe6d99 StorageTextureTests: Use new access qualifiers
Instead of the old style texture_storage_[r,w]o_* forms.

Bug: tint:140
Bug: tint:368
Change-Id: If33733d1a45f106c052698b37ca6e4deca6b3c26
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37850
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-01-15 17:32:59 +00:00
Stephen White 54449966dd Workaround ANGLE hang with a glFlush().
Change-Id: Idce1b71bdb132a1b96836d270eb2ab53fd0086f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36700
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-15 16:35:49 +00:00
Ben Clayton 331b78a739 Convert StorageTextureTests to WGSL
Bug: tint:140
Fixed: tint:368
Change-Id: I339ff9546d21ea236a14dce9815d08fd13bbbbdb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37080
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-01-14 17:07:06 +00:00
dan sinclair 1c6082149a Update texture storage syntax.
This CL updates the WGSL texture storage syntax to use the access
decoration.

Bug: tint:286
Change-Id: I0024a0682c6a6479eb7a8436f8df4c9a76ec5e2a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37880
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-14 14:50:16 +00:00
Hao Li 6f833b7f78 Add internal compute pipeline in ResolveQuerySet for Timestamp Query
- Enable internal compute pipeline in ResolveQuerySet for Timestamp
  Query.
- Known issue:
  The user-provided resolve buffer cannot be used as binding resources
  due to missing STORAGE usage. Currently implictly add STORAGE usage
  if the buffer is created with QUERY_RESOLVE usage as a workaround.
  Next we will add STORAGE_INTERNAL usage instead.

Bug: dawn:434
Change-Id: Ie66090de38bc3a04a58986669cd2a128b528f960
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36222
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
2021-01-14 03:26:08 +00:00
Austin Eng 8c58491d25 dawn_wire: Skip device inject error if the client drops the device
If the client drops the last reference to the device, it would
dereference an invalid pointer upon calling InjectError. So, skip the
call. We can't keep the device alive if the Buffer is still alive
because we intend to make all objects internally null if you delete
their device.

It is ok to skip error injection because if the client deletes the
device, it should not expect to receive any more error callbacks.

Bug: dawn:384
Change-Id: I4c694310e4395b06cd49603fc5d4cd846799decb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37580
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-01-14 00:51:58 +00:00
Ben Clayton 3639186e7e ShaderModule: Include extra information in shader errors
If the SPIR-V fails to validate, include the SPIR-V disassembly in the error.
If the shader fails to compile, include the shader source in the error.

Change-Id: I05f93b5dec7985c42ddf9cd14621af2a855ee640
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37282
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-13 22:27:08 +00:00
Brandon Jones 2f1278e68b Enabled BindGroupLayout deprecation warning and fixed tests it broke.
This should be the last change BindGroupLayout change needed to complete
the conversion to the new structure aside from removing the deprecated
code paths in the future.

Bug: dawn:527
Change-Id: I44f67de80f1b4e1b7b32909d70d74610f7a06d8d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37560
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-01-13 22:25:58 +00:00
Austin Eng 8ba0a01d1e Ensure all wire child objects are destroyed before their device
Destroying a device will implicit destroy all its child objects.
Attempting to use a child object after results in a fatal error.

Bug: dawn:384
Change-Id: I43c27c92cacde759be83cca79ac890f41bac3927
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37002
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2021-01-13 20:58:18 +00:00
Ben Clayton cd9dc36d2e [wgsl]: s/texture_sampled_/texture_
These texture types were renamed in October 2020:
https://github.com/gpuweb/gpuweb/pull/1180

Tint has supported both forms since November 2020:
https://dawn-review.googlesource.com/c/tint/+/31380

Finally migrate to the new form so we can drop support for the old.

Bug: tint:286
Change-Id: Id19b79be28152b3de163f9cce75eefff1ae31d76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37702
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
2021-01-13 20:29:08 +00:00
Austin Eng 5ad5557667 Remove special-casing of device reference/release in the wire
The wire's device is externally owned so reference/release were no-ops.
To unify the code paths, remove the special casing and instead
take an extra ref on the device the wire server is created with. This
is functionally equivalent and will allow both the current wire code,
and the incoming change to allow multiple device/adapter creation to
both work.

This CL also makes it possible for the client to destroy the device
before child objects.
A follow-up CL will mitigate this on the server side.

Bug: dawn:384
Change-Id: Ic5427074469012dccf8689ec95a848e6ba2c1fc2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37001
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-13 19:23:48 +00:00
Austin Eng f0d7cc4f5a dawn_wire: Make all objects owned by the client
This removes the logic where the Client owns the Device and the
Device owns all other objects. Ownership should be tracked in
dawn_native either with refcounting or validation to disallow
operations after an object's parent has been destroyed.

This simplifies the wire client code in that the client only
tracks allocated handles and does not manage parent/child lifetimes.
This is an important simplification so we can support multiple WebGPU
instances, adapters, and devices on a single wire.

Bug: dawn:384
Change-Id: I8ecc7c368130b8917202150c467b5f0e7d4b753e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37000
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-13 18:31:47 +00:00
Austin Eng f6ef7530ab Make the Device ref the Instance
This is needed before supporting instances, adapters, and devices on
the wire so that the client cannot free the instance before the device.

In Dawn native, the developer still needs to make sure the device is not
freed before all child objects.

Bug: dawn:384
Change-Id: I863d44c6a8acecc7b8ea0cc0ac483f7a864162fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37003
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-01-13 17:54:37 +00:00
Austin Eng 8ef94f1684 Don't forward device lost errors to the uncaptured error callback
This issue was discovered in http://crrev.com/c/2613517 where a
device lost error on page teardown was bubbling up to the Renderer's
uncaptured error callback.

Bug: chromium:1160459
Change-Id: I64b8c7779f4808d5a4b87c131aaf2e041c512bb9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36960
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-01-13 17:53:29 +00:00
Carl Woffenden 558599fc9a Further fixes to build with with VS2019 (end2end tests)
These fix the tests so that the entire of Dawn can now be built with
VS2019. Some details:

Multiples of "error C3493: 'X' cannot be implicitly captured because no
default capture mode has been specified" in BufferTests.cpp. This
appears to be a bug in VS whereby the constexprs need capturing; the
workaround, rather than explicitly name them and change the function
signature, is to make the vars also static.

In DepthStencilSamplingTests.cpp we get "warning C4310: cast truncates
constant value" for uint8_t(256). Rather than try to silence the
warning the test was removed, since the cast will *always* result in
zero, which is also the first in the test values.

To successfully build two further third-party dependencies also require
updating:

https://dawn-review.googlesource.com/c/tint/+/37700
https://chromium-review.googlesource.com/c/angle/angle/+/2624888

Note: whilst this now builds the entire of Dawn with VS not yet all of
the build arguments are supported. Yet to investigate is turning on
optimisations (with is_official_build=true) which attempts to combine
"/INCREMENTAL" with "/OPT:REF" and fails (to be addressed next).

Bug: dawn:602
Change-Id: I37202992f16b999d5627022eeeb6b9fff0d4b60b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37701
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Carl Woffenden <cwoffenden@gmail.com>
2021-01-13 12:25:45 +00:00
Corentin Wallez 111ba65a5e D3D12: Use Texture::Create pattern for swapchain textures
Bug: dawn:269
Change-Id: Ia4b48126c153ddff2feefc1bf04dcc9adc783bd1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37421
Auto-Submit: 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>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-01-13 08:53:34 +00:00
Mark Sibly 9f9a9785f2 Reset scissor reset before presenting in opengl
The opengl backend uses glBlitFramebuffer to present frames which
is affected by the opengl scissor rect.

Bug: dawn:616
Change-Id: I0b8c3eb7139ab22a98eeb60e3ad16678e3afad5d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37101
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Mark Sibly <marksibly@gmail.com>
2021-01-13 05:09:24 +00:00
Austin Eng 424fd82889 Update DepthStencilStateTests to use WGSL
Bug: dawn:572
Change-Id: Ia0bc64304cfa91e3c5f0179781eeef0eab21323a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33761
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-01-13 03:10:54 +00:00
shrekshao 7faa362ea9 Fix SamplerFilterAnisotropicTests mipmap
Fix a bug about mipmap level in SamplerFilterAnisotropicTests.
Sizes of the 3 miplevels should be 4,2,1.
The old code allocates 8,4,2 (which don't have a 1x1 level)
Expected rendered pixel values have to change.
The render result now fits the webgl demo at https://jsfiddle.net/t8k7c95o/5/
(Thanks Kai for the enlarged pixelated canvas)

ComputeBoids.cpp and DawnTest.cpp change is due to git cl format

Bug: dawn:568
Change-Id: I9069732208a16be285be13b8cd1ab19b211995a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37380
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-01-12 23:56:54 +00:00
dan sinclair e6ca254c72 Convert WGSL comments to //
This CL updates the tests with WGSL sources to use // for comments
instead of #. This matches the current WGSL spec.

Change-Id: I04e1a18630a16b794955cace7e55a89221c964fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37520
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-01-12 22:11:14 +00:00
Carl Woffenden 22eff1eb8c Fixes to build with MSVC 2019
When building with MSVC (using 'is_clang=false') various errors are
encountered. This fixes:

- multiple tests/end2end/ColorStateTests.cpp(309): error C2039:
  'transform': is not a member of 'std'

- dawn_wire/server/Server.h(171): error C2248:
  'dawn_wire::server::MapUserdata::MapUserdata': cannot access private
  member declared in class 'dawn_wire::server::MapUserdata'

- variants of the above in Server.h for all the other CallbackUserdata
  subclasses

Bug: dawn:602

Change-Id: I01b1db3fbf67ae170b21a7d890af6162b82a1725
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37420
Commit-Queue: Carl Woffenden <cwoffenden@gmail.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-12 19:47:13 +00:00
Corentin Wallez 4b30f93762 Add the correct rpath to use Swiftshader / Vulkan on macOS
Previously the @executable_path rpath was only added when doing
component builds and non-component builds failed to find Vulkan and
Swiftshader on macOS.

Bug: None
Change-Id: I0277566e4bf181703dff26bb1bf3e57858864009
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37442
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-01-12 19:01:04 +00:00
Bryan Bernhart f600666866 D3D12: Add HLSL compiler version to key
BUG=dawn:529

Change-Id: I84d8edc6022564cda084a0f0de384a4e15e0e1a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/35480
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2021-01-12 18:21:33 +00:00
Ben Clayton 64275742e0 ShaderModule: Enable the prettier tint diagnostic formatter
Includes code snippits and squiggles of the offending line(s)

Bug: none
Change-Id: If704b5d1118d0246c16f6e729a10d16363a1169b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37281
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-01-12 08:55:57 +00:00
Carl Woffenden ede229f313 Minor fix to build with MSVC: Removes switch with only default case
Fixes warning C4065: switch statement contains 'default' but no 'case' labels

Change-Id: If9a8f20eaeb2499f71bc25a69e545b3e8b21be4d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36081
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Carl Woffenden <cwoffenden@gmail.com>
2021-01-12 08:55:27 +00:00