SkSLSetting.cpp 635 B

12345678910111213141516171819202122
  1. /*
  2. * Copyright 2017 Google Inc.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #include "src/sksl/SkSLIRGenerator.h"
  8. #include "src/sksl/ir/SkSLSetting.h"
  9. #include "src/sksl/ir/SkSLVariableReference.h"
  10. namespace SkSL {
  11. std::unique_ptr<Expression> Setting::constantPropagate(const IRGenerator& irGenerator,
  12. const DefinitionMap& definitions) {
  13. if (irGenerator.fSettings->fReplaceSettings) {
  14. return VariableReference::copy_constant(irGenerator, fValue.get());
  15. }
  16. return nullptr;
  17. }
  18. } // namespace