Revert "fixed constant vector swizzling"
This reverts commit8ac36a577f
. Reason for revert: Need to revert88d99c6387
Original change's description: > fixed constant vector swizzling > > Bug: skia: > Change-Id: I2d205bf7242d2223c4939c3e7897db9aba02c705 > Reviewed-on: https://skia-review.googlesource.com/35640 > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> TBR=bsalomon@google.com,ethannicholas@google.com Change-Id: I0b0ee62b9173beed9513947244e37d5a528f85a3 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/35704 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
b0d88eda90
commit
23f92277b9
@ -50,17 +50,6 @@ struct Constructor : public Expression {
|
|||||||
&fType));
|
&fType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fArguments.size() == 1 && fArguments[0]->fKind == Expression::kFloatLiteral_Kind) {
|
|
||||||
if (fType == *irGenerator.fContext.fFloat_Type ||
|
|
||||||
fType == *irGenerator.fContext.fHalf_Type) {
|
|
||||||
// convert float(1.0) to 1.0
|
|
||||||
double floatValue = ((FloatLiteral&) *fArguments[0]).fValue;
|
|
||||||
return std::unique_ptr<Expression>(new FloatLiteral(irGenerator.fContext,
|
|
||||||
fPosition,
|
|
||||||
floatValue,
|
|
||||||
&fType));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,15 +94,13 @@ struct Swizzle : public Expression {
|
|||||||
if (fBase->fKind == Expression::kConstructor_Kind && fBase->isConstant()) {
|
if (fBase->fKind == Expression::kConstructor_Kind && fBase->isConstant()) {
|
||||||
// we're swizzling a constant vector, e.g. float4(1).x. Simplify it.
|
// we're swizzling a constant vector, e.g. float4(1).x. Simplify it.
|
||||||
ASSERT(fBase->fKind == Expression::kConstructor_Kind);
|
ASSERT(fBase->fKind == Expression::kConstructor_Kind);
|
||||||
if (fType == *irGenerator.fContext.fInt_Type ||
|
if (fType == *irGenerator.fContext.fInt_Type) {
|
||||||
fType == *irGenerator.fContext.fShort_Type) {
|
|
||||||
ASSERT(fComponents.size() == 1);
|
ASSERT(fComponents.size() == 1);
|
||||||
int64_t value = ((Constructor&) *fBase).getIVecComponent(fComponents[0]);
|
int64_t value = ((Constructor&) *fBase).getIVecComponent(fComponents[0]);
|
||||||
return std::unique_ptr<Expression>(new IntLiteral(irGenerator.fContext,
|
return std::unique_ptr<Expression>(new IntLiteral(irGenerator.fContext,
|
||||||
Position(),
|
Position(),
|
||||||
value));
|
value));
|
||||||
} else if (fType == *irGenerator.fContext.fFloat_Type ||
|
} else if (fType == *irGenerator.fContext.fFloat_Type) {
|
||||||
fType == *irGenerator.fContext.fHalf_Type) {
|
|
||||||
ASSERT(fComponents.size() == 1);
|
ASSERT(fComponents.size() == 1);
|
||||||
double value = ((Constructor&) *fBase).getFVecComponent(fComponents[0]);
|
double value = ((Constructor&) *fBase).getFVecComponent(fComponents[0]);
|
||||||
return std::unique_ptr<Expression>(new FloatLiteral(irGenerator.fContext,
|
return std::unique_ptr<Expression>(new FloatLiteral(irGenerator.fContext,
|
||||||
|
@ -1573,17 +1573,4 @@ DEF_TEST(SkSLNumberConversions, r) {
|
|||||||
"float f2f = f;\n");
|
"float f2f = f;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_TEST(SkSLConstantSwizzleComparison, r) {
|
|
||||||
test(r,
|
|
||||||
"void main() { if (half4(1.0).x == half4(1.0).y) { sk_FragColor = half4(1.0); } }",
|
|
||||||
*SkSL::ShaderCapsFactory::Default(),
|
|
||||||
"#version 400\n"
|
|
||||||
"out vec4 sk_FragColor;\n"
|
|
||||||
"void main() {\n"
|
|
||||||
" {\n"
|
|
||||||
" sk_FragColor = vec4(1.0);\n"
|
|
||||||
" }\n"
|
|
||||||
"}\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user