Only load extension entry points if the extension is supported.
From the eglGetProcAddress manpage:
"A non-NULL return value does not guarantee that an extension function
is actually supported at runtime. The client must also make a
corresponding query, such as glGetString(GL_EXTENSIONS) for OpenGL and
OpenGL ES extensions [...] to determine if a function is supported by
EGL or a specific client API context."
This required moving extension initialization from OpenGLFunctions
into OpenGLFunctionsBase.
Change-Id: Ib4e8360ba455818701990b4476689b651d097ca8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121760
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Also increased stack size for windows + debug GN builds of
tint_unittests to 4 MB, which matches what we do in the CMake build.
Required, otherwise some of my new tests stack overflow.
Bug: tint:1209
Change-Id: I3b98000a989aa8b42b20cc4e2219c91887e52451
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121360
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This will be used by the PackedVec3 transform to avoid triggering
stricter layout validation rules for the uniform address space when
mutating types.
Bug: tint:1571
Change-Id: Ib15737fbe3cab4a8fbe453bcaf96ef2acc595921
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121601
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This will allow the WGSL interpreter to use it (as the interpreter
does not have semantic nodes for its runtime results).
Change-Id: Icf81852d099b34cbb48c098bc116b4f08a3a7c61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121545
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
The PreservePadding transform now decomposes writes to matrices with
three rows into separate column vector writes, to avoid modifying
padding between columns.
Bug: tint:1571
Change-Id: If575f79bb87f52810783fd3338e2f3ce3228ab2e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121600
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
The result of integer mod is defined to be zero when the RHS is zero
and for (MOST_NEGATIVE / -1). Floating point is expected to be
implementation defined, so also return zero in this case.
Change-Id: Ic25250d637ccb93ba62a5fc0bcebe670d5cd4e3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121544
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
If buffer is released and the external refcount reaches 0 while
buffer map state is pending map in Wire, the map async callback
is fired with destroyed-before-callback status from the buffer
destructor.
It is possible to call another MapAsync in the callback. At that
time the pointer is still valid because the internal refcount is
not 0 yet.
The behavior of MapAsync should be undefined if external refcount
is 0. This commit adds an assert to check whether external
refcount is 0 in Buffer::MapAsync() in Wire. Ending up with
assertion error may be reasonable.
This commit also adds protected GetRefcount() method to
ObjectBase to allow derived classes to check the refcount.
bug: dawn:1624
Change-Id: I95411a7be2093ba7bb2bb45b466f17f1ebac0ca9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119961
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This CL add a toggle-controlled Tint polyfill for reflect on vec2<f32>,
and enable this toggle by default on D3D12 Intel device when using FXC.
This CL works around issue tint:1798.
Bug: tint:1798
Change-Id: If2f4de836eaf5e7374bc2c1ae3fbe06b91a5bbd5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121160
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
The higher tier currently supports all D3D12 devices, all Metal,
and most Vulkan devices.
Bug: dawn:685
Change-Id: I5bcb778b92a073c9c1af943acee193073c0741ff
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121101
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
It wasn't actually called, as array is parsed like any other templated type.
Fixed: tint:1850
Change-Id: I2f1c8b8990cf7f3a5f8b09316e4dc539dbe6535a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121520
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Avoid linearly searching for prefix_i. This becomes very slow when
adding the same prefix many times. Instead, cache each prefix and the
last index that was assigned, and start searching from there.
Note that this locally speeds up MaxLimitTests.MaxBufferBindingSize on
GL backends from about 10 minutes to a few seconds. This test creates a
very large struct, and Tint's GLES backend runs the PadStructs
transform, which produces a struct with 16384 members. Creating these
members triggers the behaviour described above when creating names for
each member.
Also replaced std::unordered_maps with utils::Hashmap.
Change-Id: I86678a049ac229ce617d500971e9c077ff5c10a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121440
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This makes the output value consistent between different platforms.
Change-Id: I4f94da4deac6998c4b809b03ed3b8f58d32bb1b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121501
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Change the DecomposeMemoryAccess to behave more like the DirectVariableAccess transform, in that it'll inline the access of buffer variable into the load / store helper functions, instead of passing the array down.
This avoids large array copies observed with FXC, which can have *severe* performance costs.
Fixed: tint:1819
Change-Id: I52eb3f908813f72ab9da446743e24a2637158309
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121460
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
This reverts commit 9cdc3343ff.
Reason for revert: For some reason, Windows kokoro bots are now taking objection to this test.
Original change's description:
> Add test setting the locale.
>
> This CL adds a test which sets the locale to one which uses `1,00`
> instead of `1.00`. This ensures the float emission will get the right
> format.
>
> Bug: tint:1686
> Change-Id: Ib87235c7beac351b7dcbf37534df07135da377e5
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120881
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
TBR=dsinclair@chromium.org,bclayton@google.com,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com
Change-Id: I2ace266871958a2d467855d55079aae467195ce0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: tint:1686
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121462
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Instead, compile pipelines synchronously.
When backend validation is on with Mac AMD, the driver crashes during
pipeline compilation. This seems to only occur when partition alloc
is enabled.
Bug: dawn:1200
Change-Id: I520087eeae9c356990962d0c4a96eba017735af1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121400
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
ExternalTexture has active, expired and destroyed states.
Only active state external texture is valid to submit.
Expired state external texture can be refresh to active but
destroyed external texture cannot be refresh.
Bug: chromium:1412338
Change-Id: Ic7f12d274d27b644f19ec3ef8b46c110610afa2b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120982
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
On Intel Gen9 and Gen9.5 GPUs there is a D3D12 driver bug about
using DstAlpha as the source blend factors in both color and alpha
blending.
Although we cannot add workaround for all such cases, we have
confirmed that when the blend operation is 'add', and the
destination blend factors are ‘zero', we can workaround this driver
bug by replacing 'add' to 'minus'. We cannot add workaround when
destination blend factor is another value.
This patch adds such workaround on the affected platforms.
Bug: dawn:1579
Test: dawn_end2end_tests
Change-Id: If7c82b9d559b876e42fb36e2f539f9ff2f71ea91
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120981
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This CL updates some EXPECT to ASSERT in the spirv-reader tests to
work around segvs when tests fail.
Bug: tint:1686
Change-Id: Icfd5a83cc71709fd351c3d5a39a9a0173056a0f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121340
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL adds a test which sets the locale to one which uses `1,00`
instead of `1.00`. This ensures the float emission will get the right
format.
Bug: tint:1686
Change-Id: Ib87235c7beac351b7dcbf37534df07135da377e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120881
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL adds an `attribute` enum into intrinsics.def and updates the
WGSL parser to use the enum parser and SuggestAlternatives.
Bug: tint:1831
Change-Id: I33b3e6bbf092282d9b1f86a1080e69940f55ff68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121280
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Not sure if MSVC is wrong here, but it now fails to compile this file
because it looks for `builtin::AddressSpace::kPrivate` within the inner
`builtin` namespace, rather than in `tint::builtin`.
Change-Id: I10f9e1bd58e6ba548d40823f03802320865f069d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121221
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This Cl updates the parser to use a generic attribute grammar.
Bug: tint:1845
Change-Id: Icd600a2d87f03972f60d89b27fe0eef7be7667d5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121100
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
UV plane's coord should be half of that of Y plane for NV12.
Bug: chromium:1415832
Change-Id: Icee851e61eca1f7da291285100f8edcce482b511
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119860
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Jie A Chen <jie.a.chen@intel.com>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Validate as the bind group lazy aspect at each dispatch/draw
call.
Use nested loops to iterate through each bind group and binding
to find if any aliasing exists, which has time complexity of
O(N^2) and can be further optimized to use O(NlogN) algorithm.
Bug: dawn:1642
Change-Id: I8c43128cdeea75352c194752fb22258b6a73430e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118440
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This Cl adds the requires directive into Tint. Using the directive is
currently always an error as there is no valid value which can be used.
Bug: tint:1843
Change-Id: Idf77ba4e95ff0c1e177d02d1ba9598edc89a9812
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120740
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
- Plumbs all descriptors through so that the objects act much more like
a real implementation.
- Lots of changes to DestroyObjectTests.cpp to update usages and test
through the APIs when applicable.
- Put in defaults for the mock device and make it as easy to use as
possible.
Change-Id: I85b243a18ec1872aff0172549aec0f599967ea0e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119821
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
This follows the recent semantic from the WebGPU spec and fixes a couple
failing CTS tests.
Bug: None
Change-Id: I9197ea3fda6c15bd9302f8d60e70ee00f1d37708
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120980
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>