Commit Graph

199 Commits

Author SHA1 Message Date
Ben Clayton 77a90cb796 test/tint/builtins/gen: Use returned value
It appears that FXC and DXC do some validation post dead-code-elimination.
These tests have been updated so that the return value is assigned to a storage buffer, ensuring that all validation is performed.

Many DXC tests are affected by https://github.com/microsoft/DirectXShaderCompiler/issues/5082, which have been SKIP'ed.

Fixed: tint:1859
Change-Id: I0001a9a9821846cd0855c3d8ce2bec79ab8e64ef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122662
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2023-03-06 18:25:08 +00:00
Ben Clayton bd9f6e6684 tint: Remove textureNumLayers() overloads for texture cube arrays
These are not supported in HLSL shader model 5.1

See: https://github.com/gpuweb/gpuweb/issues/3913
Change-Id: Ic33666ff910f04e3f561cbc40c9db14c5de59284
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122524
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-03-04 00:55:16 +00:00
Ben Clayton 3a431d71be tint/intrinsics.def: Fix textureStore overload
The texture_storage_3d overload should allow for unsigned coordinates.

Change-Id: I6278571fb9dc7bba644a4ba88cce6b8bd7c790bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122521
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-03-04 00:43:21 +00:00
dan sinclair 6cc183c85a Generic template and forward in stringstream.
This CL updates the templates in the StringStream to match more types.
All of the internal `operator<<` methods have been converted over to
StringStream. The precision was increased in order to better match the
precision needed to read back as a double.

Bug: tint:1686
Change-Id: Iaa15cf247f174967dd1014647ba5a74804997c22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122080
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2023-03-02 21:28:45 +00:00
Ben Clayton 03de0e83ae Move tint::transform::Robustness to a santizier transform
There's no good reason for this to be public.
Move it into the writers, and expose a 'disable_robustness' option to
turn it off. This can be expanded to hold more fine-grain control in the
future.

Change-Id: I6ea6e54a27b2ae0fbcba5fdf45539063045cc15a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122203
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-03-02 20:48:48 +00:00
Ben Clayton b990d393f5 test/tint: Update SKIP "expectations"
Change-Id: I131522625051426e93624fbe4f4763071f26ad72
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122202
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-03-02 09:25:40 +00:00
dan sinclair dba03d30fb Convert GLSL Generator over to utils::StringStream.
This CL switches the GLSL Generator to use utils::StringStream. The line
writer is converted internally as well, although it converts to
`std::ostream` for now. This caused a couple of the MSL, HLSL and GLSL
tests to generate slightly fewer decimal points in a couple tests.

Bug: tint:1686
Change-Id: I9ec8c1a5ef49679fc1c9a9aece86ab3390e103fc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121880
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-02-28 14:41:45 +00:00
James Price 4d3af66bbd tint/msl: Preserve trailing vec3 padding
In order to preserve padding properly for MSL, we need to use its
packed_vec type for all vec3 types in storage buffers, not just struct
members. This commit includes a complete rewrite of the PackedVec3
transform to achieve this. The key details are:

* An internal `__packed_vec3<>` type was added, which corresponds to a
  `type::Vector` with an additional flag to indicate that it will be
  emitted as packed vector.

* The `PackedVec3` transform replaces all vec3 types used in
  host-shareable address spaces with the internal `__packed_vec3`
  type. This includes vec3 types that appear as the store type of a
  pointer.

* When used as an array element, these `__packed_vec3` types are
  wrapped in a struct that contains a single `__packed_vec3`
  member. This allows us to add an `@align()` attribute that ensures
  that `array<vec3<T>>` still has the correct array element stride.

* When the `vec3<T>` appears as a struct member in the input program,
  we apply the `@align()` to that member to ensure that we do not
  change its offset.

* Matrix types with three rows that are used in memory are replaced
  with an array of columns, where each column uses a `__packed_vec3`
  inside an aligned wrapper structure as above.

* Accesses to host-shareable memory that involve any of these types
  invoke a "pack" or "unpack" helper function to convert them to the
  equivalent type that uses `__packed_vec3` or a regular `vec3` as
  required.

* The `chromium_internal_relaxed_uniform_layout` extension is used to
  avoid issues where modifying a type in the uniform address space
  triggers stricter layout validation rules.

Bug: tint:1571
Fixed: tint:1837
Change-Id: Idaf2da2f5bcb2be00c85ec657edfb614186476bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121200
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-02-27 20:21:03 +00:00
James Price 66d487395d tint: Use PI/2 as the input value for sin tests
This makes the output value consistent between different platforms.

Change-Id: I4f94da4deac6998c4b809b03ed3b8f58d32bb1b0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121501
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-02-24 18:57:39 +00:00
Ben Clayton 1a1b5278d5 tint/transform: Inline HLSL uniform / storage buffers
Change the DecomposeMemoryAccess to behave more like the DirectVariableAccess transform, in that it'll inline the access of buffer variable into the load / store helper functions, instead of passing the array down.

This avoids large array copies observed with FXC, which can have *severe* performance costs.

Fixed: tint:1819
Change-Id: I52eb3f908813f72ab9da446743e24a2637158309
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121460
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
2023-02-24 17:16:55 +00:00
jchen10 39b7330b5b Fix UV coord for TextureLoad
UV plane's coord should be half of that of Y plane for NV12.

Bug: chromium:1415832
Change-Id: Icee851e61eca1f7da291285100f8edcce482b511
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119860
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Jie A Chen <jie.a.chen@intel.com>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-02-23 13:03:52 +00:00
Ben Clayton 4d3ff9711e tint: Resolve @builtin() args as expressions
This CL makes the builtin argument resolve as a shadowable enumerator
expression.

Bug: tint:1841
Bug: tint:1845
Change-Id: I2aaa2c63025752f25c113cf2fb38f4d91c2c16c2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120680
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2023-02-21 17:33:54 +00:00
Ben Clayton 9dc48bcef3 tint: Rename 'type' to 'alias'
Bug: tint:1812
Change-Id: I50bd8b036b47b4ec223a81eda53bd658d19645e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117211
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-24 14:55:17 +00:00
Ben Clayton d03dceebf3 tint: Add bgra8unorm storage texture support
Polyfill this for the SPIR-V, HLSL and GLSL backends by replacing bgra8unorm with rgba8unorm, and swizzling.

Bug: tint:1804
Change-Id: I36638202840d7313001dff6c5b60dcb948988c34
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117204
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2023-01-18 19:42:03 +00:00
dan sinclair 7092786f31 Fixup return of HLSL sign to match WGSL.
The HLSL `sign` method returns an `int` result (scalar or vector). The
WGSL `sign` expects the result to be the same type as the argument. This
CL injects a cast to the correct type after the `sign` call in the HLSL
generated source.

Bug: tint:1795
Change-Id: I51fed24b5b8b752b6b27fdfb5dd47eb803902793
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116692
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2023-01-11 13:18:29 +00:00
Stephen White 1d04cf841c Enable the 1D -> 2D texture transform in GLSL writer.
Fix unit and WGSL test results.

Bug: dawn:1301
Change-Id: Idfe046bdb211c8db9724e02c2f9dfb12d04d5c2a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114800
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2023-01-07 17:19:21 +00:00
James Price 128980f218 tint: Add support for workgroupUniformLoad
Accept any type in the intrinsics definition, and then manually
validate that there are no atomics in the type. Add manual E2E tests
for composite types.

Use the BuiltinPolyfill transform to implement it for all backends.

Update the uniformity analysis with special-case tags for the builtin.

Fixed: tint:1780
Change-Id: I95786dff4df70a0b16ed1c53b853b5d0ec6bc501
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114862
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: James Price <jrprice@google.com>
2023-01-06 02:25:06 +00:00
Ben Clayton be367b73ae Reduce shader complexity for external textures
Do more math on the CPU to avoid per-fragment ALU operations.
Use a mat3x2 instead of mat2x3 to avoid padding.

Fixed: dawn:1614
Change-Id: Ib0e0f7d44ed9aa16eaca712f6553214fad141feb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116060
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon1 Jones <brandon1.jones@intel.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2023-01-04 12:29:56 +00:00
Antonio Maiorano bf8a230c81 tint: const eval of ldexp builtin
Bug: tint:1581
Change-Id: Ib21717065041b65a637f4d73ce0088544b1fce0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114321
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-16 18:37:19 +00:00
Brandon Jones 183df9d24e Implement External Texture Crop Functionality
Adds to the External Texture shader transform to allow cropping. Tests
included.

Bug: chromium:1316671
Change-Id: Id0ec9acac22a0968ba6847d6ead9cf5084eaca88
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113281
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-16 05:41:06 +00:00
Stephen White 987902e795 Update GLSL test results.
Change-Id: I3e2d0f4e00e10ea221c1a760775550f4a0374b3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114420
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-12-15 16:42:28 +00:00
Antonio Maiorano bed9c98a07 tint: const eval of fract
Bug: tint:1581
Change-Id: I14207080b14e45e7520f50230c85cd902f25dc71
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113943
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-13 23:59:45 +00:00
Antonio Maiorano be96967778 tint: const eval of pow builtin
Bug: tint:1581
Change-Id: I11999f0adbd4b12d362e8f47772ac0a625b8fa68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113821
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-12-13 16:29:06 +00:00
Antonio Maiorano 7c9e639e35 tint: const eval of mix builtin
Bug: tint:1581
Change-Id: I3b9f0ff3a58956616daf17b3d4a922979fc30216
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113680
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-12 15:31:21 +00:00
Ben Clayton f528d33d52 tint/transform: fix PromoteInitializersToLet for constant expressions
Fix more edge cases uncovered with tint:1781

Fixed: tint:1781
Change-Id: I58d120185f47c10bc9fe55dd95a198d496c4ec94
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113024
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-12-09 12:34:36 +00:00
Ben Clayton 7017ec264c tint: Implement signed-int overloads of sign()
Bug: tint:1581
Fixed: tint:1782
Change-Id: Ia029bf9d1ce1d978c5cabc3016cb8ad1b4bac06a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113243
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-12-07 19:52:49 +00:00
Ben Clayton efb17b0254 tint/writer/wgsl: Print @offset attributes as comment
We use WGSL to visualize the AST. Make sure we don't hide anything.

Bug: tint:1776
Change-Id: Iedd7ca797fb745d9db7d0aba8a5718039241afbb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112602
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2022-12-01 17:37:56 +00:00
Zhaoming Jiang a54df5eca5 Tint: Fix extractBits polyfill
This CL fix the extractBits polyfill, used for D3D12 backend on windows.
With this patch the related CTS would get pass.

Fixed: tint:1775
Change-Id: I15636bb55af502fff773c19f03b4c3c9e99b63fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112207
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-30 23:55:28 +00:00
Brandon Jones 85ceb08d5c Add ExternalTexture Rotate and FlipY Functionality
Adds functionality to Dawn and Tint to rotate and flip-Y external
textures through the shader transform. Tests are included.

Bug: chromium:1316671
Change-Id: I40a6b67eaeb2a348f469e4879eeb585bc40537b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110181
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-30 21:32:26 +00:00
Antonio Maiorano 3728a505d6 tint: const eval of refract builtin
Bug: tint:1581
Change-Id: Iff64e8a680fbbc82e1f8efe2e2f8e05af8e3692c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111920
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-28 21:14:36 +00:00
Antonio Maiorano ee7d6db047 tint: const eval of reflect builtin
Bug: tint:1581
Change-Id: Ife4409ca897a5754fe6b76c650d26fd66ef5880f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111901
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-28 15:13:16 +00:00
Antonio Maiorano ffeae7aa50 tint: const eval of faceForward builtin
Bug: tint:1581
Change-Id: Ia50b4ec4d494face5e7f438037a092cd1f839849
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111840
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-25 23:35:53 +00:00
dan sinclair 8392a82a40 Const eval for `normalize`
This CL adds const-eval for the `normalize` builtin.

Bug: tint:1581
Change-Id: I6d5ba3e0ba507921137ca90c4caefa9daf88f735
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-25 04:25:18 +00:00
dan sinclair 724ad2a290 Const eval for `fma`
This CL adds const-eval for the `fma` builtin.

Bug: tint:1581
Change-Id: Ia4df818fec9d5d969b364b2c165400d787a9e275
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111584
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-24 21:54:00 +00:00
dan sinclair a2a8895020 Const eval for `distance`
This CL adds const-eval for the `distance` builtin.

Bug: tint:1581
Change-Id: Iee3af6474ace8e7baa230156f582f0a372f77cb7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111583
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-24 21:48:48 +00:00
dan sinclair 7736153c15 Const eval for `inverseSqrt`
This CL adds const-eval for the `inverseSqrt` builtin.

Bug: tint:1581
Change-Id: Ieef063416a8033b5fac9396e30c76c20b3360a90
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111581
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-24 18:16:13 +00:00
Zhaoming Jiang ab9b5f3aa5 Tint: Implement f16 in uniform and storage address space
This CL implements f16 in uniform and storage address space, allowing
using f16 types in uniform and storage buffers on all backends. Tint
uint tests and Dawn E2E tests are added to validate the f16 types work
as expected.

Bug: tint:1473, tint:1502
Change-Id: I15e3de1033d3727f2ea33f4657f682c5f13c2153
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106320
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-11-24 05:25:35 +00:00
Antonio Maiorano 9ba5f9e2c6 tint: const eval of transpose builtin
Bug: tint:1581
Change-Id: Ia614647bc4a3d24a53d45981ddcdb1c84ea84608
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111600
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-23 23:12:56 +00:00
Ben Clayton ed998e91ab tint: Suffix builtin return types with '_f32'
If the template type is f32.

See: https://github.com/gpuweb/gpuweb/pull/3629
Change-Id: Ia686d77b4dbc169d7ef69a91d67e45357bee199f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111442
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-23 19:57:00 +00:00
Antonio Maiorano 05c8daac42 tint: const eval of determinant builtin
Bug: tint:1581
Change-Id: Ifed8202ba2346eee435ee4e3d0e82ab614a86255
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111281
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Kokoro: Antonio Maiorano <amaiorano@google.com>
2022-11-23 19:16:15 +00:00
Ben Clayton 69c2c34326 tint: Implement const-eval of frexp()
Also add abstract overloads.

Bug: tint:1581
Fixed: tint:1768
Change-Id: Icda465e0cfe960b77823c2135f0cfe8f82ed394f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111441
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-23 18:21:38 +00:00
dan sinclair f2ad5fd260 Add const-eval for `log` and `log2`.
This CL adds const-eval routines for `log` and `log2`.

Bug: tint:1581
Change-Id: I052b5ddd3bc8bdcd7c0925fa7912dcbe1a60e299
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111323
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-23 17:34:40 +00:00
dan sinclair ae739d6d1c Add const-eval for `exp` and `exp2`.
This CL adds const-eval routines for `exp` and `exp2`.

Bug: tint:1581
Change-Id: I59cc77aee64bfadf6ff10548f27f3d253b68a129
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111322
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-11-23 16:37:21 +00:00
Ben Clayton 31b7fca82c tint: Add abstract overload of modf
Required fleshing out resolver handling of abstract structures.

Bug: tint:1768

Change-Id: Icb2983ac9bf37d4e260735cfdba5ac5e7dfe3ee2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111400
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-23 15:00:20 +00:00
Ben Clayton 9dc770baef test/tint: Expand modf end-to-end tests
Check that these work as a mix of constant and runtime.

Bug: tint:1581
Change-Id: I572122d9425c4bb8e60125879f9829d765580d1f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111243
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-23 10:39:48 +00:00
Ben Clayton 329dfd7cbd tint: Implement const-eval of modf
Bug: tint:1581
Change-Id: I53151ebf43601cd6afcdd2ec91d0ff9c4e650ef3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111241
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-11-23 00:05:05 +00:00
Antonio Maiorano 92d858ac3c tint: const eval of length builtin
Bug: tint:1581
Change-Id: Ie6dc9da6b48c606af03da023c835ec36a99dd362
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110981
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-11-23 00:00:45 +00:00
Antonio Maiorano d6d30f4256 tint: const eval of dot builtin
Bug: tint:1581
Change-Id: Ie7768f8bf254509c1795207de0a1d8b07a317555
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110984
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-22 15:02:55 +00:00
dan sinclair efe9c49819 Add const-eval for `degrees` and `radians`
This CL adds const-eval for `degrees` and `radians`.

Bug: tint:1581
Change-Id: I7f00e2b1e5ab7c8e895680a6b75b9531dac31f5a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110601
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-11-21 18:00:01 +00:00
Ben Clayton 619f9bd639 tint/transform: Fix ICE when combining polyfills
There's a reason the overload of `ctx.Replace()` that takes a pointer to the replacement is deprecated - it doesn't play well when used as part of another replacement.
Switch to using the callback overload of Replace() to fix bad transform output.

Bug: tint:1386647
Change-Id: I94292eeb65d24d7b2446b16b8b4ad13bdd27965a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111000
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-11-21 17:11:05 +00:00