Use a hashmap to de-duplicate constants.
Bug: tint:1906
Change-Id: Ic2654e1819d8c3c0199ce3f723f20877495ed0f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132282
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Change-Id: I6b8c109ae67e230fea3fb14511c2b3562191c0fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132300
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
There's a few reasons for this change:
* Not all values have identifiers, and carrying redundant fields is
inefficent.
* Not all IDs will be integers - much like LLVM IR and SPIR-V, we will
likely want to disassemble with textual identifiers, so a uint32_t
is not ideal, and a std::string is even more bloat for each value.
* Transforms don't use identifiers, but instead raw pointers. We don't
want to encourage using IDs as they're simply a less-efficient way to
refer to values.
* This makes values consistent with types and flow-control blocks, as
they will both have their disassembly ID generated by the
disassembler.
The next step will be to add a hashmap to the module so that
pre-declared value names can be stored out-of-band.
Bug: tint:1718
Change-Id: I80beafc165f2bde54cc44a91015776926ca952b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Change-Id: I4f8ff98b980d9dd9a89e7e4407f6e1cbd1eaaf0a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132320
Kokoro: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
An OpName decoration for a result ID may end up unintentionally
shadowing a WGSL builtin function.
Fixed: tint:1932
Change-Id: I1b1302629c69b7bdf7a0a0c97d3ad6ce3d0d587b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132080
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Can be used to write simple whole-vector comparision checks.
Change-Id: I441a7e8d6b626a5a32ef3db9043e771f792900d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131746
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
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.
This is a reland of commit 90789ea1f8
with compilation fixes for MSVC.
Bug: tint:1906
Change-Id: If5290df504ebc8925b3c52510acab123edfd1073
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131800
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Unwrap sem::Materialize as well as sem::Load when looking for users of
a renamed declaration.
Fixed: tint:1934
Change-Id: I7d5ade1f902dbdb4cf3b4f7552b78359f5b3ea9a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132060
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
When traverseing an accessor expression, stop as soon as we hit a
source object that has a constant value. This prevents us from trying
to emit expressions that have abstract types and no materialization
nodes.
Bug: chromium:1442551
Change-Id: I8296ae58e63624e647052cdf966dbff15630a4d8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132040
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This makes the generated WGSL more concise and readable.
Change-Id: I78a722b9a86264d3bbf219445628dc5597cbfd62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132141
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
This makes the generated WGSL more concise and readable.
Change-Id: Ia486a74796a4029aaac1c4d051d304d05f1d5ea2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: James Price <jrprice@google.com>
The message now reports the group/number of the binding that failed
validation, as well as the buffer.
Bug: dawn:1604
Change-Id: Ib08a3eace5ec5ebaf9eecce01eb397b5c0681bd1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131843
Reviewed-by: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Consumers of the event expect it to be signaled after all work
enqueued thus far. Ensure that commands are flushed to ensure this.
Fixed: dawn:1691
Change-Id: I1409c668119a12e5e50a1ce2924ebc16d0470a4d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131880
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
This is not currently supported, so produce a meaningful error message
instead of crashing.
Bug: oss-fuzz:55819
Bug: tint:111
Change-Id: Ib245a47edbbe6ef972844f940ea1d674e6b08a76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131222
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: James Price <jrprice@google.com>
Make sure .bat files are checked out as CRLF, otherwise goto will jump
to the wrong offset under certain conditions.
Change-Id: Iffaf2ec960890ed7f0f8bb9b62bb7724d8334941
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131981
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Adds instructions on how to generate an MSVS solution.
Bug: dawn:1661
Change-Id: I3433951a3460d6b6392964e4b163060fc100b6c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131881
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
This introduces the notion of FeatureLevel, currently consisting of
Core or Compatibility. Each AdapterBase is now constructed with the
FeatureLevel it supports.
When discovering PhysicalDevices, create an AdapterBase for each of
the FeaturLevels which that PhysicalDevice supports. For most of the
backends, this will mean Core and Compatibility, while OpenGL and
D3D11 support only Compatibility.
Bug: dawn:1796.
Change-Id: I828247ef43e2220805ccf6c08827aa5e2382a026
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118240
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
The problem is becasue a resource can not be set as input and
output at same time on device context. So we have to track used
slots and unset related slots before binding a group.
This CL also unset all affect slots when a render pass or compute
pass is end, so all related resources could be unref from the
device context.
Bug: dawn:1705
Change-Id: I597762ad8afa3b8df7139b0070f0b457d7319836
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131380
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Allows map with std::string keys to be looked up, using a c-string or
stringview without incuring a temporary heap allocation.
Change-Id: Id5b7fd5ac1ab7febf545472f9767273f8637a0de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131623
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
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>