Skip to content

Commit

Permalink
Remove WGSL diagnostics from SkSL golden outputs.
Browse files Browse the repository at this point in the history
Tint has been revamping their diagnostics, which makes rolls
difficult.

Bug: b/332679947
Change-Id: Iffd809c4a9a4ffd96d4b254445b1a7237c6b41fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/836576
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
  • Loading branch information
johnstiles-google authored and SkCQ committed Apr 4, 2024
1 parent 4fa6c69 commit 8caa3e2
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 143 deletions.
15 changes: 7 additions & 8 deletions src/sksl/codegen/SkSLWGSLCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4517,15 +4517,16 @@ static bool validate_wgsl(ErrorReporter& reporter, const std::string& wgsl, std:
tint::Program program(tint::wgsl::reader::Parse(&srcFile, options));

if (program.Diagnostics().ContainsErrors()) {
// The program isn't valid WGSL. In debug, report the error via SkDEBUGFAIL. We also append
// the generated program for ease of debugging.
// The program isn't valid WGSL.
#if defined(SKSL_STANDALONE)
reporter.error(Position(), std::string("Tint compilation failed.\n\n") + wgsl);
#else
// In debug, report the error via SkDEBUGFAIL. We also append the generated program for
// ease of debugging.
tint::diag::Formatter diagFormatter;
std::string diagOutput = diagFormatter.Format(program.Diagnostics()).Plain();
diagOutput += "\n";
diagOutput += wgsl;
#if defined(SKSL_STANDALONE)
reporter.error(Position(), diagOutput);
#else
SkDEBUGFAILF("%s", diagOutput.c_str());
#endif
return false;
Expand Down Expand Up @@ -4554,9 +4555,7 @@ bool ToWGSL(Program& program, const ShaderCaps* caps, OutputStream& out) {
std::string warnings;
result = validate_wgsl(*program.fContext->fErrors, wgslString, &warnings);
if (!warnings.empty()) {
out.writeText("/*\n\n");
out.writeString(warnings);
out.writeText("*/\n\n");
out.writeText("/* Tint reported warnings. */\n\n");
}
out.writeString(wgslString);
}
Expand Down
5 changes: 1 addition & 4 deletions tests/sksl/intrinsics/BitCount.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
### Compilation failed:

error: :13:20 error: unresolved call target 'bitCount'
let _skTemp0 = bitCount(_globalUniforms.a);
^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
5 changes: 1 addition & 4 deletions tests/sksl/intrinsics/FindLSB.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
### Compilation failed:

error: :13:20 error: unresolved call target 'findLSB'
let _skTemp0 = findLSB(_globalUniforms.a);
^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
5 changes: 1 addition & 4 deletions tests/sksl/intrinsics/FindMSB.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
### Compilation failed:

error: :13:20 error: unresolved call target 'findMSB'
let _skTemp0 = findMSB(_globalUniforms.a);
^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
5 changes: 1 addition & 4 deletions tests/sksl/intrinsics/FloatBitsToInt.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
### Compilation failed:

error: :16:20 error: unresolved call target 'floatBitsToInt'
let _skTemp0 = floatBitsToInt(inputVal.x);
^^^^^^^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
5 changes: 1 addition & 4 deletions tests/sksl/intrinsics/FloatBitsToUint.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
### Compilation failed:

error: :16:20 error: unresolved call target 'floatBitsToUint'
let _skTemp0 = floatBitsToUint(inputVal.x);
^^^^^^^^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
19 changes: 1 addition & 18 deletions tests/sksl/intrinsics/Fma.wgsl
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
### Compilation failed:

error: :9:14 error: 'uniform' storage requires that array elements are aligned to 16 bytes, but array element of type 'f32' has a stride of 4 bytes. Consider using a vector or struct as the element type instead.
testArray: array<f32, 5>,
^^^^^^^^^^^^^

:6:8 note: see layout of struct:
/* align(16) size(64) */ struct _GlobalUniforms {
/* offset( 0) align(16) size(16) */ colorGreen : vec4<f32>,
/* offset(16) align(16) size(16) */ colorRed : vec4<f32>,
/* offset(32) align( 4) size(20) */ testArray : array<f32, 5>,
/* offset(52) align( 1) size(12) */ // -- implicit struct size padding --
/* */ };
struct _GlobalUniforms {
^^^^^^^^^^^^^^^

:11:23 note: '_GlobalUniforms' used in address space 'uniform' here
@binding(0) @group(0) var<uniform> _globalUniforms: _GlobalUniforms;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
5 changes: 1 addition & 4 deletions tests/sksl/intrinsics/IntBitsToFloat.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
### Compilation failed:

error: :16:20 error: unresolved call target 'intBitsToFloat'
let _skTemp0 = intBitsToFloat(expectedB.x);
^^^^^^^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
5 changes: 1 addition & 4 deletions tests/sksl/intrinsics/IsInf.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
### Compilation failed:

error: :16:20 error: unresolved call target 'isinf'
let _skTemp0 = isinf(infiniteValue.x);
^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
5 changes: 1 addition & 4 deletions tests/sksl/intrinsics/IsNan.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
### Compilation failed:

error: :16:20 error: unresolved call target 'isnan'
let _skTemp0 = isnan(valueIsNaN.x);
^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
5 changes: 1 addition & 4 deletions tests/sksl/intrinsics/OuterProduct.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
### Compilation failed:

error: :17:20 error: unresolved call target 'outerProduct'
let _skTemp0 = outerProduct(_globalUniforms.testMatrix2x2[0], _globalUniforms.testMatrix2x2[1]);
^^^^^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
5 changes: 1 addition & 4 deletions tests/sksl/intrinsics/RoundEven.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
### Compilation failed:

error: :15:20 error: unresolved call target 'roundEven'
let _skTemp0 = roundEven(_globalUniforms.testInputs.x);
^^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
5 changes: 1 addition & 4 deletions tests/sksl/intrinsics/UintBitsToFloat.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
### Compilation failed:

error: :16:20 error: unresolved call target 'uintBitsToFloat'
let _skTemp0 = uintBitsToFloat(expectedB.x);
^^^^^^^^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
20 changes: 1 addition & 19 deletions tests/sksl/shared/ArrayComparison.wgsl
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
### Compilation failed:

error: :9:14 error: 'uniform' storage requires that array elements are aligned to 16 bytes, but array element of type 'f32' has a stride of 4 bytes. Consider using a vector or struct as the element type instead.
testArray: array<f32, 5>,
^^^^^^^^^^^^^

:6:8 note: see layout of struct:
/* align(16) size(80) */ struct _GlobalUniforms {
/* offset( 0) align(16) size(16) */ colorGreen : vec4<f32>,
/* offset(16) align(16) size(16) */ colorRed : vec4<f32>,
/* offset(32) align( 4) size(20) */ testArray : array<f32, 5>,
/* offset(52) align( 4) size(20) */ testArrayNegative : array<f32, 5>,
/* offset(72) align( 1) size( 8) */ // -- implicit struct size padding --
/* */ };
struct _GlobalUniforms {
^^^^^^^^^^^^^^^

:12:23 note: '_GlobalUniforms' used in address space 'uniform' here
@binding(0) @group(0) var<uniform> _globalUniforms: _GlobalUniforms;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
19 changes: 1 addition & 18 deletions tests/sksl/shared/ConstantCompositeAccessViaConstantIndex.wgsl
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
### Compilation failed:

error: :9:14 error: 'uniform' storage requires that array elements are aligned to 16 bytes, but array element of type 'f32' has a stride of 4 bytes. Consider using a vector or struct as the element type instead.
testArray: array<f32, 5>,
^^^^^^^^^^^^^

:6:8 note: see layout of struct:
/* align(16) size(64) */ struct _GlobalUniforms {
/* offset( 0) align(16) size(16) */ colorRed : vec4<f32>,
/* offset(16) align( 8) size(16) */ testMatrix2x2 : mat2x2<f32>,
/* offset(32) align( 4) size(20) */ testArray : array<f32, 5>,
/* offset(52) align( 1) size(12) */ // -- implicit struct size padding --
/* */ };
struct _GlobalUniforms {
^^^^^^^^^^^^^^^

:11:23 note: '_GlobalUniforms' used in address space 'uniform' here
@binding(0) @group(0) var<uniform> _globalUniforms: _GlobalUniforms;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
19 changes: 1 addition & 18 deletions tests/sksl/shared/StructComparison.wgsl
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
### Compilation failed:

error: :9:14 error: 'uniform' storage requires that array elements are aligned to 16 bytes, but array element of type 'f32' has a stride of 4 bytes. Consider using a vector or struct as the element type instead.
testArray: array<f32, 5>,
^^^^^^^^^^^^^

:6:8 note: see layout of struct:
/* align(16) size(64) */ struct _GlobalUniforms {
/* offset( 0) align(16) size(16) */ colorGreen : vec4<f32>,
/* offset(16) align(16) size(16) */ colorRed : vec4<f32>,
/* offset(32) align( 4) size(20) */ testArray : array<f32, 5>,
/* offset(52) align( 1) size(12) */ // -- implicit struct size padding --
/* */ };
struct _GlobalUniforms {
^^^^^^^^^^^^^^^

:11:23 note: '_GlobalUniforms' used in address space 'uniform' here
@binding(0) @group(0) var<uniform> _globalUniforms: _GlobalUniforms;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down
19 changes: 1 addition & 18 deletions tests/sksl/shared/UniformArray.wgsl
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
### Compilation failed:

error: :7:14 error: 'uniform' storage requires that array elements are aligned to 16 bytes, but array element of type 'f32' has a stride of 4 bytes. Consider using a vector or struct as the element type instead.
testArray: array<f32, 5>,
^^^^^^^^^^^^^

:6:8 note: see layout of struct:
/* align(16) size(64) */ struct _GlobalUniforms {
/* offset( 0) align( 4) size(20) */ testArray : array<f32, 5>,
/* offset(20) align( 1) size(12) */ // -- implicit field alignment padding --
/* offset(32) align(16) size(16) */ colorGreen : vec4<f32>,
/* offset(48) align(16) size(16) */ colorRed : vec4<f32>,
/* */ };
struct _GlobalUniforms {
^^^^^^^^^^^^^^^

:11:23 note: '_GlobalUniforms' used in address space 'uniform' here
@binding(0) @group(0) var<uniform> _globalUniforms: _GlobalUniforms;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Tint compilation failed.

diagnostic(off, derivative_uniformity);
diagnostic(off, chromium.unreachable_code);
Expand Down

0 comments on commit 8caa3e2

Please sign in to comment.