diff --git a/gn/sksl_tests.gni b/gn/sksl_tests.gni index d0ccd12250..77d680a9ce 100644 --- a/gn/sksl_tests.gni +++ b/gn/sksl_tests.gni @@ -224,27 +224,27 @@ sksl_error_tests = [ "/sksl/errors/SwizzleOnlyLiterals.rts", "/sksl/errors/SwizzleOutOfBounds.rts", "/sksl/errors/SwizzleTooManyComponents.rts", - "/sksl/errors/TernaryMismatch.sksl", - "/sksl/errors/UnassignedOutParameter.sksl", - "/sksl/errors/UndeclaredFunction.sksl", - "/sksl/errors/UndefinedFunction.sksl", - "/sksl/errors/UndefinedSymbol.sksl", - "/sksl/errors/UniformVarWithInitializerExpression.sksl", + "/sksl/errors/TernaryMismatch.rts", + "/sksl/errors/UnassignedOutParameter.rts", + "/sksl/errors/UndeclaredFunction.rts", + "/sksl/errors/UndefinedFunction.rts", + "/sksl/errors/UndefinedSymbol.rts", + "/sksl/errors/UniformVarWithInitializerExpression.rts", "/sksl/errors/UnknownDivideByZero.sksl", - "/sksl/errors/UnsupportedGLSLIdentifiers.sksl", "/sksl/errors/UnscopedVariableInDoWhile.sksl", - "/sksl/errors/UnscopedVariableInElse.sksl", - "/sksl/errors/UnscopedVariableInFor.sksl", - "/sksl/errors/UnscopedVariableInIf.sksl", + "/sksl/errors/UnscopedVariableInElse.rts", + "/sksl/errors/UnscopedVariableInFor.rts", + "/sksl/errors/UnscopedVariableInIf.rts", "/sksl/errors/UnscopedVariableInWhile.sksl", - "/sksl/errors/UsingInvalidValue.sksl", - "/sksl/errors/VectorIndexOutOfRange.sksl", + "/sksl/errors/UnsupportedGLSLIdentifiers.rts", + "/sksl/errors/UsingInvalidValue.rts", + "/sksl/errors/VectorIndexOutOfRange.rts", "/sksl/errors/VectorInlinedIndexOutOfRange.sksl", - "/sksl/errors/VectorSlice.sksl", + "/sksl/errors/VectorSlice.rts", "/sksl/errors/VertexEarlyReturn.vert", - "/sksl/errors/VoidConstructor.sksl", - "/sksl/errors/VoidInStruct.sksl", - "/sksl/errors/VoidVariable.sksl", + "/sksl/errors/VoidConstructor.rts", + "/sksl/errors/VoidInStruct.rts", + "/sksl/errors/VoidVariable.rts", "/sksl/errors/WhileTypeMismatch.sksl", ] @@ -292,7 +292,7 @@ sksl_spirv_tests = [ "/sksl/errors/LayoutInStruct.sksl", "/sksl/errors/Ossfuzz36850.sksl", "/sksl/errors/Ossfuzz37469.sksl", - "/sksl/errors/UndefinedFunction.sksl", + "/sksl/errors/UndefinedFunction.rts", ] sksl_shared_tests = [ diff --git a/resources/sksl/errors/TernaryMismatch.sksl b/resources/sksl/errors/TernaryMismatch.rts similarity index 100% rename from resources/sksl/errors/TernaryMismatch.sksl rename to resources/sksl/errors/TernaryMismatch.rts diff --git a/resources/sksl/errors/UnassignedOutParameter.sksl b/resources/sksl/errors/UnassignedOutParameter.rts similarity index 95% rename from resources/sksl/errors/UnassignedOutParameter.sksl rename to resources/sksl/errors/UnassignedOutParameter.rts index 55e548117d..6730dcf1d7 100644 --- a/resources/sksl/errors/UnassignedOutParameter.sksl +++ b/resources/sksl/errors/UnassignedOutParameter.rts @@ -4,7 +4,7 @@ void testIn(in float2 a, in float2 b, in float2 c) { a = float2(1); void testOut(out float2 a, out float2 b, out float2 c) { a = float2(1); } void testInout(inout float2 a, inout float2 b, inout float2 c) { a = float2(1); } -void main(float2 p) { +void func(float2 p) { testIn(p, p, p); testOut(p, p, p); testInout(p, p, p); diff --git a/resources/sksl/errors/UndeclaredFunction.sksl b/resources/sksl/errors/UndeclaredFunction.rts similarity index 54% rename from resources/sksl/errors/UndeclaredFunction.sksl rename to resources/sksl/errors/UndeclaredFunction.rts index 4ee08a19c3..5b4fa372e1 100644 --- a/resources/sksl/errors/UndeclaredFunction.sksl +++ b/resources/sksl/errors/UndeclaredFunction.rts @@ -1,4 +1,4 @@ -void main() { int x = foo(1); } +void func() { int x = foo(1); } /*%%* unknown identifier 'foo' diff --git a/resources/sksl/errors/UndefinedFunction.sksl b/resources/sksl/errors/UndefinedFunction.rts similarity index 68% rename from resources/sksl/errors/UndefinedFunction.sksl rename to resources/sksl/errors/UndefinedFunction.rts index d41d8861bd..5de828ee98 100644 --- a/resources/sksl/errors/UndefinedFunction.sksl +++ b/resources/sksl/errors/UndefinedFunction.rts @@ -1,6 +1,6 @@ int foo(int x); -void main() { int x = foo(1); } +void func() { int x = foo(1); } /*%%* function 'int foo(int x)' is not defined diff --git a/resources/sksl/errors/UndefinedSymbol.sksl b/resources/sksl/errors/UndefinedSymbol.rts similarity index 100% rename from resources/sksl/errors/UndefinedSymbol.sksl rename to resources/sksl/errors/UndefinedSymbol.rts diff --git a/resources/sksl/errors/UniformVarWithInitializerExpression.sksl b/resources/sksl/errors/UniformVarWithInitializerExpression.rts similarity index 100% rename from resources/sksl/errors/UniformVarWithInitializerExpression.sksl rename to resources/sksl/errors/UniformVarWithInitializerExpression.rts diff --git a/resources/sksl/errors/UnscopedVariableInElse.rts b/resources/sksl/errors/UnscopedVariableInElse.rts new file mode 100644 index 0000000000..bb5925bece --- /dev/null +++ b/resources/sksl/errors/UnscopedVariableInElse.rts @@ -0,0 +1,7 @@ +void func() { + if (true) ; else half x = 1; +} + +/*%%* +variable 'x' must be created in a scope +*%%*/ diff --git a/resources/sksl/errors/UnscopedVariableInElse.sksl b/resources/sksl/errors/UnscopedVariableInElse.sksl deleted file mode 100644 index 877bc6cb12..0000000000 --- a/resources/sksl/errors/UnscopedVariableInElse.sksl +++ /dev/null @@ -1,7 +0,0 @@ -void main() { - if (true) ; else half4 color = sk_FragColor; -} - -/*%%* -variable 'color' must be created in a scope -*%%*/ diff --git a/resources/sksl/errors/UnscopedVariableInFor.sksl b/resources/sksl/errors/UnscopedVariableInFor.rts similarity index 88% rename from resources/sksl/errors/UnscopedVariableInFor.sksl rename to resources/sksl/errors/UnscopedVariableInFor.rts index 88be1c10a3..59904aa415 100644 --- a/resources/sksl/errors/UnscopedVariableInFor.sksl +++ b/resources/sksl/errors/UnscopedVariableInFor.rts @@ -1,4 +1,4 @@ -void main() { +void func() { for (int x=0; x<10; ++x) float s = sqrt(4); } diff --git a/resources/sksl/errors/UnscopedVariableInIf.sksl b/resources/sksl/errors/UnscopedVariableInIf.rts similarity index 84% rename from resources/sksl/errors/UnscopedVariableInIf.sksl rename to resources/sksl/errors/UnscopedVariableInIf.rts index 89cef37eea..86c964b1fe 100644 --- a/resources/sksl/errors/UnscopedVariableInIf.sksl +++ b/resources/sksl/errors/UnscopedVariableInIf.rts @@ -1,4 +1,4 @@ -void main() { +void func() { if (true) half4 x; } diff --git a/resources/sksl/errors/UnsupportedGLSLIdentifiers.sksl b/resources/sksl/errors/UnsupportedGLSLIdentifiers.rts similarity index 100% rename from resources/sksl/errors/UnsupportedGLSLIdentifiers.sksl rename to resources/sksl/errors/UnsupportedGLSLIdentifiers.rts diff --git a/resources/sksl/errors/UsingInvalidValue.sksl b/resources/sksl/errors/UsingInvalidValue.rts similarity index 100% rename from resources/sksl/errors/UsingInvalidValue.sksl rename to resources/sksl/errors/UsingInvalidValue.rts diff --git a/resources/sksl/errors/VectorIndexOutOfRange.sksl b/resources/sksl/errors/VectorIndexOutOfRange.rts similarity index 100% rename from resources/sksl/errors/VectorIndexOutOfRange.sksl rename to resources/sksl/errors/VectorIndexOutOfRange.rts diff --git a/resources/sksl/errors/VectorSlice.sksl b/resources/sksl/errors/VectorSlice.rts similarity index 100% rename from resources/sksl/errors/VectorSlice.sksl rename to resources/sksl/errors/VectorSlice.rts diff --git a/resources/sksl/errors/VoidConstructor.sksl b/resources/sksl/errors/VoidConstructor.rts similarity index 78% rename from resources/sksl/errors/VoidConstructor.sksl rename to resources/sksl/errors/VoidConstructor.rts index 94df380cf0..4739bea325 100644 --- a/resources/sksl/errors/VoidConstructor.sksl +++ b/resources/sksl/errors/VoidConstructor.rts @@ -1,4 +1,4 @@ -void main() { +void func() { void(); } diff --git a/resources/sksl/errors/VoidInStruct.sksl b/resources/sksl/errors/VoidInStruct.rts similarity index 100% rename from resources/sksl/errors/VoidInStruct.sksl rename to resources/sksl/errors/VoidInStruct.rts diff --git a/resources/sksl/errors/VoidVariable.sksl b/resources/sksl/errors/VoidVariable.rts similarity index 100% rename from resources/sksl/errors/VoidVariable.sksl rename to resources/sksl/errors/VoidVariable.rts diff --git a/tests/sksl/errors/UnscopedVariableInElse.glsl b/tests/sksl/errors/UnscopedVariableInElse.glsl index 46151b7629..3ce2f16f51 100644 --- a/tests/sksl/errors/UnscopedVariableInElse.glsl +++ b/tests/sksl/errors/UnscopedVariableInElse.glsl @@ -1,4 +1,4 @@ ### Compilation failed: -error: 2: variable 'color' must be created in a scope +error: 2: variable 'x' must be created in a scope 1 error