Commit Graph

2963 Commits

Author SHA1 Message Date
Corentin Wallez bd04e15890 Remove deprecated APIs
Bug: None
Change-Id: I77ac6660318bef1f9a245b3aee06a8e89a67e518
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64540
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-09-17 16:05:40 +00:00
Austin Eng bffc966f17 Add wgpuDeviceGetLimits. Split Required/Supported limit structs
Bug: dawn:685
Change-Id: Ibb5dd0479f5e887d4b2ca864c014ebaafb674dba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64443
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-09-17 15:36:00 +00:00
Jiawei Shao 4ecfc58777 D3D12: Support creating render pipeline asynchronously
This patch implements the asynchronous path of CreateRenderPipelineAsync
on D3D12 backend.
1. Call the constructor of dawn_native::d3d12::RenderPipeline in main
   thread.
2. Execute dawn_native::RenderPipelineBase::Initialize() (a virtual function)
   asynchronously.
3. Ensure every operation in dawn_native::d3d12::RenderPipeline::Initialize()
   is thread-safe.
4. Save all the return values (pipeline object or error message, userdata, etc)
   in a CreateRenderPipelineAsyncWaitableCallbackTask object and insert this
   callback task into CallbackTaskManager.
5. In Callback.Finish():
- Insert the pipeline object into the pipeline cache if necessary
- Call WGPUCreateRenderPipelineAsyncCallback

This patch also removes FlatRenderPipelineDescriptor as it is not needed
right now.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I7fd30339ab7bea599c483dea4bd1100359982409
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64440
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-17 07:39:00 +00:00
jchen10 b166b99f86 Treat 'mipLevelCount == 0' as error
It's no longer a valid default value.

Bug: dawn:1026

Change-Id: I9de656f29c8b7673de412cef35dcfb8a45121ac7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64165
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2021-09-16 05:29:44 +00:00
Jiawei Shao 8626b2142d Disable the workaround about the T2T copy issue on newer Intel drivers
This patch disables the workaround about the T2T copy issue (the Toggle
UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel)
on the latest Intel Gen9 and Gen9.5 D3D driver (30.0.100.9864) which
contains the fix for this issue.

BUG=chromium:1161355
TEST=dawn_end2end_tests

Change-Id: I6e62b95d1cb92358482356901c541df02998a764
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64280
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-16 01:11:01 +00:00
Shrek Shao 2f8f2518e5 Revert "Added Abseil as a third-party dependency"
This reverts commit 020d69905e.

Reason for revert: Causing Dawn Skia roll build fails

https://task-scheduler.skia.org/job/AZXXBm9h9ozj3kKiRJM5

Original change's description:
> Added Abseil as a third-party dependency
>
> Using the version in the Chromium repo in order to make use of the .gn
> files it contains.
>
> Doing so also appears to require us to switch where we pull googletest
> from so that the directory structure matches what the Abseil build
> config expects. Fortunately this doesn't seem to cause issues in our
> tests.
>
> Bug: dawn:563
> Change-Id: I55831ad33f282b3d8b03b67826fd2776e5602d89
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63780
> Reviewed-by: Austin Eng <enga@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Auto-Submit: Brandon Jones <bajones@chromium.org>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:563
Change-Id: I0fc4e5fc73ab9b0887591135ec01adde990edd6f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64361
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-09-15 19:22:19 +00:00
Ken Rockot 4646de90be Support flattening multiple CommandAllocators
This introduces CommandAllocator::AcquireCommandBlocks, which accepts a
vector of CommandAllocators and flattens them into a single iterable
sequence of commands. To support this, CommandAllocator is made movable.

Bug: dawn:809
Change-Id: I3984c243e4bd74568eccba1a8a58ec26324c8ffa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63822
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-15 18:29:00 +00:00
Austin Eng 5528d0edd2 Metal: Allocate threadgroup memory based on Tint reflection
Tint passes threadgroup memory in MSL as entrypoint arguments since
threadgroup memory at the module scope cannot be default initialized.
MSL lacks default constructors for matrices in threadgroup memory.

Bug: dawn:1110
Change-Id: I7462fa448c6ebdb3cc4dc24bd5ff0a99287cdba0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64240
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-09-15 18:16:50 +00:00
Corentin Wallez 49d794fbcc Use IterateBitSet in AddVertexPullingPass
BUG=dawn:529
Change-Id: Ibc05ee56f79c967b6dc8e08303ad726aff83c7a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64300
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-09-15 15:35:43 +00:00
jchen10 4935c14eec Use WGPU_MIP_LEVEL_COUNT_UNDEFINED instead of 0
The follow up CL will remove 0.

Bug: dawn:1026
Change-Id: Ida62f8d8b0dd8f9722e40f3f95366d3db0c7ab52
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64164
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2021-09-15 06:27:25 +00:00
Zhaoming Jiang 857d4e62e3 Support vertex-only render pipeline
Support vertex-only render pipeline on D3D12, Vulkan, Metal, OpenGL
and OpenGL ES backends. Related validation tests and end to end tests
are also implemented.

Bug: dawn:136
Change-Id: If266fd441c1d39ccd940ea26b74b405f8abb351a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63080
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-15 03:17:42 +00:00
Jiawei Shao 43ce892284 Remove descriptor in RenderPipeline::Initialize
This patch removes the parameter "descriptor" from the function
RenderPipeline::Initialize() on D3D12, Metal and Vulkan backends as
a preparation of creating render pipeline asynchronously.

BUG=dawn:529

Change-Id: I6bdd74ad0af6a1924fac3703908cd5f66b75994b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64163
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-15 01:41:42 +00:00
Jiawei Shao 24cad6e2c3 Metal: Remove vertexState in the parameter of TranslateToMSL
This patch removes the parameter "vertexState" from TranslateToMSL
and ShaderModule::CreateFunction as we have already been able to
get the vertex states from the RenderPipelineBase object.

BUG=dawn:529

Change-Id: I2971438bfd5e0f3fbea900e1f06c1b33349571da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-15 01:28:23 +00:00
Brandon Jones 020d69905e Added Abseil as a third-party dependency
Using the version in the Chromium repo in order to make use of the .gn
files it contains.

Doing so also appears to require us to switch where we pull googletest
from so that the directory structure matches what the Abseil build
config expects. Fortunately this doesn't seem to cause issues in our
tests.

Bug: dawn:563
Change-Id: I55831ad33f282b3d8b03b67826fd2776e5602d89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63780
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
2021-09-14 16:56:15 +00:00
François Beaufort 088071a5a7 Add device ID and vendor ID to device properties
This CL adds device ID and vendor ID to device properties so that WebGPU
can access it to help populate GPUAdapter.name.

Bug: chromium:1231163
Change-Id: I460e5a72ffba350f88d2649789a61eaea9670135
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
2021-09-14 16:15:35 +00:00
Corentin Wallez 77755b9f55 Remove deprecated wgpu::StoreOp::Clear
Bug: dawn:937
Change-Id: I80cdb3b6b3caecc83a6e8cc009bb494179808cd9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63742
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-14 16:02:00 +00:00
Corentin Wallez c7203ba890 Remove deprecated ComputePipelineDescriptor.computeStage
Bug: dawn:800
Change-Id: I8d9d2a7cdba328d1cf040f7c8c622d1d7d403be2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63741
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-14 11:42:27 +00:00
Corentin Wallez 1ac4565115 Remove deprecated RenderPass*Attachment.attachment
Bug: dawn:762
Change-Id: I86144f77ffd647d2e5c01742fb67367c7a5c914e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63382
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-14 10:42:22 +00:00
jchen10 96ac969a33 Use WGPU_ARRAY_LAYER_COUNT_UNDEFINED instead of 0
This seperates the undefined 'arrayLayerCount' from 0 to
WGPU_ARRAY_LAYER_COUNT_UNDEFINED. So 0 arrayLayerCount is treated
as a validation error.

Bug: dawn:1026
Change-Id: I7b4ae024b02ac0d2aa260b2a8c64b09bd967db87
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63660
Reviewed-by: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
2021-09-14 02:41:49 +00:00
Brandon Jones 1934e56159 Disable multiple mip levels for r8/rg8unorm textures on Metal
Bug: dawn:1071
Change-Id: I2cc9173f0dff325e4bb2583bb27a98bbaaa61531
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63462
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-14 00:54:59 +00:00
Brian Sheedy cc3f16c437 Suppress Mac 11.5 failure
Suppresses LoadOpClearIntegerFormatsToLargeValues on Mac 11.5 with
Metal on Intel GPUs.

Bug: dawn:1109

Change-Id: Ia4316ee00ad790752fa3b5d1778d885c5eb3a188
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64160
Commit-Queue: Brian Sheedy <bsheedy@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Brian Sheedy <bsheedy@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-13 20:35:49 +00:00
Austin Eng 02fbf168e0 Add validation, storage, and querying of limits
Adds a way to store the limits on the Adapter and the
Device. For now, adapter limits are always the default
limits, and device limits are stored but not used.

This CL also adds usage of an ErrorObjectIdResolver and
Provider in the WGPUDeviceProperties serialization and
deserialization helpers. Serializing/deserializing this
struct should never have objects.

Bug: dawn:685
Change-Id: I1479b4407b0f9ec9f9b2bff62cad7caa693c99d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63983
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-13 18:49:09 +00:00
Bryan Bernhart caf6e8b3f0 Disable remap binding test on WARP.
Adds a supression to the failing test.

BUG=dawn:1106

Change-Id: Ib0cfd49b6d1af59c60d7bc4f2e3e1bec5ae80601
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64062
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2021-09-13 17:27:29 +00:00
Jiawei Shao 42448dafb4 Remove descriptor from the parameter of ComputePipeline::Initialize()
This patch removes the parameter "descriptor" in the function
ComputePipeline::Initialize() so that we don't need to define
FlatComputePipelineDescriptor right now.

For render pipeline, as descriptor->vertex is being used for vertex
pulling (passed into vertexModule->CreateFunction()), we will first
refactor the related code in vertex pulling before removing the
parameter "descriptor" in the function RenderPipeline::Initialize().

BUG=dawn:529

Change-Id: Ib172ac0c76fa24070e78c0e57c3262acad9399b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-11 09:04:34 +00:00
Michael Tang b21ccebac8 D3D12: Use a separate space for the index offset constants
Tint's HLSL writer can now map sets to spaces, so we can use a dedicated
space  and register to store the index offset constants. Currently, we
use the first space (0) and find a free unused register.

Bug: dawn:1103
Change-Id: Ie1fe95ec314097baf0e0952a0c78222cad493c95
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63223
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Michael Tang <tangm@microsoft.com>
2021-09-10 23:16:33 +00:00
Austin Eng 2092a66ab5 dawn_native: Add RequestDevice to the Adapter
Adds a basic RequestDevice method to the adapter, only in
dawn_native. We will revisit this when we implement adapters
in dawn_wire.

RequestDevice allows us to have tests of the limit bounds
because it receives a callback which can return status codes
and error messages.

Bug: dawn:685
Change-Id: I7a68922b078c6a436f49a16346cb41fb9df9cfee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63982
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-10 21:07:39 +00:00
Austin Eng dc7971ce58 dawn_wire: Support deserializing s->c chained structs
Chained structs *may* contain objects which means
deserialization may need an ObjectIdResolver.
However, in practice, we never need to send chained
structs from the server to the client that contain objects for
a valid command.

The one upcoming need for chained server->client structs is to
serialize limit structs.

Because limit structs never need objects, we provide a dummy
implementation of the ObjectIdResolver which always yields an error.
An analogous change is done for ObjectIdProvider.
These classes will be used in a follow-up CL.

Bug: dawn:685
Change-Id: I1c0f3f2d080377f2e1a77bc6e896f24d3d9ab931
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63981
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-10 20:36:20 +00:00
Corentin Wallez 8ee643c9d0 Remove suppression for fixed Tint issue
Bug: tint:449
Change-Id: I7a1ee41bbd149c211096d0ce84c35ab8a0f937f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63745
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-10 17:46:29 +00:00
Bryan Bernhart d9331035a6 Skip failing CopyTexture tests on WARP
BUG=dawn:1104

Change-Id: Ie4e870fd182bcf5ec0a0007317705a0555a76e0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63980
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2021-09-10 16:09:19 +00:00
Corentin Wallez 363c28e5d1 Remove typedefs for deprecated types.
Bug: dawn:762
Change-Id: I1581d80898d4a98010bb14c5823a1a343c229664
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63383
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@google.com>
Reviewed-by: Brandon Jones <bajones@google.com>
2021-09-10 15:50:19 +00:00
Corentin Wallez d4b85fbd76 Lift suppression for incorrect VVL image layout tracking
Fixed: dawn:785
Change-Id: I618d2d44c02ae5e256841392cb2359f3992e32dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64020
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@google.com>
Commit-Queue: Brandon Jones <bajones@google.com>
2021-09-10 15:02:24 +00:00
Corentin Wallez 7a446220a1 Reenable / delete DISABLED tests.
- We use Tint unconditionally so binding reflection is now correct.
 - WGSL disallows textureSampleCompare in compute shaders and is not
   likely to change.
 - We now support reading back stencil in tests.

Bug: dawn:439, dawn:667, dawn:216, dawn:704
Change-Id: I7ba0026bb906ce985abb495581b56977da7be2da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63680
Reviewed-by: Brandon Jones <bajones@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-09-10 14:56:09 +00:00
Jiawei Shao 6fa50b5e6c Vulkan: Support extension "depth_clamp"
This patch implements the extension "depth_clamp" on Vulkan, which
we need to test if we can correctly record "PrimitiveDepthClampingState"
in FlatRenderPipelineDescriptor - Currently FlatRenderPipelineDescriptor
fails to record this because we incorrectly ignore all the members in
"nextInChain".

BUG=dawn:529, dawn:716
TEST=dawn_end2end_tests

Change-Id: Iec407245a3f37d10a3d1428b0612f0e18e80c616
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63820
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-10 01:33:41 +00:00
James Price 6e1f01f32b metal: Use single-entry point transform
We only remap bindings for the target entry point, so we need to strip
all other entry points to avoid generating invalid bindings for them.

Bug: tint:1170
Change-Id: Ia1a73601e8d620341fb4f7170dfa856632a04245
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63880
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-09 20:40:31 +00:00
Jiawei Shao d7ddfb4a91 Add FlatRenderPipelineDescriptor for CreateRenderPipelineAsync
This patch implements the struct FlatRenderPipelineDescriptor to
save all the pointer members of RenderPipelineDescriptor in
CreateRenderPipelineAsync so that the render pipeline descriptor
is always valid when the render pipeline is created asynchronously.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I99e06581f84c52d484f877ba29e8cc1ca50d68b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63368
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-09 00:59:29 +00:00
Zhaoming Jiang c6140d5c95 Initializing stencil reference for render pass in D3D12
When creating a new render pass in D3D12, call the OMSetStencilRef
to set the stencil reference value to zero.

Bug: dawn:1097
Change-Id: I5dd94691b1b354b601c06a02d3d5fa619d8b58ee
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63360
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-08 02:21:33 +00:00
Loko Kung 37a8649f92 Adds ASTC texture compression formats and Vulkan support for them.
The end to end texture tests with the binary information for the textures are generated using the open source astc-encoder tool.

Also: Refactors end2end compressed texture tests to allow for non-4x4 texel compression formats (ASTC formats are not all 4x4).

Bug: dawn:955
Change-Id: I5311a5aa7bd017de72300bf7c87fba6c869b1db5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63121
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-07 18:39:04 +00:00
Jiawei Shao ba1feb07bc Always point to own members in FlatComputePipelineDescriptor
This patch fixes a use-after-free issue in FlatComputePipelineDescriptor
by always making its pointer members point to its own members.

BUG=dawn:529, chromium:1246158, chromium:1246748
TEST=dawn_end2end_tests

Change-Id: I49b98357444edcdb1b225e961d1e4d6e5b11e978
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63366
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-06 07:46:49 +00:00
Rafael Cintron 0376ebe3df Handle failed calls to ID3D12CommandQueue::GetTimestampFrequency
ID2D12CommandQueue::GetTimestampFrequency returns an error HRESULT
when there are bugs in Windows container and vGPU implementations.

To workaround, we check the return value during adapter creation
and disable the timestamp query extension upon failure.

Device creation is still allowed to succeed when the method returns
failure.

Change-Id: Ie71f8712fc9f4f50e4ce26ecfec929b5b1a126d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63225
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
2021-09-03 17:29:20 +00:00
Corentin Wallez 10b9cce816 Remove deprecated SetBlendColor and blend factors
Bug: chromium:1199057
Change-Id: I6fdc08f0a62b579b556c4c910611d095fcb3a66f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63381
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-09-03 16:37:00 +00:00
Corentin Wallez fdfbb3aab3 Add dawn_wire/client/RequestTracker.h to build files
This was missed in a previous CL.

Bug: dawn:1092
Change-Id: I1915371c6a049d8c3b503c72194e568eb7fde95c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63384
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-03 16:09:30 +00:00
Brandon Jones 8a0b49b6d6 Add check for an invalid D3D12/Vk object in SetDebugLabel
Fixes a crash found while fuzzing by returning early when SetDebugName
is called with an empty D3D12/Vulkan object or when the device is lost.
Adds tests.

Bug: chromium:1245720
Change-Id: Ie443f690cf5635d017295a13e21c33dd2e97dc46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63363
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones (Intel) <brandon1.jones@intel.com>
2021-09-02 21:15:40 +00:00
Brandon Jones c1bcbbf357 Add Labels For Pipelines and ShaderModule for D3D12/Vk
Adds labels for Pipelines and ShaderModule. Includes tests. Backend
functionality is implemented for Pipelines, and completed to best effort
for ShaderModule.

Bug: dawn:840
Change-Id: I55024a83f66d9fc2fc0e8b79e4b9a7ebc6f3cf1c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62860
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones (Intel) <brandon1.jones@intel.com>
2021-09-02 18:39:53 +00:00
Corentin Wallez 71f2214e14 vulkan: wait for fences on ErrorInjector device loss
When ErrorInjector injects a device loss, it is fake and commands are
still running on the device and we need to wait for them before we start
to deallocate stuff.

When handling the error in the frontend, call WaitForIdleForDestruction
so that all the commands are finished. In the Vulkan backend
WaitForIdleForDestruction have a special code path to no allow error
injection on vkWaitForFences in this specific case, as double error
injection would make the problem appear again.

Bug: chromium:1244408

Change-Id: I710fccbb40b4b14d84f5787be5e002b469e6e2e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63101
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-09-02 17:23:18 +00:00
Stephen White c0f20fbc54 Remove all "WithTint" suffixes from Dawn native.
The D3D12 and Metal backends no longer support any other
shading language translator, so the suffix is superfluous.

Bug: dawn:1099
Change-Id: I6a1a249a80d59dbf9cabf5d4ea917f852745e78e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63400
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-09-02 16:50:58 +00:00
Jiawei Shao 305f4df2b5 Add FlatComputePipelineDescriptor for CreateComputePipelineAsync
This patch implements the struct FlatComputePipelineDescriptor to
save all the pointer members of ComputePipelineDescriptor in
CreateComputePipelineAsyncTask to better simplify the orignal code
path.

We will also implement FlatRenderPipelineDescriptor in the next
patch, which is more important for CreateRenderPipelineAsync as
there are many more pointer members in RenderPipelineDescriptor
than those in ComputePipelineDescriptor.

BUG=dawn:529

Change-Id: I69ab0dc898f0a6dcc9886d827729e6fd7308bd2d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-09-02 00:30:31 +00:00
Brandon Jones 1f48c97353 Update default pipeline layout compatibility rules
Prevents bind group layouts created by a default pipeline layout from
being reusable with any other pipelines or layouts, as detailed in
https://github.com/gpuweb/gpuweb/pull/2068

Change-Id: Ic398eb6c6e089ac63ce6650f125dd20a9dfc8862
Bug: dawn:1094
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63220
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-09-01 22:15:41 +00:00
Corentin Wallez baf8df396c dawn_wire/client: Add RequestTracker helper
This helper helps ensure correct handling of request maps by:

 - Forcing erasing to happen immediately when acquiring a request. This
   prevents some cases of iterator invalidation if we later change the
   container type.
 - Implements correct closure of all callbacks, including if the
   callbacks themselves add more callbacks.

Bug: dawn:1092

Change-Id: Ia0ba9f050bbf3f0dee846f537910523bebb3bf1b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63003
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-09-01 16:40:22 +00:00
shrekshao 3fdfa82f7b Callback reentrancy tests
Some tests to make sure new requests inside user callback
is okay.

Bug: dawn:1091
Change-Id: I4c53d7fb6637f77e5af6fd0a78d879a2431d4ac8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63041
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-08-31 15:18:54 +00:00
Jiawei Shao 67fc6aeb82 Remove redundant code in CreateRenderPipeline
This patch removes the redundant code in CreateRenderPipeline so
that we can better share the common code in both CreateRenderPipeline
and CreateRenderPipelineAsync.

BUG=dawn:529

Change-Id: Ic2a7781525e5594da3d51a42b231df63c0c09339
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62880
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-08-31 07:47:57 +00:00
Loko Kung c7226a7624 Adds ETC2/EAC texture compression formats and Vulkan support for them
The end to end texture tests with the binary information for the textures are generated with a combination of the open source etc2comp tool and manual crafting of the data based on the specification in the Kronos Data Format Specifications (https://www.khronos.org/registry/DataFormat/specs/1.1/dataformat.1.1.pdf) for the compressed formats.

Also: Refactors end2end compressed texture tests and some utilities so that we can use parameterized tests for easier new format additions.

Bug: dawn:955
Change-Id: I91686f26a693a85cb076ef0eca3029111a64c50f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62740
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-08-31 00:15:45 +00:00
Corentin Wallez 6bb3f6f216 vulkan: Free "in flight" fences/commands in ShutdownImpl
There might still be fences and commands marked as in-flight in
ShutdownImpl if the device was lost. Delete them anyway because since
the device was lost, it means that all objects are no longer in the
"pending" state (from the Vulkan spec point of view)

Bug: chromium:1244454
Change-Id: I905a9a8e5174591bf93e3cdac3cdcb349d75a581
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63102
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-08-30 20:01:04 +00:00
Corentin Wallez 52ad8f6768 client: call pending GetCompilationInfo on Disconnect
Fixed: dawn:1090
Change-Id: Ia7cf692ea41ebe85aaac58e3f3aa6727e6cc8ba4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/63002
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-08-30 08:00:45 +00:00
Corentin Wallez 378ea27f39 Remove stray reference to GetDefaultQueue
Bug: dawn:22
Change-Id: Ia5c1f552317d9c35a9c09fe4e0684593cee9cacf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62940
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-08-27 07:51:00 +00:00
Li Hao c31b16f5dc Check Query API feature support by GPU counter on Metal
Currently we use gpu family to determine whether a query extension is
supported. The official document provides a way to check the feature
support by GPU counter. Update checking following the official guide.

Bug: dawn:996
Change-Id: I09cf51ed8a8209642eed71c9e4592f6eab82bfa5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/60360
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-08-27 04:20:21 +00:00
James Price 086c44ee73 Add missing includes to SemaphoreService.h
These are needed for the VulkanDeviceInfo and VulkanFunctions structs.

Change-Id: I1d18e59cd923e5fd702ac65d505793519b3a42b7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62920
Commit-Queue: James Price <jrprice@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-08-26 17:17:35 +00:00
Corentin Wallez 21940df81b Device: Mark all commands as completed on device loss
Previously device loss would produce an assert when shutting down where
the frontend though not all commands where finished.

Bug: chromium:1242195
Change-Id: I90fe626b6930859b3fd98b660882fb11b6a9ff8c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62542
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-08-26 09:25:15 +00:00
Jiawei Shao 2aee6eef7f Refactor APICreateRenderPipelineAsync to support sync and async path
This patch refactors the implementation of APICreateRenderPipelineAsync
as a preparation of the async path of the creation of render pipeline.

Now the code path of APICreateRenderPipelineAsync() includes the
following 3 parts:
- When an error occurs in the front-end validations, the callback will
  be called at once in the main thread.
- When we can find a proper render pipeline object in the cache, the
  callback will be called at once in the main thread.
- When we cannot find the proper render pipeline object in the cache,
  the newly-created pipeline object, the callback and userdata will be
  saved into the CreatePipelineAsyncTracker, and the callback will be
  called in device.Tick(). All the logic mentioned in this section has
  been put into one function CreateRenderPipelineAsyncImpl(), which will
  be overridden by its asynchronous version on all the backends that
  support creating pipeline objects asynchronously.

BUG=dawn:529
TEST=dawn_end2end_tests

Change-Id: I5706224092588a8c042a952aef2591696072592d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62781
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-08-26 00:39:14 +00:00
Zhaoming Jiang 6fa34f80bd Adding VB OOB validation for zero array stride
In this patch OOB validation in draw and drawIndexed is added for vertex
buffer with zero array stride. For such case, both vertex step and
instance step mode buffer can be validated for both draw and drawIndexed,
as we don't care about actual vertex count and instance count for buffer
with zero array stride.
Related unit test is also added. Also fix the DrawIndexedVertexBufferOOB
unit test.

Bug: dawn:1065
Change-Id: Id302dc0c443dec965347c8ae9f3f4d73aeddc38c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62200
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2021-08-25 01:30:03 +00:00
Loko Kung c1d395865f Adds placeholders for ETC2/ASTC compression texture format
Compatible Vulkan backends should now enable ETC2/ASTC but no functional
changes because no TextureFormat in ETC2 or ASTC have been added yet.

Bug: dawn:955
Change-Id: I56e8ff73f931a12253fe6d21f3f4b91e3459ef13
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62701
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-08-25 00:53:42 +00:00
Austin Eng 20ffe9712f Fix a bug with D3D12 buffer alignment computation
We should use D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT
if the usage *contains* Uniform usage, not if it is exactly
equal.

Fixed: dawn:1085
Change-Id: I540081e550c9e88efeb08169cecdc40b68d36d14
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62242
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-08-24 01:52:03 +00:00
Brandon Jones 5ae66fbcc7 Add Tag for Unimplemented Labels to ObjectBase Constructor
Adds the LabelNotImplemented tag param to the main constructor of
ObjectBase to document objects that still require labels.

Bug: dawn:840
Change-Id: Idd19664e797e4d622401e28e5d278331acefb7a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62461
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones (Intel) <brandon1.jones@intel.com>
2021-08-23 23:14:36 +00:00
Corentin Wallez da230e5e5c Remove typedefs for passed deprecations
Bug: None
Change-Id: I922fc4b1149c94f891692e6961423162a5a131e1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62360
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-08-23 10:10:11 +00:00
Brandon Jones c95e574ce0 Add Debug Label Functionality For D3D12/Vk Buffers & Textures
Adds a generic SetDebugName utility for D3D12 and Vulkan. Passes down
debug label set by user for buffers and textures to be labeled by the
appropriate backend method.

Bug: dawn:840
Change-Id: I7158b537a6e37fdf733645e6830dc33833ee683e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61588
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones (Intel) <brandon1.jones@intel.com>
2021-08-19 20:47:28 +00:00
Austin Eng ddd0a0a856 Initialize padding on buffer allocations
Buffer allocations in Dawn may be padded. This padding
could be visible, depending on how the backend
implements robust vertex buffer access. This commit
updates buffer creation to clear all padding bytes
immediately after creation.
It is not counted as a lazy clear.
And, add a test which reads off the end of a padded
vertex buffer to check that the padding bytes are also
initialized.

Also: Update Metal buffers to always allocate enough
space for Tint's vertex pulling, and pass the full
allocated size to Tint. While writing the test in this
commit, a bug was found where Tint assumes there is at
least 4 bytes in the vertex pulling buffer. The WebGPU
API currently allows zero-sized bindings, so Dawn needs
to always allocate enough space for one element.

Also: Update Vulkan vertex/index buffers to allocate
at least one more byte than requested because
vkCmdSetVertexBuffers and vkCmdSetIndexBuffer disallow
the offset to be equal to the buffer size. We need
at least one more byte to make zero-sized bindings
as the end of the buffer valid.

Lastly: Update helper so that a T2B copy of a single
row that touches all bytes in a buffer updates the
buffer state to be fully initialized. This is a small
optimization that is necessary to write the test.

Bug: dawn:837
Change-Id: I829f4764509c4ec784c5aeaaf40b6dcbd4be6866
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62161
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-08-19 18:02:36 +00:00
Michael Tang 663a16e2fe D3D12: use the WGSL binding number as shader register
Currently, the bind group layout tightly packs the shader registers for
each of the sampler and non-sampler descriptors sets. This reduces the
max shader register used and helps targeting shader model 5.0, which has
a relatively low max slot count per resource. It is safe in D3D, since a
shader register collision can be valid if the descriptor types differ.

To support Mesa's SPIR-V to DXIL compiler, we need to avoid possible
collisions between resources' shader registers because it uses SPIR-V as
an intermediate representation (which does not namespace bindings by
type). This change re-works BindGroupLayoutD3D12 to not assume the
resulting shader registers will be tightly packed and group per
descriptor type.

Change-Id: I0bb51106c4683bfe02ce15ecad71716734b7a91f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/60764
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Michael Tang <tangm@microsoft.com>
2021-08-19 17:17:26 +00:00
Michael Tang 71d7c2e670 D3D12: Include serializer error messages in pipeline layout creation
Currently, Dawn ignores the output of D3D12SerializeRootSignature. This
change adds these error messages to the the CheckHRESULT context.

Change-Id: Ieeb63d7b5408ca1bc9e4ab97d777f764cdf06664
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62163
Commit-Queue: Michael Tang <tangm@microsoft.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-08-18 00:36:37 +00:00
Stephen White 8d1ead6393 Remove unused SPIRV-Cross shader reflection bits.
The only part of mGLEntryPoints actually used is the bindings, so
replace ShaderModuleGL::mGLEntryPoints with mBindings.
This required extracting BindingInfoArray from EntryPointMetadata,
making it visible in the dawn_native namespace.
Remove all non-bindings-related reflection, and MSL-specific checks
and workarounds.

Bug: dawn:1076
Change-Id: I05657c0c89f5d8a2185e55f9ad7c8f81d89a8e60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62180
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-08-17 20:50:36 +00:00
Brandon Jones e1bdfa8d32 Remove deprecated depth texture sampling path
Removes deprecated path for sampling depth textures with
float/unfilterable-float. Attempting to do so now results in a
validation error.

Bug: dawn:1021
Change-Id: I112f45e7227ab1caaf0d6ed203194295e7022db2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61861
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-08-16 19:55:00 +00:00
Corentin Wallez e53a7cc874 Fix CMake build on macOS
Fixed: dawn:1061
Change-Id: Ie4208f32e9403220d78601ebefcc62c2c44c3485
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62040
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-08-16 15:32:52 +00:00
shrekshao 5486a2fba5 Remove some validation for alpha.src/dstFactor
Validation rules revised at
https://github.com/gpuweb/gpuweb/issues/2013#issuecomment-897364617

Bug: dawn:1063
Change-Id: I8ae1cd00f75c8049206a8c5f6fcdb879e1b6a469
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61821
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2021-08-13 00:08:50 +00:00
Bryan Bernhart 31f039350b D3D12: Cache DXGI keyed mutexes on the external image.
Maintains a 11on12 resource cache on the external image
to prevent re-creating the wrapped resource then
flushing it per produced texture. To prevent
unbounded growth, a basic cap is used which gets
cleared.

This change fixes signficant CPU time spent in the WebGPU command
decoder for video import workloads and excessive memory overhead
from swap chain buffers.

Fixed: dawn:625

Change-Id: I72c07b02f6ab6877a9f21758650962c895933bf9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51421
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2021-08-12 23:32:49 +00:00
Juanmi 633bb68c6b Reland "Making D3D12 accept InternalUsageDescriptors"
This is a reland of 365d40b93a

Original change's description:
> Making D3D12 accept InternalUsageDescriptors
>
> This is a follow up from two previous CLs,
> https://dawn-review.googlesource.com/c/dawn/+/58440
> and
> https://dawn-review.googlesource.com/c/dawn/+/58140
>
> This CL adds in the D3D12Backend the possibility to use Dawn Texture
> Internal Usage Descriptor, and adds a series of tests to validate it.
>
> Change-Id: I94f6b39153b60ec8af61bda22d41a865898da613
> Bug: dawn:1027, dawn:1052
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61520
> Commit-Queue: Juanmi Huertas <juanmihd@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>

Bug: dawn:1027, dawn:1052
Change-Id: I0d35cbf4dc1c6dc80e1a5dfb4770a5383ef543fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61840
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Juanmi Huertas <juanmihd@chromium.org>
2021-08-12 20:17:39 +00:00
Bryan Bernhart 0d6da1072c Fix ASSERT setting staging buffer label
Ensures the mapped staging buffer will
always be locked before setting the label.
Otherwise, setting the label could fail
and leave it unlocked which isn't
allowed.

BUG: chromium:1239112
Change-Id: I738f8d6fc3b20b8c8b51671d77e7014d967ffd52
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61860
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2021-08-12 19:46:18 +00:00
Austin Eng 39c4fcbdd3 Revert "Making D3D12 accept InternalUsageDescriptors"
This reverts commit 365d40b93a.

Reason for revert: Broke the ChromeOS build in the Dawn roll.
https://chromium-review.googlesource.com/c/chromium/src/+/3090302

Original change's description:
> Making D3D12 accept InternalUsageDescriptors
>
> This is a follow up from two previous CLs,
> https://dawn-review.googlesource.com/c/dawn/+/58440
> and
> https://dawn-review.googlesource.com/c/dawn/+/58140
>
> This CL adds in the D3D12Backend the possibility to use Dawn Texture
> Internal Usage Descriptor, and adds a series of tests to validate it.
>
> Change-Id: I94f6b39153b60ec8af61bda22d41a865898da613
> Bug: dawn:1027, dawn:1052
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61520
> Commit-Queue: Juanmi Huertas <juanmihd@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>

TBR=kainino@chromium.org,enga@chromium.org,juanmihd@chromium.org,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I11b246f38505df23a6c61e851d6d90e34c8d1287
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:1027, dawn:1052
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61820
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-08-12 17:05:21 +00:00
Juanmi 365d40b93a Making D3D12 accept InternalUsageDescriptors
This is a follow up from two previous CLs,
https://dawn-review.googlesource.com/c/dawn/+/58440
and
https://dawn-review.googlesource.com/c/dawn/+/58140

This CL adds in the D3D12Backend the possibility to use Dawn Texture
Internal Usage Descriptor, and adds a series of tests to validate it.

Change-Id: I94f6b39153b60ec8af61bda22d41a865898da613
Bug: dawn:1027, dawn:1052
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61520
Commit-Queue: Juanmi Huertas <juanmihd@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-08-12 15:35:48 +00:00
Stephen White 1935043d35 Fix CMake build.
SpirvUtils.* are now in the dawn_native/opengl/ directory.

Bug: dawn:1067

Change-Id: I9cfb7ee52ec1f4ac321cb03978008843e33f82c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61680
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-08-12 15:24:48 +00:00
Austin Eng 8e402bc4c5 Suppress flaky CopyTextureForBrowserTest on Win Vulkan Intel
Bug: dawn:1070
Change-Id: Ic5dc1b334e4b006594ee950bf508057361e821bd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61720
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
2021-08-12 15:16:14 +00:00
Austin Eng eda73e3c4e Validate SPIRV produced by Tint
The now-removed SPIRV-Cross path used to always do this, and the
pure Tint-only path never actually validated the SPIRV. Tint
does not run SPIRV-Tools validation on its output, so add in
validation to ensure we don't pass invalid SPIRV to the driver.
The validation can probably eventually be removed when we're more
confident that Tint's SPIRV output is always correct.

Also include various cleanups for old / unused code.

Bug: dawn:1036
Change-Id: Iaab037518965e52edbd1829f6ab6ba2af0e70143
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61589
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Auto-Submit: Austin Eng <enga@chromium.org>
2021-08-12 05:20:48 +00:00
Austin Eng 5bed1ed838 More spirv-cross related removal
Bug: dawn:1036
Change-Id: Ia60c71558bd2c47a6b7148d86b8dcedfaa79ba89
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61585
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-08-11 21:15:26 +00:00
shrekshao 4f2edf576e Add validation for fragment output and attachment interface matching
Validation rules discussed at
https://github.com/gpuweb/gpuweb/issues/2013

Bug: dawn:1063
Change-Id: I264eecb7c548f29975e5459a7ad020105acab634
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61383
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-08-11 21:12:36 +00:00
Austin Eng 38534b6e74 D3D12: Only set the root signature when bind groups are applied
Dawn only reapplies bind groups that have changed on the layout
since the last draw. However, the D3D12 backend was always resetting
the root signature state upon switching pipelines. This led to a
bug where the root signature could be changed and dirtied without
reapplying the dirty bind groups.

Moving application of the root signature state to the same loop
that applies bind groups helps ensure the state stays in sync.

Fixed: dawn:1055
Change-Id: Iae89088560e83f6104c921d42de27c03095d654f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61582
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
2021-08-11 18:44:59 +00:00
Austin Eng e02bb36a2a Avoid [MTLDevice sampleTimestamps] unless the extension is enabled
This callsite was missed in a previous CL:
https://dawn-review.googlesource.com/c/dawn/+/59041

Bug: chromium:1226078
Change-Id: I3829dc16a8ec3c7b7274bc6057030bdade598ade
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61584
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-08-11 15:36:35 +00:00
Austin Eng 9978b2f742 Add Adapter::SupportsExternalImages
This commit adds a getter so that Chromium can check whether an
Adapter would support external images. External images are
necessary to implement the WebGPU swapchain and interop with the
rest of the web platform. We should not expose adapters that
cannot interop with the canvas and other web platform primitives
until WebGPU gains options to request more "limited" adapters.

Bug: dawn:1056
Change-Id: Iff83ac26b0e92dccdd4e29c0d854d9276a4a37bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61580
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Brian Ho <hob@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-08-11 14:27:55 +00:00
Stephen White bcbe2e0c94 Move SPIRV-Cross functions into OpenGL backend.
Since the other backends no longer need it, move all of the
utility functions specific to SPIRV-Cross into the OpenGL backend.
This obviates the need for the DAWN_USE_SPIRV_CROSS define, so remove it.

Bug: dawn:1036

Change-Id: I67bb5a85dc128a6f343d09876046cf559395e05f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61541
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-08-10 22:04:33 +00:00
Stephen White 5d17ed6541 Wrap all uses of SPIRV-Cross in #define.
Put all cross-platform code references to Spirv-Cross behind
ifdef DAWN_USE_SPIRV_CROSS. Hide build dependencies behind
dawn_use_spirv_cross, which itself is set from dawn_enable_opengl,
since it is the only backend which is still using SPIRV-Cross.

Bug: dawn:1036

Change-Id: Id61512230b50a32c63827a16fece40d7899968d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61400
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-08-10 18:30:55 +00:00
Stephen White ebbbcc7ecb Remove SPIRV-Cross support from D3D12 backend.
Bug: dawn:1036

Change-Id: If447f93f7a17ecfe73f04605a60893edb00990d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61402
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-08-10 14:51:27 +00:00
Brandon Jones 27e17a6aad Update deprecated TextureUsage flag names
Older names are kept around as an alias for a while. Unfortunately we
have no mechanism for producing deprecation error messages when they
are used.

Bug: dawn:1035
Change-Id: Ic6716fd526ecbedaa8e7925ab93e3ff32f642d97
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61382
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-08-10 04:07:37 +00:00
Jiawei Shao f99d5aa7d4 Remove a useless comment
This patch removes the comment about adding "interpolationType" and
"interpolationSampling" to InterStageVariableInfo as they have already
added before. Sorry that we forgot to remove it in the PR of adding
these two members to InterStageVariableInfo.

BUG=dawn:802

Change-Id: Ib2f3769f2dc1c8152280a28aad77bf90abf76608
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61384
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-08-10 03:42:44 +00:00
Stephen White a03e847227 Remove SPIRV-Cross support from Vulkan backend.
Bug: dawn:1036

Change-Id: I463d067af03fbcd732402fd0e0cc7045669e13b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61220
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-08-10 02:56:03 +00:00
Bryan Bernhart c61a24b5fd D3D12: Fix crash from non-initialized adapter.
If the Adapter failed to create a D3D device, it would
attempt to access it on destruction causing the
process to crash.

Bug: dawn:460
Change-Id: I3f13043e8049cd71806ee54efa92c70e26561580
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61300
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
2021-08-09 17:46:03 +00:00
Michael Tang ed9681c921 dawn_native: Fallback sorting bindings in BindGroupLayout to use the binding number
This helps us merge contiguous descriptor ranges in https://dawn-review.googlesource.com/c/dawn/+/60764

Change-Id: I772262b117087ec1f1d744596be2585a5996325f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/60765
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Michael Tang <tangm@microsoft.com>
2021-08-06 22:39:21 +00:00
Jiawei Shao 8d8fadbbe4 Validate MaxInterStageShaderComponents when creating shader module
According to the discussion[1], the sum of all the user-defined
inter-stage component count and all the inter-stage builtin component
count should be no more than MaxInterStageShaderComponents (currently
in Dawn it is always 60).

[1] https://github.com/gpuweb/gpuweb/issues/1962

BUG=dawn:1032
TEST=dawn_unittests

Change-Id: Id5266b72b89c48f5b7073b8307f8f2c0512c8a33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61104
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-08-06 20:57:18 +00:00
Austin Eng 93011d0305 Set the Tint MSL emit_vertex_point_size option when necessary
If [[point_size]] is not emitted, it is undefined. Set the option for
Tint to explicitly set it to 1.0 when necessary.

Bug: dawn:1059
Change-Id: I27c19e88cda30aef0a8f31b213c58d5bf87feabd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61280
Commit-Queue: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2021-08-06 18:19:38 +00:00
Austin Eng 567e071b5b Free VkCommandPool if vkResetCommandPool fails
Bug: chromium:1234680
Change-Id: If8f5c2dc0cdf14bf8a0c713d724b883657bd1463
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61103
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-08-06 16:16:20 +00:00
Brandon Jones 9096fc290f Remove createRenderPipeline2 and GPURenderPipelineDescriptor2
Blocked on:
https://chromium-review.googlesource.com/c/chromium/src/+/3075622
https://skia-review.googlesource.com/c/skia/+/437076

Change-Id: I49773b422c0fda7c752b90c341e5a9f243fc0b36
Bug: dawn:751
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61101
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2021-08-06 03:58:50 +00:00
Stephen White 6ab06f8881 Remove SPIRV-Cross usage from Metal backend.
Change-Id: I456b6cc660779175afc73bbef5134fbcf4988ad3
Bug: dawn:1036
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/60900
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2021-08-06 01:24:59 +00:00
Juanmi f00c68a216 Adding APICopyTextureToTextureInternal
This CL adds an internal method to copy textures, that will disregard
the need of having CopySrc usage.

This CL adds an intermediate helped method to be used by both
APIContextTextureToTexture and APIContextTextureToTextureInternal.

Fixed: dawn:1052
Change-Id: Icd28e0ef58ecfaa412eefe8c95e41cd2298a9acc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/58440
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Juanmi Huertas <juanmihd@chromium.org>
2021-08-05 22:55:09 +00:00
James Price 565863e954 Fix linker error with iOS build
The IsMacOSVersionAtLeast() function is only defined on macOS, but was
being used on all Apple platforms.

Change-Id: Ie5e37fb8e408f424e55795327cca7f2a345bfdfa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61120
Commit-Queue: James Price <jrprice@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2021-08-05 20:35:19 +00:00
Austin Eng 6c6707021a Add Buffer::GetAllocatedSize()
Buffer allocations may need padding based on backend requirements.
GetAllocatedSize returns the size of the buffer actually allocated.

This CL also updates the backends to use GetAllocatedSize for buffer
clearing and barrier operations which should operate over the
entire allocated resource.

Bug: dawn:1011
Change-Id: Ic5233214414fa090725a4f50fff70d6e178494c3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/60701
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
2021-08-05 15:26:58 +00:00