Switch to using intrinsicKind to detect "sample" calls

Change-Id: I2b6b3ec24e42859b811de0125276f1d33d5f5037
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425181
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
Brian Osman 2021-07-07 10:43:47 -04:00 committed by Skia Commit-Bot
parent 78b7397995
commit 66657d17c6

View File

@ -66,7 +66,7 @@ namespace {
static bool is_sample_call_to_fp(const FunctionCall& fc, const Variable& fp) {
const FunctionDeclaration& f = fc.function();
return f.isBuiltin() && f.name() == "sample" && fc.arguments().size() >= 1 &&
return f.intrinsicKind() == k_sample_IntrinsicKind && fc.arguments().size() >= 1 &&
fc.arguments()[0]->is<VariableReference>() &&
fc.arguments()[0]->as<VariableReference>().variable() == &fp;
}
@ -159,7 +159,7 @@ public:
bool visitExpression(const Expression& e) override {
if (e.is<FunctionCall>()) {
const FunctionDeclaration& f = e.as<FunctionCall>().function();
if (f.isBuiltin() && f.name() == "sample") {
if (f.intrinsicKind() == k_sample_IntrinsicKind) {
return true;
}
}