Adapt the builtin parsing and resolving to also support operators.
Will be used to generate intrinsic table entries for operators.
This will simplify maintenance of the operators, and will greatly
simplify the [AbstractInt -> i32|u32] [AbstractFloat -> f32|f16] logic.
Bug: tint:1504
Change-Id: Id75735ea24e501877418812185796f3fba88a521
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89026
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
• Rename 'builtin-gen' back to 'intrinsic-gen', as 'intrinsics' now
include both builtins and operators.
• Move the intrinsic definitions, and IntrinsicTable to the resolver
package, where it belongs.
Bug: tint:1504
Change-Id: I5ad5c285c1e360a224ee1235c293ccd55eb2693d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89025
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Unsuffixed integer literals are currently treated as i32,
but will shortly become AbstractInteger. To keep tests behaving
identically to how they are currently, change all test literals
to using either 'i' or 'u' suffixes.
Bug: tint:1504
Change-Id: Ic373d18ce1c718a16b6905568aec89da3641d36b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88845
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
And use this to define constants for override vars in unit tests that
would fail for HLSL.
Bug: tint:1519
Change-Id: I4fd15c517868694d2bcd81d563399f817ed74ae6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88882
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Use this for the BlockAllocator cast.
Bug: dawn:1406
Change-Id: Ic5d1acf7f8e74037fb51fc9d5d3b5141a15bd962
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89021
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
For all i32 literal values.
Reduces risk of the SPIR-V reader producing WGSL that behaves
differently, when abstract-integers are fully implemented.
Bug: tint:1504
Change-Id: Ieaf8afec5b09c7978c75a38c6ed144633ddc017e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88843
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Merge SintLiteralExpression and UintLiteralExpression with
IntLiteralExpression. IntLiteralExpression has a new Suffix field which
indicates whether the literal is either a:
• 'i' suffixed integer literal
• 'u' suffixed integer literal
• no-suffix integer literal
Have the SPIR-V reader produce no-suffixed literals for i32 types, to
keep this change small. In future changes the SPIR-V reader will
produce 'i' suffixed types for these.
Have all consumers of IntLiteralExpression treat unsuffixed integers the
same as 'i'-suffixed literals. Unsuffixed will be treated as abstract in
future changes.
Removed SemHelper::TypeOf(const ast::LiteralExpression* lit).
Fixed: tint:1510
Bug: tint:1504
Change-Id: I443f41984e637ddd948182ee756af1010c5f8226
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88842
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
'smoothStep' has been renamed to 'smoothstep'.
We cannot generate both sets of tests during this deprecation period as Windows and macOS can be file case-insensitive, and we'd have 'smoothstep' and 'smoothStep' as two sibling directories.
Bug: tint:1483
Change-Id: I944309585e8ff23345d9cc23669edf3774f3afb8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88664
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
And use it in the fuzzers to fix ICE that occurs when bindings are not
flattened when processing MSL.
Bug: chromium:1314938
Change-Id: Ic35503e53395fad232487226c324067975291fbf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88461
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
Adds configurable gamma and gamut correction in Tint's external texture
transform. Adds constants in Dawn to perform correct conversion from
BT.709 to sRGB.
Bug: dawn:1082
Change-Id: I68b7ad7ccec29977c637a0a0d4f526cd47fe73d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88367
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
For error "access violation. Attempted to read from address
0x0000000000000048", added link to GitHub issue I opened. Helps to
understand what these errors are when reading the expectation files.
Bug: tint:1521
Change-Id: Ie2a1693f021e17586a4fe3b4dfe652bbdc877c49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88363
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Instead of using an `if` node that has a list of `else` statements,
make each `if` statement have a single optional `else` statement,
which may itself be an `if` statement (or just a block statement).
This better matches the WGSL grammar (now that we have removed
`elseif`), and simplifies various pieces of code that handle these
statements.
Change-Id: Ie4272f1422224490ac598a03aa8b4dd00ba03010
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87940
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: James Price <jrprice@google.com>
These suffixes existed because the GN build errored when there were two files sets with the same name (ast + sem).
This is no longer required as the GN build splits these into two separate targets.
Change-Id: Ib451da33a5f4aa5c867cb99419dd252766dc3daa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88308
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
ScopeStack is not needed here - the resolver already provides variable scoping with the sem::Variables.
Re-purpose scope_stack_ for a stack of Scope, which now holds the type constructor -> SPIR-V ID map.
This map needs to be per-scope, to fix issues like crbug.com/tint/1520
Fixed: tint:1520
Change-Id: Ifa7749338abf63652a1369e76cf5400be1c37298
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88301
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Also mark all the skips for time out the same way for easier grepping.
Change-Id: Ie071df30431bded7838205c3a18483a5233687c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88341
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Concatenating strings to use for cache keys is horribly inefficent and very error prone.
Add a UnorderedKeyWrapper helper to allow types to be used as a unordered_map and unordered_set key. Use this for the type_constructor_to_id_ map.
Produces SPIR-V with some duplicate SPIR-V instructions for constructors removed.
Change-Id: Ib072d485ca28bb07f03e979c133cdce1f69ee482
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88300
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
In this CL the enable directive is implemented.
1. Add AST node for enable directive, assign a ExtensionKind (enum) for
each supported extension.
2. Use an unorder_set in ast::Module to record all required extensions'
kind.
3. Provide inspector methods for getting names of used extension, and
getting all used enable directives' extension names and location.
4. For different writer, the extension nodes are handled in different
ways. MSL and HLSL writers will just ignore the extension nodes, while
SPIRV and GLSL writers will emit corresponding code.
5. Implement unittests and end2end test for enable directive and
inspector, using a reserved extension name `InternalExtensionForTesting`.
Bug: tint:1472
Change-Id: I40cb4061554deb477bc2005d7e38c9718385f825
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86623
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This PR adds the validator_is_storable test into the CMakeList file
correctly and removes the helper files. The resolver helper is used
instead and a test helper to return the validator added into the
resolver.
Change-Id: I5b18bcc6373e3b39807af05cf5c058fab61ed4ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88041
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Adds configurable gamma and gamut correction in Tint's external texture
transform. Adds constants in Dawn to perform correct conversion from
BT.709 to sRGB.
Bug: dawn:1082
Change-Id: Id5eecc37f0224541bf36e2f9757e7e2047e4b66b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87666
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
The OpenGL ES 3.1 spec says:
"The point size is taken from the shader built-in gl_PointSize written by the vertex shader, and clamped to the implementation-dependent point size range. If the value written to gl_PointSize is less than or equal to zero, or if no value is written, the point size is undefined."
ANGLE/D3D11 will emit a warning on this and abort processing, causing dawn_end2end tests to fail.
Bug: dawn:1390
Change-Id: I6a56467842ba80d8a070af7240ee07bb111089dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87720
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Changes Dawn and Tint to use a 3x3 matrix for external texture
YUV-to-RGB conversions. This will allow us to use standard matrices
as they exist in SkYuvMath.
Bugs: dawn::1082
Change-Id: I8e0c7c3dc1c085d8f336da956aea9496913b70fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86847
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
This broke when the inclusive language change was committed and the
newline was accidentally removed.
Change-Id: I447f34e07fd5f264b56e8ca205df558bd70946b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87308
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
The current presubmit has the filter inverted so it would only attempt
to match the filtered files. The file name also has to be converted to
`LocalPath` otherwise it's attempting to compare a python object to a
string and always fails to match.
Bug: dawn:1339
Change-Id: Ie7712dee60f6b9df2cb78c9feab11769f7ea1f02
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87080
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
There were some tests that were still using the deprecated name, as
was the SPIR-V reader.
Bug: tint:1483
Change-Id: Ie919596712e05340110fbd872470a1b4c9a625c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86745
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>
Remove transform::Glsl and replace with a Sanitize function. Cleans up
the code, reduces allocations and copies, and makes it consistent with
the other backends.
Also add a copy of src/tint/.clang-format to include/tint/ to keep files
in there formatted as per the tint standard.
Bug: tint:1495
Change-Id: I8a44ffecc6b3d244517bceb374ed93063e96f218
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86205
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro-Run: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
And force shader code to always use LF endings.
Post merge, there were a number of files that crept in with CRLF endings.
Some Tint end-to-end tests take objection to CRLF endings.
CRLF endings can be detected with:
```
git grep -I --files-with-matches --perl-regexp '\r' HEAD
```
And fixed with:
```
find . -type f -exec dos2unix {} \;
```
Bug: dawn:1339
Change-Id: Iee054bafd15875de744b86e28393cd8229bd3cfa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86140
Kokoro-Run: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
There were a bunch of helper scripts to build a go tool and run it.
Replace these with a single 'run' command that takes the tool name and arguments.
Helps reduce maintainance, file spew.
Also add the 'tools/bin' directory to .gitignore. These are the cached tool binaries.
Bug: dawn:1339
Change-Id: I012c966736b4d93949f6142c342cdcfefa9f0083
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86063
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This is both a security/ACL best practice, but also to make the Gerrit UI
better suggest owners for CLs.
Bug: dawn:1339
Change-Id: Ia79b88d919707147d2726a7e4f3ff9080cd275b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86067
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Refactor the ExpandCompoundAssignment transform to handle these
statements, which delivers support for all of the non-WGSL backends.
Fixed: tint:1488
Change-Id: I96cdc31851c61f6d92d296447d0b0637907d5fe5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86004
Reviewed-by: Ben Clayton <bclayton@google.com>
Implemented in both the reader and writer with E2E tests. Other
backends will ICE for now.
Bug: tint:1488
Change-Id: Ied2afa55a338347f427dee98a4076643ac432d9c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86003
Reviewed-by: Ben Clayton <bclayton@google.com>
These can only be applied to scalar integer references.
These currently cannot be used in a for-loop initializer.
Bug: tint:1488
Change-Id: I218c438c573ff3f5917d058718d12603f9b4057f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86002
Reviewed-by: Ben Clayton <bclayton@google.com>
Integrates Tint repo into Dawn
KIs:
- Building docs for Tint is turned off, because it fails due to lack
of annotations in Dawn source files.
- Dawn CQ needs to be updated to run Tint specific tests
- Significant post-merge cleanup needed
R=bclayton,cwallez
BUG=dawn:1339
Change-Id: I6c9714a0030934edd6c51f3cac4684dcd59d1ea3
With this change, the backend sanitizers always run the
MultiplanarExternalTexture transform. If the new option is enabled, it
auto-generates bindings for this transform.
This change also enables this auto-generation for the Tint commandline
application, as well as for the fuzzers.
Bug: chromium:1310623
Change-Id: I3c661c4753dc67c0212051d09024cbeda3939f8c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85542
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Textures as function parameters should not have the "uniform"
qualifier. Fixed by handling StorageClass::kUniformConstant the
same as StorageClass::kUniform, and removing the unconditional
"uniform" qualifier output. (Global texture variables have
StorageClass::kUniformConstant set, while function parameters don't.)
Change-Id: I9d380550ac4554917527ff330171a76a90a290e8
Bug: tint:1492
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85820
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Use the ExpandCompoundAssignment transform to convert compound
assignments to regular assignments.
Bug: tint:1325
Change-Id: I0567131aa7c6b4beb6e25c0c6c559795e9c58c19
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85286
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Use the ExpandCompoundAssignment transform to convert compound
assignments to regular assignments.
Bug: tint:1325
Change-Id: I193a09815836755bc1f7138fe1947be39f7b7206
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85285
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: James Price <jrprice@google.com>
Use the ExpandCompoundAssignment transform to convert compound
assignments to regular assignments.
Bug: tint:1325
Change-Id: Ic843964ec24d8a2f00f801823f8f8bbf1c6fab5c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85284
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Use the ExpandCompoundAssignment transform to convert compound
assignments to regular assignments.
Bug: tint:1325
Change-Id: I960bf6cd0ec3490cd58685a7c13b6a7c86395080
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85283
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This transform converts compound assignment statements into regular
assignments, hoisting LHS expressions and converting for-loops and
else-if statements if necessary.
The vector-component case needs particular care, as we cannot take the
address of a vector component. We need to capture a pointer to the
whole vector and also the component index expression:
// Before
vector_array[foo()][bar()] *= 2.0;
// After:
let _vec = &vector_array[foo()];
let _idx = bar();
(*_vec)[_idx] = (*_vec)[_idx] * 2.0;
Bug: tint:1325
Change-Id: I8b9b31fc9ac4b3697f954100ceb4be24d063bca6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85282
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Implemented in both the reader and writer with E2E tests. Other
backends detect compound assignment and ICE for now.
Bug: tint:1325
Change-Id: Ie3f51e03627a38b12bd1513c4bcf1bebb3282863
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/74363
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reuse the logic for resolving binary operator result types that was
implemented for binary expressions. This validates that the LHS and
RHS are compatible for the target operator. We then try to match the
resolved result type against the LHS store type.
Bug: tint:1325
Change-Id: If80a883079bb71fa6c4eb5545654279fefffacb4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/74362
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This will ease rolling Dawn into Chromium, once Tint is merged in
BUG=dawn:1343
Change-Id: I53fa7b82a001ab3351f5366e8e045090c0fdb49b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85380
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Added a new transform::RemoveContinueInSwitch that replaces continue
statements in switch cases with setting a bool variable, and checking if
the variable is set after the switch to continue.
Bug: tint:1080
Change-Id: I3c0a6c790e1bb612fac3f927a4bd5beb2d0d4ed1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84960
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This function was copy-pasted in two transforms, and will be used in the
next one I'm writing.
Bug: tint:1080
Change-Id: Ic5ffe68a7e9d00b37722e8f5faff01e9e15fa6b1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85262
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
The test files were already updated manually in a previous change, so
we just need to update the template file to match.
Bug: tint:1475
Change-Id: I6f1b3d3a7a3df014b58e67ec2645b1dfcc275de1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85260
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Implement new transform UnwindDiscardFunctions that replaces discard
statements with setting a module-level bool, adds a check and return for
this bool after every function call that may discard, and finally
invokes a single function that executes a discard from top-level
functions.
Regenerated tests and remove HLSL ones that used to fail FXC because it
had difficulty with discard.
Bug: tint:1478
Bug: chromium:1118
Change-Id: I09d680f59e2d5d0cad907bfbbdd426aae76d4bf3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84221
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
- Format specific targets to have the hash in the target rule instead
of a variable.
- Only have the base part of the URL in a variable
- Use vulkan-deps instead of individual DEPS (spirv-tools,
spirv-headers & glslang)
BUG=tint:1481
Change-Id: I871a656e26050698da2c77f4f39fec94a9c4f8a4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84723
Reviewed-by: David Neto <dneto@google.com>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Use of semicolons is still supported, but deprecated.
Also updates the parsing methods for structures to better match the
WGSL grammar.
Bug: tint:1475
Change-Id: I7675ba42c13f91080b0ac173c352e0092021f80b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Tests were moved to a new 'tint' subdirectory for the tint -> Dawn
merge, but these paths were not updated.
Also regen'd files for HLSL and a couple are no longer failing.
Change-Id: I11c315d948013ed30635d20e6da565450859cb03
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84341
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
We still use the StrideAttribute AST node in the SPIR-V reader for
strided arrays and matrices, which are then removed by transforms.
The WGSL parser no longer has to handle attributes on types.
Bug: tint:1381
Change-Id: Ifa39575ce207d3fdfcbef7125fe6a3686fad5f20
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/83963
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This removes @stride, which will soon be invalid.
Bug: tint:1381
Change-Id: I3cbe987edb9b918b2f344b92a4f0fe4838df4a80
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/83962
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Since this was the only attribute allowed on structures, we can also
remove the parsing code for them. However, we still need to have
attributes on the struct AST node, since the AddSpirvBlockAttribute
transform adds one.
Fixed: tint:1324
Change-Id: I7966237765b1d8a58c59908b59e1f1152a8a0439
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/83740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This transform ensures that expressions are evaluated in the order
defined in the WGSL spec. It does this by making sure to hoist
expressions that have side-effects (calls) along with variables that may
receive these side-effects to lets in the correct order.
Bug: tint:1300
Change-Id: Ic027dc4e0d894beff626a68b5837bd2eed26d8a5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78620
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
These were deprecated in M98.
Fixed: tint:1312
Change-Id: Ieec17bfcc729f90d0a9aa8904a162167b9de54ed
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82800
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
UniqueAllocator is used to allocate unique instances of the template type.
This will be used to clean up duplicated code we have throughout Tint.
Change-Id: I79d5834bf7c7c31cdefd38d4fa3b9240f7ebbf5f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82741
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Just a minor cleanup; no functional change.
Change-Id: Iac4f97c2b5507f7665024885a81f6ccf8e5ab269
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82440
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
It's a no-op.
Bug: tint:1462
Change-Id: Ic79f33682097be075eb2e99b714d1e65bed10d4d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82365
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
It's a no-op.
Bug: tint:1458
Change-Id: Ib97c409fd806da1c97ac867f21ef42b8a18c178c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82364
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Note: ES doesn't support cube arrays, so this fixes the tests but does
not cause them to pass.
Bug: tint:1461
Change-Id: Ia2b1ffacab83dae58ac1b50eb04457da270d73e2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82363
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
GLSL uses not() for vectors, and ! for scalars.
Bug: tint:1444
Change-Id: I7fa9bdf0b546224737f9cda18428dea7051fe9e5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82362
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
textureQueryLevels() and textureSamples() were being emitted with a
spurious semicolon.
Bug: tint:1222
Change-Id: I56c561fcaac510b76a27a850f5be522ab7f98307
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82361
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
In GLSL, runtime-sized arrays are only valid in interface blocks, not
in structs. The existing code was attempting to avoid emitting structs
containing runtime-sized arrays but was confused by type aliases in
the AST resulting in arrays being missed.
The fix is to do the work on the semantic types instead, where type
aliases have been resolved.
Bug: tint:1339
Change-Id: I8c305ee9bddd75f975dd13f1d19d623d71410693
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82360
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Unlike other texture functions in GLSL, textureGather() and
textureGatherOffset() do not expect the refZ value to be appended to
the texture coordinates. It is passed as a regular argument. So append
refZ to coordinates by default, and pass as a regular parameter only
for the gather functions.
Bug: tint:1459
Change-Id: Iad1255be3de5915aeff4adb9054479b9e92c45cb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82340
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Multiple bugs here:
1) Like texture(), GLSL's textureLod() on depth textures returns a
scalar, and does not need to be swizzled. So set glsl_ret_width to
1 in that case.
2) Like texture(), GLSL's textureLod() always requires a Dref
parameter, so append a zero if not present.
3) GLSL's "lod" parameter to textureLod() is always a float, unlike
WGSL's textureSampleLevel() which is an i32 for depth textures,
so cast it.
Along the way, I discovered that textureLod() is not supported on
samplerCubeShadow or sampler2DArrayShadow (even on Desktop GL). So some
tests will never pass. Logged as https://crbug.com/dawn/1313
Bug: tint:1456
Change-Id: If67d8d288704142278d7a4e52b46e8010776f381
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82300
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This change essentially relands 10c554ecf4,
aka https://dawn-review.googlesource.com/c/tint/+/82140.
(Somehow, I managed to revert most of that in the subsequent CL for
reverseBits. I suspect a bad upstream and/or rebase.)
Bug: tint:1430
Change-Id: Iba2688294dcd7d3008ee9da78957a7a464ca1c0f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
The '%' operator in GLSL is integer-only. Use the full OpFRem
expression: (a - b * trunc(a / b)).
Bug: tint:1270
Change-Id: I0a969983bef132e004ce456d4a738488e400a61b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68760
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
While Desktop GLSL supports the Coarse and Fine flavours, GLSL ES does
not. For now, emit dFdx/dFdy in all cases for ES, but excluding the
Coarse and Fine flavours via validation is also an option.
Bug: tint:1445
Change-Id: Iaac589f72043b5547e9141a6e870c1fd49631f6f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82142
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
The multiplanar external texture transform has been integrated into
Dawn, which means we have no use for the single plane transform - so it
should be deleted.
Bug: dawn:1082
Change-Id: Id8977d03839b76c90ae6e70400d048c13fbe85f4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80120
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Currently polyfilled for all backends.
HLSL should be able to map this to 'firstbithigh', but there might need
to be some special case handling for 0 (undocumented behavior). For now
just polyfill.
CTS tests: https://github.com/gpuweb/cts/pull/1004
Bug: tint:1367
Bug: tint:1449
Change-Id: I9c9a08ea93d1c4a602e0ab763e95e2eea336fb0d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81503
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Files left over from the Grand File Shuffle.
These already exist at test/tint/builtins/gen/countLeadingZeros
Change-Id: I3651e34b2390771947894a5ae29f95dad4c2adf4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81700
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Currently polyfilled for all backends.
HLSL should be able to map this to 'firstbitlow', but there might need
to be some special case handling for 0 (undocumented behavior). For now
just polyfill.
CTS tests: https://github.com/gpuweb/cts/pull/1003
Bug: tint:1367
Bug: tint:1449
Change-Id: I8125b32687196678906e5a9d056b4f2efd885073
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81502
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Requires polyfilling for all but the MSL backend.
CTS tests: https://github.com/gpuweb/cts/pull/1002
Bug: tint:1367
Change-Id: I0cf56b74c01f30436f9ad00595a554a4042587e4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81501
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Requires polyfilling for all but the MSL backend.
CTS tests: https://github.com/gpuweb/cts/pull/1001
Bug: tint:1367
Change-Id: I75097de945909e3242ede9001124d8821bc832bc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Bug: tint:1418
Change-Id: Ic1560bf7a0aa99ecbe554b985dc07f1b055fab64
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81500
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This got left out of the large reshuffle of dbc13af2
Bug: tint:1418
Change-Id: I0e55e19cdb8e3931ab87a99bce0e16b0cf5d5bff
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81320
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This didn't make the M100 release branch, so update the release notes.
Fix a type in one of the E2E test names.
Bug: tint:1437
Change-Id: I36c018a126f412607a55ff254add60dae4fa9ae5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81200
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>