skia2/src/sksl/SkSLCodeGenerator.h
Ethan Nicholas 34b19c5750 SkSL optimization now happens in convertProgram rather than being a
separate step.

This ended up uncovering an optimization bug. SkSLNonConstantCase
started failing; it turns out that the optimizer was never being run on
this test, and so we hadn't noticed that it didn't actually work in the
presence of optimization.

Change-Id: Iff1d330be7534113b86f86b00c39f91282903ae3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316568
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-14 16:34:47 +00:00

41 lines
790 B
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SKSL_CODEGENERATOR
#define SKSL_CODEGENERATOR
#include "src/sksl/SkSLOutputStream.h"
#include "src/sksl/ir/SkSLProgram.h"
namespace SkSL {
/**
* Abstract superclass of all code generators, which take a Program as input and produce code as
* output.
*/
class CodeGenerator {
public:
CodeGenerator(const Program* program, ErrorReporter* errors, OutputStream* out)
: fProgram(*program)
, fErrors(*errors)
, fOut(out) {}
virtual ~CodeGenerator() {}
virtual bool generateCode() = 0;
protected:
const Program& fProgram;
ErrorReporter& fErrors;
OutputStream* fOut;
};
} // namespace SkSL
#endif