Commit Graph

2440 Commits

Author SHA1 Message Date
Ryan Harrison 53426a4538 Remove old infra configuration files
BUG=tint:693

Change-Id: I51512924b9bcec5cb71e6ce5abed9444768d73b8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53640
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-07 17:09:21 +00:00
Ben Clayton b2a7d8b9b0 diagnostic: Fix stupid bug in Formatter::format
That would cause OOB reads.

Fixed: tint:836
Change-Id: I6e44ab5d140e99a701c190c13ed6aaba762e19d4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53660
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-07 16:53:32 +00:00
Ben Clayton 224ce729cc resolver: Add more inferred access tests
The tests that were in ptr_ref_* should have been in var_let_*. Move these to the right place, and add more tests that actually test the pointer access.

Bug: tint:846
Change-Id: I383fcbf7eeb4a1428cf50c52bc2958720458adcb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53388
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-07 16:51:02 +00:00
Ben Clayton fb6a6185fa test: SKIP deprecated/access_deco for MSL backend
This does not pass validation.

Change-Id: I3e63ad899d346321a4dea13f3a681d01546ed2bb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53621
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-07 16:50:22 +00:00
Antonio Maiorano 6a665d1b85 test-runner: allow using '/' in filter on Windows, and fix using '\'
Change-Id: I635952a6c04bc305a896143333b2ae141bb6a2b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53400
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-07 14:51:22 +00:00
Ben Clayton 6b358c3f21 Fix tint fuzzer build
Enable the fuzzers for Kokoro presubmits so we can actually know when we break it.

Change-Id: I7270390045353f79c27a7f661afcc7e888628fcd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53385
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2021-06-07 08:07:11 +00:00
Ben Clayton 03d10721e7 Stop tint.h from including program_builder.h
ProgramBuilder is about as internal as you can get - this really should not be public.

MSVC seems to try an instantiate some of the template methods in ProgramBuilder when it is included externally (for PCH or DLL exports perhaps?), and failing with bizzare error messages that contain no point-of-instantiation.

As this header was never intended to be public in the first place, detect and error if the tint.h include guard is found while processing program_builder.h, and fix up the couple of bad transitive includes.

Fixes tint -> dawn autoroller

Change-Id: Ic9a81a44ab1b4a29a7297b94bbf85bcfdb1310b5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53384
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-05 12:45:50 +00:00
Ben Clayton 1858854f7e Add optional access to ptr<>
This also completes the work to resolve the access controls for each
storage type.

Fixed: tint:846
Change-Id: Iab24057ec14620a2978ec63c4a91ba12d1bc6e9b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53381
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-04 22:17:37 +00:00
Ben Clayton 3db1820f0b test-runner: Don't overwrite SKIPs with --generate-expected
Unless the test also passed validation.
Prevents clobbering expected validation failures when you've only checked tint didn't error.

Change-Id: I44be0c8b1f9ef1a0df51bba81f5ad694715204b8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53383
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-06-04 21:58:07 +00:00
Ben Clayton 93e8f527ee wgsl: Deprecate [[access]] decorations
Handle access control on var declarations instead of via [[access]]
decorations. This change does the minimal work to migrate the WGSL
parser over to the new syntax. Additional changes will be needed
to correctly generate defaulted access qualifiers, as well as
validating access usage.

The [[access]] decorations are still supported by the WGSL parser,
with new deprecated warnings, but not for aliases. Example:
   var x : [[access(x)]] alias_to_struct;

Making this work is far more effort than I want to dedicate to backwards
compatibility, and I do not beleive any real-world usage will be doing
this.

Still TODO:
* Adding access control as the optional, third parameter to ptr<>.
* Calculating default accesses for the various storage types.
* Validating usage of variables against the different accesses.

Bug: tint:846
Change-Id: If8ca82e5d16ec319ecd01f9a2cafffd930963bde
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53088
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-04 20:41:47 +00:00
Ben Clayton b175d91c7e test-runner: Pass a relative path to tint
Avoids absolute paths being emitted in diagnostics

Change-Id: Ic62af27e079ceac8d89735486edcaca75014b8c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53382
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-04 20:02:45 +00:00
Ben Clayton 620d77e480 PB: Make Var() and Global() params optional
and allow them in any order.

We're about to add Yet Another optional parameter - access control.
For style, we probably want this field before the decorations, however
that means adding more default values for all the cases where we don't
need to specify the access control.

Instead use some template magic to allow extra parameters to be
specified in any order, and entirely optional, with sensible defaults.
This keeps things readable and without huge code refactorings.

Bug: tint:846
Change-Id: I4f61eb765de63ad98ae786d187d2bd1b42942756
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53087
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-04 19:55:08 +00:00
James Price 9fd3befa17 tools: Return position from generated vertex shaders
This is required to generate valid MSL code, and will soon be
validated by Tint too.

Change-Id: I4c5f5c4ecb1c91131c934de1132217d9f6be1f8e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53420
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-04 17:31:48 +00:00
David Neto 6b22219798 spirv-writer: Fix | and & on bool and bool-vec
Fixed: tint:861
Change-Id: Ib9709b3793fb5c405f4ba519c189295999f556ee
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53280
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-04 16:25:27 +00:00
Antonio Maiorano 9834fefa7f Implement type inference
Bug: tint:672
Change-Id: I3f586ee867f75427c4e8c309f72fb468643c23c0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53182
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-04 15:28:47 +00:00
James Price 7697c31e84 writer/msl: Emit builtins as parameters
Add a config parameter for the CanonicalizeEntryPoint transform that
selects between emitting builtins as parameters (for MSL) or struct
members (for HLSL).

This fixes all of the shader IO issues in Tint's E2E tests for MSL.

Fixed: tint:817
Change-Id: Ieb31cdbd2e4d96ac41f8d8515fd07ead8241d770
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53282
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-06-04 14:40:28 +00:00
James Price 3604e80321 transform/EntryPointIO: Use InsertFront
This removes the need to check for an empty function body and means we
can unconditionally build the function constant initializers, instead
of deferring this work via captured lambdas.

Change-Id: I1571a065fb5885e2b29f0ffb41940a71e5b3f121
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53281
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>
2021-06-04 14:03:28 +00:00
Ryan Harrison cd5492c910 Add Starlark based configs to Tint
This does no remove the existing configs, since there is a chrome
infrastructure change that needs to occur to point LUCI at the new
configs.

BUG=tint:693

Change-Id: Ie32427c51dde3386d6ca15e5dfc0222afe5c1f92
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51401
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-06-03 19:58:51 +00:00
James Price 851b18b2f2 writer/msl: Emit field designators for structures
This fixes constructors for structures that contain padding members
due to explicit layout attributes.

Also fix one test that was wrongly using an identity type constructor
for a structure.

Fixed: tint:853
Change-Id: I0a3e84fcd7c6a7f2ad92a4970ed11378e6ce2465
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53240
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-03 18:12:15 +00:00
Ben Clayton 71786c99b3 resolver: Validate pipline stage use for intrinsics
Use the new [[stage()]] decorations in intrinsics.def to validate that intrinsics are only called from the correct pipeline stages.

Fixed: tint:657
Change-Id: I9efda26369c45c6f816bdaa53408d3909db403a1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53084
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-03 16:07:34 +00:00
Ben Clayton 7b366475ed [utils]: Add EnumSet
Simple container for sets of enum values.

Change-Id: I9efe5fc15e9f179cb63b64f3783235a92013a2b3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53083
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-06-03 15:53:34 +00:00
David Neto cc49619e60 Remove stdout printing from test
Change-Id: Ib5083da6d0545d6dc7fc7dd50d889d9c73fd57f4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53200
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-03 15:20:45 +00:00
Antonio Maiorano 0d7ea4bced Fix fileutils not working on Windows
Change-Id: Ifcda643e35bcb63c3d7a235391ba95384f7ef444
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53180
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-03 15:08:44 +00:00
Ben Clayton 55ca24e696 [writer]: AppendVector() - support zero value vectors
These were not correctly handled, causing multiple writer issues.

Updated test stats:
3248 tests run, 2693 tests pass, 555 tests skipped, 0 tests failed

Fixed: tint:757
Change-Id: If92e9c2ceefe986c92ca47d23c8d6b64b155ca49
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53081
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-03 15:08:14 +00:00
Ben Clayton b07a7cead6 [tools]: Generate intrinisic test cases
Add test/intrinsics/intrinsics.wgsl.tmpl that generates a vast set of intrinsic overload permutations into test/intrinsics/gen/...

Add expected output for all of these, including 'SKIP' headers for those that currently fail.

Fixed: tint:832
Change-Id: Id6888df52c07f35e7a55199f2ad4d842c6e2595c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53051
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-03 11:26:17 +00:00
Ben Clayton 2270b434bc [tools] test-runner: Add --generate-skip flag
Generates expected cases that fail, using a SKIP header

Change-Id: I2738fa2cf47c715fe6e978edf51aa928c5e3b216
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53049
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
2021-06-03 10:47:24 +00:00
Ben Clayton 194c58f89c intrinsics.def: Support [[stage()]] decorations on overloads
Specifies that the overload can only be used in the specific stages.
Actually validating this with the IntrinsicTable is TODO.

Bug: tint:657
Bug: tint:832
Change-Id: I11ffefee22e5f26103f008b23d16066a2a3ba90d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53050
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2021-06-03 09:53:34 +00:00
James Price bb0496e52a test: Add E2E test coverage for shader IO
This provides much more complete coverage than what we have in the
unit tests. We now test:
- All builtins, for all stages, both struct and non-struct
- Multiple location attributes for vertex and fragment stages, both
  struct and non-struct
- Mixing builtins and location attributes, whilst mixing struct and
  non-struct
- A few "interesting" cases of IO structs being shared between
  different functions, stages, and with an SSBO variable

There are 7 skipped tests for MSL due to two different MSL bugs which
will be fixed in upcoming patches.

Change-Id: I8b802591762c8ff018e01bf37838551e353162b1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53120
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
2021-06-03 09:38:34 +00:00
Ben Clayton 142143109a intrinsic-gen: Additional functionality
* Add new template utilty functions, including the ability to split out multiple files.
* Add basic printing of the semantic overloads.
* Add a pointer from the overload to the function
* Change TemplateArguments from a list of FQN to a list of interface{} (any).  This is required as once the overload is permutated, some arguments will need to hold integers.

This will be used by the test generator.

Bug: tint:832
Change-Id: Idbfbe85e52489b31850cbb0ee7430bb4b021530e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53046
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-06-03 09:16:14 +00:00
Ben Clayton fa9a9b5528 Support tools/src/fileutils on macos
Change-Id: Ibfb6b92f0df14822994a5c355f6d2044326f7028
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53080
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-03 08:49:04 +00:00
Ben Clayton cb7e5d4252 reader/wgsl: Support access on storage texture
Add a deprecated warning for the old syntax.

Bug: tint:846
Change-Id: Id46af28054b32c2ba6f1b96556da023f46a6b87b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53048
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-03 08:44:14 +00:00
Ben Clayton 04bd2e8083 intrinsic-gen: Support decorations on enum entries
Add `[[internal]]` decoration on `storage_class.handle` - its not an entry that should ever appear in WGSL.

Bug: tint:832
Change-Id: I210f64c495bf37a8f48422919248806e7b096638
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53045
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-03 08:42:14 +00:00
Ben Clayton 57d6bd2ef3 intrinsics.def: Tighten up texture constraints
Nothing was limiting the texel format to i32, u32, f32, and so the resolver was accepting any type here, and things would break in the backends.

Also limit texture access controls to read or write. read_write is not supported for textures currently.

Change-Id: I41c54a9b285800ad89aa1c4ea07e142ba0506384
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53044
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-03 08:32:44 +00:00
Ben Clayton efb741fe13 resolver: Check IsStorable() earlier for array els
This was done in ValidateArray(), but this comes after the call to DefaultAlignAndSize(), which will ICE if the type is not storable.

Change-Id: Ia3f1b640f42a45362487c3156237b59ea6fed68b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53043
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-03 08:24:55 +00:00
Ben Clayton 0e66b403a0 Resolver: Remove SetType() that takes ast::Type
This was calling Type() without actually checking that the resolve succeeded.
Have the caller resolve the AST type to the semantic type, so that there's a sensible place to handle errors.

Change-Id: I8fae91854377994f68a924fe8104a48a8afe150e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53042
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-03 08:17:44 +00:00
Antonio Maiorano 8324d227a1 tmpfile_windows: fix temp file name collisions when appending an extension
Formerly, tmpnam_s was used to ensure a unique file name, but then we'd
append an extension to it, invalidating its uniqueness. Instead, we now
do our own uniqueness check by attempting to create a unique empty file
for write with new names until it succeeds.

Bug: tint:812
Change-Id: I90b85074ad2281f9904f24e8fddda80d67e61ba7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53061
Auto-Submit: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-02 23:22:44 +00:00
Antonio Maiorano a7f47b49e7 command_windows: fix deadlock when waiting on stdout and stderr of process
Using WaitForMultipleObjects on the handles to stdout and stderr streams
is apparently not the right way to do this. Instead, we create 2
threads, one that reads stdout, and one that reads stderr, and we wait
on those threads, along with the process handle.

Bug: tint:812
Change-Id: I5975e4d649b58d0f8bffb76dec5a3f4079513e04
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53060
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-02 22:57:24 +00:00
Ben Clayton a70c14dbce main: Replace --dawn-validation with --validate
Performs output validation with spirv-val for SPIR-V (as before), HLSL
validation with DXC, and MSL validation with the Metal Shader Compiler.

Disable HLSL tests that fail to validate

Bug: tint:812
Change-Id: If78c351b4e23c7fb50d333eacf9ee7cc81d18564
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51280
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-02 21:02:34 +00:00
James Price a7a23eaa9e test: Fix type of vertex_index builtin
This should be a u32, but we are missing validation rules for builtin
types (opened crbug.com/tint/861 for this). This meant that we were
generating invalid HLSL for this test.

Change-Id: Ib2189d98e5e515e41374372c0f8963df04eb1b01
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53001
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-06-02 20:53:14 +00:00
Ben Clayton 815cfd14e7 docs: Add a guide for writing diagnostic messages
Change-Id: I552a062931a3ce7a51189559b05c9275f7b205cf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51785
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-02 20:50:24 +00:00
Ben Clayton f5163d01b5 writer/wgsl: Handle ExternalTexture
Bug: dawn:728
Change-Id: Idda800c301ac88397aeeb4cd75d03d59a434c30f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53041
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-02 20:12:34 +00:00
Ben Clayton e3cd216e29 main: Print WGSL from correct program
PrintWGSL() was using the moved program, triggering an ICE

Change-Id: I8976feac8712cc883d1b1b4bdca35a929bcb846a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53040
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-02 20:01:54 +00:00
James Price 94ac078990 writer/msl: Wrap each array type in a struct
This allows them to be used in various places that WGSL allows, such
as function return types and parameters, and as the type of the RHS of
an assignment.

Fixed: tint:814
Fixed: tint:820
Change-Id: Idb6a901b9a34e96bb9733cc158191e7b3bafaa0e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52844
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-02 17:23:03 +00:00
David Neto 5c0820c76b spirv-writer: support isNormal
Fixed: tint:158
Change-Id: Iabe7c1afe7dea87e62277bacb2086ee6d2964e78
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52460
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-02 17:09:43 +00:00
David Neto 5ed3f68eb5 spirv-reader: unwrap references for conversions
Bug: tint:804
Change-Id: I39a4d20de17a5c2ae23e9425d85559b7bb70fd22
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52845
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-01 19:46:31 +00:00
Ben Clayton b29a59de6e src: Reimplement IntrinsicTable from intrisics.def
Add a template file to generate intrinsic_table.inl and
include this from intrinsic_table.cc.

Speeds up execution of the unittests by 20 - 30%, and
reduces the executable size by a couple of percent.

Bug: tint:832
Change-Id: Ifa7f3c42202c92e97b46ed1716ece48660dd29dd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52504
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-06-01 19:06:31 +00:00
David Neto ae5437cc87 spirv-reader: ignore phi inputs coming from non-ordered blocks
Bug: tint:804
Change-Id: I789c05a31d869052036351b8c173ef8cd7191cc2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52841
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-01 18:52:01 +00:00
Antonio Maiorano 0895c238e3 Fix integer vector bitwise ops not being allowed
Bug: 768
Change-Id: Id5023cd32b9368e9c0634bdad884ad199f17aa80
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52943
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-06-01 17:42:41 +00:00
David Neto 2871ad9138 spirv-reader: emit null for value from unreachable block
Sometimes a value can come from a block which does not appear
in the structured block order.  That block will never execute,
so we can safely use the null value instead.

Bug: tint:804
Change-Id: Idc1a6c4f76f14a1d76919a95e5a65e56018ce68f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52840
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: David Neto <dneto@google.com>
2021-06-01 16:28:43 +00:00
Ben Clayton e8177dade6 Add tools/src/lut: A lookup table with compaction
Used by the intrinsic definition generator.

Bug: tint:832
Change-Id: I000b1ebe067117e533b3edd8a3fac67a3cbc14c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52601
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-01 15:41:11 +00:00