aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-07-28 15:19:46 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-28 20:43:03 +0000
commit5af9ea399d5e0344cc4b7da4e97b5dc5b3c74f64 (patch)
treedf906a3af0b954b130340589f24d128ce655bb01 /tests
parent0edfbb78244739cb6e695f240edb7f659a543160 (diff)
renamed SkSL types in preparation for killing precision modifiers
Bug: skia: Change-Id: Iff0289e25355a89cdc289a0892ed755dd1b1c900 Reviewed-on: https://skia-review.googlesource.com/27703 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/GrMeshTest.cpp10
-rw-r--r--tests/GrPipelineDynamicStateTest.cpp4
-rw-r--r--tests/ImageStorageTest.cpp10
-rw-r--r--tests/PrimitiveProcessorTest.cpp4
-rw-r--r--tests/SkSLErrorTest.cpp100
-rw-r--r--tests/SkSLFPTest.cpp50
-rw-r--r--tests/SkSLGLSLTest.cpp270
-rw-r--r--tests/SkSLMemoryLayoutTest.cpp124
8 files changed, 287 insertions, 285 deletions
diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp
index 922a996499..288c057589 100644
--- a/tests/GrMeshTest.cpp
+++ b/tests/GrMeshTest.cpp
@@ -327,20 +327,20 @@ class GLSLMeshTestProcessor : public GrGLSLGeometryProcessor {
GrGLSLVertexBuilder* v = args.fVertBuilder;
if (!mp.fInstanceLocation) {
- v->codeAppendf("vec2 vertex = %s;", mp.fVertex->fName);
+ v->codeAppendf("float2 vertex = %s;", mp.fVertex->fName);
} else {
if (mp.fVertex) {
- v->codeAppendf("vec2 offset = %s;", mp.fVertex->fName);
+ v->codeAppendf("float2 offset = %s;", mp.fVertex->fName);
} else {
- v->codeAppend ("vec2 offset = vec2(sk_VertexID / 2, sk_VertexID % 2);");
+ v->codeAppend ("float2 offset = float2(sk_VertexID / 2, sk_VertexID % 2);");
}
- v->codeAppendf("vec2 vertex = %s + offset * %i;",
+ v->codeAppendf("float2 vertex = %s + offset * %i;",
mp.fInstanceLocation->fName, kBoxSize);
}
gpArgs->fPositionVar.set(kVec2f_GrSLType, "vertex");
GrGLSLPPFragmentBuilder* f = args.fFragBuilder;
- f->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
+ f->codeAppendf("%s = float4(1);", args.fOutputCoverage);
}
};
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp
index 2c9e2c3b17..2049ccb182 100644
--- a/tests/GrPipelineDynamicStateTest.cpp
+++ b/tests/GrPipelineDynamicStateTest.cpp
@@ -91,11 +91,11 @@ class GLSLPipelineDynamicStateTestProcessor : public GrGLSLGeometryProcessor {
varyingHandler->addPassThroughAttribute(&mp.fColor, args.fOutputColor);
GrGLSLVertexBuilder* v = args.fVertBuilder;
- v->codeAppendf("vec2 vertex = %s;", mp.fVertex.fName);
+ v->codeAppendf("float2 vertex = %s;", mp.fVertex.fName);
gpArgs->fPositionVar.set(kVec2f_GrSLType, "vertex");
GrGLSLPPFragmentBuilder* f = args.fFragBuilder;
- f->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
+ f->codeAppendf("%s = float4(1);", args.fOutputCoverage);
}
};
diff --git a/tests/ImageStorageTest.cpp b/tests/ImageStorageTest.cpp
index 9a5f8962fb..589f69471f 100644
--- a/tests/ImageStorageTest.cpp
+++ b/tests/ImageStorageTest.cpp
@@ -58,21 +58,21 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) {
const TestFP& tfp = args.fFp.cast<TestFP>();
GrGLSLFPFragmentBuilder* fb = args.fFragBuilder;
SkString imageLoadStr;
- fb->codeAppend("highp vec2 coord = sk_FragCoord.xy;");
+ fb->codeAppend("highp float2 coord = sk_FragCoord.xy;");
fb->appendImageStorageLoad(&imageLoadStr, args.fImageStorages[0],
- "ivec2(coord)");
+ "int2(coord)");
if (GrPixelConfigIsSint(tfp.fImageStorageAccess.peekTexture()->config())) {
// Map the signed bytes so that when then get read back as unorm values they
// will have their original bit pattern.
- fb->codeAppendf("highp ivec4 ivals = %s;", imageLoadStr.c_str());
+ fb->codeAppendf("highp int4 ivals = %s;", imageLoadStr.c_str());
// NV gives a linker error for this:
// fb->codeAppend("ivals +=
- // "mix(ivec4(0), ivec4(256), lessThan(ivals, ivec4(0)));");
+ // "mix(int4(0), int4(256), lessThan(ivals, int4(0)));");
fb->codeAppend("if (ivals.r < 0) { ivals.r += 256; }");
fb->codeAppend("if (ivals.g < 0) { ivals.g += 256; }");
fb->codeAppend("if (ivals.b < 0) { ivals.b += 256; }");
fb->codeAppend("if (ivals.a < 0) { ivals.a += 256; }");
- fb->codeAppendf("%s = vec4(ivals)/255;", args.fOutputColor);
+ fb->codeAppendf("%s = float4(ivals)/255;", args.fOutputColor);
} else {
fb->codeAppendf("%s = %s;", args.fOutputColor, imageLoadStr.c_str());
}
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 75bdb834fd..d2e851d9d1 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -72,8 +72,8 @@ private:
args.fVaryingHandler->emitAttributes(gp);
this->setupPosition(args.fVertBuilder, gpArgs, gp.getAttrib(0).fName);
GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder;
- fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputColor);
- fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
+ fragBuilder->codeAppendf("%s = float4(1);", args.fOutputColor);
+ fragBuilder->codeAppendf("%s = float4(1);", args.fOutputCoverage);
}
void setData(const GrGLSLProgramDataManager& pdman,
const GrPrimitiveProcessor& primProc,
diff --git a/tests/SkSLErrorTest.cpp b/tests/SkSLErrorTest.cpp
index c631382ac1..df829874f6 100644
--- a/tests/SkSLErrorTest.cpp
+++ b/tests/SkSLErrorTest.cpp
@@ -37,7 +37,7 @@ static void test_success(skiatest::Reporter* r, const char* src) {
DEF_TEST(SkSLUndefinedSymbol, r) {
test_failure(r,
- "void main() { x = vec2(1); }",
+ "void main() { x = float2(1); }",
"error: 1: unknown identifier 'x'\n1 error\n");
}
@@ -80,14 +80,14 @@ DEF_TEST(SkSLIfTypeMismatch, r) {
DEF_TEST(SkSLDoTypeMismatch, r) {
test_failure(r,
- "void main() { do { } while (vec2(1)); }",
- "error: 1: expected 'bool', but found 'vec2'\n1 error\n");
+ "void main() { do { } while (float2(1)); }",
+ "error: 1: expected 'bool', but found 'float2'\n1 error\n");
}
DEF_TEST(SkSLWhileTypeMismatch, r) {
test_failure(r,
- "void main() { while (vec3(1)) { } }",
- "error: 1: expected 'bool', but found 'vec3'\n1 error\n");
+ "void main() { while (float3(1)) { } }",
+ "error: 1: expected 'bool', but found 'float3'\n1 error\n");
}
DEF_TEST(SkSLForTypeMismatch, r) {
@@ -98,14 +98,14 @@ DEF_TEST(SkSLForTypeMismatch, r) {
DEF_TEST(SkSLConstructorTypeMismatch, r) {
test_failure(r,
- "void main() { vec2 x = vec2(1.0, false); }",
+ "void main() { float2 x = float2(1.0, false); }",
"error: 1: expected 'float', but found 'bool'\n1 error\n");
test_failure(r,
- "void main() { vec2 x = vec2(bvec2(false)); }",
- "error: 1: 'bvec2' is not a valid parameter to 'vec2' constructor\n1 error\n");
+ "void main() { float2 x = float2(bool2(false)); }",
+ "error: 1: 'bool2' is not a valid parameter to 'float2' constructor\n1 error\n");
test_failure(r,
- "void main() { bvec2 x = bvec2(vec2(1)); }",
- "error: 1: 'vec2' is not a valid parameter to 'bvec2' constructor\n1 error\n");
+ "void main() { bool2 x = bool2(float2(1)); }",
+ "error: 1: 'float2' is not a valid parameter to 'bool2' constructor\n1 error\n");
test_failure(r,
"void main() { bool x = bool(1.0); }",
"error: 1: cannot construct 'bool'\n1 error\n");
@@ -116,21 +116,21 @@ DEF_TEST(SkSLConstructorTypeMismatch, r) {
"struct foo { int x; } foo; void main() { float x = float(foo); }",
"error: 1: invalid argument to 'float' constructor (expected a number or bool, but found 'foo')\n1 error\n");
test_failure(r,
- "struct foo { int x; } foo; void main() { vec2 x = vec2(foo); }",
- "error: 1: 'foo' is not a valid parameter to 'vec2' constructor\n1 error\n");
+ "struct foo { int x; } foo; void main() { float2 x = float2(foo); }",
+ "error: 1: 'foo' is not a valid parameter to 'float2' constructor\n1 error\n");
test_failure(r,
- "void main() { mat2 x = mat2(true); }",
+ "void main() { float2x2 x = float2x2(true); }",
"error: 1: expected 'float', but found 'bool'\n1 error\n");
}
DEF_TEST(SkSLConstructorArgumentCount, r) {
test_failure(r,
- "void main() { vec3 x = vec3(1.0, 2.0); }",
- "error: 1: invalid arguments to 'vec3' constructor (expected 3 scalars, but "
+ "void main() { float3 x = float3(1.0, 2.0); }",
+ "error: 1: invalid arguments to 'float3' constructor (expected 3 scalars, but "
"found 2)\n1 error\n");
test_failure(r,
- "void main() { vec3 x = vec3(1.0, 2.0, 3.0, 4.0); }",
- "error: 1: invalid arguments to 'vec3' constructor (expected 3 scalars, but found "
+ "void main() { float3 x = float3(1.0, 2.0, 3.0, 4.0); }",
+ "error: 1: invalid arguments to 'float3' constructor (expected 3 scalars, but found "
"4)\n1 error\n");
}
@@ -142,25 +142,25 @@ DEF_TEST(SkSLSwizzleScalar, r) {
DEF_TEST(SkSLSwizzleMatrix, r) {
test_failure(r,
- "void main() { mat2 x = mat2(1); float y = x.y; }",
- "error: 1: cannot swizzle value of type 'mat2'\n1 error\n");
+ "void main() { float2x2 x = float2x2(1); float y = x.y; }",
+ "error: 1: cannot swizzle value of type 'float2x2'\n1 error\n");
}
DEF_TEST(SkSLSwizzleOutOfBounds, r) {
test_failure(r,
- "void main() { vec3 test = vec2(1).xyz; }",
+ "void main() { float3 test = float2(1).xyz; }",
"error: 1: invalid swizzle component 'z'\n1 error\n");
}
DEF_TEST(SkSLSwizzleTooManyComponents, r) {
test_failure(r,
- "void main() { vec4 test = vec2(1).xxxxx; }",
+ "void main() { float4 test = float2(1).xxxxx; }",
"error: 1: too many components in swizzle mask 'xxxxx'\n1 error\n");
}
DEF_TEST(SkSLSwizzleDuplicateOutput, r) {
test_failure(r,
- "void main() { vec4 test = vec4(1); test.xyyz = vec4(1); }",
+ "void main() { float4 test = float4(1); test.xyyz = float4(1); }",
"error: 1: cannot write to the same swizzle field more than once\n1 error\n");
}
@@ -172,10 +172,10 @@ DEF_TEST(SkSLAssignmentTypeMismatch, r) {
"void main() { int x; x = 1.0; }",
"error: 1: type mismatch: '=' cannot operate on 'int', 'float'\n1 error\n");
test_success(r,
- "void main() { vec3 x = vec3(0); x *= 1.0; }");
+ "void main() { float3 x = float3(0); x *= 1.0; }");
test_failure(r,
- "void main() { ivec3 x = ivec3(0); x *= 1.0; }",
- "error: 1: type mismatch: '*=' cannot operate on 'ivec3', 'float'\n1 error\n");
+ "void main() { int3 x = int3(0); x *= 1.0; }",
+ "error: 1: type mismatch: '*=' cannot operate on 'int3', 'float'\n1 error\n");
}
DEF_TEST(SkSLReturnFromVoid, r) {
@@ -255,17 +255,17 @@ DEF_TEST(SkSLCallNonFunction, r) {
DEF_TEST(SkSLInvalidUnary, r) {
test_failure(r,
- "void main() { mat4 x = mat4(1); ++x; }",
- "error: 1: '++' cannot operate on 'mat4'\n1 error\n");
+ "void main() { float4x4 x = float4x4(1); ++x; }",
+ "error: 1: '++' cannot operate on 'float4x4'\n1 error\n");
test_failure(r,
- "void main() { vec3 x = vec3(1); --x; }",
- "error: 1: '--' cannot operate on 'vec3'\n1 error\n");
+ "void main() { float3 x = float3(1); --x; }",
+ "error: 1: '--' cannot operate on 'float3'\n1 error\n");
test_failure(r,
- "void main() { mat4 x = mat4(1); x++; }",
- "error: 1: '++' cannot operate on 'mat4'\n1 error\n");
+ "void main() { float4x4 x = float4x4(1); x++; }",
+ "error: 1: '++' cannot operate on 'float4x4'\n1 error\n");
test_failure(r,
- "void main() { vec3 x = vec3(1); x--; }",
- "error: 1: '--' cannot operate on 'vec3'\n1 error\n");
+ "void main() { float3 x = float3(1); x--; }",
+ "error: 1: '--' cannot operate on 'float3'\n1 error\n");
test_failure(r,
"void main() { int x = !12; }",
"error: 1: '!' cannot operate on 'int'\n1 error\n");
@@ -276,7 +276,7 @@ DEF_TEST(SkSLInvalidUnary, r) {
"struct foo { } bar; void main() { foo x = -bar; }",
"error: 1: '-' cannot operate on 'foo'\n1 error\n");
test_success(r,
- "void main() { vec2 x = vec2(1, 1); x = +x; x = -x; }");
+ "void main() { float2 x = float2(1, 1); x = +x; x = -x; }");
}
DEF_TEST(SkSLInvalidAssignment, r) {
@@ -296,7 +296,7 @@ DEF_TEST(SkSLBadIndex, r) {
"void main() { int x = 2[0]; }",
"error: 1: expected array, but found 'int'\n1 error\n");
test_failure(r,
- "void main() { vec2 x = vec2(0); int y = x[0][0]; }",
+ "void main() { float2 x = float2(0); int y = x[0][0]; }",
"error: 1: expected array, but found 'float'\n1 error\n");
}
@@ -305,8 +305,8 @@ DEF_TEST(SkSLTernaryMismatch, r) {
"void main() { int x = 5 > 2 ? true : 1.0; }",
"error: 1: ternary operator result mismatch: 'bool', 'float'\n1 error\n");
test_failure(r,
- "void main() { int x = 5 > 2 ? vec3(1) : 1.0; }",
- "error: 1: ternary operator result mismatch: 'vec3', 'float'\n1 error\n");
+ "void main() { int x = 5 > 2 ? float3(1) : 1.0; }",
+ "error: 1: ternary operator result mismatch: 'float3', 'float'\n1 error\n");
}
DEF_TEST(SkSLInterfaceBlockStorageModifiers, r) {
@@ -333,7 +333,7 @@ DEF_TEST(SkSLUseWithoutInitialize, r) {
"error: 1: 'x' has not been assigned\n1 error\n");
test_failure(r,
"void main() { int x; switch (3) { case 0: x = 0; case 1: x = 1; }"
- "sk_FragColor = vec4(x); }",
+ "sk_FragColor = float4(x); }",
"error: 1: 'x' has not been assigned\n1 error\n");
}
@@ -424,11 +424,11 @@ DEF_TEST(SkSLUnsupportedGLSLIdentifiers, r) {
DEF_TEST(SkSLWrongSwitchTypes, r) {
test_failure(r,
- "void main() { switch (vec2(1)) { case 1: break; } }",
- "error: 1: expected 'int', but found 'vec2'\n1 error\n");
+ "void main() { switch (float2(1)) { case 1: break; } }",
+ "error: 1: expected 'int', but found 'float2'\n1 error\n");
test_failure(r,
- "void main() { switch (1) { case vec2(1): break; } }",
- "error: 1: expected 'int', but found 'vec2'\n1 error\n");
+ "void main() { switch (1) { case float2(1): break; } }",
+ "error: 1: expected 'int', but found 'float2'\n1 error\n");
}
DEF_TEST(SkSLNonConstantCase, r) {
@@ -453,10 +453,10 @@ DEF_TEST(SkSLFieldAfterRuntimeArray, r) {
DEF_TEST(SkSLStaticIf, r) {
test_success(r,
"void main() { float x = 5; float y = 10;"
- "@if (x < y) { sk_FragColor = vec4(1); } }");
+ "@if (x < y) { sk_FragColor = float4(1); } }");
test_failure(r,
"void main() { float x = sqrt(25); float y = 10;"
- "@if (x < y) { sk_FragColor = vec4(1); } }",
+ "@if (x < y) { sk_FragColor = float4(1); } }",
"error: 1: static if has non-static test\n1 error\n");
}
@@ -465,16 +465,16 @@ DEF_TEST(SkSLStaticSwitch, r) {
"void main() {"
"int x = 1;"
"@switch (x) {"
- "case 1: sk_FragColor = vec4(1); break;"
- "default: sk_FragColor = vec4(0);"
+ "case 1: sk_FragColor = float4(1); break;"
+ "default: sk_FragColor = float4(0);"
"}"
"}");
test_failure(r,
"void main() {"
"int x = int(sqrt(1));"
"@switch (x) {"
- "case 1: sk_FragColor = vec4(1); break;"
- "default: sk_FragColor = vec4(0);"
+ "case 1: sk_FragColor = float4(1); break;"
+ "default: sk_FragColor = float4(0);"
"}"
"}",
"error: 1: static switch has non-static test\n1 error\n");
@@ -482,8 +482,8 @@ DEF_TEST(SkSLStaticSwitch, r) {
"void main() {"
"int x = 1;"
"@switch (x) {"
- "case 1: sk_FragColor = vec4(1); if (sqrt(0) < sqrt(1)) break;"
- "default: sk_FragColor = vec4(0);"
+ "case 1: sk_FragColor = float4(1); if (sqrt(0) < sqrt(1)) break;"
+ "default: sk_FragColor = float4(0);"
"}"
"}",
"error: 1: static switch contains non-static conditional break\n1 error\n");
diff --git a/tests/SkSLFPTest.cpp b/tests/SkSLFPTest.cpp
index dc4ef93aa3..7a1d371738 100644
--- a/tests/SkSLFPTest.cpp
+++ b/tests/SkSLFPTest.cpp
@@ -62,7 +62,7 @@ static void test(skiatest::Reporter* r, const char* src, const GrShaderCaps& cap
DEF_TEST(SkSLFPHelloWorld, r) {
test(r,
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{
@@ -130,7 +130,7 @@ DEF_TEST(SkSLFPHelloWorld, r) {
" GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;\n"
" const GrTest& _outer = args.fFp.cast<GrTest>();\n"
" (void) _outer;\n"
- " fragBuilder->codeAppendf(\"%s = vec4(1.0);\\n\", args.fOutputColor);\n"
+ " fragBuilder->codeAppendf(\"%s = float4(1.0);\\n\", args.fOutputColor);\n"
" }\n"
"private:\n"
" void onSetData(const GrGLSLProgramDataManager& pdman, "
@@ -154,9 +154,9 @@ DEF_TEST(SkSLFPHelloWorld, r) {
DEF_TEST(SkSLFPInput, r) {
test(r,
- "in vec2 point;"
+ "in float2 point;"
"void main() {"
- "sk_OutColor = vec4(point, point);"
+ "sk_OutColor = float4(point, point);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{
@@ -167,7 +167,7 @@ DEF_TEST(SkSLFPInput, r) {
", fPoint(point)"
},
{
- "fragBuilder->codeAppendf(\"%s = vec4(vec2(%f, %f), vec2(%f, %f));\\n\", "
+ "fragBuilder->codeAppendf(\"%s = float4(float2(%f, %f), float2(%f, %f));\\n\", "
"args.fOutputColor, _outer.point().fX, _outer.point().fY, "
"_outer.point().fX, _outer.point().fY);",
"if (fPoint != that.fPoint) return false;"
@@ -176,7 +176,7 @@ DEF_TEST(SkSLFPInput, r) {
DEF_TEST(SkSLFPUniform, r) {
test(r,
- "uniform vec4 color;"
+ "uniform float4 color;"
"void main() {"
"sk_OutColor = color;"
"}",
@@ -192,7 +192,7 @@ DEF_TEST(SkSLFPUniform, r) {
DEF_TEST(SkSLFPInUniform, r) {
test(r,
- "in uniform vec4 color;"
+ "in uniform float4 color;"
"void main() {"
"sk_OutColor = color;"
"}",
@@ -212,7 +212,7 @@ DEF_TEST(SkSLFPSections, r) {
test(r,
"@header { header section }"
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{
@@ -222,7 +222,7 @@ DEF_TEST(SkSLFPSections, r) {
test(r,
"@class { class section }"
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{
@@ -234,7 +234,7 @@ DEF_TEST(SkSLFPSections, r) {
test(r,
"@cpp { cpp section }"
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{},
@@ -243,7 +243,7 @@ DEF_TEST(SkSLFPSections, r) {
"@constructorParams { int x, float y, std::vector<float> z }"
"in float w;"
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{
@@ -256,7 +256,7 @@ DEF_TEST(SkSLFPSections, r) {
test(r,
"@constructor { constructor section }"
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{
@@ -266,7 +266,7 @@ DEF_TEST(SkSLFPSections, r) {
test(r,
"@initializers { initializers section }"
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{
@@ -277,7 +277,7 @@ DEF_TEST(SkSLFPSections, r) {
"float x = 10;"
"@emitCode { fragBuilder->codeAppendf(\"float y = %d\\n\", x * 2); }"
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{},
@@ -288,7 +288,7 @@ DEF_TEST(SkSLFPSections, r) {
test(r,
"@fields { fields section }"
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{
@@ -299,7 +299,7 @@ DEF_TEST(SkSLFPSections, r) {
test(r,
"@make { make section }"
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{
@@ -312,7 +312,7 @@ DEF_TEST(SkSLFPSections, r) {
"in float provided;"
"@setData(varName) { varName.set1f(calculated, provided * 2); }"
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{},
@@ -326,7 +326,7 @@ DEF_TEST(SkSLFPSections, r) {
test(r,
"@test(testDataName) { testDataName section }"
"void main() {"
- "sk_OutColor = vec4(1);"
+ "sk_OutColor = float4(1);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{},
@@ -343,7 +343,7 @@ DEF_TEST(SkSLFPColorSpaceXform, r) {
"in uniform sampler2D image;"
"in uniform colorSpaceXform colorXform;"
"void main() {"
- "sk_OutColor = sk_InColor * texture(image, vec2(0, 0), colorXform);"
+ "sk_OutColor = sk_InColor * texture(image, float2(0, 0), colorXform);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{
@@ -353,12 +353,12 @@ DEF_TEST(SkSLFPColorSpaceXform, r) {
"sk_sp<GrColorSpaceXform> fColorXform;"
},
{
- "fragBuilder->codeAppendf(\"vec4 _tmpVar1;%s = %s * %stexture(%s, "
- "vec2(0.0, 0.0)).%s%s;\\n\", args.fOutputColor, args.fInputColor ? args.fInputColor : "
- "\"vec4(1)\", fColorSpaceHelper.isValid() ? \"(_tmpVar1 = \" : \"\", "
+ "fragBuilder->codeAppendf(\"float4 _tmpVar1;%s = %s * %stexture(%s, "
+ "float2(0.0, 0.0)).%s%s;\\n\", args.fOutputColor, args.fInputColor ? args.fInputColor : "
+ "\"float4(1)\", fColorSpaceHelper.isValid() ? \"(_tmpVar1 = \" : \"\", "
"fragBuilder->getProgramBuilder()->samplerVariable(args.fTexSamplers[0]).c_str(), "
"fragBuilder->getProgramBuilder()->samplerSwizzle(args.fTexSamplers[0]).c_str(), "
- "fColorSpaceHelper.isValid() ? SkStringPrintf(\", vec4(clamp((%s * vec4(_tmpVar1.rgb, "
+ "fColorSpaceHelper.isValid() ? SkStringPrintf(\", float4(clamp((%s * float4(_tmpVar1.rgb, "
"1.0)).rgb, 0.0, _tmpVar1.a), _tmpVar1.a))\", args.fUniformHandler->getUniformCStr("
"fColorSpaceHelper.gamutXformUniform())).c_str() : \"\");"
});
@@ -367,14 +367,14 @@ DEF_TEST(SkSLFPColorSpaceXform, r) {
DEF_TEST(SkSLFPTransformedCoords, r) {
test(r,
"void main() {"
- "sk_OutColor = vec4(sk_TransformedCoords2D[0], sk_TransformedCoords2D[0]);"
+ "sk_OutColor = float4(sk_TransformedCoords2D[0], sk_TransformedCoords2D[0]);"
"}",
*SkSL::ShaderCapsFactory::Default(),
{},
{
"SkSL::String sk_TransformedCoords2D_0 = "
"fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);",
- "fragBuilder->codeAppendf(\"%s = vec4(%s, %s);\\n\", args.fOutputColor, "
+ "fragBuilder->codeAppendf(\"%s = float4(%s, %s);\\n\", args.fOutputColor, "
"sk_TransformedCoords2D_0.c_str(), sk_TransformedCoords2D_0.c_str());"
});
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index 8f09d6b084..de002c7e81 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -50,7 +50,7 @@ static void test(skiatest::Reporter* r, const char* src, const GrShaderCaps& cap
DEF_TEST(SkSLHelloWorld, r) {
test(r,
- "void main() { sk_FragColor = vec4(0.75); }",
+ "void main() { sk_FragColor = float4(0.75); }",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
"out vec4 sk_FragColor;\n"
@@ -62,7 +62,7 @@ DEF_TEST(SkSLHelloWorld, r) {
DEF_TEST(SkSLControl, r) {
test(r,
"void main() {"
- "if (sqrt(2) > 5) { sk_FragColor = vec4(0.75); } else { discard; }"
+ "if (sqrt(2) > 5) { sk_FragColor = float4(0.75); } else { discard; }"
"int i = 0;"
"while (i < 10) { sk_FragColor *= 0.5; i++; }"
"do { sk_FragColor += 0.01; } while (sk_FragColor.x < 0.75);"
@@ -99,7 +99,7 @@ DEF_TEST(SkSLFunctions, r) {
test(r,
"float foo(float v[2]) { return v[0] * v[1]; }"
"void bar(inout float x) { float y[2], z; y[0] = x; y[1] = x * 2; z = foo(y); x = z; }"
- "void main() { float x = 10; bar(x); sk_FragColor = vec4(x); }",
+ "void main() { float x = 10; bar(x); sk_FragColor = float4(x); }",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
"out vec4 sk_FragColor;\n"
@@ -141,8 +141,8 @@ DEF_TEST(SkSLOperators, r) {
"z >>= 2;"
"z <<= 4;"
"z %= 5;"
- "x = (vec2(sqrt(1)) , 6);"
- "z = (vec2(sqrt(1)) , 6);"
+ "x = (float2(sqrt(1)) , 6);"
+ "z = (float2(sqrt(1)) , 6);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -174,12 +174,12 @@ DEF_TEST(SkSLOperators, r) {
DEF_TEST(SkSLMatrices, r) {
test(r,
"void main() {"
- "mat2x4 x = mat2x4(1);"
- "mat3x2 y = mat3x2(1, 0, 0, 1, vec2(2, 2));"
- "mat3x4 z = x * y;"
- "vec3 v1 = mat3(1) * vec3(2);"
- "vec3 v2 = vec3(2) * mat3(1);"
- "sk_FragColor = vec4(z[0].x, v1 + v2);"
+ "float2x4 x = float2x4(1);"
+ "float3x2 y = float3x2(1, 0, 0, 1, float2(2, 2));"
+ "float3x4 z = x * y;"
+ "float3 v1 = float3x3(1) * float3(2);"
+ "float3 v2 = float3(2) * float3x3(1);"
+ "sk_FragColor = float4(z[0].x, v1 + v2);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -197,11 +197,11 @@ DEF_TEST(SkSLInterfaceBlock, r) {
"uniform testBlock {"
"float x;"
"float y[2];"
- "layout(binding=12) mat3x2 z;"
+ "layout(binding=12) float3x2 z;"
"bool w;"
"};"
"void main() {"
- " sk_FragColor = vec4(x, y[0], y[1], 0);"
+ " sk_FragColor = float4(x, y[0], y[1], 0);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -220,7 +220,7 @@ DEF_TEST(SkSLInterfaceBlock, r) {
"float x;"
"} test;"
"void main() {"
- " sk_FragColor = vec4(test.x);"
+ " sk_FragColor = float4(test.x);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -236,7 +236,7 @@ DEF_TEST(SkSLInterfaceBlock, r) {
"float x;"
"} test[2];"
"void main() {"
- " sk_FragColor = vec4(test[1].x);"
+ " sk_FragColor = float4(test[1].x);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -283,7 +283,7 @@ DEF_TEST(SkSLStructs, r) {
DEF_TEST(SkSLVersion, r) {
test(r,
- "in float test; void main() { sk_FragColor = vec4(0.75); }",
+ "in float test; void main() { sk_FragColor = float4(0.75); }",
*SkSL::ShaderCapsFactory::Version450Core(),
"#version 450 core\n"
"out vec4 sk_FragColor;\n"
@@ -292,7 +292,7 @@ DEF_TEST(SkSLVersion, r) {
" sk_FragColor = vec4(0.75);\n"
"}\n");
test(r,
- "in float test; void main() { sk_FragColor = vec4(0.75); }",
+ "in float test; void main() { sk_FragColor = float4(0.75); }",
*SkSL::ShaderCapsFactory::Version110(),
"#version 110\n"
"varying float test;\n"
@@ -304,7 +304,7 @@ DEF_TEST(SkSLVersion, r) {
DEF_TEST(SkSLUsesPrecisionModifiers, r) {
test(r,
"void main() { float x = 0.75; highp float y = 1; x++; y++;"
- "sk_FragColor.rg = vec2(x, y); }",
+ "sk_FragColor.rg = float2(x, y); }",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
"out vec4 sk_FragColor;\n"
@@ -317,7 +317,7 @@ DEF_TEST(SkSLUsesPrecisionModifiers, r) {
"}\n");
test(r,
"void main() { float x = 0.75; highp float y = 1; x++; y++;"
- "sk_FragColor.rg = vec2(x, y); }",
+ "sk_FragColor.rg = float2(x, y); }",
*SkSL::ShaderCapsFactory::UsesPrecisionModifiers(),
"#version 400\n"
"precision highp float;\n"
@@ -362,7 +362,7 @@ DEF_TEST(SkSLMinAbs, r) {
DEF_TEST(SkSLNegatedAtan, r) {
test(r,
- "void main() { vec2 x = vec2(sqrt(2)); sk_FragColor.r = atan(x.x, -x.y); }",
+ "void main() { float2 x = float2(sqrt(2)); sk_FragColor.r = atan(x.x, -x.y); }",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
"out vec4 sk_FragColor;\n"
@@ -371,7 +371,7 @@ DEF_TEST(SkSLNegatedAtan, r) {
" sk_FragColor.x = atan(x.x, -x.y);\n"
"}\n");
test(r,
- "void main() { vec2 x = vec2(sqrt(2)); sk_FragColor.r = atan(x.x, -x.y); }",
+ "void main() { float2 x = float2(sqrt(2)); sk_FragColor.r = atan(x.x, -x.y); }",
*SkSL::ShaderCapsFactory::MustForceNegatedAtanParamToFloat(),
"#version 400\n"
"out vec4 sk_FragColor;\n"
@@ -442,13 +442,13 @@ DEF_TEST(SkSLHex, r) {
DEF_TEST(SkSLVectorConstructors, r) {
test(r,
- "vec2 v1 = vec2(1);"
- "vec2 v2 = vec2(1, 2);"
- "vec2 v3 = vec2(vec2(1));"
- "vec3 v4 = vec3(vec2(1), 1.0);"
- "ivec2 v5 = ivec2(1);"
- "ivec2 v6 = ivec2(vec2(1, 2));"
- "vec2 v7 = vec2(ivec2(1, 2));",
+ "float2 v1 = float2(1);"
+ "float2 v2 = float2(1, 2);"
+ "float2 v3 = float2(float2(1));"
+ "float3 v4 = float3(float2(1), 1.0);"
+ "int2 v5 = int2(1);"
+ "int2 v6 = int2(float2(1, 2));"
+ "float2 v7 = float2(int2(1, 2));",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
"out vec4 sk_FragColor;\n"
@@ -464,8 +464,8 @@ DEF_TEST(SkSLVectorConstructors, r) {
DEF_TEST(SkSLArrayConstructors, r) {
test(r,
"float test1[] = float[](1, 2, 3, 4);"
- "vec2 test2[] = vec2[](vec2(1, 2), vec2(3, 4));"
- "mat4 test3[] = mat4[]();",
+ "float2 test2[] = float2[](float2(1, 2), float2(3, 4));"
+ "float4x4 test3[] = float4x4[]();",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
"out vec4 sk_FragColor;\n"
@@ -693,55 +693,55 @@ DEF_TEST(SkSLBoolFolding, r) {
DEF_TEST(SkSLVecFolding, r) {
test(r,
"void main() {"
- "sk_FragColor.r = vec4(0.5, 1, 1, 1).x;"
- "sk_FragColor = vec4(vec2(1), vec2(2, 3)) + vec4(5, 6, 7, 8);"
- "sk_FragColor = vec4(8, vec3(10)) - vec4(1);"
- "sk_FragColor = vec4(2) * vec4(1, 2, 3, 4);"
- "sk_FragColor = vec4(12) / vec4(1, 2, 3, 4);"
- "sk_FragColor.r = (vec4(12) / vec4(1, 2, 3, 4)).y;"
- "sk_FragColor.x = vec4(1) == vec4(1) ? 1.0 : -1.0;"
- "sk_FragColor.x = vec4(1) == vec4(2) ? 2.0 : -2.0;"
- "sk_FragColor.x = vec2(1) == vec2(1, 1) ? 3.0 : -3.0;"
- "sk_FragColor.x = vec2(1, 1) == vec2(1, 1) ? 4.0 : -4.0;"
- "sk_FragColor.x = vec2(1) == vec2(1, 0) ? 5.0 : -5.0;"
- "sk_FragColor.x = vec4(1) == vec4(vec2(1), vec2(1)) ? 6.0 : -6.0;"
- "sk_FragColor.x = vec4(vec3(1), 1) == vec4(vec2(1), vec2(1)) ? 7.0 : -7.0;"
- "sk_FragColor.x = vec4(vec3(1), 1) == vec4(vec2(1), 1, 0) ? 8.0 : -8.0;"
- "sk_FragColor.x = vec2(1) != vec2(1, 0) ? 9.0 : -9.0;"
- "sk_FragColor.x = vec4(1) != vec4(vec2(1), vec2(1)) ? 10.0 : -10.0;"
- "sk_FragColor = vec4(sqrt(1)) * vec4(1);"
- "sk_FragColor = vec4(1) * vec4(sqrt(2));"
- "sk_FragColor = vec4(0) * vec4(sqrt(3));"
- "sk_FragColor = vec4(sqrt(4)) * vec4(0);"
- "sk_FragColor = vec4(0) / vec4(sqrt(5));"
- "sk_FragColor = vec4(0) + vec4(sqrt(6));"
- "sk_FragColor = vec4(sqrt(7)) + vec4(0);"
- "sk_FragColor = vec4(sqrt(8)) - vec4(0);"
- "sk_FragColor = vec4(0) + sqrt(9);"
- "sk_FragColor = vec4(0) * sqrt(10);"
- "sk_FragColor = vec4(0) / sqrt(11);"
- "sk_FragColor = vec4(1) * sqrt(12);"
- "sk_FragColor = 0 + vec4(sqrt(13));"
- "sk_FragColor = 0 * vec4(sqrt(14));"
- "sk_FragColor = 0 / vec4(sqrt(15));"
- "sk_FragColor = 1 * vec4(sqrt(16));"
- "sk_FragColor = vec4(sqrt(17)) + 0;"
- "sk_FragColor = vec4(sqrt(18)) * 0;"
- "sk_FragColor = vec4(sqrt(19)) * 1;"
- "sk_FragColor = vec4(sqrt(19.5)) - 0;"
- "sk_FragColor = sqrt(20) * vec4(1);"
- "sk_FragColor = sqrt(21) + vec4(0);"
- "sk_FragColor = sqrt(22) - vec4(0);"
- "sk_FragColor = sqrt(23) / vec4(1);"
- "sk_FragColor = vec4(sqrt(24)) / 1;"
- "sk_FragColor += vec4(1);"
- "sk_FragColor += vec4(0);"
- "sk_FragColor -= vec4(1);"
- "sk_FragColor -= vec4(0);"
- "sk_FragColor *= vec4(1);"
- "sk_FragColor *= vec4(2);"
- "sk_FragColor /= vec4(1);"
- "sk_FragColor /= vec4(2);"
+ "sk_FragColor.r = float4(0.5, 1, 1, 1).x;"
+ "sk_FragColor = float4(float2(1), float2(2, 3)) + float4(5, 6, 7, 8);"
+ "sk_FragColor = float4(8, float3(10)) - float4(1);"
+ "sk_FragColor = float4(2) * float4(1, 2, 3, 4);"
+ "sk_FragColor = float4(12) / float4(1, 2, 3, 4);"
+ "sk_FragColor.r = (float4(12) / float4(1, 2, 3, 4)).y;"
+ "sk_FragColor.x = float4(1) == float4(1) ? 1.0 : -1.0;"
+ "sk_FragColor.x = float4(1) == float4(2) ? 2.0 : -2.0;"
+ "sk_FragColor.x = float2(1) == float2(1, 1) ? 3.0 : -3.0;"
+ "sk_FragColor.x = float2(1, 1) == float2(1, 1) ? 4.0 : -4.0;"
+ "sk_FragColor.x = float2(1) == float2(1, 0) ? 5.0 : -5.0;"
+ "sk_FragColor.x = float4(1) == float4(float2(1), float2(1)) ? 6.0 : -6.0;"
+ "sk_FragColor.x = float4(float3(1), 1) == float4(float2(1), float2(1)) ? 7.0 : -7.0;"
+ "sk_FragColor.x = float4(float3(1), 1) == float4(float2(1), 1, 0) ? 8.0 : -8.0;"
+ "sk_FragColor.x = float2(1) != float2(1, 0) ? 9.0 : -9.0;"
+ "sk_FragColor.x = float4(1) != float4(float2(1), float2(1)) ? 10.0 : -10.0;"
+ "sk_FragColor = float4(sqrt(1)) * float4(1);"
+ "sk_FragColor = float4(1) * float4(sqrt(2));"
+ "sk_FragColor = float4(0) * float4(sqrt(3));"
+ "sk_FragColor = float4(sqrt(4)) * float4(0);"
+ "sk_FragColor = float4(0) / float4(sqrt(5));"
+ "sk_FragColor = float4(0) + float4(sqrt(6));"
+ "sk_FragColor = float4(sqrt(7)) + float4(0);"
+ "sk_FragColor = float4(sqrt(8)) - float4(0);"
+ "sk_FragColor = float4(0) + sqrt(9);"
+ "sk_FragColor = float4(0) * sqrt(10);"
+ "sk_FragColor = float4(0) / sqrt(11);"
+ "sk_FragColor = float4(1) * sqrt(12);"
+ "sk_FragColor = 0 + float4(sqrt(13));"
+ "sk_FragColor = 0 * float4(sqrt(14));"
+ "sk_FragColor = 0 / float4(sqrt(15));"
+ "sk_FragColor = 1 * float4(sqrt(16));"
+ "sk_FragColor = float4(sqrt(17)) + 0;"
+ "sk_FragColor = float4(sqrt(18)) * 0;"
+ "sk_FragColor = float4(sqrt(19)) * 1;"
+ "sk_FragColor = float4(sqrt(19.5)) - 0;"
+ "sk_FragColor = sqrt(20) * float4(1);"
+ "sk_FragColor = sqrt(21) + float4(0);"
+ "sk_FragColor = sqrt(22) - float4(0);"
+ "sk_FragColor = sqrt(23) / float4(1);"
+ "sk_FragColor = float4(sqrt(24)) / 1;"
+ "sk_FragColor += float4(1);"
+ "sk_FragColor += float4(0);"
+ "sk_FragColor -= float4(1);"
+ "sk_FragColor -= float4(0);"
+ "sk_FragColor *= float4(1);"
+ "sk_FragColor *= float4(2);"
+ "sk_FragColor /= float4(1);"
+ "sk_FragColor /= float4(2);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -798,23 +798,24 @@ DEF_TEST(SkSLVecFolding, r) {
DEF_TEST(SkSLMatFolding, r) {
test(r,
"void main() {"
- "sk_FragColor.x = mat2(vec2(1.0, 0.0), vec2(0.0, 1.0)) == "
- "mat2(vec2(1.0, 0.0), vec2(0.0, 1.0)) ? 1 : -1;"
- "sk_FragColor.x = mat2(vec2(1.0, 0.0), vec2(1.0, 1.0)) == "
- "mat2(vec2(1.0, 0.0), vec2(0.0, 1.0)) ? 2 : -2;"
- "sk_FragColor.x = mat2(1) == mat2(1) ? 3 : -3;"
- "sk_FragColor.x = mat2(1) == mat2(0) ? 4 : -4;"
- "sk_FragColor.x = mat2(1) == mat2(vec2(1.0, 0.0), vec2(0.0, 1.0)) ? 5 : -5;"
- "sk_FragColor.x = mat2(2) == mat2(vec2(1.0, 0.0), vec2(0.0, 1.0)) ? 6 : -6;"
- "sk_FragColor.x = mat3x2(2) == mat3x2(vec2(2.0, 0.0), vec2(0.0, 2.0), vec2(0.0)) ? 7 : -7;"
- "sk_FragColor.x = mat2(1) != mat2(1) ? 8 : -8;"
- "sk_FragColor.x = mat2(1) != mat2(0) ? 9 : -9;"
- "sk_FragColor.x = mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 0.0)) == "
- "mat3(mat2(1.0)) ? 10 : -10;"
- "sk_FragColor.x = mat2(mat3(1.0)) == mat2(1.0) ? 11 : -11;"
- "sk_FragColor.x = mat2(vec4(1.0, 0.0, 0.0, 1.0)) == mat2(1.0) ? 12 : -12;"
- "sk_FragColor.x = mat2(1.0, 0.0, vec2(0.0, 1.0)) == mat2(1.0) ? 13 : -13;"
- "sk_FragColor.x = mat2(vec2(1.0, 0.0), 0.0, 1.0) == mat2(1.0) ? 14 : -14;"
+ "sk_FragColor.x = float2x2(float2(1.0, 0.0), float2(0.0, 1.0)) == "
+ "float2x2(float2(1.0, 0.0), float2(0.0, 1.0)) ? 1 : -1;"
+ "sk_FragColor.x = float2x2(float2(1.0, 0.0), float2(1.0, 1.0)) == "
+ "float2x2(float2(1.0, 0.0), float2(0.0, 1.0)) ? 2 : -2;"
+ "sk_FragColor.x = float2x2(1) == float2x2(1) ? 3 : -3;"
+ "sk_FragColor.x = float2x2(1) == float2x2(0) ? 4 : -4;"
+ "sk_FragColor.x = float2x2(1) == float2x2(float2(1.0, 0.0), float2(0.0, 1.0)) ? 5 : -5;"
+ "sk_FragColor.x = float2x2(2) == float2x2(float2(1.0, 0.0), float2(0.0, 1.0)) ? 6 : -6;"
+ "sk_FragColor.x = float3x2(2) == float3x2(float2(2.0, 0.0), float2(0.0, 2.0), float2(0.0))"
+ "? 7 : -7;"
+ "sk_FragColor.x = float2x2(1) != float2x2(1) ? 8 : -8;"
+ "sk_FragColor.x = float2x2(1) != float2x2(0) ? 9 : -9;"
+ "sk_FragColor.x = float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), "
+ "float3(0.0, 0.0, 0.0)) == float3x3(float2x2(1.0)) ? 10 : -10;"
+ "sk_FragColor.x = float2x2(float3x3(1.0)) == float2x2(1.0) ? 11 : -11;"
+ "sk_FragColor.x = float2x2(float4(1.0, 0.0, 0.0, 1.0)) == float2x2(1.0) ? 12 : -12;"
+ "sk_FragColor.x = float2x2(1.0, 0.0, float2(0.0, 1.0)) == float2x2(1.0) ? 13 : -13;"
+ "sk_FragColor.x = float2x2(float2(1.0, 0.0), 0.0, 1.0) == float2x2(1.0) ? 14 : -14;"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -866,7 +867,7 @@ DEF_TEST(SkSLCaps, r) {
"if (sk_Caps.fbFetchSupport) y = 1;"
"if (sk_Caps.dropsTileOnZeroDivide && sk_Caps.texelFetchSupport) z = 1;"
"if (sk_Caps.dropsTileOnZeroDivide && sk_Caps.canUseAnyFunctionInShader) w = 1;"
- "sk_FragColor = vec4(x, y, z, w);"
+ "sk_FragColor = float4(x, y, z, w);"
"}",
*SkSL::ShaderCapsFactory::VariousCaps(),
"#version 400\n"
@@ -881,11 +882,11 @@ DEF_TEST(SkSLTexture, r) {
"uniform sampler1D one;"
"uniform sampler2D two;"
"void main() {"
- "vec4 a = texture(one, 0);"
- "vec4 b = texture(two, vec2(0));"
- "vec4 c = texture(one, vec2(0));"
- "vec4 d = texture(two, vec3(0));"
- "sk_FragColor = vec4(a.x, b.x, c.x, d.x);"
+ "float4 a = texture(one, 0);"
+ "float4 b = texture(two, float2(0));"
+ "float4 c = texture(one, float2(0));"
+ "float4 d = texture(two, float3(0));"
+ "sk_FragColor = float4(a.x, b.x, c.x, d.x);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -903,11 +904,11 @@ DEF_TEST(SkSLTexture, r) {
"uniform sampler1D one;"
"uniform sampler2D two;"
"void main() {"
- "vec4 a = texture(one, 0);"
- "vec4 b = texture(two, vec2(0));"
- "vec4 c = texture(one, vec2(0));"
- "vec4 d = texture(two, vec3(0));"
- "sk_FragColor = vec4(a.x, b.x, c.x, d.x);"
+ "float4 a = texture(one, 0);"
+ "float4 b = texture(two, float2(0));"
+ "float4 c = texture(one, float2(0));"
+ "float4 d = texture(two, float3(0));"
+ "sk_FragColor = float4(a.x, b.x, c.x, d.x);"
"}",
*SkSL::ShaderCapsFactory::Version110(),
"#version 110\n"
@@ -1022,7 +1023,7 @@ DEF_TEST(SkSLClipDistance, r) {
"}\n",
SkSL::Program::kVertex_Kind);
test(r,
- "void main() { sk_FragColor = vec4(sk_ClipDistance[0]); }",
+ "void main() { sk_FragColor = float4(sk_ClipDistance[0]); }",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
"out vec4 sk_FragColor;\n"
@@ -1033,9 +1034,9 @@ DEF_TEST(SkSLClipDistance, r) {
DEF_TEST(SkSLArrayTypes, r) {
test(r,
- "void main() { vec2 x[2] = vec2[2](vec2(1), vec2(2));"
- "vec2[2] y = vec2[2](vec2(3), vec2(4));"
- "sk_FragColor = vec4(x[0], y[1]); }",
+ "void main() { float2 x[2] = float2[2](float2(1), float2(2));"
+ "float2[2] y = float2[2](float2(3), float2(4));"
+ "sk_FragColor = float4(x[0], y[1]); }",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
"out vec4 sk_FragColor;\n"
@@ -1051,9 +1052,9 @@ DEF_TEST(SkSLGeometry, r) {
"layout(invocations = 2) in;"
"layout(line_strip, max_vertices = 2) out;"
"void main() {"
- "gl_Position = sk_in[0].gl_Position + vec4(-0.5, 0, 0, sk_InvocationID);"
+ "gl_Position = sk_in[0].gl_Position + float4(-0.5, 0, 0, sk_InvocationID);"
"EmitVertex();"
- "gl_Position = sk_in[0].gl_Position + vec4(0.5, 0, 0, sk_InvocationID);"
+ "gl_Position = sk_in[0].gl_Position + float4(0.5, 0, 0, sk_InvocationID);"
"EmitVertex();"
"EndPrimitive();"
"}",
@@ -1087,7 +1088,7 @@ DEF_TEST(SkSLSwitch, r) {
" default:"
" x = 2.0;"
" }"
- " sk_FragColor = vec4(x);"
+ " sk_FragColor = float4(x);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1118,7 +1119,7 @@ DEF_TEST(SkSLSwitch, r) {
" default:"
" x = 2.0;"
" }"
- " sk_FragColor = vec4(x);"
+ " sk_FragColor = float4(x);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1144,7 +1145,7 @@ DEF_TEST(SkSLSwitch, r) {
" case 1:"
" x = 1.0;"
" }"
- " sk_FragColor = vec4(x);"
+ " sk_FragColor = float4(x);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1169,7 +1170,7 @@ DEF_TEST(SkSLSwitch, r) {
" case 1:"
" x = 1.0;"
" }"
- " sk_FragColor = vec4(x);"
+ " sk_FragColor = float4(x);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1187,7 +1188,7 @@ DEF_TEST(SkSLSwitch, r) {
" case 1:"
" x = 1.0;"
" }"
- " sk_FragColor = vec4(x);"
+ " sk_FragColor = float4(x);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1206,7 +1207,7 @@ DEF_TEST(SkSLSwitch, r) {
" case 1:"
" x = 1.0;"
" }"
- " sk_FragColor = vec4(x);"
+ " sk_FragColor = float4(x);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1225,7 +1226,7 @@ DEF_TEST(SkSLSwitch, r) {
" case 1:"
" x = 1.0;"
" }"
- " sk_FragColor = vec4(x);"
+ " sk_FragColor = float4(x);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1244,7 +1245,7 @@ DEF_TEST(SkSLSwitch, r) {
" case 1:"
" x = 1.0;"
" }"
- " sk_FragColor = vec4(x);"
+ " sk_FragColor = float4(x);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1266,7 +1267,7 @@ DEF_TEST(SkSLRectangleTexture, r) {
test(r,
"uniform sampler2D test;"
"void main() {"
- " sk_FragColor = texture(test, vec2(0.5));"
+ " sk_FragColor = texture(test, float2(0.5));"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1278,7 +1279,7 @@ DEF_TEST(SkSLRectangleTexture, r) {
test(r,
"uniform sampler2DRect test;"
"void main() {"
- " sk_FragColor = texture(test, vec2(0.5));"
+ " sk_FragColor = texture(test, float2(0.5));"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1290,7 +1291,7 @@ DEF_TEST(SkSLRectangleTexture, r) {
test(r,
"uniform sampler2DRect test;"
"void main() {"
- " sk_FragColor = texture(test, vec3(0.5));"
+ " sk_FragColor = texture(test, float3(0.5));"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1309,7 +1310,7 @@ DEF_TEST(SkSLUnusedVars, r) {
"float e = d;"
"b++;"
"d++;"
- "sk_FragColor = vec4(b, b, d, d);"
+ "sk_FragColor = float4(b, b, d, d);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1330,7 +1331,7 @@ DEF_TEST(SkSLMultipleAssignments, r) {
"float y;"
"int z;"
"x = y = z = 1;"
- "sk_FragColor = vec4(z);"
+ "sk_FragColor = float4(z);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1342,13 +1343,14 @@ DEF_TEST(SkSLMultipleAssignments, r) {
DEF_TEST(SkSLComplexDelete, r) {
test(r,
- "uniform mat4 colorXform;"
+ "uniform float4x4 colorXform;"
"uniform sampler2D sampler;"
"void main() {"
- "vec4 tmpColor;"
- "sk_FragColor = vec4(1.0) * (tmpColor = texture(sampler, vec2(1)) , "
- "colorXform != mat4(1.0) ? vec4(clamp((mat4(colorXform) * vec4(tmpColor.xyz, 1.0)).xyz, "
- "0.0, tmpColor.w), tmpColor.w) : tmpColor);"
+ "float4 tmpColor;"
+ "sk_FragColor = float4(1.0) * (tmpColor = texture(sampler, float2(1)) , "
+ "colorXform != float4x4(1.0) ? float4(clamp((float4x4(colorXform) * "
+ "float4(tmpColor.xyz, 1.0)).xyz, "
+ "0.0, tmpColor.w), tmpColor.w) : tmpColor);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1367,7 +1369,7 @@ DEF_TEST(SkSLDependentInitializers, r) {
test(r,
"void main() {"
"float x = 0.5, y = x * 2;"
- "sk_FragColor = vec4(y);"
+ "sk_FragColor = float4(y);"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -1401,11 +1403,11 @@ DEF_TEST(SkSLInvocations, r) {
"layout(invocations = 2) in;"
"layout(line_strip, max_vertices = 2) out;"
"void test() {"
- "gl_Position = sk_in[0].gl_Position + vec4(0.5, 0, 0, sk_InvocationID);"
+ "gl_Position = sk_in[0].gl_Position + float4(0.5, 0, 0, sk_InvocationID);"
"EmitVertex();"
"}"
"void main() {"
- "gl_Position = sk_in[0].gl_Position + vec4(-0.5, 0, 0, sk_InvocationID);"
+ "gl_Position = sk_in[0].gl_Position + float4(-0.5, 0, 0, sk_InvocationID);"
"EmitVertex();"
"}",
*SkSL::ShaderCapsFactory::MustImplementGSInvocationsWithLoop(),
diff --git a/tests/SkSLMemoryLayoutTest.cpp b/tests/SkSLMemoryLayoutTest.cpp
index ff3d0105bd..0a5d382e8a 100644
--- a/tests/SkSLMemoryLayoutTest.cpp
+++ b/tests/SkSLMemoryLayoutTest.cpp
@@ -18,43 +18,43 @@ DEF_TEST(SkSLMemoryLayout140Test, r) {
// basic types
REPORTER_ASSERT(r, 4 == layout.size(*context.fFloat_Type));
- REPORTER_ASSERT(r, 8 == layout.size(*context.fVec2_Type));
- REPORTER_ASSERT(r, 12 == layout.size(*context.fVec3_Type));
- REPORTER_ASSERT(r, 16 == layout.size(*context.fVec4_Type));
+ REPORTER_ASSERT(r, 8 == layout.size(*context.fFloat2_Type));
+ REPORTER_ASSERT(r, 12 == layout.size(*context.fFloat3_Type));
+ REPORTER_ASSERT(r, 16 == layout.size(*context.fFloat4_Type));
REPORTER_ASSERT(r, 4 == layout.size(*context.fInt_Type));
- REPORTER_ASSERT(r, 8 == layout.size(*context.fIVec2_Type));
- REPORTER_ASSERT(r, 12 == layout.size(*context.fIVec3_Type));
- REPORTER_ASSERT(r, 16 == layout.size(*context.fIVec4_Type));
+ REPORTER_ASSERT(r, 8 == layout.size(*context.fInt2_Type));
+ REPORTER_ASSERT(r, 12 == layout.size(*context.fInt3_Type));
+ REPORTER_ASSERT(r, 16 == layout.size(*context.fInt4_Type));
REPORTER_ASSERT(r, 1 == layout.size(*context.fBool_Type));
- REPORTER_ASSERT(r, 2 == layout.size(*context.fBVec2_Type));
- REPORTER_ASSERT(r, 3 == layout.size(*context.fBVec3_Type));
- REPORTER_ASSERT(r, 4 == layout.size(*context.fBVec4_Type));
- REPORTER_ASSERT(r, 32 == layout.size(*context.fMat2x2_Type));
- REPORTER_ASSERT(r, 32 == layout.size(*context.fMat2x4_Type));
- REPORTER_ASSERT(r, 48 == layout.size(*context.fMat3x3_Type));
- REPORTER_ASSERT(r, 64 == layout.size(*context.fMat4x2_Type));
- REPORTER_ASSERT(r, 64 == layout.size(*context.fMat4x4_Type));
+ REPORTER_ASSERT(r, 2 == layout.size(*context.fBool2_Type));
+ REPORTER_ASSERT(r, 3 == layout.size(*context.fBool3_Type));
+ REPORTER_ASSERT(r, 4 == layout.size(*context.fBool4_Type));
+ REPORTER_ASSERT(r, 32 == layout.size(*context.fFloat2x2_Type));
+ REPORTER_ASSERT(r, 32 == layout.size(*context.fFloat2x4_Type));
+ REPORTER_ASSERT(r, 48 == layout.size(*context.fFloat3x3_Type));
+ REPORTER_ASSERT(r, 64 == layout.size(*context.fFloat4x2_Type));
+ REPORTER_ASSERT(r, 64 == layout.size(*context.fFloat4x4_Type));
REPORTER_ASSERT(r, 4 == layout.alignment(*context.fFloat_Type));
- REPORTER_ASSERT(r, 8 == layout.alignment(*context.fVec2_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fVec3_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fVec4_Type));
+ REPORTER_ASSERT(r, 8 == layout.alignment(*context.fFloat2_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat3_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat4_Type));
REPORTER_ASSERT(r, 4 == layout.alignment(*context.fInt_Type));
- REPORTER_ASSERT(r, 8 == layout.alignment(*context.fIVec2_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fIVec3_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fIVec4_Type));
+ REPORTER_ASSERT(r, 8 == layout.alignment(*context.fInt2_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fInt3_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fInt4_Type));
REPORTER_ASSERT(r, 1 == layout.alignment(*context.fBool_Type));
- REPORTER_ASSERT(r, 2 == layout.alignment(*context.fBVec2_Type));
- REPORTER_ASSERT(r, 4 == layout.alignment(*context.fBVec3_Type));
- REPORTER_ASSERT(r, 4 == layout.alignment(*context.fBVec4_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fMat2x2_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fMat2x4_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fMat3x3_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fMat4x2_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fMat4x4_Type));
+ REPORTER_ASSERT(r, 2 == layout.alignment(*context.fBool2_Type));
+ REPORTER_ASSERT(r, 4 == layout.alignment(*context.fBool3_Type));
+ REPORTER_ASSERT(r, 4 == layout.alignment(*context.fBool4_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat2x2_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat2x4_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat3x3_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat4x2_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat4x4_Type));
// struct 1
std::vector<SkSL::Type::Field> fields1;
- fields1.emplace_back(SkSL::Modifiers(), SkString("a"), context.fVec3_Type.get());
+ fields1.emplace_back(SkSL::Modifiers(), SkString("a"), context.fFloat3_Type.get());
SkSL::Type s1(SkSL::Position(), SkString("s1"), fields1);
REPORTER_ASSERT(r, 16 == layout.size(s1));
REPORTER_ASSERT(r, 16 == layout.alignment(s1));
@@ -76,7 +76,7 @@ DEF_TEST(SkSLMemoryLayout140Test, r) {
REPORTER_ASSERT(r, 16 == layout.size(s4));
REPORTER_ASSERT(r, 16 == layout.alignment(s4));
- fields2.emplace_back(SkSL::Modifiers(), SkString("b"), context.fVec3_Type.get());
+ fields2.emplace_back(SkSL::Modifiers(), SkString("b"), context.fFloat3_Type.get());
SkSL::Type s5(SkSL::Position(), SkString("s5"), fields2);
REPORTER_ASSERT(r, 32 == layout.size(s5));
REPORTER_ASSERT(r, 16 == layout.alignment(s5));
@@ -87,7 +87,7 @@ DEF_TEST(SkSLMemoryLayout140Test, r) {
REPORTER_ASSERT(r, 16 == layout.alignment(array1));
REPORTER_ASSERT(r, 16 == layout.stride(array1));
- SkSL::Type array2(SkString("vec4[4]"), SkSL::Type::kArray_Kind, *context.fVec4_Type, 4);
+ SkSL::Type array2(SkString("float4[4]"), SkSL::Type::kArray_Kind, *context.fFloat4_Type, 4);
REPORTER_ASSERT(r, 64 == layout.size(array2));
REPORTER_ASSERT(r, 16 == layout.alignment(array2));
REPORTER_ASSERT(r, 16 == layout.stride(array2));
@@ -99,43 +99,43 @@ DEF_TEST(SkSLMemoryLayout430Test, r) {
// basic types
REPORTER_ASSERT(r, 4 == layout.size(*context.fFloat_Type));
- REPORTER_ASSERT(r, 8 == layout.size(*context.fVec2_Type));
- REPORTER_ASSERT(r, 12 == layout.size(*context.fVec3_Type));
- REPORTER_ASSERT(r, 16 == layout.size(*context.fVec4_Type));
+ REPORTER_ASSERT(r, 8 == layout.size(*context.fFloat2_Type));
+ REPORTER_ASSERT(r, 12 == layout.size(*context.fFloat3_Type));
+ REPORTER_ASSERT(r, 16 == layout.size(*context.fFloat4_Type));
REPORTER_ASSERT(r, 4 == layout.size(*context.fInt_Type));
- REPORTER_ASSERT(r, 8 == layout.size(*context.fIVec2_Type));
- REPORTER_ASSERT(r, 12 == layout.size(*context.fIVec3_Type));
- REPORTER_ASSERT(r, 16 == layout.size(*context.fIVec4_Type));
+ REPORTER_ASSERT(r, 8 == layout.size(*context.fInt2_Type));
+ REPORTER_ASSERT(r, 12 == layout.size(*context.fInt3_Type));
+ REPORTER_ASSERT(r, 16 == layout.size(*context.fInt4_Type));
REPORTER_ASSERT(r, 1 == layout.size(*context.fBool_Type));
- REPORTER_ASSERT(r, 2 == layout.size(*context.fBVec2_Type));
- REPORTER_ASSERT(r, 3 == layout.size(*context.fBVec3_Type));
- REPORTER_ASSERT(r, 4 == layout.size(*context.fBVec4_Type));
- REPORTER_ASSERT(r, 16 == layout.size(*context.fMat2x2_Type));
- REPORTER_ASSERT(r, 32 == layout.size(*context.fMat2x4_Type));
- REPORTER_ASSERT(r, 48 == layout.size(*context.fMat3x3_Type));
- REPORTER_ASSERT(r, 32 == layout.size(*context.fMat4x2_Type));
- REPORTER_ASSERT(r, 64 == layout.size(*context.fMat4x4_Type));
+ REPORTER_ASSERT(r, 2 == layout.size(*context.fBool2_Type));
+ REPORTER_ASSERT(r, 3 == layout.size(*context.fBool3_Type));
+ REPORTER_ASSERT(r, 4 == layout.size(*context.fBool4_Type));
+ REPORTER_ASSERT(r, 16 == layout.size(*context.fFloat2x2_Type));
+ REPORTER_ASSERT(r, 32 == layout.size(*context.fFloat2x4_Type));
+ REPORTER_ASSERT(r, 48 == layout.size(*context.fFloat3x3_Type));
+ REPORTER_ASSERT(r, 32 == layout.size(*context.fFloat4x2_Type));
+ REPORTER_ASSERT(r, 64 == layout.size(*context.fFloat4x4_Type));
REPORTER_ASSERT(r, 4 == layout.alignment(*context.fFloat_Type));
- REPORTER_ASSERT(r, 8 == layout.alignment(*context.fVec2_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fVec3_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fVec4_Type));
+ REPORTER_ASSERT(r, 8 == layout.alignment(*context.fFloat2_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat3_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat4_Type));
REPORTER_ASSERT(r, 4 == layout.alignment(*context.fInt_Type));
- REPORTER_ASSERT(r, 8 == layout.alignment(*context.fIVec2_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fIVec3_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fIVec4_Type));
+ REPORTER_ASSERT(r, 8 == layout.alignment(*context.fInt2_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fInt3_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fInt4_Type));
REPORTER_ASSERT(r, 1 == layout.alignment(*context.fBool_Type));
- REPORTER_ASSERT(r, 2 == layout.alignment(*context.fBVec2_Type));
- REPORTER_ASSERT(r, 4 == layout.alignment(*context.fBVec3_Type));
- REPORTER_ASSERT(r, 4 == layout.alignment(*context.fBVec4_Type));
- REPORTER_ASSERT(r, 8 == layout.alignment(*context.fMat2x2_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fMat2x4_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fMat3x3_Type));
- REPORTER_ASSERT(r, 8 == layout.alignment(*context.fMat4x2_Type));
- REPORTER_ASSERT(r, 16 == layout.alignment(*context.fMat4x4_Type));
+ REPORTER_ASSERT(r, 2 == layout.alignment(*context.fBool2_Type));
+ REPORTER_ASSERT(r, 4 == layout.alignment(*context.fBool3_Type));
+ REPORTER_ASSERT(r, 4 == layout.alignment(*context.fBool4_Type));
+ REPORTER_ASSERT(r, 8 == layout.alignment(*context.fFloat2x2_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat2x4_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat3x3_Type));
+ REPORTER_ASSERT(r, 8 == layout.alignment(*context.fFloat4x2_Type));
+ REPORTER_ASSERT(r, 16 == layout.alignment(*context.fFloat4x4_Type));
// struct 1
std::vector<SkSL::Type::Field> fields1;
- fields1.emplace_back(SkSL::Modifiers(), SkString("a"), context.fVec3_Type.get());
+ fields1.emplace_back(SkSL::Modifiers(), SkString("a"), context.fFloat3_Type.get());
SkSL::Type s1(SkSL::Position(), SkString("s1"), fields1);
REPORTER_ASSERT(r, 16 == layout.size(s1));
REPORTER_ASSERT(r, 16 == layout.alignment(s1));
@@ -157,7 +157,7 @@ DEF_TEST(SkSLMemoryLayout430Test, r) {
REPORTER_ASSERT(r, 4 == layout.size(s4));
REPORTER_ASSERT(r, 4 == layout.alignment(s4));
- fields2.emplace_back(SkSL::Modifiers(), SkString("b"), context.fVec3_Type.get());
+ fields2.emplace_back(SkSL::Modifiers(), SkString("b"), context.fFloat3_Type.get());
SkSL::Type s5(SkSL::Position(), SkString("s5"), fields2);
REPORTER_ASSERT(r, 32 == layout.size(s5));
REPORTER_ASSERT(r, 16 == layout.alignment(s5));
@@ -168,7 +168,7 @@ DEF_TEST(SkSLMemoryLayout430Test, r) {
REPORTER_ASSERT(r, 4 == layout.alignment(array1));
REPORTER_ASSERT(r, 4 == layout.stride(array1));
- SkSL::Type array2(SkString("vec4[4]"), SkSL::Type::kArray_Kind, *context.fVec4_Type, 4);
+ SkSL::Type array2(SkString("float4[4]"), SkSL::Type::kArray_Kind, *context.fFloat4_Type, 4);
REPORTER_ASSERT(r, 64 == layout.size(array2));
REPORTER_ASSERT(r, 16 == layout.alignment(array2));
REPORTER_ASSERT(r, 16 == layout.stride(array2));