This is required to handle materialized values, and for constant
expressions.
Bug: tint:1504
Change-Id: I79ad567954de2d1cfea09dda255894e4e2aa678e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92081
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This is required to handle materialized values, and for constant
expressions.
Bug: tint:1504
Change-Id: Ic3ac62317241fa6f7009360128f222aeb56f62e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92083
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This is required to handle materialized values, and for constant
expressions.
Bug: tint:1504
Change-Id: Ie0177f148e08a0e1a3f4d7e06e283f121655804b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92080
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
If the literal was constructed with an 'f', make sure we print it.
Bug: tint:1504
Change-Id: I6f04e31a166919c07574db56b0a2063ce5b8ca5c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91965
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Also fixed implementation of this atomic in GLSL. It was emitting code
that would not compile because, as for HLSL, we must pass in the
variable directly to atomic funcs, not via an in/out arg to a function.
Bug: tint:1185
Change-Id: Id0e9f99d6368717511ef3a94473634c512e10cb8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91881
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
These two functions in HLSL only accept and return uint. Thus, if the
result of these calls is passed to a function that wants int, it will
fail, or call the uint overload if one exists. Fixed by casting the
result to int if the arg is int.
Bug: tint:1550
Change-Id: Id4c0970a29ac4c83ee5b78be8d2762e05e4a3f03
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91001
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This patch adds the support of dot4I8Packed and dot4U8Packed in
semantics under the extension "chromium_experimental_dp4a".
Bug: tint:1497
Test: tint_unittests
Change-Id: I659172fcb8953ba13b49664c6c9ad75724ff5957
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88962
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Adapt the builtin parsing and resolving to also support operators.
Will be used to generate intrinsic table entries for operators.
This will simplify maintenance of the operators, and will greatly
simplify the [AbstractInt -> i32|u32] [AbstractFloat -> f32|f16] logic.
Bug: tint:1504
Change-Id: Id75735ea24e501877418812185796f3fba88a521
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89026
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
• Rename 'builtin-gen' back to 'intrinsic-gen', as 'intrinsics' now
include both builtins and operators.
• Move the intrinsic definitions, and IntrinsicTable to the resolver
package, where it belongs.
Bug: tint:1504
Change-Id: I5ad5c285c1e360a224ee1235c293ccd55eb2693d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89025
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Unsuffixed integer literals are currently treated as i32,
but will shortly become AbstractInteger. To keep tests behaving
identically to how they are currently, change all test literals
to using either 'i' or 'u' suffixes.
Bug: tint:1504
Change-Id: Ic373d18ce1c718a16b6905568aec89da3641d36b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88845
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
For all i32 literal values.
Reduces risk of the SPIR-V reader producing WGSL that behaves
differently, when abstract-integers are fully implemented.
Bug: tint:1504
Change-Id: Ieaf8afec5b09c7978c75a38c6ed144633ddc017e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88843
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
'smoothStep' has been renamed to 'smoothstep'.
We cannot generate both sets of tests during this deprecation period as Windows and macOS can be file case-insensitive, and we'd have 'smoothstep' and 'smoothStep' as two sibling directories.
Bug: tint:1483
Change-Id: I944309585e8ff23345d9cc23669edf3774f3afb8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88664
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Adds configurable gamma and gamut correction in Tint's external texture
transform. Adds constants in Dawn to perform correct conversion from
BT.709 to sRGB.
Bug: dawn:1082
Change-Id: I68b7ad7ccec29977c637a0a0d4f526cd47fe73d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88367
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Adds configurable gamma and gamut correction in Tint's external texture
transform. Adds constants in Dawn to perform correct conversion from
BT.709 to sRGB.
Bug: dawn:1082
Change-Id: Id5eecc37f0224541bf36e2f9757e7e2047e4b66b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87666
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
The OpenGL ES 3.1 spec says:
"The point size is taken from the shader built-in gl_PointSize written by the vertex shader, and clamped to the implementation-dependent point size range. If the value written to gl_PointSize is less than or equal to zero, or if no value is written, the point size is undefined."
ANGLE/D3D11 will emit a warning on this and abort processing, causing dawn_end2end tests to fail.
Bug: dawn:1390
Change-Id: I6a56467842ba80d8a070af7240ee07bb111089dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87720
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Changes Dawn and Tint to use a 3x3 matrix for external texture
YUV-to-RGB conversions. This will allow us to use standard matrices
as they exist in SkYuvMath.
Bugs: dawn::1082
Change-Id: I8e0c7c3dc1c085d8f336da956aea9496913b70fa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86847
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
With this change, the backend sanitizers always run the
MultiplanarExternalTexture transform. If the new option is enabled, it
auto-generates bindings for this transform.
This change also enables this auto-generation for the Tint commandline
application, as well as for the fuzzers.
Bug: chromium:1310623
Change-Id: I3c661c4753dc67c0212051d09024cbeda3939f8c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85542
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Textures as function parameters should not have the "uniform"
qualifier. Fixed by handling StorageClass::kUniformConstant the
same as StorageClass::kUniform, and removing the unconditional
"uniform" qualifier output. (Global texture variables have
StorageClass::kUniformConstant set, while function parameters don't.)
Change-Id: I9d380550ac4554917527ff330171a76a90a290e8
Bug: tint:1492
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85820
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
The test files were already updated manually in a previous change, so
we just need to update the template file to match.
Bug: tint:1475
Change-Id: I6f1b3d3a7a3df014b58e67ec2645b1dfcc275de1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/85260
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
- Format specific targets to have the hash in the target rule instead
of a variable.
- Only have the base part of the URL in a variable
- Use vulkan-deps instead of individual DEPS (spirv-tools,
spirv-headers & glslang)
BUG=tint:1481
Change-Id: I871a656e26050698da2c77f4f39fec94a9c4f8a4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84723
Reviewed-by: David Neto <dneto@google.com>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Use of semicolons is still supported, but deprecated.
Also updates the parsing methods for structures to better match the
WGSL grammar.
Bug: tint:1475
Change-Id: I7675ba42c13f91080b0ac173c352e0092021f80b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
These were deprecated in M98.
Fixed: tint:1312
Change-Id: Ieec17bfcc729f90d0a9aa8904a162167b9de54ed
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82800
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Just a minor cleanup; no functional change.
Change-Id: Iac4f97c2b5507f7665024885a81f6ccf8e5ab269
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82440
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
It's a no-op.
Bug: tint:1462
Change-Id: Ic79f33682097be075eb2e99b714d1e65bed10d4d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82365
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
It's a no-op.
Bug: tint:1458
Change-Id: Ib97c409fd806da1c97ac867f21ef42b8a18c178c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82364
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Note: ES doesn't support cube arrays, so this fixes the tests but does
not cause them to pass.
Bug: tint:1461
Change-Id: Ia2b1ffacab83dae58ac1b50eb04457da270d73e2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82363
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
textureQueryLevels() and textureSamples() were being emitted with a
spurious semicolon.
Bug: tint:1222
Change-Id: I56c561fcaac510b76a27a850f5be522ab7f98307
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82361
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
In GLSL, runtime-sized arrays are only valid in interface blocks, not
in structs. The existing code was attempting to avoid emitting structs
containing runtime-sized arrays but was confused by type aliases in
the AST resulting in arrays being missed.
The fix is to do the work on the semantic types instead, where type
aliases have been resolved.
Bug: tint:1339
Change-Id: I8c305ee9bddd75f975dd13f1d19d623d71410693
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82360
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Unlike other texture functions in GLSL, textureGather() and
textureGatherOffset() do not expect the refZ value to be appended to
the texture coordinates. It is passed as a regular argument. So append
refZ to coordinates by default, and pass as a regular parameter only
for the gather functions.
Bug: tint:1459
Change-Id: Iad1255be3de5915aeff4adb9054479b9e92c45cb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82340
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Multiple bugs here:
1) Like texture(), GLSL's textureLod() on depth textures returns a
scalar, and does not need to be swizzled. So set glsl_ret_width to
1 in that case.
2) Like texture(), GLSL's textureLod() always requires a Dref
parameter, so append a zero if not present.
3) GLSL's "lod" parameter to textureLod() is always a float, unlike
WGSL's textureSampleLevel() which is an i32 for depth textures,
so cast it.
Along the way, I discovered that textureLod() is not supported on
samplerCubeShadow or sampler2DArrayShadow (even on Desktop GL). So some
tests will never pass. Logged as https://crbug.com/dawn/1313
Bug: tint:1456
Change-Id: If67d8d288704142278d7a4e52b46e8010776f381
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82300
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This change essentially relands 10c554ecf4,
aka https://dawn-review.googlesource.com/c/tint/+/82140.
(Somehow, I managed to revert most of that in the subsequent CL for
reverseBits. I suspect a bad upstream and/or rebase.)
Bug: tint:1430
Change-Id: Iba2688294dcd7d3008ee9da78957a7a464ca1c0f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
The '%' operator in GLSL is integer-only. Use the full OpFRem
expression: (a - b * trunc(a / b)).
Bug: tint:1270
Change-Id: I0a969983bef132e004ce456d4a738488e400a61b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68760
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
While Desktop GLSL supports the Coarse and Fine flavours, GLSL ES does
not. For now, emit dFdx/dFdy in all cases for ES, but excluding the
Coarse and Fine flavours via validation is also an option.
Bug: tint:1445
Change-Id: Iaac589f72043b5547e9141a6e870c1fd49631f6f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82142
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
The multiplanar external texture transform has been integrated into
Dawn, which means we have no use for the single plane transform - so it
should be deleted.
Bug: dawn:1082
Change-Id: Id8977d03839b76c90ae6e70400d048c13fbe85f4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80120
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Currently polyfilled for all backends.
HLSL should be able to map this to 'firstbithigh', but there might need
to be some special case handling for 0 (undocumented behavior). For now
just polyfill.
CTS tests: https://github.com/gpuweb/cts/pull/1004
Bug: tint:1367
Bug: tint:1449
Change-Id: I9c9a08ea93d1c4a602e0ab763e95e2eea336fb0d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81503
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Currently polyfilled for all backends.
HLSL should be able to map this to 'firstbitlow', but there might need
to be some special case handling for 0 (undocumented behavior). For now
just polyfill.
CTS tests: https://github.com/gpuweb/cts/pull/1003
Bug: tint:1367
Bug: tint:1449
Change-Id: I8125b32687196678906e5a9d056b4f2efd885073
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81502
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Requires polyfilling for all but the MSL backend.
CTS tests: https://github.com/gpuweb/cts/pull/1002
Bug: tint:1367
Change-Id: I0cf56b74c01f30436f9ad00595a554a4042587e4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81501
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Requires polyfilling for all but the MSL backend.
CTS tests: https://github.com/gpuweb/cts/pull/1001
Bug: tint:1367
Change-Id: I75097de945909e3242ede9001124d8821bc832bc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Bug: tint:1418
Change-Id: Ic1560bf7a0aa99ecbe554b985dc07f1b055fab64
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81500
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>