SkSLExtension.h 786 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright 2016 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. #ifndef SKSL_EXTENSION
  8. #define SKSL_EXTENSION
  9. #include "src/sksl/ir/SkSLProgramElement.h"
  10. namespace SkSL {
  11. /**
  12. * An extension declaration.
  13. */
  14. struct Extension : public ProgramElement {
  15. Extension(int offset, String name)
  16. : INHERITED(offset, kExtension_Kind)
  17. , fName(std::move(name)) {}
  18. std::unique_ptr<ProgramElement> clone() const override {
  19. return std::unique_ptr<ProgramElement>(new Extension(fOffset, fName));
  20. }
  21. String description() const override {
  22. return "#extension " + fName + " : enable";
  23. }
  24. const String fName;
  25. typedef ProgramElement INHERITED;
  26. };
  27. } // namespace
  28. #endif