Commit Graph

8318 Commits

Author SHA1 Message Date
Quyen Le 87f51237b4 Revert "Disable frontend cache when implicit device sync is on."
This reverts commit 8cc6205bf7.

Reason for revert: Graphite actually reuses the bind groups between
draw calls using different pipelines and this change prevents it
from happening.

Original change's description:
> Disable frontend cache when implicit device sync is on.
>
> Normal behavior of ApiObjectBase's APIRelease() which only locks the
> device when last ref dropped is not thread safe if the object is cached
> as raw pointers by the device. Example of cached objects: bind group
> layout, pipeline, sampler, shader module.
>
> The following scenario could happen:
>  - thread A:
>     - shaderModuleA.APIRealease()
>     - shaderModuleA.refCount.Decrement() == true (ref count has reached zero)
>     - going to call shaderModuleA.LockAndDeleteThis().
>  - thread B:
>     - device.CreateShaderModule().
>     - lock()
>     - device.GetOrCreateShaderModule()
>     - shaderModuleA is in the cache, so return it.
>     - unlock()
>  - thread A:
>     - starting to call shaderModuleA.LockAndDeleteThis()
>     - lock()
>     - erase shaderModuleA from the cache.
>     - delete shaderModuleA.
>     - unlock()
>
> This CL disables caching when ImplicitDeviceSynchronization is turned on
> until we find a better solution.
>
> Bug: dawn:1769
> Change-Id: Ideb2a717ece0a40e18bd1c2bef00817262bd25da
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127900
> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>

TBR=cwallez@chromium.org,enga@chromium.org,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com,lehoangquyen@chromium.org

Change-Id: Ib13bba8005402d06963865fae919388a91e718f0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:1769
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128440
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-21 03:10:12 +00:00
Jiawei Shao cd4b42b5a2 dawn/node: Implement Adapter.GetAdapterInfo()
Bug: dawn:1761
Change-Id: Ia1bf7841052897b69de50d6db41b05ee5645be47
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128104
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-21 01:49:38 +00:00
Jiawei Shao 2d1136281e Add missing default return values to slience Wreturn-type
This patch adds two missing default return values to slience the
compilation warning "Wreturn-type" when building dawn.node.

Bug: dawn:1761
Change-Id: I87c8566cabba4c2e14174bf9f38f53ed3c0fdb74
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128103
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-21 00:29:43 +00:00
Peng Huang cf5aa73f81 d3d11: remove a noreached `break`
Bug: dawn:1795
Change-Id: I32e1407a5d9054ac81d672202b0597334aa7721e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128400
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-20 23:52:56 +00:00
Ben Clayton 7883a0cb8d tint: Add two-token form for diagnostics rule names.
Fixed: tint:1891
Change-Id: Ia3737c29b111d7b6e6b00fbd68da7f85a5a49bca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128301
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-20 23:51:53 +00:00
Brandon Jones 6cb055b6aa Retain descriptor labels for error objects
Since these objects are more likely to be included in error messages
it's important that we keep the labels that the developer has given
them.

Bug: dawn:1771
Change-Id: I78f4ccc23ce40d8eeceed8ca7dd563dff949b4fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128420
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
2023-04-20 23:35:14 +00:00
Le Hoang Quyen 8cc6205bf7 Disable frontend cache when implicit device sync is on.
Normal behavior of ApiObjectBase's APIRelease() which only locks the
device when last ref dropped is not thread safe if the object is cached
as raw pointers by the device. Example of cached objects: bind group
layout, pipeline, sampler, shader module.

The following scenario could happen:
 - thread A:
    - shaderModuleA.APIRealease()
    - shaderModuleA.refCount.Decrement() == true (ref count has reached zero)
    - going to call shaderModuleA.LockAndDeleteThis().
 - thread B:
    - device.CreateShaderModule().
    - lock()
    - device.GetOrCreateShaderModule()
    - shaderModuleA is in the cache, so return it.
    - unlock()
 - thread A:
    - starting to call shaderModuleA.LockAndDeleteThis()
    - lock()
    - erase shaderModuleA from the cache.
    - delete shaderModuleA.
    - unlock()

This CL disables caching when ImplicitDeviceSynchronization is turned on
until we find a better solution.

Bug: dawn:1769
Change-Id: Ideb2a717ece0a40e18bd1c2bef00817262bd25da
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127900
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-20 21:12:25 +00:00
Le Hoang Quyen 335573116c Add Device::GetSupportedSurfaceUsage() method.
This method will return supported usage flags that can be used to create
a swap chain.

Bug: dawn:1760
Change-Id: I7699c2c4ef7142c6bd06e72239d6e4f9112f15a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127440
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-20 20:42:05 +00:00
Ben Clayton 7eb37948ab tint/reader/wgsl: Have expect_identifier return an ast::Identifier
Instead of a std::string. This avoids unnecessary string allocations, and follows the pattern of all other AST nodes.

Change-Id: I3faf534090a2033d671b2ef463d8b9ed3e47eecd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128300
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2023-04-20 20:08:44 +00:00
Peng Huang 91a23a3ac3 d3d11: CommandBuffer: implement render pass
Bug: dawn:1705
Change-Id: I21c6a8550f098cb1e97d5f0c9a93da53600fa8a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127700
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
2023-04-20 18:07:20 +00:00
AlbinBernhardssonARM ce2cdb4b4d Fix Dawn Native Android build
Fixes 2 CMake issues:
1. GLFW subdirectory was added regardless of
   DAWN_SUPPORTS_GLFW_FOR_WINDOWING.
2. Android uses the AHardwareBuffer implementation of
   memory service. But in the CMake MemoryServiceOpaqueFD.cpp
   was added instead of MemoryServiceAHardwareBuffer.cpp .

Bug: dawn:286
Change-Id: I6d81976a5c12717b3e565c4d9f8d5ae54f4e0446
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128260
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-20 17:58:59 +00:00
Peng Huang bd696e91d2 d3d11: fix several OOM end2end test on trybot
BufferTests.CreateBufferOOM/D3D11_Intel_R_UHD_Graphics_630 fails on
trybots due to buffer size overflow UINT which is used as size for
create ID3D11Buffer.

This CL fixes above issue and also uses CheckOutOfMemoryHRESULT()
to handle hresult from texture and buffer creation. It makes OOM
an allowed error.

Bug: dawn:1705
Change-Id: I2c4a4841cac15934fe83b7f7d6e568e9f3c8d210
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128280
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-20 17:27:17 +00:00
dan sinclair 45ff7a8c4a Remove extra work from `is_reserved`
Currently the `is_reserved` method in the WGSL parser uses the
`operator==` on the token to check the reserved words. This ends up
re-doing a bunch of work as it checks the token type, then gets the
`string_view` or `string` from the variant, then compares.

This CL adds a precondition that the token is an identifier (which is
true in the only case we call this method) and then extracts the string
from the token once and uses that for all the comparisons.

Change-Id: If425afea38e727169de7991a84f6fa1e47f660ef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128140
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-20 16:50:29 +00:00
Peng Huang 03d68fa33f d3d11: CommandBuffer: implement compute pass
Bug: dawn:1705
Change-Id: I0d935a9ce42b08e436d68f1400ee9faf1ab00cc3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127560
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-20 15:27:01 +00:00
dan sinclair 517278ac08 Move text/unicode into utils.
This CL consolidates the unicode code into utils. These are utility
libraries, so the extra namespace doesn't add much.

Change-Id: Id0de612b6be036392a3cb018bfe66733f2f1ebcb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127403
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-20 10:06:25 +00:00
Peng Huang 9e9c456075 d3d11: CommandBuffer: implement buffer and texture related cmd
This CL also enables several buffer end2end tests

Bug: dawn:1705
Change-Id: I16c23346a60f3f15dbfbb96b2cb8dc0f5ba8c89c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127405
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-20 03:24:55 +00:00
dan sinclair 12fa303899 Move castable into utils.
The Castable class is used by utils/. This Cl moves the implementation
into the utils/ folder. The `Is` and `As` methods are added into the
`tint` namespace to make usage shorter.

Change-Id: I0decedb92ebed01b6aa12d2e3efa7190742e9a33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127402
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-19 23:52:33 +00:00
Shrek Shao a965f520f9 Add alphaToCoverage validation aligning with WebGPU V1
Add alphaToCoverage validation regards to targets[0] has alpha channel.

This change reflecting WebGPU V1 spec update is aimed to ship together
with WebGPU in Chromium.

Bug: dawn:1759
Change-Id: I0aef60cf8c4dc828e05d6027644ffed35b33f652
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128061
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-04-19 23:42:36 +00:00
Peng Huang ff75ab9a87 d3d11: set object labels
Change-Id: I26b7accf973b03cef7ba113b0ee3672b99e41338
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126861
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-19 23:26:15 +00:00
dan sinclair e6e5998e2b Cleanup GLSL writer.
This Cl removes the boolean return values from most of the GLSL
writer methods. The diagnostics are used to determine if the generation
was successful. The writer itself just continues until complete.

Change-Id: Ia64968eaa6a0aa39a9713fa78f3e743f2de38b44
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127020
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-19 20:32:13 +00:00
dan sinclair c480632ed6 Setup ArrayLength transform for MSL benchmark
Some of the benchmark shaders when run with the MSL backend are
currently failing because the robustness transform is injecting the
arrayLength method but there is no configuration for running the
arrayLength transform.

This Cl adds some default configuration to the MSL bench to make a slot
available for each possible value. It just always makes them available
such that all shaders work correctly.

Change-Id: Ie8a15abc0b7da7d2f46be11274e66302406be019
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128060
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-19 20:14:50 +00:00
dan sinclair e16ed7ccc2 Make more SymbolTable methods string_view.
This CL updates more of the SymbolTable to use string views.

Change-Id: I0d9c7817ba4e3b0d0e73cfc02406481eb796c3c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-19 16:58:12 +00:00
dan sinclair 0559005494 Move traits into utils.
This CL moves the tint/traits file into tint/utils/traits. Traits is one
of the few items not in utils which is referred to by utils.

Change-Id: Ie955398f24e949b7618fdc868dbcb903fe20b3f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127400
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-19 16:52:46 +00:00
Peng Huang b7285f3c9e d3d11: implement Buffer
Bug: dawn:1705
Change-Id: I4542cc2e0f4f6a7f0d13c5f071bfb25897350008
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126440
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-19 15:52:32 +00:00
dan sinclair d21e2d64ec Convert VariableUser vector over to utils::Vector.
This vector was causing a lot of small allocations to happen, this CL
converts over to a utils::Vector to take advantage of the better
allocation strategy

Change-Id: Id740bd2a50a8d0bdd84f4b6e7c7ad4607436c7f4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127500
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-19 15:06:24 +00:00
Ben Clayton 8fc9b86214 CMake: Add TINT_EXTERNAL_BENCHMARK_CORPUS_DIR
If specified, CMake will glob all the .wgsl files in this directory, and add these to the list of benchmarks to run.

Change-Id: I75b2754a6561dcd931c42bd47649c4f625e1c581
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127980
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2023-04-19 15:03:19 +00:00
Ben Clayton 5f4847c23e tint/sem: Make BindingPoint optional
Reduces hops from sem -> ast, just to know whether the variable has a binding point.

Change-Id: I5620198e6f08b73d5a0171d95874f1a2dae5d93e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127060
Reviewed-by: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-04-19 13:24:27 +00:00
Loko Kung c47e05ae50 Rolls third_party/gpuweb to 2e75d5e
- Needed to remove maxFragmentCombinedOutputResources limit.

Bug: dawn:1756
Change-Id: Ia7c87d845a79fafee45ab7d1e2b7798e3157945f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127940
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-19 09:08:42 +00:00
Jiawei Shao f4b9f95b68 dawn/node: Implement GPUBuffer.getMapState()
Bug: dawn:1761
Change-Id: Id01789a2df8afd5726f6fc776e7d825153fd0f85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127722
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2023-04-19 01:47:52 +00:00
Ben Clayton 692846d0a0 tint/resolver: Fix use after move
Bug: chromium:1434271
Change-Id: Ib70f9468c60fe00ca7bf9346b6ee8a71a819b59d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127681
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-04-18 21:15:44 +00:00
Antonio Maiorano bacf44f964 Workaround dawn_wire_server_and_frontend_fuzzer ASAN false positive
When discovering Vulkan adapters, if none is found, the vulkan loader
DLL is loaded and then unloaded, which results in ASAN false positives
when the loader's previously allocated memory is re-used, which happens
in fuzzer::TracePC::ClearInlineCounters.

Bug: chromium:1427723
Bug: chromium:1038952
Change-Id: Idb205607426a0af22daba363e2679afaa33204b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127840
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2023-04-18 20:10:51 +00:00
dan sinclair d026e13f48 Remove `SymbolTable::NameFor`
This CL removes the `NameFor` method from SymbolTable and accesses the
symbols name directly.

Change-Id: Ic4ad6eecfa78efb946d97aeaecf2d784af2e6f16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127301
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-18 19:38:25 +00:00
dan sinclair b353ebe752 Add an allocator to store the symbol names.
This CL adds an allocator, owned by the SymbolTable, which stores the
names of all the symbols in the table. The Symbols then have a
`string_view` to their name.

Change-Id: I28e5b2aefcf9f67c1877b7ebab52416f780bd8c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127300
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-18 19:31:21 +00:00
dan sinclair fa3c08d112 Add a bump allocator.
This CL adds a simple allocator which will provide a chunk of memory of
the given size. It allocates out of slabs of memory.

Change-Id: I9acf59fac88cd6bef260b7ebae7d7b77fd939754
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127302
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-18 16:15:44 +00:00
shrekshao 8f0607a8c8 Fix D3D12 shader interstage truncating transform
Don't skip the TruncateInterstageVariables transform when
user defined interstage attribute input for fragment stage
is empty. Because builtin inputs could also cause register
mismatch for D3D12 HLSL compiler.

Add a boolean flag to Tint hlsl generator option to indicate
whether to run TruncateInterstageVariables or not.
This defaults to false in Tint, while Dawn always set
this to true for vertex stage.

Bug: dawn:1733
Change-Id: Ie4c3648b226513bf15f0e03ae4ce7f3cc09fdef4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127206
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
2023-04-18 01:34:41 +00:00
Austin Eng 6a7bba54fa Add basic Dawn microbenchmarks using Google benchmark
The initial test tests bind group layout creation of
different sizes, cache / no-cache hit, with and without
multiple threads.

Change-Id: Ic9ed6c6f1c298d35cd1358c7ff492027c83649a7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127346
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-17 18:11:51 +00:00
Ben Clayton 559e5a2cde tint/transform: Fix ICE in HLSL backend
When referencing a pointer parameter with a 'let', but not using that
let.

Also fix a bunch of places where we used the old names for the pointer
transforms.

Bug: chromium:1433499

Change-Id: I8decefeacd6150bd6f7637f80e62b9cb62936235
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127540
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-04-17 14:24:58 +00:00
Le Hoang Quyen 7532f6665e Disable OOM tests when TSAN is enabled.
Bug: dawn:1725
Change-Id: I83ddaaf0d98d2831f95abbfbf5adfad268ebdba5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-14 22:38:28 +00:00
Peng Huang f5966b09e1 d3d11: enable d3d11 if dawn is not build with chromium
This CL enable build d3d11 by default, if dawn is not build with
chromium. d3d11 backend is not full implemented yet, so no tests
will run against d3d11 backend.

Bug: dawn:1705
Change-Id: Id689ab5168511af0f75f0b3537f246713de5ca45
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127260
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-14 02:05:17 +00:00
Peng Huang 34d52ffa4c Revert "d3d11: add d3d11 backend in end2end tests"
This reverts commit 3fcf96dd8c.

Reason for revert: want to enable end2end test piece by piece on bots for d3d11

Original change's description:
> d3d11: add d3d11 backend in end2end tests
>
> Right now, many tests are not passed becasue unimplemented
> features in d3d11 backend. HoweverD3D11 backend is disabled on
> bots by default, so this CL will not break out bots.
>
> Bug: dawn:1705
> Change-Id: I57321b86a404bc245b71c467479fdee0464dee9b
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126260
> Commit-Queue: Peng Huang <penghuang@chromium.org>
> Reviewed-by: Austin Eng <enga@chromium.org>
> Kokoro: Kokoro <noreply+kokoro@google.com>

Bug: dawn:1705
Change-Id: I95a1cc9a0962b01a6b31ea32b6129f109f4b3e42
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127240
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-13 22:45:28 +00:00
dan sinclair c4cc6ec038 Remove the demangler.
The demangler is no longer used by the Tint executable, and nothing else
calls it, so delete it.

Change-Id: Ic47238e4a6126e5daacd81dfc6f5986524b648ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127280
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-13 21:17:12 +00:00
Brian Sheedy c0398e4174 Skip logging on Win official builds
Skips logging in sandboxed processes on Windows
official builds since the file handles will not
be set properly, causing crashes when we try to
write to stdout/stderr.

Bug: chromium:1429665
Change-Id: Ie70d0cc2e096bd22490dc3538467752b448f213b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127205
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Brian Sheedy <bsheedy@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@google.com>
2023-04-13 20:41:23 +00:00
Le Hoang Quyen c405dddf5e Add missing locks to indirect draw validation & timestamp query.
Also added new multithreaded tests to verify them.

Bug: dawn:1662
Change-Id: I58ebe265edf58e0c4eb5d9337d3441a6bb972ed4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126781
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-13 15:59:15 +00:00
Peng Huang b08d87c06e d3d11: implement SwapChain
This CL also abstracts common code from d3d12::SwapChain to
d3d::SwapChain base class for sharing.

Bug: dawn:1705
Change-Id: I7b6ac8770b3c517fe552061de3c5589174ba5814
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126665
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-13 15:36:52 +00:00
dan sinclair 2200823afd Allow building SPIRV_WRITER without READER
Currently the SPIR-V headers are only included when building the
SPIRV_READER. This means the build breaks if the SPIRV_WRITER is enabled
but not the reader.

This CL fixes the conditionals to include the SPIR-V header for both the
reader and the writer.

Change-Id: I8690e3e42dbe3071dcaa3ed467d6eac8f62a7bbc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127160
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-13 12:59:33 +00:00
Le Hoang Quyen a4866d0d97 D3D12's external image: Add multithread support.
Bug: dawn:1662
Change-Id: Id2d720af4e5e654b5f34aebf485bededc6d247ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-13 08:44:34 +00:00
dan sinclair 541138b11b Cleanup SyntaxTree writer.
This Cl removes the boolean return values from most of the SyntaxTree
writer methods. The diagnostics are used to determine if the generation
was successful. The writer itself just continues until complete.

Change-Id: I87d85e2cbe061306a4598a498ccad4510f62e8c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124681
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-13 04:18:55 +00:00
dan sinclair 27c7722620 Cleanup WGSL writer.
This Cl removes the boolean return values from most of the WGSL writer
methods. The diagnostics are used to determine if the generation was
successful. The writer itself just continues until complete.

Change-Id: Iff33128c1df286cab799f08dab8c3defc5651d76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124680
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-13 02:57:27 +00:00
Le Hoang Quyen 3e7a114a6e Add missing lock to APIBeginRender/ComputePass.
Add tests to verify multithreading behaviors of encoding render/compute
passes.

Bug: dawn:1662
Change-Id: I9bc6a0dd5d94b53b59e7e49a4611d4d55cc36e60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126980
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-12 21:07:31 +00:00
Peng Huang 3dba94c1d4 d3d11: implement RenderPipeline
Bug: dawn:1705
Change-Id: If6de0d18c4da530ba63637aa095ae2f4a957c2f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126663
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
2023-04-12 19:05:00 +00:00
dan sinclair 0b3fc055d3 Update samples to process events.
This CL updates the `dawn/sample` programs to call the
`dawn::native::InstanceProcessEvents` which allows things like shader
validation errors to be emitted.

Without this change the errors are never displayed.

Change-Id: I054bb4f7177c5d0c110e97409852143b2bef1e02
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-12 13:19:35 +00:00
dan sinclair 8a435a2a4b Remove `error` from TextGenerator.
This CL removes the `error()` method from the TextGenerator in favour of
using `Diagnostics().str()`.

Change-Id: If20261ac839d11f6d29890cb17f95f2d4df5db2d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126923
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-12 11:59:24 +00:00
dan sinclair 585f395e66 Simplify MultiplanarExternalTexture::ShouldRun.
Currently the multiplanar `ShouldRun` function is scanning all objects
looking for an external texture. This CL switches to using the type
manager and attempts to find an `ExternalTexture` type in the system. If
found, then the transform should run.

Change-Id: I28b8fa1835a83f2bff5d804e95bcbaa73d3d2124
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126922
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-04-12 00:44:20 +00:00
Peng Huang c3cc75067e d3d11: implement ComputePipeline
Bug: dawn:1705
Change-Id: I915000a747cc913ed52a423940d20e169b829315
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126664
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-12 00:02:30 +00:00
dan sinclair 04d61c85cd Always run Multiplanar transform.
Currently the multiplanar transform is only run if a global variable is
seen with a `texture_external`. There are cases where a function with a
`texture_external` can exist (the fuzzers do this, the tint command line
can do this as well). These will fail when hitting the backend.

This CL makes the running of multiplanar unconditional. This causes the
logic to process the function parameters to run and the external texture
is removed.

Bug: chromium:1431610
Change-Id: I1793142e803e864c744b38cf843931521e6a449f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126921
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-11 23:02:45 +00:00
dan sinclair d146c8a7a2 Enable multiplanar for SPIRV fuzzers.
This CL updates the common fuzzer code to enable the multiplanar
extension for the SPIR-V backend.

Bug: chromium:1427801
Change-Id: Ie03d3e10f7831ca851aa11c00cbac0aa474ccabb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126920
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-04-11 23:02:38 +00:00
Peng Huang defda09e3c d3d11: implement Texture
Bug: dawn:1705
Change-Id: Iff5e301c04120a86ccf4eba33281233e4d972981
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126662
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-11 20:42:23 +00:00
Le Hoang Quyen dc626d357d Add missing lock when creating new pipeline during encoding.
This was unsafe when encoding indirect draws with validations on
multiple threads.

Bug: dawn:1662
Change-Id: I479bb35bc98dd314860955b3c30df788d18ed84e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126780
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-10 10:09:57 +00:00
Le Hoang Quyen 3dce55a6fe MetalBackend: Enable multithread support.
Bug: dawn:1662
Change-Id: If2f74b4bbce9d108fcd5906c2105f9ebd95845fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124400
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-10 09:33:43 +00:00
Corentin Wallez 087deedbc8 dawn.json: remove leftovers from implementation-based swapchains.
This also removes the need for special casing the swapchain creation
proc in the fuzzers because it is no longer possible to have a valid
CreateSwapChain call since the wire can't create a surface (which is no
longer optional).

Bug: dawn:269
Change-Id: Icc6ed5e82c1d5382628d71d212640d238cfba348
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126425
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-04-07 14:59:55 +00:00
Corentin Wallez a48ba981ea Remove dawn_wsi.h
Bug: dawn:269
Change-Id: Ie1fb1a8109ff646b880c3e27762300167776d050
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126424
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-07 13:33:26 +00:00
Corentin Wallez 1226684b09 Merge NewSwapChainBase in SwapChainBase
Bug: dawn:269
Change-Id: I514c210f88e2bf1f501e2d814f8ab931c5ed724f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126423
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-07 13:30:50 +00:00
Peng Huang 6635b965b9 d3d11: implement ShaderModule
Bug: dawn:1705
Change-Id: I621a561e1b61762bb8347a74b24cb18a7c808ba3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126303
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-06 22:37:26 +00:00
Peng Huang 86e6a13649 d3d11: add BindGroup, BindGroupLayout and PipelineLayout
Bug: dawn:1705
Change-Id: I9bc7545328409c7ce8fd8adc26a35b872cda1420
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126302
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-06 19:59:05 +00:00
Peng Huang 4faf3d31ba d3d11: add Device, Queue, Sampler, etc
Bug: dawn:1705
Change-Id: I0cfc54a3be2c9dc4471d0b5b9cb7d6066519bcf1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126300
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-06 18:02:13 +00:00
Peng Huang ac77863352 d3d: supports more errors in HRESULTAsString()
Bug: dawn:1705
Change-Id: I811ed5867399fa417a0a542f3d4e706e989f0a23
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126660
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-06 17:12:04 +00:00
Le Hoang Quyen b7a3cbe8ca end2end tests: add --enable-implicit-device-sync option.
This option will allow tests to be run with
ImplicitiDeviceSynchronization feature.

Bug: dawn:1662
Change-Id: Ic001b2fa175f63e8d77eeb3b23d4d2cf52bb224e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126580
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-06 16:03:13 +00:00
Le Hoang Quyen c173a0ea88 Fix TRACE_EVENT wasn't thread safe.
TRACE_EVENT uses INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO and
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO reads and writes to a static
variable on multiple threads.

Fix by using std::atomic for the static variable.

Bug: dawn:1700
Change-Id: I914bb73352e400f0adeafb64518d61099276270d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/123680
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-04-06 08:08:00 +00:00
Le Hoang Quyen 7971bfe16f Add an option to enable implicit device synchronization.
1. Auto-generate mutex locking code in DawnNative's ProcTable's
functions. Using a mutex owned by the related Device.
  - Unless the function/class has "no autolock" attribute (new) in
  dawn.json. In which cases, no locking code will be auto-generated.
  - Currently Instance, Adapter, Surface, Encoder classes and
  Reference/Release method have "no autolock".

2. Added Feature::ImplicitDeviceSynchronization to enable Device's
mutex.
  - If this feature is disabled, lock/unlock Device's mutex is no-op.
  Auto-generated locking code will have no effect. This is the default.
  - This approach is used instead of generating two sets of ProcTable
  because it's cleaner and the internal code doesn't need to care about
  whether there is a mutex being locked or not. Furthermore, if there
  were two sets of ProcTable, and user used dawnProcSetProcs() to set
  global ProcTable, it would affect all other modules using different
  Devices. Even though those modules don't need thread safety.

Bug: dawn:1662
Change-Id: I75f0d28959f333318e4159916b259131581f79f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119940
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-05 19:35:07 +00:00
Austin Eng 78c496395c Always flush device callbacks when the callbacks are changed
With the wire, callbacks reference device-related data which is
freed when the device is unregistered from the wire. However,
the device that the wire refers to can live longer than this
and have its callbacks invoked at a later time, leading to a
use-after-free. Always flush the callbacks so that when the
wire unregisters a device and clears its callbacks, they are
called immediately and no dangling pointers remain.

Bug: chromium:1430221
Change-Id: Ib753b58cee5e7cb4d90ebd703958a0ddd5873573
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126481
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-05 17:10:58 +00:00
Corentin Wallez 8a6ed63809 Remove OldSwapChain*
Bug: dawn:269
Change-Id: I5bc6f5f8b98a88c5d0bd69e0d2eaf1e4bbd12e2b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126422
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2023-04-05 10:13:01 +00:00
Corentin Wallez 961f7eae70 Remove all NativeSwapChain*
These were helpers to avoid the need for users of implementation-based
swapchains to implement them themselves. They are no longer used and can
be removed.

Also removes SwapChainuUtils.h that's no longer used.

Bug: dawn:269
Change-Id: I3c563edaf107e9ce04f708e8bacae9d231b0f40d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126421
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-04-05 07:24:44 +00:00
Corentin Wallez 974802d17c Remove BackendBinding and its implementations.
These were helpers for implementation-based swapchains that are getting
removed.

Bug: dawn:269
Change-Id: I44b0f9a9d221b9370c3eb2625c68e540b6e2ef46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126420
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-05 07:23:09 +00:00
Yan,Shaobo 2c4847e59a Fix bug about requiring unexpected files when compiling on Android
In MemoryService implementation, Dawn uses DAWN_PLATFORM_IS() to choose
required header files for different OS platform.

On Android platform, both DAWN_PLATFORM_IS(LINUX) and DAWN_PLATFORM_IS(ANDROID) are true. This caused some linux platform header files and implementations has been included unexpected when compiling on Android platform.

This CL strict the macro condition to ensure Android platform include AHardwareBuffer related files only.

Bug:dawn:1593
Change-Id: If64567edf99cd25a3783d8c456a1fc3f6a7dccf2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126323
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2023-04-04 08:57:46 +00:00
Peng Huang 3fcf96dd8c d3d11: add d3d11 backend in end2end tests
Right now, many tests are not passed becasue unimplemented
features in d3d11 backend. HoweverD3D11 backend is disabled on
bots by default, so this CL will not break out bots.

Bug: dawn:1705
Change-Id: I57321b86a404bc245b71c467479fdee0464dee9b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126260
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-04 00:27:36 +00:00
Peng Huang ebfd505d29 d3d11: implement Adaptor, Backend, etc
This CL also moves some comman code in d3d12::Adapter and
d3d11::Backend to d3d::Adapter and d3d::Backend, so it can be
shared with d3d11 backend.

Bug: dawn:1705
Change-Id: Ica3bf33232d3380b7d4799c77bf9b43a8374a66e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-04-03 21:33:54 +00:00
Stephan Hartmann a7423b3d83 IWYU: add cstdint for uint8_t dawn::native::stream::ByteVectorSink
Bug: chromium:957519
Change-Id: I48436db0e203d793e47d717bfb75977c67145e94
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126120
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephan Hartmann <stha09@googlemail.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-03 13:51:27 +00:00
Le Hoang Quyen 44afd7112f Fix APIGetInstance() didn't increase external ref.
InstanceBase has two seperate ref counts: external & internal.
When we return it to the external user, we need to increase external
ref count as well.

Bug: chromium:1429835
Change-Id: I4b585d04149180418bd620e6e4d86522e033b64e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126080
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-03 10:04:42 +00:00
Yan,Shaobo 07b88f3aef MemoryService Choose Implementation based on ExternalImageType
This CL add supports for MemoryService choosing implementation based on
ExternalImageType in runtime instead of choosing in compile time.

This CL also removes MemoryServiceNull.cpp.

Bug: dawn:1593
Change-Id: Iddec1f5cf03a7d962ef12b8fd6293ffbb7dc064d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-04-03 02:14:21 +00:00
Peng Huang c00ff7f3c7 [tint] do not emit space for binding group 0
D3D11 only supports HLSL SM5.0 which doesn't support `space`
(binding group in WGSL). So for D3D11, only one binding group will be
used, and tint will not emit `space` for HLSL, so shaders can be used
with D3D11.

Bug: dawn:1705
Change-Id: Ie0e9868137f10762c5243e188d76f5e41879c2bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125080
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2023-03-31 17:55:19 +00:00
Peng Huang 70d8711973 [d3d] Move some texture format convert methods to d3d folder
Bug: dawn:1705
Change-Id: I08a348666785ab25110b179e37b6a2869313d998
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125241
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-31 17:24:31 +00:00
Peng Huang 3f76570d9a Print FPS for sample Animometer
Change-Id: I21ae60077638944258436c4cab14cc1d98e7f169
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125881
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-03-31 16:44:51 +00:00
Antonio Maiorano d8f0f44b54 dawn: enable IEEE strictness for compute pipeline to match render pipeline
This is the only flag we set for FXC compilation of render pipelines that we don't set for compute.

This fixes a (potentially unrelated) bug I've been looking into it (tint:1887

Bug: tint:1887
Change-Id: Iaf67ebe9221cd1d6e4e20afe0bcd3e5aa6e89366
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125820
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-31 12:24:10 +00:00
Antonio Maiorano 51249b83e6 tint/hlsl: don't use min16float to implement quantizeToF16
min16float is not required to convert its input to an 16-bit float.
Instead, use f32tof16, and f16tof32.

This is also required to be able to enable the IEEE strictness option on
FXC, otherwise FXC emits an error X4028: expression has a minimum
precision type and cannot be marked precise

Bug: tint:1887
Change-Id: I2268c9336b8e873b36e6532984838054fe4dedbd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125920
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-31 08:00:33 +00:00
Peng Huang 151e67b5d1 Support D3D11 backend for dawn samples also add toggle options
Bug: dawn:1705
Change-Id: I192ea2e8f85df8f995855109ef20eaf3bfd1ffa0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125840
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-03-31 01:03:42 +00:00
Le Hoang Quyen 947a7deb99 DawnNative: Add dawn::native::InstanceProcessEvents()
Make this a standalone function instead of a dawn::native::Instance's
member method.

Some code base don't use dawn::native::Instance but instead use
wgpu::Instance. And InstanceProcessEvents() function actually returns
a bool unlike wgpu::Instance::ProcessEvents() which returns void.

Bug: dawn:752
Change-Id: Ia354a4ed5b5568ee23bcc70935c104059a9f6fc8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125660
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
2023-03-29 07:06:18 +00:00
Yan,Shaobo 8e414572be Add ServiceImplementation class in external_memory
This CL introduced ServiceImplementation class. Service class deleate
its work to ServiceImplementation class.

Different platforms inherit ServiceImplementation class and implement
it to support Service class. It helps isolate implementaion and
interface. And it's the base for supporting choosing implementation
in runtime.

Bug: dawn:1593
Change-Id: Ib18dfaa41ef4a1ce9554a5241cac1ef0fede8dd8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125481
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-28 06:33:41 +00:00
Yan,Shaobo ef62a88f89 Rename Service Files in external_memory and external_semaphore
This CL do a pure rename work as the base of External memory
service refactory.

Bug: dawn:1593
Change-Id: If9595e8d8be97f5eb725acff8891e0bd1baf8928
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125480
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
2023-03-28 01:17:19 +00:00
Antonio Maiorano 5cf943e797 tint/hlsl: implement trunc in terms of floor/ceil to work around FXC bug
Bug: tint:1883
Change-Id: If6c160da0684353a873428a08063aa91ee7a01c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125420
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2023-03-27 18:55:25 +00:00
Antonio Maiorano deb2ec9785 tint: fix UB const-eval div by zero
Bug: oss-fuzz:56904
Change-Id: I2f47fcfa238b28e1148b0b36ccbe2166445964a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125380
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2023-03-24 18:44:02 +00:00
Ben Clayton aff2b43596 tint/resolver: Fix ICE when using template args with builtin enums
Fixes an 'unreachable AST node' ICE which is otherwise completely harmless.

Bug: chromium:1427389
Change-Id: Id5a75b76ca27e00b9e44336a8dd303abed950333
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125400
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2023-03-24 17:27:42 +00:00
Le Hoang Quyen 99b8081e31 Add AdapterBase::APIGetInstance
This method is useful for Chrome to query the Instance from Device
by calling device.GetAdapter().GetInstance(). Then
instance.ProcessEvents() can be used to poll for events instead of
device.Tick().

Bug: dawn:1726
Change-Id: I45b5760bc07869a191ae3fd02ec25b99d78b068b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125360
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-03-24 15:50:50 +00:00
Yan,Shaobo 8150d1cf81 Add natural size in imageCopyExternalTexture
CopyExternalTextureForBrowser() uses external texture visible rect
as source size in previous.

But video frame natural size is the only one developer could get
from HTMLVideoElement and it means the size browser present video
on screen.

This CL add "natural size" in imageCopyExternalTexture and uses this
size as CopyExternalTextureForBrowser() source size.

Bug:dawn:1694

Change-Id: I2a3bfa8e689df11d1d13320d40ad02c7090425e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/123380
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-24 03:43:56 +00:00
Peng Huang 35cab288aa [d3d] Move DumpCompiledShader to d3d folder
It will be shared between D3D11 and D3D12.

Bug: dawn:1705
Change-Id: If38122484a9063f158e83d364e2615a4ff10ead7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124884
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-24 00:08:29 +00:00
dan sinclair 5ab6dcb59b Update AST Fuzzers to initialize MultiPlanar transform.
When the fuzzers execute they need to make sure that, if there is data
effecting the MultiPlanar transform that the configuration is provided.
This used to be done by the generator, but is now the requirement of the
caller to initialize.

ThiS CL updates the AST Fuzzer common code to initialize the
`ExternalTextureOptions` with the same logic that is done by the tint
command.

Bug: chromium:1421379
Change-Id: Id957d73fe1317558edfdfcec3c0e2eaee48625bd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125280
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-03-23 19:35:02 +00:00
Peng Huang 88daf92d34 [d3d] Move shader translation and compile code to d3d
So it can be shared between d3d11 and d3d12 backends

Bug: dawn:1705
Change-Id: Iffabe8d77a0ac3713da985c0cac5839299dc2a47
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124883
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
2023-03-23 18:32:00 +00:00
Brendon Tiszka a045643361 Add Dawn Wire Server LPM Fuzzer [2/N]
Add generators for protobuf files.

This CL contains the basic logic required to generate the protobuf
files from dawn.json and the newly added dawn_lpm.json for
libprotobuf-mutator.

Bug: chromium:1374747
Change-Id: I5dd207ed94ecdac365306c26e79b6cc18d3978f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114640
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brendon Tiszka <tiszka@chromium.org>
2023-03-23 16:02:20 +00:00
Le Hoang Quyen de078bad8d Forward callbacks to Instance after Device is destroyed.
When InstanceBase::ProcessEvents() iterates through list of devices, one
device might be being destructed on another thread. Even if we try to
increase ref count of that device inside the ProcessEvents(), the device
might be in the middle of destructor call on another thread, increasing
the ref count is invalid in this case.

This CL attempts to fix this issue by removing the device's pointer
from InstanceBase earlier: when DeviceBase::WillDropLastExternalRef()
is called. After this point, any callback registered to this device will
be forwarded to InstanceBase's callback queue instead.

Bug: dawn:752
Change-Id: I8ae86575e34f753e52a76f5fc774bbb5366a1b85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124281
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
2023-03-23 15:16:46 +00:00
Austin Eng 0dc09c01a4 Workaround empty occlusion queries on Apple GPUs
Fixed: dawn:1707
Change-Id: I73f2b595c57830266e7d34ca9e483d803a00d331
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125180
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
2023-03-23 07:15:03 +00:00
Austin Eng fa2d3851a8 Remove D3D12/NVIDIA occlusion query suppressions
This was fixed a while ago in
https://dawn-review.googlesource.com/c/dawn/+/48320
which filled the resolve buffer with 0 and only
resolved the available queries.

Bug: dawn:973
Change-Id: Icf6f83eeca65507ba3e6dda9e9f910d684465622
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
2023-03-23 07:11:23 +00:00