Also includes adding in sizing information for various types.
BUG=tint:257
Change-Id: Iaaa8a7c28851d14790285b5bd14636bf3ae2b9b0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30704
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Updated to check if failure happened with the intended error code
Change-Id: If8eee7605b8ab1af481fde067dcb0e64e0df6256
Bug:tint:271
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30002
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This CL removes the `type IDENT = struct` format in favour of the
`struct IDENT` variant.
Bug: tint:175
Change-Id: I4fde8012fd07f811cd0bd80445198f6bbc92b720
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30661
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Both sampler types generate an `OpTypeSampler` in SPIR-V so we need to
make sure they're considered duplicates in the SPIR-V backend. This CL
registers the generated ID with for both sampler type_names when either
one is emitted.
Bug: tint:272
Change-Id: If459bbb34fe8670a7e29d101686b70bf83b184c2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30662
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This CL adds the parsing of structs with names. The parsing of type
aliased structs remains to allow for migration to the new system. The
named struct format is always emitted.
Bug: tint:175
Change-Id: Ic0579dedbd2dd0edc7dfd30bc2ec02972091e718
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30341
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This also involves a reorganization of the code into its own
subdirectory.
BUG=tint:253
Change-Id: If05018da2662e923e659b485576704f3a6bcd062
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30340
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL changes the AST dumping order to emit alias types before global
variables. This makes the output easier to read as the types come before
the usages.
Bug: tint:175
Change-Id: Ib7325384b910472e89d6d01853503be989ce4210
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30281
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL moves the StructType name into the constructor of the struct
type instead of receiving through an accessor. The |set_name| accessor
is removed as it should not be needed anymore. All call sites have been
updated.
The vertex pulling transform was fixed to correctly register an alias
for the structure being created so it will be emitted.
Bug: tint:175
Change-Id: I8802931d9bdbc6c2f12982eea9032931939d195c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30280
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This Cl updates the identifier type determination check to fail if the
identifier is not found and is not an intrinsic method.
Bug: tint:139
Change-Id: I332dd7fb42dae62bdee459c4a8819bdb5685c903
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30081
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This Cl removes the SPIR-V validation errors to emit after the desired
output format. This means a SPVASM output will have the error at the
bottom making it more visible.
Change-Id: I010f45ea4f35b2f5489749a49492c3d860410e8a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30080
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
The change from `cast` to type constructor casts causes our current
determination if a constructor is constant to no longer be correct.
This Cl updates the determination to match the current spec and adds a
bunch of unit tests to verify the behaviour..
Bug: tint:270
Change-Id: I8ce74eb7c3f849ce62815868313449d8ca2de6be
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30020
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Currently, if we access an array of non-scalar items we'll incorrectly
emit an OpVectorExtractDynamic which will fail as the result is not
scalar.
This CL updates the array accessor code such that if the base array is
an array of non-scalars we'll do load of the array and then access chain
into the loaded variable.
Bug: tint:267
Change-Id: Ia4d7052b57d8b31b835714b7b922c7859e3dce1f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29844
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
The AST doesn't do detailed checking of numeric parameters.
That's deferred to the separate validation step.
Change-Id: I85aada7292fcc9757f9fd54e2d9a50ad1405ef9c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29940
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
BUG=tint:268
Change-Id: Ie90df82146f4853ef310e32219e5195d36a742db
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29960
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL updates the WGSL parser to allow global variable decorations
to accept multiple blocks.
Bug: tint:240
Change-Id: Iaf8f794d285d87af6e2ff8c93e34d88331eedccb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29840
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
The push_preamble method was dealing with multiple sections of the
SPIR-V binary layout. As we changed the way things write (like
extensions getting written later) the preamble section was ending up in
incorrect order.
This CL replaces push_preamble with push methods for each of the
sections at the start of the SPIR-V module which should fixup the
ordering issue.
Bug: tint:267
Change-Id: Ib73a66d0fdb2c67dd6e80582289dd18475fad9f9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29841
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL updates the WGSL parser to allow array decorations to accept
multiple blocks. The stride decoration on arrays was turned into a
proper decoration object instead of just storing the stride directly.
Bug: tint:240
Change-Id: I6cdc7400d8847e3e043b846ea5c9f86cb795cf86
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29780
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: David Neto <dneto@google.com>
This CL updates the struct member decoration parsing to allow multiple
blocks of decorations.
Bug: tint:240
Change-Id: I97293ef30333f63c33bbc6e728dba11abc020c7c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29280
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
BUG=tint:257
Change-Id: Iec0dca854dfa6380991c04544848c24f21496a93
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29524
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL updates to match the spec change allowing multiple struct
decorations.
Bug: tint:240
Change-Id: Id859c6a331c67c46597fc3c70de06d6cc0f486ec
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29260
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This CL adds support for retrieving the array length of a Runtime Array
in the SPIR-V backend.
Bug: tint:252
Change-Id: Ic13c4a99da5760738d57702c45f52c6a194a172d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29220
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This CL adds specialization to the HLSL backend. The specialization is
emulated using defined preprocessor macros.
Bug: tint:154
Change-Id: I73ab42360558967eee9a0da6bbe74d513fe4cc57
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29720
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This CL adds the inspector into the architecture document.
Change-Id: I17f06e0ae29398a39b5082b0b4399c9c5e65769f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29800
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL moves spirv-tools so that it will only build what is requested.
This means that the tool binaries will not be built as part of tint as
they aren't needed.
Change-Id: Idd89b45facbe835948c57fe6dda6068657a2f822
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29660
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Currently if a constructor contains constructors we consider it const.
This falls down with the new type constructor syntax if the types don't
match. In the case they don't match we no longer consider the
constructor const as we'll generate OpBitcast and OpCopyObject
instructions which we need to build the composite from.
Bug: tint: 263
Change-Id: Ic85f58c8410e862a2ec30c7d93c9b87a61822f6d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29523
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
All of the OpEntryPoint declarations must come before OpExecutionMode.
Currently if you have multiple fragment shaders we'll interleave the
OpEntryPoint and OpExeutionMode which will fail to validate.
Bug: tint:263
Change-Id: I7c925cf6b5345c03bfaf1aa15115caa1bdb9af4c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29522
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This CL adds the code to emit function_constant attributes to the
generated MSL.
Bug: tint:153
Change-Id: I0e4f50257fde7e8db8f53e15bc9f460ebfc809ee
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29520
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Add some missing doxygen comments
Change-Id: Ic5d6684d90f5b2fe9ed3914bbb7c4058effc040c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29500
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
BUG=tint:257
Change-Id: Iaf03bfaeb622b7315d65e46eccfe90244bced339
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29420
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL suppresses some Doxygen warnings for code doxygen doesn't
process correctly and adds the missing return for GenerateEntryPoint
method.
Change-Id: If97443a7177caa51c1054de83fb0711692a7ab22
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29461
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL moves the visibility=hidden directive from the top level applied
flags to libtint specifically. This fixes up an issue between
SPIRV-Tools and the sample app when using std::rfind which ends up with
different visibility.
Change-Id: Ib06949b3755db66027d3656d3d6ce2504bfda81e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29460
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL makes the AST type format name match the WGSL name so the
overloaded operator<< can be used in the WGSL writer. This removes a
bunch of duplication of WGSL type format name strings.
Bug: tint:230
Change-Id: I14aaefd21ced267ceed31f21faba3bd291275f0d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29402
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This Cl adds countOneBits and reverseBits intrinsic support to the MSL
and HLSL backends.
Bug: tint:250
Change-Id: Idb572da32e9c10767a27326cacf58aafef44a77a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29401
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This Cl removes the unused ctx method from the inspector helper.
Change-Id: I3c35aeb18c29078d5bdb46e3d1a2c5d4d6dcce54
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29400
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This class is used to examine a module and get information about its
contents. This is the getting side of shader of reflection. Future
work will add transforms that perform the setting side of reflection.
In addition to the basic class and infrastructure, this CL adds a
GetEntryPoints() function demonstrate it works. More functionality
will be added in later CLs.
BUG=tint:257
Change-Id: If41dbb6c93302e0332754c086c75729d6ffe04d0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29320
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
In WGSL you can provide a constant_id variable without a constructor. In
SPIR-V we must synthesize a constant to attach the SpecId too. This CL
adds that variable creation.
Bug: tint:254
Change-Id: I2f25fdc3cb7e2c9c0f9e2129885865bd24298416
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29200
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
This Cl converts the cast in computeboids to a type constructor.
Change-Id: Ie1e7183226bb2f629f25cb2d35fc917d8ca68564
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29140
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL extends the sample app to allow running the bound array accessor
transform.
Bug: tint:206
Change-Id: I226a947a2e0a9e0945aa044b2847b4fd62b7c277
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29122
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds constant_id decorations to the WGSL writer.
Bug: tint:152
Change-Id: I637d158c0ef4d0ace2ce70a6fb3cbe6f0b8b3b4e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29102
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This CL holds a simpler manager to hold and execute multiple transforms.
Bug: tint:206
Change-Id: I45f6b55134f871167704f3549c4e4c72ef806c3a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29121
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL adds OpSpec constants to the SPIRV-Writer.
Bug: tint:151
Change-Id: I309013ca0b4cb514edd92fab3dab2e4faa15969a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29101
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds a Transformer base class from which the transformers will
inherit.
Bug: tint:206
Change-Id: I542eacb05d9a92af46d172a5803c245472c0e22c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29120
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This CL adds constant id helper methods to the decorated variable class.
Bug: tint:150
Change-Id: Icfdc516f37d4f2680d2b990879bff722085cf732
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/29082
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This CL adds a buffer array accessor clamping transform to
the available transforms in Tint.
Bug: tint:101
Change-Id: If9d5b0fb2c3adba723ce2185870b0e10981103a6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28980
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>