Revert "Add tests for matrix-vector conversions."

This reverts commit a89781215a.

Reason for revert: breakage on Windows 

Original change's description:
> Add tests for matrix-vector conversions.
>
> GLSL supports casting vec4 into mat2 and vice versa, so SkSL should have
> equivalent support. Adding tests as a starting point.
>
> Change-Id: If8bcbf99afcec94d948d5da9e6205cb4a232af18
> Bug: skia:12067
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425837
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: I2563041f538b1b20074385f1b61af5fc506ffad5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12067
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426057
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2021-07-08 21:46:17 +00:00 committed by Skia Commit-Bot
parent 1f7300bdcb
commit f009db5b85
10 changed files with 0 additions and 261 deletions

View File

@ -319,7 +319,6 @@ sksl_shared_tests = [
"/sksl/shared/MatricesNonsquare.sksl",
"/sksl/shared/MatrixEquality.sksl",
"/sksl/shared/MatrixScalarSplat.sksl",
"/sksl/shared/MatrixToVectorCast.sksl",
"/sksl/shared/MultipleAssignments.sksl",
"/sksl/shared/NegatedVectorLiteral.sksl",
"/sksl/shared/NoFragCoordsPos.vert",
@ -390,7 +389,6 @@ sksl_shared_tests = [
"/sksl/shared/UnusedVariables.sksl",
"/sksl/shared/VectorConstructors.sksl",
"/sksl/shared/VectorScalarMath.sksl",
"/sksl/shared/VectorToMatrixCast.sksl",
"/sksl/shared/VertexEarlyReturn.vert",
"/sksl/shared/VertexID.vert",
"/sksl/shared/WhileLoopControlFlow.sksl",

View File

@ -1,18 +0,0 @@
uniform half4 colorGreen, colorRed;
uniform half2x2 testMatrix2x2;
half4 main(float2 coords) {
const half2x2 mat1234 = half2x2(1, 2, 3, 4);
bool ok = true;
ok = ok && half4(testMatrix2x2) == half4(1, 2, 3, 4);
ok = ok && half4(half2x2(1, 2, 3, 4)) == half4(1, 2, 3, 4);
ok = ok && half4(mat1234) == half4(1, 2, 3, 4);
ok = ok && float4(testMatrix2x2) == float4(1, 2, 3, 4);
ok = ok && float4(half2x2(1, 2, 3, 4)) == float4(1, 2, 3, 4);
ok = ok && float4(mat1234) == float4(1, 2, 3, 4);
return ok ? colorGreen : colorRed;
}

View File

@ -1,18 +0,0 @@
uniform half4 colorGreen, colorRed;
uniform half4 testInputs;
half4 main(float2 coords) {
bool ok = true;
const half4 vec1234 = half4(1, 2, 3, 4);
ok = ok && half2x2(testInputs) == half2x2(-1.25, 0, 0.75, 2.25);
ok = ok && half2x2(half4(1, 2, 3, 4)) == half2x2(1, 2, 3, 4);
ok = ok && half2x2(vec1234) == half2x2(1, 2, 3, 4);
ok = ok && float2x2(testInputs) == float2x2(-1.25, 0, 0.75, 2.25);
ok = ok && float2x2(half4(1, 2, 3, 4)) == float2x2(1, 2, 3, 4);
ok = ok && float2x2(vec1234) == float2x2(1, 2, 3, 4);
return ok ? colorGreen : colorRed;
}

View File

@ -252,8 +252,6 @@ SKSL_TEST(SkSLMatrices, "shared/Matrices.sksl")
SKSL_TEST_ES3(SkSLMatricesNonsquare, "shared/MatricesNonsquare.sksl")
SKSL_TEST(SkSLMatrixEquality, "shared/MatrixEquality.sksl")
SKSL_TEST(SkSLMatrixScalarSplat, "shared/MatrixScalarSplat.sksl")
// TODO(skia:12067): casting a mat2 into a vec4 does not yet parse as a valid constructor
//SKSL_TEST(SkSLMatrixToVectorCast, "shared/MatrixToVectorCast.sksl")
SKSL_TEST(SkSLMultipleAssignments, "shared/MultipleAssignments.sksl")
SKSL_TEST(SkSLNegatedVectorLiteral, "shared/NegatedVectorLiteral.sksl")
SKSL_TEST(SkSLNumberCasts, "shared/NumberCasts.sksl")
@ -285,7 +283,6 @@ SKSL_TEST(SkSLTernaryExpression, "shared/TernaryExpression.sksl")
SKSL_TEST(SkSLUnaryPositiveNegative, "shared/UnaryPositiveNegative.sksl")
SKSL_TEST(SkSLUnusedVariables, "shared/UnusedVariables.sksl")
SKSL_TEST(SkSLVectorConstructors, "shared/VectorConstructors.sksl")
SKSL_TEST(SkSLVectorToMatrixCast, "shared/VectorToMatrixCast.sksl")
// skbug.com/11919: Fails on Nexus5/7, and Intel GPUs
SKSL_TEST_CPU(SkSLVectorScalarMath, "shared/VectorScalarMath.sksl")
SKSL_TEST_ES3(SkSLWhileLoopControlFlow, "shared/WhileLoopControlFlow.sksl")

View File

@ -1,4 +0,0 @@
### Compilation failed:
error: 9: 'half2x2' is not a valid parameter to 'half4' constructor
1 error

View File

@ -1,4 +0,0 @@
### Compilation failed:
error: 9: 'half2x2' is not a valid parameter to 'half4' constructor
1 error

View File

@ -1,4 +0,0 @@
### Compilation failed:
error: 9: 'half2x2' is not a valid parameter to 'half4' constructor
1 error

View File

@ -1,165 +0,0 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %_entrypoint_v "_entrypoint" %sk_FragColor %sk_Clockwise
OpExecutionMode %_entrypoint_v OriginUpperLeft
OpName %sk_FragColor "sk_FragColor"
OpName %sk_Clockwise "sk_Clockwise"
OpName %_UniformBuffer "_UniformBuffer"
OpMemberName %_UniformBuffer 0 "colorGreen"
OpMemberName %_UniformBuffer 1 "colorRed"
OpMemberName %_UniformBuffer 2 "testInputs"
OpName %_entrypoint_v "_entrypoint_v"
OpName %main "main"
OpName %ok "ok"
OpDecorate %sk_FragColor RelaxedPrecision
OpDecorate %sk_FragColor Location 0
OpDecorate %sk_FragColor Index 0
OpDecorate %sk_Clockwise BuiltIn FrontFacing
OpMemberDecorate %_UniformBuffer 0 Offset 0
OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 1 Offset 16
OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 2 Offset 32
OpMemberDecorate %_UniformBuffer 2 RelaxedPrecision
OpDecorate %_UniformBuffer Block
OpDecorate %10 Binding 0
OpDecorate %10 DescriptorSet 0
OpDecorate %30 RelaxedPrecision
OpDecorate %37 RelaxedPrecision
OpDecorate %38 RelaxedPrecision
OpDecorate %39 RelaxedPrecision
OpDecorate %40 RelaxedPrecision
OpDecorate %41 RelaxedPrecision
OpDecorate %42 RelaxedPrecision
OpDecorate %43 RelaxedPrecision
OpDecorate %44 RelaxedPrecision
OpDecorate %49 RelaxedPrecision
OpDecorate %50 RelaxedPrecision
OpDecorate %51 RelaxedPrecision
OpDecorate %63 RelaxedPrecision
OpDecorate %67 RelaxedPrecision
OpDecorate %88 RelaxedPrecision
OpDecorate %96 RelaxedPrecision
OpDecorate %99 RelaxedPrecision
OpDecorate %100 RelaxedPrecision
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%sk_FragColor = OpVariable %_ptr_Output_v4float Output
%bool = OpTypeBool
%_ptr_Input_bool = OpTypePointer Input %bool
%sk_Clockwise = OpVariable %_ptr_Input_bool Input
%_UniformBuffer = OpTypeStruct %v4float %v4float %v4float
%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
%10 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
%void = OpTypeVoid
%15 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
%float_0 = OpConstant %float 0
%19 = OpConstantComposite %v2float %float_0 %float_0
%_ptr_Function_v2float = OpTypePointer Function %v2float
%23 = OpTypeFunction %v4float %_ptr_Function_v2float
%_ptr_Function_bool = OpTypePointer Function %bool
%true = OpConstantTrue %bool
%false = OpConstantFalse %bool
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%int = OpTypeInt 32 1
%int_2 = OpConstant %int 2
%mat2v2float = OpTypeMatrix %v2float 2
%float_n1_25 = OpConstant %float -1.25
%float_0_75 = OpConstant %float 0.75
%float_2_25 = OpConstant %float 2.25
%v2bool = OpTypeVector %bool 2
%_ptr_Function_v4float = OpTypePointer Function %v4float
%int_0 = OpConstant %int 0
%int_1 = OpConstant %int 1
%_entrypoint_v = OpFunction %void None %15
%16 = OpLabel
%20 = OpVariable %_ptr_Function_v2float Function
OpStore %20 %19
%22 = OpFunctionCall %v4float %main %20
OpStore %sk_FragColor %22
OpReturn
OpFunctionEnd
%main = OpFunction %v4float None %23
%24 = OpFunctionParameter %_ptr_Function_v2float
%25 = OpLabel
%ok = OpVariable %_ptr_Function_bool Function
%89 = OpVariable %_ptr_Function_v4float Function
OpStore %ok %true
%30 = OpLoad %bool %ok
OpSelectionMerge %32 None
OpBranchConditional %30 %31 %32
%31 = OpLabel
%33 = OpAccessChain %_ptr_Uniform_v4float %10 %int_2
%37 = OpLoad %v4float %33
%39 = OpCompositeExtract %float %37 0
%40 = OpCompositeExtract %float %37 1
%41 = OpCompositeExtract %float %37 2
%42 = OpCompositeExtract %float %37 3
%43 = OpCompositeConstruct %v2float %39 %40
%44 = OpCompositeConstruct %v2float %41 %42
%38 = OpCompositeConstruct %mat2v2float %43 %44
%50 = OpCompositeConstruct %v2float %float_n1_25 %float_0
%51 = OpCompositeConstruct %v2float %float_0_75 %float_2_25
%49 = OpCompositeConstruct %mat2v2float %50 %51
%53 = OpCompositeExtract %v2float %38 0
%54 = OpCompositeExtract %v2float %49 0
%55 = OpFOrdEqual %v2bool %53 %54
%56 = OpAll %bool %55
%57 = OpCompositeExtract %v2float %38 1
%58 = OpCompositeExtract %v2float %49 1
%59 = OpFOrdEqual %v2bool %57 %58
%60 = OpAll %bool %59
%61 = OpLogicalAnd %bool %56 %60
OpBranch %32
%32 = OpLabel
%62 = OpPhi %bool %false %25 %61 %31
OpStore %ok %62
%63 = OpLoad %bool %ok
OpSelectionMerge %65 None
OpBranchConditional %63 %64 %65
%64 = OpLabel
%66 = OpAccessChain %_ptr_Uniform_v4float %10 %int_2
%67 = OpLoad %v4float %66
%69 = OpCompositeExtract %float %67 0
%70 = OpCompositeExtract %float %67 1
%71 = OpCompositeExtract %float %67 2
%72 = OpCompositeExtract %float %67 3
%73 = OpCompositeConstruct %v2float %69 %70
%74 = OpCompositeConstruct %v2float %71 %72
%68 = OpCompositeConstruct %mat2v2float %73 %74
%76 = OpCompositeConstruct %v2float %float_n1_25 %float_0
%77 = OpCompositeConstruct %v2float %float_0_75 %float_2_25
%75 = OpCompositeConstruct %mat2v2float %76 %77
%78 = OpCompositeExtract %v2float %68 0
%79 = OpCompositeExtract %v2float %75 0
%80 = OpFOrdEqual %v2bool %78 %79
%81 = OpAll %bool %80
%82 = OpCompositeExtract %v2float %68 1
%83 = OpCompositeExtract %v2float %75 1
%84 = OpFOrdEqual %v2bool %82 %83
%85 = OpAll %bool %84
%86 = OpLogicalAnd %bool %81 %85
OpBranch %65
%65 = OpLabel
%87 = OpPhi %bool %false %32 %86 %64
OpStore %ok %87
%88 = OpLoad %bool %ok
OpSelectionMerge %93 None
OpBranchConditional %88 %91 %92
%91 = OpLabel
%94 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%96 = OpLoad %v4float %94
OpStore %89 %96
OpBranch %93
%92 = OpLabel
%97 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
%99 = OpLoad %v4float %97
OpStore %89 %99
OpBranch %93
%93 = OpLabel
%100 = OpLoad %v4float %89
OpReturnValue %100
OpFunctionEnd

View File

@ -1,11 +0,0 @@
out vec4 sk_FragColor;
uniform vec4 colorGreen;
uniform vec4 colorRed;
uniform vec4 testInputs;
vec4 main() {
bool ok = true;
ok = ok && mat2(testInputs) == mat2(-1.25, 0.0, 0.75, 2.25);
ok = ok && mat2(testInputs) == mat2(-1.25, 0.0, 0.75, 2.25);
return ok ? colorGreen : colorRed;
}

View File

@ -1,32 +0,0 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Uniforms {
float4 colorGreen;
float4 colorRed;
float4 testInputs;
};
struct Inputs {
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};
thread bool operator==(const float2x2 left, const float2x2 right) {
return all(left[0] == right[0]) &&
all(left[1] == right[1]);
}
thread bool operator!=(const float2x2 left, const float2x2 right) {
return !(left == right);
}
float2x2 float2x2_from_float4(float4 x0) {
return float2x2(float2(x0[0], x0[1]), float2(x0[2], x0[3]));
}
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _out;
(void)_out;
bool ok = true;
ok = ok && float2x2_from_float4(_uniforms.testInputs) == float2x2(float2(-1.25, 0.0), float2(0.75, 2.25));
ok = ok && float2x2_from_float4(_uniforms.testInputs) == float2x2(float2(-1.25, 0.0), float2(0.75, 2.25));
_out.sk_FragColor = ok ? _uniforms.colorGreen : _uniforms.colorRed;
return _out;
}