Commit Graph

7228 Commits

Author SHA1 Message Date
David Neto 6988e894d2 spirv-reader: track access mode for ptr/ref
Fixed: tint:1041 tint:1103
Change-Id: Ief5f3da73c65700fe904e76683b9b25f4eca2169
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104900
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-10-12 21:32:19 +00:00
David Neto cc0c67bce8 spirv-reader: Support GLSL.std.450 FindSMsb
Fixed: tint:1058
Change-Id: Ifdc2ee9c54d18e1efe6b908991e8eb1b8c6a6de4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104903
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-12 20:42:26 +00:00
Corentin Wallez 042711b2b1 Remove redundant file in tint/BUILD.gn
Change-Id: I457d765aa58319b9b2a60253463e4fef04981492
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105561
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-12 20:24:25 +00:00
Ben Clayton ba384f0383 tint/transform: Fix array materialization when indexing with override
Fixed: tint:1697
Change-Id: I6de9ea520e8e8fcba281c8cf68ad77021eb3dd22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104825
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-12 19:18:25 +00:00
Ben Clayton d6daefc379 wgsl: Print abstract-floats with full precision.
Change-Id: Ie95547f065b896983b90ffd5455538fdd843b81a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104824
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-12 19:13:38 +00:00
David Neto 2b8c9d7c2a spirv-reader: Support GLSL.std.450 FindUMsb
Fixed: tint:1059
Change-Id: I7bd7ae4b83036fce3ba5979b33d17d274e26bd69
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104902
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
2022-10-12 18:59:01 +00:00
Ben Clayton d2e0db3af2 tint: Rename kInvalid to kUndefined for enums
This is a more neutral term for an unassigned enum value.

Change-Id: Ic69d912472f26fd8a2c8348281b27edfcc145eab
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105480
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-12 18:49:15 +00:00
Ben Clayton 78c839be97 tint/resolver: Ensure that total workgroup size fits in u32
This is below the 256x256x64 limits as defined by the WebGPU spec:
https://gpuweb.github.io/gpuweb/#limits

Fixed: tint:1692
Change-Id: I3608eb41094fbc7c77a40ea32f0f7418c31e0a05
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105401
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-10-12 17:03:57 +00:00
Ben Clayton fafeb9a327 tint/reader/wgsl: Improve errors when parsing access controls
If the access control doesn't parse, then generate an error message that includes the list of possible values, and a suggestion if there was a close match.

Change-Id: I12fdbe0f73762b51e670b5b1b0f087f3a9157339
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105330
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-12 11:17:56 +00:00
Ben Clayton bccd87c37a tint/ast: Generate access.[h|cc]
Emits all the enum info from the single-source-of-truth `intrinsics.def` file

Change-Id: Ib9170a2337597d4d81983c446d50582b518c6d71
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105329
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-10-12 09:42:00 +00:00
Jiawei Shao 75a8574b29 Validate effective storage or read-only storage buffer size be multiple of 4
This patch adds a validation that the effective buffer size must be a multiple
of 4 when the binding type is storage or read-only storage to match the latest
WebGPU SPEC.

This patch also fixes some typos in BindGroupValidationTests.

Bug: dawn:1542
Test: dawn_unittest
Change-Id: I30234bcf718be0d82d4a09b9980127a98ebe8172
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105101
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2022-10-12 00:55:37 +00:00
Ben Clayton a44e3d8bea tint: include T type in converter overload diagnostics
Fixed: tint:1710
Change-Id: Iac66b5bb9e1b8f38f46e01b1d6aee0e5284eb157
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105262
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-11 23:46:55 +00:00
Ben Clayton c889500f6e tint/reader/wgsl: Improve errors when parsing interpolation modes
If the interpolation mode doesn't parse, then generate an error message that includes the list of possible values, and a suggestion if there was a close match.

Change-Id: I4ee52389e94c834b9d5d9b8d1e76f453a1acd4d1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105328
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-11 22:04:29 +00:00
David Neto 542d27d874 spirv-reader: support GLSL.std.450 instruction FindILsb
Fixed: tint:1057
Change-Id: Iacaefb9d634b60745f163061424090b041fccc68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104901
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2022-10-11 21:47:41 +00:00
Antonio Maiorano 2ad747dedd tint: Fix const eval unary tests
I broke this in a recent CL:
https://dawn-review.googlesource.com/c/dawn/+/104424

Bug: tint:1709
Change-Id: I930a57bae723e18708d4f746ed66d24378518df4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105461
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-10-11 21:29:28 +00:00
Ben Clayton 75bc93c0df tint: Fix const eval of type conversions
These were quite spectacularly broken.

Also:
* Fix the definition of 'scalar' in `intrinsics.def`. This was in part why conversions were broken, as abstracts were materialized before reaching the converter builtin when they shouldn't have been.
* Implement `ScalarArgsFrom()` helper in `const_eval_test.cc`. This is used by the new conversion tests, and also implements part of the suggestion to improve tint:1709.

Fixed: tint:1707
Bug: tint:1709
Change-Id: Iab962b671305e868f92710912d2ed07e3338c680
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105261
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-10-11 20:36:48 +00:00
Ben Clayton feb447d9dc tint/resolver: Formatting
Change-Id: I9580a9bad5b1f281d14ee1c1fba38c18d9cff610
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105402
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-10-11 20:01:52 +00:00
Ben Clayton f9ed9d3a63 tint/ast: Generate interpolate_attribute.[h|cc]
Emits all the enum info from the single-source-of-truth `intrinsics.def` file

Change-Id: Ie9deba9e64927945133027cf243777944119ea41
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105327
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-11 19:49:17 +00:00
Ben Clayton c1af0f5005 tint/reader/wgsl: Improve errors when parsing address spaces
If the address space doesn't parse, then generate an error message that includes the list of possible values, and a suggestion if there was a close match.

Change-Id: Id55bedfdabd693b211ce69b6dcd01b28b61f3a12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105326
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-11 19:47:33 +00:00
Ben Clayton 9af5b406ba tint/reader/wgsl: Improve errors when parsing texel formats
If the texel format doesn't parse, then generate an error message that includes the list of possible values, and a suggestion if there was a close match.

Change-Id: I206aa712d9c9a4f47da099d5f98e12e42f36d42e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105325
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-11 19:40:44 +00:00
Ben Clayton ecd7f7ee7f tint/reader/wgsl: Improve errors when parsing extensions
If the extension name doesn't parse, then generate an error message that includes the list of possible values, and a suggestion if there was a close match.

Change-Id: I0eb2a682ca5a0717bb31d2716824663924ccd8f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105324
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-11 19:34:19 +00:00
Ben Clayton 760eee9e92 tint/reader/wgsl: Improve errors when parsing builtin
If the builtin doesn't parse, then generate an error message that includes the list of possible values, and a suggestion if there was a close match.

Fixed: tint:1629
Change-Id: I8f575a2ffcef2af308b9566ae7832702e76085ef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105323
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-10-11 19:32:19 +00:00
Ben Clayton b7aef033fa tint/templates: Generate enum string arrays
This will be useful for emitting possible enum values when an enum fails to parse.

Bug: tint:1629
Change-Id: I0be177a2bc27962580f4465ec18fdc5f2e930a99
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105322
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-10-11 19:29:11 +00:00
Ben Clayton 3e0984afe0 tint/program_builder.h: Remove stale comment
Change-Id: Ifb8eb10e9fdc5ff46329285716b8460dc71d9d85
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104661
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-10-11 19:27:53 +00:00
Ben Clayton db368f1b9c tools/tint/intrinsic: Sort enum values lexicographically
Reorders the output of the CanonicalizeEntryPointIO transform, but
otherwise is a no-op.

This will help with diagnostics that print the enum values.

Bug: tint:1629
Change-Id: Iff517d88836d2a8cd42ce3cfde6363c1973df0dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105321
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-11 18:26:18 +00:00
Ben Clayton ae832a2c6a tint/reader/wgsl: Minor cleanups
Change-Id: I3fccb7f5c31c27da5118d9ec6ed86d4a9c3157ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105400
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-10-11 18:21:42 +00:00
Ben Clayton d04c54e178 tint/utils: Add Levenshtein Distance() function
Will be used to make a suggestion when enums fail to parse.

Bug: tint:1629
Change-Id: Ia2754f86641f752539fa541ddb6b90b4e200f07c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-11 17:53:07 +00:00
Ben Clayton 3c34d83088 tint/ast: Add missing 'const' on pointer member
Change-Id: I8572e3b3f1b26ba79b1306e23f3447cc739108a4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104660
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-11 16:31:52 +00:00
Ben Clayton ab2fa8be87 tint: Fix vector equality operator
Change-Id: Ic8e66016beb8fd6a3046beaccbb9c07acbd765d5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105260
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-10-11 15:31:46 +00:00
Corentin Wallez 8d3d4f6fd1 tint/inspector: Reflect whether @builtin(frag_depth) is used.
This will be used by Dawn between other factors to decide whether to use
the ClampFragDepth transform.

Bug: dawn:1125
Change-Id: I53be846d9c3ebb9b2d424f40fc87db89c843c81b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105220
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-10-11 09:52:59 +00:00
Corentin Wallez 98a7cd11af Add a ClampFragDepth transform.
Add clamping of the @builtin(frag_depth) output of fragment shaders using
two push constantsprovided by the outside environment. For example the
following code:

  @fragment fn main() -> @builtin(frag_depth) f32 {
      return 0.0;
  }

Is transformed to:

  enable chromium_experimental_push_constant;

  struct FragDepthClampArgs {
    min : f32,
    max : f32,
  }

  var<push_constant> frag_depth_clamp_args : FragDepthClampArgs;

  fn clamp_frag_depth(v : f32) -> f32 {
    return clamp(v, frag_depth_clamp_args.min, frag_depth_clamp_args.max);
  }

  @fragment
  fn main() -> @builtin(frag_depth) f32 {
    return clamp_frag_depth(0.0);
  }

Fixed: tint:1620
Change-Id: Id403c4813fb2698aa87630abc30d26f02d53634a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104980
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-10-11 09:52:25 +00:00
Zhaoming Jiang 5cbb32d764 Tint/tranfsorm/test: Refactor and add exhaustive test for Std140
This CL refactor unittests in std140_test.cc, and add exhaustive
parameterized unittests in std140_exhaustive_test.cc. In std140_test.cc,
only test Std140 transform result for `mat2x2<f32>` for matrix used as
array element type and `mat3x2<f32>` otherwise, and keep the source and
expected programs as plain WGSL code to ensure the readablity. In
std140_exhaustive_test.cc, all matrix shape and different constant index
are tested using parameterized WGSL code, at the cost of readablity.
This CL prepares for supporting f16 in Std140 transform by allowing
testing all shape of f16 matrix as well by simply adding parameters.

Bug: tint:1473, tint:1502
Change-Id: Ib2ef5bd806ee61eab04d73a415ba62c2191e2a7e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104282
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2022-10-11 07:55:00 +00:00
David Neto 112d761448 spirv-reader: Track storage class for pointer/ref values
Fixed: tint:1041 tint:1648
Change-Id: I28c6677e0ef3f96902f4f9ced030c2280a17c247
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104762
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-10 17:15:18 +00:00
Ben Clayton c8f1075310 tint: Disable tint_concurrency_fuzzer for win+asan
This combination uses a suspiciously high amount of memory, triggering the fuzzer limits of 2560MB.

Tint doesn't really have any OS specific code paths, so we should still have good coverage with ASAN builds for other OSes.

Fixed: chromium:1357188
Change-Id: I4c7001f7e194ff46b2e8da635ddccdb04d60b838
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105140
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-10 11:38:49 +00:00
Ben Clayton cc636273da tint: Validate no f16 sampled textures
Bug: chromium:1370417
Change-Id: Id78178ab61cd882ff8fcbbe96aa8123de512f9aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105120
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-10-10 11:37:57 +00:00
Corentin Wallez 174b6bd5d9 Make GetBindGroupLayout error for indices past the last defined BGL.
Fixed: dawn:1565
Change-Id: I8a482623fcbd68648c451499ce769b871cf89c0a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104820
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
2022-10-07 22:02:20 +00:00
Brandon Jones b68cd1a212 Split Vulkan command buffers to work around bug
There's a bug in some Qualcomm devices where using a depth/stencil
texture as a render attachment and then sampling it in a compute pass
causes a crash. This only happens, however, if the two passes occur as
part of the same Vulkan command buffer.

To work around the issue, this change splits the Vulkan command buffer
while recording any time it identifies that the problematic scenario may
occur.

Bug: dawn:1564
Change-Id: Ie137e9118ef9cc41f5908ca32c72c33f3798cd71
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104860
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
2022-10-07 20:53:17 +00:00
Ben Clayton a1c8527f6c tint/sem: Add Type::HoldsAbstract()
Tells you if there's an abstract numeric somewhere in the type.

Change-Id: I0573be9e57ec48f2fa63c46944214e7f5be7d67c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104823
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@google.com>
2022-10-06 20:58:46 +00:00
Ben Clayton 933eb5159e tint: Add _tint_materialize internal builtin
Returns a materialization of the given argument.

Bug: tint:1697
Change-Id: Id25f7e10baa884047af21f89245884c551560f7b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104822
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-06 19:54:07 +00:00
Ben Clayton 73683027a3 tint: Use PascalCase for builtin enum names
Nicer names if we add some "_tint_*" builtins

Change-Id: I7574f5cfeeeb04ec5910b20068aa0dd12a460bd5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104821
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-06 19:23:29 +00:00
David Neto 76a709c760 spirv-reader: track module scope variables
Bug: tint:1041 tint:1643
Change-Id: Ifc0aed85eae758e674e90bb73693503888847f76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104761
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-06 19:08:22 +00:00
David Neto 861099fc81 spirv-reader: refactor definition info pertaining to pointers
Change-Id: I3999f85c60a08f3eeb921b6931c07ca3bdd1f417
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104760
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-10-06 16:55:10 +00:00
Antonio Maiorano 7aaf23eac9 Fix 32-bit build
Bug: oss-fuzz:51844
Change-Id: I7e6583c67ffa72659e00b5c8a4b692b44fe92a57
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104642
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-10-05 18:25:22 +00:00
dan sinclair 8fd4ef26f5 Fix MSL packed_int casting.
In 104681 the vectors were cast to themselves to fixup an issue
with `packed_int`. That CL used an `as_type` which does a bit cast.
A `packed_int` can not be bitcast to an `int`. This CL changes to
a type cast, so instead of `as_type<int3>()` it does `int3()`.

Bug: tint:1677
Change-Id: I72218c06853e4e5ae1a0d34e2fc3e1ca597de993
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104682
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-05 17:49:00 +00:00
Brandon Jones f35c719054 Allow tolerance on compressed texture verification
Qualcomm GPUs are apparently decoding textures with a lower precision,
resulting in some of the rendered values when verifying the texture in
a test to be off by +-1 on any given channel. This change adds a
tolerance to those tests to allow a little wiggle room, since compressed
textures are inherently lossy anyway.

Allows Qualcomm GPUs to pass all compressed texture end2end tests.

Bug: dawn:1562
Change-Id: I08a21b9ce361486c247c34640080b369ae2b799d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104622
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-05 16:10:44 +00:00
John Stiles 761536d941 Improve robustness of FloatToString.
When converting floats to string, we now enforce the "C" locale, so
decimal points will be written as "." rather than the "," separator
used natively in some European locales.

Also, we now use operator>> to read back the number instead of
std::stof. std::stof works in the system locale, and will fail to
read back floats with the wrong decimal separator. (Also, std::stof
will throw if the number is out of range and can't fit in the
destination, which implies that the `if` check was probably never
failing.)

Skia encountered similar issues: see http://review.skia.org/587536
for the Skia implementation.

Change-Id: I5aded6acc7cfcf2ad4d5b974bc30c3b645eaec51
Bug: dawn:1686
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104680
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-10-05 15:47:25 +00:00
Antonio Maiorano 8800d885e7 tint: const eval of 'select' builtin
Bug: tint:1581
Change-Id: I222433acb6a30245ab319a15081811f691aca9ff
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104440
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-05 01:39:53 +00:00
Antonio Maiorano 6b3f4aaf26 tint: add vector cases for const eval builtin tests
- Make the const eval builtin tests use the same framework as the
unary/binary op tests, allowing for Vector cases.
- No longer always use float compare, instead enable it per case.
  Currently this is necessary because atan2 doesn't always return the
  same constant for PI on all platforms.
- Add vector cases for atan2 and clamp.

Bug: tint:1581
Change-Id: I7eaec10b4f9685c913a9d0d17b47c413f659be7a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104424
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-10-04 22:40:32 +00:00
Antonio Maiorano fc7994ba4c tint: fix intrinsic table lookup of mixed const and non-const with non-matching arg element types
Bug: tint:1581
Change-Id: I7676ec6857c5fd790cb9c5644bfe674a603113ab
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104545
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-04 22:19:48 +00:00
dan sinclair 7a69a3411f Update type_decl grammar element name.
The `type_decl` term in the spec was updated to `type_specifier`. This
CL updates Tint to match.

Bug: tint:1633
Change-Id: I264ae78a4b09c3c69d8673e24fe4f60975539b8f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104421
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2022-10-04 21:12:01 +00:00