Produce a meaningful error instead of just crashing.
Bug: oss-fuzz:55170
Change-Id: I09d94a910835839ce9407849446cf2928231a114
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128540
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
When `invariant` is enabled on MSL was was incorrectly setting
`@invariant` instead of `[[invariant]]`. We test with metal1.2 which
does not have invariant, so this only showed up when using metal2.1 or
higher.
Bug: chromium:1439273
Change-Id: Iab866608195e697b0370d465f350b25277d904a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128880
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
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 fixes this bug by locking the entire APIRelease() method until
we find a better solution.
Bug: dawn:1769
Change-Id: I1161af66fc24f3a7bafee22b9614b783e0dc4503
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128441
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This Cl updates the lexer to only create tokens when needed, in the case
of no match an empty optional is returned.
Change-Id: Ie4ba45d72cfb263beb8d9c83e3098ff11beeecd2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128620
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL adds a simple program which can be set to loop over specific
parts of the tint pipeline to generate profiling data.
Change-Id: I6375940619b7ef2f7e66540d4f740e6e0b9b3132
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128541
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
When attempting to member-access a non-value expression.
GetVal() ensures the expression resolves to a value expression, and errors accordingly.
Bug: chromium:1436467
Change-Id: I77ebb44f836be3b99db4b5c26ff41db2ee3fe30a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128840
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
In the case of ASCII characters, which a lot of WGSL source is, the
decoder can early out after a checking the value.
Change-Id: Iff655565dde23b143fddb95c6c353a917e25e916
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128120
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
- Note that by default these are already errors, not warnings.
Change-Id: If35284041963cd387839fe102efe4dca73e594dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128064
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
This CL extends the Symbol class to store if the content of the symbol could parse as a builtin.
Change-Id: I7e14ad944c1c9c43d900f9ccf8be6539ac9ea667
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127460
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
BufferBase uses a staging buffer to upload data for non-mappable
buffer created with mappedAtCreation. However BufferBase doesn't
unmap staging buffer before copy data from it. But d3d11 debug
layer complain this illegal usage. It causes test failures.
Bug: dawn:1772
Change-Id: Id1c386ac7c45f41487f9cc7ef4e431eab87ba1c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128480
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
This CL splits the base_src set in the GN build into a symbols_src and a
utils_src.
Change-Id: I39036a4ba5163aa816233b42d9a2ebfe34ddf038
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128361
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
- Note that by default these are already errors, not warnings.
Change-Id: Iab9ecf3cfd54c0219777c2d1587a7752c3173595
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128102
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
- Note that by default these are already errors, not warnings.
Change-Id: I46afa6e54e7915ba54aa6990cd641288609108c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128101
Reviewed-by: Shrek Shao <shrekshao@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
- Note that by default these are already errors, not warnings.
Change-Id: I4eadbb6f71b2d2a39efe5755dbb6b8c329f1674f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128063
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Shrek Shao <shrekshao@google.com>
- Note that by default these are already errors, not warnings.
Change-Id: I33202a0cca8167c4c79e4aeee680b6b7cf1ff830
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128062
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>