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));
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -94,15 +94,13 @@ struct Swizzle : public Expression {
|
||||
if (fBase->fKind == Expression::kConstructor_Kind && fBase->isConstant()) {
|
||||
// we're swizzling a constant vector, e.g. float4(1).x. Simplify it.
|
||||
ASSERT(fBase->fKind == Expression::kConstructor_Kind);
|
||||
if (fType == *irGenerator.fContext.fInt_Type ||
|
||||
fType == *irGenerator.fContext.fShort_Type) {
|
||||
if (fType == *irGenerator.fContext.fInt_Type) {
|
||||
ASSERT(fComponents.size() == 1);
|
||||
int64_t value = ((Constructor&) *fBase).getIVecComponent(fComponents[0]);
|
||||
return std::unique_ptr<Expression>(new IntLiteral(irGenerator.fContext,
|
||||
Position(),
|
||||
value));
|
||||
} else if (fType == *irGenerator.fContext.fFloat_Type ||
|
||||
fType == *irGenerator.fContext.fHalf_Type) {
|
||||
} else if (fType == *irGenerator.fContext.fFloat_Type) {
|
||||
ASSERT(fComponents.size() == 1);
|
||||
double value = ((Constructor&) *fBase).getFVecComponent(fComponents[0]);
|
||||
return std::unique_ptr<Expression>(new FloatLiteral(irGenerator.fContext,
|
||||
|
@ -1573,17 +1573,4 @@ DEF_TEST(SkSLNumberConversions, r) {
|
||||
"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
|
||||
|
Loading…
Reference in New Issue
Block a user