For some reason, only a handful of compilers complain about the implicit cast of an enum to a uint32_t.
Make the cast explicit to fix these builds.
Change-Id: Ib57026cbbb28e330055a5c64eaf1ae05ea3ff7dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131744
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
This reverts commit 90789ea1f8.
Reason for revert: Compilation errors on MSVC and some linux machines.
Original change's description:
> ir/spirv-writer: Emit entry point declarations
>
> Emit the OpEntryPoint instruction with the pipeline stage. Interface
> variables will be done later.
>
> Emit OpExecutionMode instructions for the workgroup size and fragment
> shader origin, depending on the pipeline stage.
>
> Bug: tint:1906
> Change-Id: Ieeeda5f17da48a8cf0d3344d3b254542c7198cb9
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131381
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
> Commit-Queue: James Price <jrprice@google.com>
TBR=dsinclair@chromium.org,bclayton@google.com,jrprice@google.com,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com
Change-Id: If828577648a585a51568eabc79f41e1735b72b8a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: tint:1906
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131743
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
There's an odd mix of IR classes that use raw fields, and others that
have getters. Migrate a bunch of those getters to raw fields.
Change-Id: I5c80abe16d3b4e6e5e9dc8f985611f9edfe5cdc6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131621
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
ToProgram() will most likely be conditionally compiled as a separate .h
and .cc file. With just one static method, ir::Converter doesn't make a
lot of sense to be a class. Just replace with a free-function.
Bug: tint:1902
Change-Id: I305bf9cb73082a94848ec5b94129feabdb9b6fe9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131620
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL fix an issue related to tiering the maxBufferSize and
maxStorageBufferBindingSize limits. In detail, this CL:
1. Fix the maxStorageBufferBindingSize tiers to [128MB, 1GB, 2GB-4,
4GB-4] instead of the original last two 2GB-1 and 4GB-1, holding the
guarantee that maxStorageBufferBindingSize is a multiple of 4 bytes.
2. Add a maxBufferSize tier 4GB, ensuring the guarantee that
maxStorageBufferBindingSize must be no larger than maxBufferSize in
case of it tiered to 4GB-4. Previously the largest maxBufferSize tier
is 2GB, making this guarantee broken after tiering.
3. Move the adapter limits normalization logics in adapter initializing
to Limits.cpp to allow unittest. Related unittests implemented.
4. Normalize tiered limits to ensure that tiered
maxStorageBufferBindingSize and maxUniformBufferBindingSize are no
larger than tiered maxBufferSize. Related unittests implemented.
Issue: dawn:1780
Change-Id: I4821f196fa89c7f18ebbf8e5e45df1c3268db895
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130120
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Emit the OpEntryPoint instruction with the pipeline stage. Interface
variables will be done later.
Emit OpExecutionMode instructions for the workgroup size and fragment
shader origin, depending on the pipeline stage.
Bug: tint:1906
Change-Id: Ieeeda5f17da48a8cf0d3344d3b254542c7198cb9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131381
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Emit the return type, function type, and the OpFunction
instruction. The body is just a label and a hardcoded OpReturn for now
and will be emitted properly in a future patch, along with entry point
declarations and function parameters.
Bug: tint:1906
Change-Id: Id7117da078bccd77a00afb54a63c9c55b13236f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131600
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
- Note unsafe API paths currently check both AllowUnsafeAPIs and
DisallowUnsafeAPIs toggle, allowing unsafe APIs if either is set to
explicitly allow them. This will be removed once users have been
updated.
Bug: dawn:1685
Change-Id: If322cc6dbe5ac3a02a31956df6fed0f5d3ec8e8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131400
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
This CL adds tests for the compound assignment builder_impl. The ops
which can not be compound assigned have been moved to report diagnostics
messages.
Bug: tint:1718
Change-Id: Ia3dbbf706f0f074fd988a2b1c01f3fb5cc602c04
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131661
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This CL adds a simple test for the builder_impl for assignments.
Bug: tint:1718
Change-Id: Ia727ace4d01f107c6ac2ad1f8e430ef00ec43da9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131660
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Also add a test helper header with some base classes that derive from
the IR builder.
Bug: tint:1906
Change-Id: If642bc64a50b6cae10363018a8dea8547ab9f542
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131441
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This Cl splits apart the builder_impl test file in order to make it
easier to determine what has been tested.
Bug: tint:1718
Change-Id: Ib2f4d11a398b26fd774eb8c60555475053f20e0b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131581
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL removes unary `not` and instead emits `x == false`. When coming
back out of IR we can detect the `== false` and convert back to a `!`.
Bug: tint:1928
Change-Id: I905493182533ac2787ab9fe9245c8b53d51c1298
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131580
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This CL consolidates the various ToInstruction and ToValue methods into
the disassembler. The type output is updated to prefix `:` instead of
surrounding by `()`.
Bug: tint:1718
Change-Id: I69e2d96ffbfe2113932740ce69d0967d29d41541
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131460
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This patch disables all the toggles about the alpha blending issue on
the latest Intel D3D12 driver which has the fix against all the related
driver bugs.
Bug: dawn:1579
Change-Id: Ief8b08fd00df1b2872d663245d728374fb38a5b3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This CL raises "mapping already pending", "offset out of range", and
"size out of range", and "validation error" error to make it easier
for developers to know why APIMapAsync fail in those cases.
Bug: chromium:1431622
Change-Id: I6f04751b2d67420a51d94aeac39ffbfd6e126fbf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129740
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Fr <beaufort.francois@gmail.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This was listed as deprecated and has been for a while (at least a
year.) No code paths in Dawn make use of it and the few remaining
uses in Chrome are being removed in
https://chromium-review.googlesource.com/c/chromium/src/+/4501347
Bug: dawn:1797
Change-Id: Ifff4e5609e228080361e5d3a20a881eaf811ab6c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131321
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This adds a GeneratorImplIr class and an option to the SPIR-V writer
to use it instead of the AST-based GeneratorImpl class.
The Tint exe now has a --use-ir flag which will use this path.
Bug: tint:1906
Change-Id: I34cc5c7468c8faf4a808669da8c44551ad01da8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131341
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
So code search cross ref can work for d3d11 backend. Chrome webgpu
will only discover D3D12 device right now, so this build d3d11
backend should not break things.
Bug: dawn:1705
Change-Id: I2cb6753fe2be1588c9cf1190742f8169164d1662
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131200
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Brings the SPIR-V writer in line with other writers.
Change-Id: Iaa261150de953b414f966dd004bd48f7315ceb0c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131221
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
We can't generate meaningful WGSL for this case, so just avoid
crashing.
Bug: oss-fuzz:58112
Change-Id: I6c02d9113c237171fdafcd06e063a62f26cae9c0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128900
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Move the generic code for building up a SPIR-V module from Builder to
a new Module class. This can then be reused by the new IR-based SPIR-V
writer.
Switches to naming of methods to camel case to bring in line with the
rest of the codebase.
Bug: tint:1906
Change-Id: I7775edff6fe56328c6562559c016a19097b50805
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131340
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL moves to having a `FunctionTerminator` and a `RootTerminator` so
we can assert if the IR is in a function depending on the terminator
seen.
Bug: tint:1929
Change-Id: Ie9e3aed71b7cf3b91439efbcca20885ec2cabe24
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131281
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
This Cl adds information into the IR on the function return type and any
associated attributes.
Bug: tint:1915
Change-Id: I74cbf2613b4ae575e33a61d04d30b515df6ba796
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131300
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL adds the pipeline_stage and workgroup_size attributes into the
IR function.
Bug: tint:1915
Change-Id: I245dbf0104a1784cff364535106b3e520322ac73
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130920
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This Cl adds a scope stack into the IR builder and uses it to replace
IdentifierExpressions with the relevant IDs. If the IdentifierExpression
was const-eval'd then it will be replaced by the constant value.
Bug: tint:1919
Change-Id: I54e38d56bd24e2ced1818c509115dd5a5149cb40
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130900
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
It is necessary to use a semaphore to synchronize rendering and
presenting even when the graphics and present queues are the same.
This fixes rendering artifacts encountered on a Mali-G78 device.
Bug: dawn:269
Change-Id: Ieb0240d3668b7f9f68857ed3cf8d3bfea18cf33a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130221
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Albin Bernhardsson <albin.bernhardsson@arm.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Now that we don't need the symbol table to get the names of the types, we can just call FriendlyName() on the type directly.
Change-Id: I39478f5b8847ee032e77c15fd0de0665ddbf4811
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130220
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
This CL removes the LogicalAnd and LogicalOr binary kinds, and updates
the names in binary and unary to drop `bit_` and `log_` prefixes.
Bug: tint:1718
Change-Id: Ie180549ee5ecfad65fff9e4b4db86dd8a8b54833
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130800
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
The BuiltinPolyfill transform expects the DirectVariableAccess transform
to run after it, but this regressed as part of
https://dawn-review.googlesource.com/c/dawn/+/122203
Add unit test along with e2e 1926.wgsl test.
Bug: tint:1926
Change-Id: I5107453ce152b12e6f2f36930846e1fffa775708
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131020
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This Cl removes the `&&` and `||` logical binary nodes and replaces them
with a var declaration and if node.
Bug: tint:1925
Change-Id: I9f25411a9b9c909fa25f2f37cbd51181ac584acc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130500
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>