Commit Graph

585 Commits

Author SHA1 Message Date
David Neto 9bb0dc543d spv: Build internal representation of the SPIR-V
For convenience, use the SPIRV-Tools' optimizer representation.

Bug: tint:3
Change-Id: I1b046209584e1e907045d496b0f8d7b36fca79bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16660
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-13 20:21:45 +00:00
David Neto e5dc367a7e spv: reject invalid SPIR-V
Use the SPIRV-Tools validator, with the WebGPU0 environment.

Bug: tint:3
Change-Id: Id1132d209fd939ed68587034761e97da9b35b21d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16821
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-13 20:18:06 +00:00
David Neto 1ae7c7dba9 Add SPIR-V parser impl
The parser impl saves a copy of the SPIR-V binary.

Bug: tint:3
Change-Id: I5d61c87123c0bcb417d0c7004e0ef4e3c8fbb027
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16642
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-13 20:14:33 +00:00
dan sinclair 306a2f8381 Add IdentifierExpression to WGSL writer.
This CL extends the WGSL writer to output IdentiferExpression and fills
out the variable with initializer test case and implementation.

Bug: tint:4
Change-Id: I9db9affb5ec4c4c109488f60bbc81bf3a96eee35
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16744
Reviewed-by: David Neto <dneto@google.com>
2020-03-12 12:43:05 +00:00
dan sinclair d9e9ff3be5 Start WGSL writer
This CL is the start of a WGSL writer.

Bug: tint:4
Change-Id: Ib2c2580d9e50c36664088556d9b8feec76935211
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16560
Reviewed-by: David Neto <dneto@google.com>
2020-03-12 12:40:01 +00:00
dan sinclair 37dbf99e34 Always define TINT_BUILD_SPV_PARSER.
This CL always sets the define for building the SPV_PARSER. This fixes
undefined errors on certian platforms.

Change-Id: I5f84295cb7ddf23d64efd9a4d00717c84bc698aa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16800
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2020-03-11 18:43:12 +00:00
David Neto ab0cdaf652 Add a FailStream error reporting helper
Bug: tint:3
Change-Id: Ie0bb2365a7dd6b2a5e9d0960593fac7586b02922
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16640
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-10 22:54:46 +00:00
David Neto f814bdc52a Add stub unit tests for spv parser
Bug: tint:3
Change-Id: I6957cddbdadbcf493fc8f1e3dbe0c6d9037dc56b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16620
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-10 22:54:31 +00:00
David Neto bbd8987e71 Instantiate a stubbed SPIR-V parser if file ends in .spv
- spv parser just errors out for now
- link against SPIRV-Tools-opt
- Fixe CMake variable TINT_ENABLE_SPV_PARSER --> TINT_BUILD_SPV_PARSER

Bug: tint:3
Change-Id: Ie4ef9b03e001fca3cc11f65a425612755857feac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16600
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-10 22:54:12 +00:00
Dan Sinclair 49faa4c8d7 Add function tests
This CL adds tests for the function node.

Bug: tint:11
Change-Id: I10b1fb73ae93bf90162948ab42e2a74d4aca7987
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16501
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 19:19:28 +00:00
Dan Sinclair 9c48ddb917 Add fallthrough statement tests
This CL adds tests for the fallthrough statement.

Bug: tint:11
Change-Id: I1bc8677e00aa9eb446a096bd2600104550480d77
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16500
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 19:19:18 +00:00
Dan Sinclair cc9d7851e1 Add builtin decoration to_str test.
This CL adds a test for the to_str method of the BuiltinDecoration.

Bug: tint:11
Change-Id: Ia350058fc4f551d62195527f0a6b86751ba92b8c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16481
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 19:19:06 +00:00
Dan Sinclair d70d07c5b9 Add binding decoration to string test
This CL adds a test for the binding decoration to_str method.

Bug: tint:11
Change-Id: Id9d16bdb68c4b68fb8bd67dae898f8b7a17ee6c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16468
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 19:18:51 +00:00
Dan Sinclair 89b2aa1207 Extend entry point to str testing
This CL adds more tests for the entry point to str method.

Bug: tint:11
Change-Id: I54bb349d606d05221d649215b7b2c6477cca6819
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16480
Reviewed-by: David Neto <dneto@google.com>
2020-03-10 19:18:29 +00:00
Dan Sinclair 18747b657a Extend array accessor validity checks
This Cl extends the array accessor to verify the sub expressions are
also valid.

Bug: tint:11
Change-Id: Ieaa9643e07deaa8c406743c3bbb6fbe3ca9cb1ef
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16467
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 19:11:35 +00:00
Dan Sinclair adb80f005a Add else statement AST tests
This CL adds tests for the else statement AST node.

Bug: tint:11
Change-Id: I30c024775d188223d5a3875ee973ffc8ac78c645
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16466
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 17:48:25 +00:00
Dan Sinclair 3a1368dead Add DecoratedVariable tests
This CL adds tests for decorated variable and updates the API to be
slightly nicer.

Bug: tint:11
Change-Id: I0bd5b8b6e6f682dc9d405e02e51d5dbcaeccc5f3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16465
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-10 17:47:56 +00:00
Dan Sinclair b893115c17 Add ContinueStatement unit test
This CL adds tests for the continue statement AST node.

Bug: tint:11
Change-Id: I6339947c338b4b035f7947cb45e33bf2dcb6fe3e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16464
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-09 13:23:22 +00:00
Dan Sinclair f981455a1c Add ConstInitializerExpression tests
This CL adds unit tests for the const initializer expression.

Bug: tint:11
Change-Id: I9fb9dd77447ac20921997614816cd75272d4e05a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16463
Reviewed-by: David Neto <dneto@google.com>
2020-03-06 21:18:50 +00:00
Dan Sinclair 11be14076b Add cast expression tests
This CL adds unit tests for the cast expression AST element.

Bug: tint:11
Change-Id: Ia5d82a00ef2a4c16d6591095b7674f1c14a33c5f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16462
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2020-03-06 21:18:19 +00:00
Dan Sinclair a659b2113d Add case statement tests
This Cl adds tests for the case statement class.

Change-Id: I585fdff9631ed44e6fb297328ed164297f5fa8f3
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16421
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-06 14:28:01 +00:00
Dan Sinclair 00cf5a4894 Add test for call expression
This CL adds unit tests for the call expression. The IsValid method is
extended to verify none of the provided parameters are a nullptr.

Change-Id: I5dfd3ec1f086ef02ab965218a1d8610a1c212628
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16360
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 20:35:57 +00:00
Dan Sinclair 51c811bfa8 Add BreakStatement test
This CL adds unit tests for the break statement.

Change-Id: I78300ea6661e9c331795aedd344ac74c63dd8e25
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16342
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 20:29:13 +00:00
Dan Sinclair 796f65fb70 Add test for assignment statement.
This CL adds unit tests for the assignment statement methods.

Change-Id: I4aea8f22b530bf43b7dfdc2b82b5414cf6590fea
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16341
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 20:20:39 +00:00
Dan Sinclair bf2b8973ed Add gclient files to gitignore
This Cl updates the .gitignore with the .gclient and .gclient_entries
files.

Bug: tint:12
Change-Id: I645016ca83396c0616f2ad3f69d2ce510be59b53
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16580
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2020-03-05 18:17:32 +00:00
Dan Sinclair 91e57dd7d8 Add unit tests for AsExpression
This CL adds unit tests for the as expression and fixes up a few issues
along the way.

Change-Id: I4591f31c1a48ea5580a87a129c728ef3c9be2c7c
Bug: tint:11
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16340
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 16:35:40 +00:00
dan sinclair 19e26f2fec Move build_module into an anonymous namespace
This CL moves build_module into an anonymous namespace which fixes up a
build warning about missing prototypes.

Change-Id: I8b2f427e32e7851c24492099103565ab0119f4fa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16503
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 16:35:25 +00:00
Ryan Harrison db6ade73b2 Convert dependency management to using gclient
BUG=tint:12

Change-Id: I9c6b9cdd584f9a2e6c360c9a457069670146da7c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16482
Reviewed-by: dan sinclair <dsinclair@google.com>
2020-03-05 15:58:27 +00:00
Dan Sinclair 707705ddf4 Add issue tracker to README
Change-Id: I27b20007786703e514f6d9c94c31d27443b8e2d7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16400
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
2020-03-05 15:06:38 +00:00
Sarah Mashayekhi 462dd675e1 v-0001: Only allowed import is GLSL.std.450
Bug: tint:10

Change-Id: I566ff378c4cd72febc0a73434b5dfe1039ef2c42
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16420
Reviewed-by: Dan Sinclair <dsinclair@google.com>
Commit-Queue: Dan Sinclair <dsinclair@google.com>
2020-03-04 20:51:29 +00:00
Dan Sinclair afc144ee95 Fixup googletest deps
I picked the wrong googletest folder when switching to chromium deps.
This CL fixes it to use the correct one.

Bug: tint:9
Change-Id: I9da1b3a7418f6738ffe8ac89aaa7104868b236c6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16461
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@google.com>
2020-03-04 14:48:39 +00:00
Dan Sinclair e631c00cba Switch to the chromium mirror for DEPS
This Cl upates the deps file to use the chromium mirror instead of
github directly.

Change-Id: Ie38bae8b171027f08054345df9ffd3ed940c1281
Bug: tint:9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16460
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@google.com>
2020-03-04 14:15:39 +00:00
Dan Sinclair e4b68bafda Add unit test for ArrayAccessorExpression
This CL adds unit tests for the array accessor expression class.

Change-Id: I97a7b366a2303b071040164cbcda404fe0592d90
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16281
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Dan Sinclair <dsinclair@google.com>
2020-03-03 14:09:27 +00:00
David Neto a00a571d81 Rolling 3 dependencies
Roll third_party/googletest/ 41b5f149a..e588eb1ff (9 commits)

41b5f149ab...e588eb1ff9

$ git log 41b5f149a..e588eb1ff --date=short --no-merges --format='%ad %ae %s'
2020-02-27 absl-team Googletest export
2020-02-25 absl-team Googletest export
2020-02-19 absl-team Googletest export
2020-02-12 absl-team Googletest export
2020-02-11 absl-team Googletest export
2020-02-11 absl-team Googletest export
2020-02-10 absl-team Googletest export
2020-02-10 absl-team Googletest export
2020-02-07 absl-team Googletest export

Roll third_party/spirv-headers/ 5dbc1c321..0a7fc4525 (1 commit)

5dbc1c3218...0a7fc45259

$ git log 5dbc1c321..0a7fc4525 --date=short --no-merges --format='%ad %ae %s'
2020-02-26 dneto Add grammars, C header, and header generator for vendor and KHR extended instruction sets (#143)

Roll third_party/spirv-tools/ fe10239f9..e1688b60c (16 commits)

fe10239f92...e1688b60ca

$ git log fe10239f9..e1688b60c --date=short --no-merges --format='%ad %ae %s'
2020-02-28 dneto Avoid use of Python distutils.dir_util (#3203)
2020-02-28 rharrison Adding WebGPU specific Workgroup scope rule (#3204)
2020-02-25 jaebaek Add validation rules for OpenCL.DebugInfo.100 extension (#3133)
2020-02-25 geofflang Combine extinst-name and extinst-output-base into one arg. (#3200)
2020-02-23 nicolasweber Fix Wrange-loop-analysis warnings in SPIRV-Tools. (#3201)
2020-02-21 geofflang Add missing dependencies when generating spvtools_core_tables (#3199)
2020-02-21 afdx Brief guide to writing a spirv-fuzz fuzzer pass (#3190)
2020-02-21 47594367+rg3igalia Fix ignored const qualifier warning in static_cast (#3197)
2020-02-20 stevenperron Make spvOpcodeString part of the public API (#3174)
2020-02-20 danyspin97 Fix static libraries linking order (#3189)
2020-02-18 bclayton vscode: Add missing fields to schema.Opcode (#3169)
2020-02-18 siglesias spirv-val: Add support for SPV_AMD_shader_image_load_store_lod (#3186)
2020-02-14 afdx spirvfuzz: Fix type-related bug, change undef to zero, and add assert (#3188)
2020-02-11 afdx spirv-fuzz: Fuzzer pass that adds access chains (#3182)
2020-02-10 afdx spirv-fuzz: Fuzzer pass to add function calls (#3178)
2020-02-10 afdx spirv-fuzz: Ensure that donated variables are always initialized (#3181)

Created with:
  roll-dep third_party/googletest third_party/spirv-headers third_party/spirv-tools

Change-Id: If0c1b679c2bc6863c21bcf78368dae16f5662b45
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16300
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Dan Sinclair <dsinclair@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: Dan Sinclair <dsinclair@google.com>
2020-03-03 14:09:01 +00:00
Dan Sinclair 6e581895a5 Initial commit 2020-03-02 15:47:43 -05:00