Fix Metal row/column confusion, again.

We didn't have any tests which exercised the non-square matrix case
(because such a test requires ES3), so it was silently broken. It's
now fixed. The tests exposed a DIFFERENT Quadro P400 bug which will be
fixed separately.

Change-Id: Icf24acad5ea6f18aea3d8aa5a903e7bea41a5c23
Bug: skia:12443
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448379
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2021-09-14 12:04:11 -04:00 committed by SkCQ
parent 4ff44eff1c
commit 143e850237
3 changed files with 9 additions and 6 deletions

View File

@ -949,12 +949,12 @@ void MetalCodeGenerator::assembleMatrixFromExpressions(const AnyConstructor& cto
auto args = ctor.argumentSpan();
const char* separator = "";
for (int r = 0; r < rows; ++r) {
for (int c = 0; c < columns; ++c) {
fExtraFunctions.printf("%s%s%d(", separator, matrixType.c_str(), rows);
separator = "), ";
const char* columnSeparator = "";
for (int c = 0; c < columns; ++c) {
for (int r = 0; r < rows; ++r) {
fExtraFunctions.writeText(columnSeparator);
columnSeparator = ", ";

View File

@ -269,6 +269,9 @@ SKSL_TEST(SkSLHelloWorld, "shared/HelloWorld.sksl")
SKSL_TEST(SkSLHex, "shared/Hex.sksl")
SKSL_TEST(SkSLMatrices, "shared/Matrices.sksl")
SKSL_TEST_ES3(SkSLMatricesNonsquare, "shared/MatricesNonsquare.sksl")
// TODO(skia:12443): Quadro P400 on Ubuntu fails to compile this test
// SKSL_TEST(SkSLMatrixConstructorsES2, "shared/MatrixConstructorsES2.sksl")
// SKSL_TEST_ES3(SkSLMatrixConstructorsES3, "shared/MatrixConstructorsES3.sksl")
SKSL_TEST(SkSLMatrixEquality, "shared/MatrixEquality.sksl")
SKSL_TEST(SkSLMatrixScalarSplat, "shared/MatrixScalarSplat.sksl")
SKSL_TEST(SkSLMatrixToVectorCast, "shared/MatrixToVectorCast.sksl")

View File

@ -38,7 +38,7 @@ thread bool operator!=(const float2x3 left, const float2x3 right) {
return !(left == right);
}
float2x3 float2x3_from_float4_float2(float4 x0, float2 x1) {
return float2x3(float3(x0[0], x0[1]), float3(x0[2], x0[3]), float3(x1[0], x1[1]));
return float2x3(float3(x0[0], x0[1], x0[2]), float3(x0[3], x1[0], x1[1]));
}
thread bool operator==(const float2x4 left, const float2x4 right) {
return all(left[0] == right[0]) &&
@ -48,7 +48,7 @@ thread bool operator!=(const float2x4 left, const float2x4 right) {
return !(left == right);
}
float2x4 float2x4_from_float3_float4_float(float3 x0, float4 x1, float x2) {
return float2x4(float4(x0[0], x0[1]), float4(x0[2], x1[0]), float4(x1[1], x1[2]), float4(x1[3], x2));
return float2x4(float4(x0[0], x0[1], x0[2], x1[0]), float4(x1[1], x1[2], x1[3], x2));
}
thread bool operator==(const float3x3 left, const float3x3 right) {
return all(left[0] == right[0]) &&
@ -71,7 +71,7 @@ thread bool operator!=(const float4x2 left, const float4x2 right) {
return !(left == right);
}
float4x2 float4x2_from_float3_float4_float(float3 x0, float4 x1, float x2) {
return float4x2(float2(x0[0], x0[1], x0[2], x1[0]), float2(x1[1], x1[2], x1[3], x2));
return float4x2(float2(x0[0], x0[1]), float2(x0[2], x1[0]), float2(x1[1], x1[2]), float2(x1[3], x2));
}
thread bool operator==(const float4x3 left, const float4x3 right) {
return all(left[0] == right[0]) &&
@ -83,7 +83,7 @@ thread bool operator!=(const float4x3 left, const float4x3 right) {
return !(left == right);
}
float4x3 float4x3_from_float_float4_float4_float3(float x0, float4 x1, float4 x2, float3 x3) {
return float4x3(float3(x0, x1[0], x1[1], x1[2]), float3(x1[3], x2[0], x2[1], x2[2]), float3(x2[3], x3[0], x3[1], x3[2]));
return float4x3(float3(x0, x1[0], x1[1]), float3(x1[2], x1[3], x2[0]), float3(x2[1], x2[2], x2[3]), float3(x3[0], x3[1], x3[2]));
}
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _out;