Skip to content

Commit bc6fb27

Browse files
Ethan NicholasSkia Commit-Bot
authored andcommitted
SkSL CPP and H backends no longer emitted in non-dev builds
As these backends are never used at runtime, it's pointless to include them in the Skia binaries. We still include them in GR_TEST_UTILS mode to support unit tests. Change-Id: I9ec9cc9300b74c501985656323ec894008255a70 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311454 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
1 parent 4a56f4c commit bc6fb27

File tree

8 files changed

+31
-3
lines changed

8 files changed

+31
-3
lines changed

src/sksl/SkSLCPPCodeGenerator.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
#include <algorithm>
1717

18+
#if defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
19+
1820
namespace SkSL {
1921

2022
static bool needs_uniform_var(const Variable& var) {
@@ -1421,3 +1423,5 @@ bool CPPCodeGenerator::generateCode() {
14211423
}
14221424

14231425
} // namespace SkSL
1426+
1427+
#endif // defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)

src/sksl/SkSLCPPCodeGenerator.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include <set>
1515

16+
#if defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
17+
1618
namespace SkSL {
1719

1820
class CPPCodeGenerator : public GLSLCodeGenerator {
@@ -145,4 +147,6 @@ class CPPCodeGenerator : public GLSLCodeGenerator {
145147

146148
} // namespace SkSL
147149

148-
#endif
150+
#endif // defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
151+
152+
#endif // SKSL_CPPCODEGENERATOR

src/sksl/SkSLCPPUniformCTypes.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#include <vector>
1313

14+
#if defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
15+
1416
namespace SkSL {
1517

1618
/////////////////////////
@@ -232,3 +234,5 @@ const UniformCTypeMapper* UniformCTypeMapper::Get(const Context& context, const
232234
}
233235

234236
} // namespace SkSL
237+
238+
#endif // defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)

src/sksl/SkSLCPPUniformCTypes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "src/sksl/ir/SkSLType.h"
1414
#include "src/sksl/ir/SkSLVariable.h"
1515

16+
#if defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
17+
1618
namespace SkSL {
1719

1820
// This uses templates to define dirtyExpression(), saveState() and setUniform(). Each template can
@@ -130,4 +132,6 @@ class UniformCTypeMapper {
130132

131133
} // namespace SkSL
132134

135+
#endif // defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
136+
133137
#endif // SkSLUniformCTypes_DEFINED

src/sksl/SkSLCompiler.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,7 @@ bool Compiler::toMetal(Program& program, String* out) {
17561756
return result;
17571757
}
17581758

1759+
#if defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
17591760
bool Compiler::toCPP(Program& program, String name, OutputStream& out) {
17601761
if (!this->optimize(program)) {
17611762
return false;
@@ -1777,8 +1778,9 @@ bool Compiler::toH(Program& program, String name, OutputStream& out) {
17771778
fSource = nullptr;
17781779
return result;
17791780
}
1781+
#endif // defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
17801782

1781-
#endif
1783+
#endif // defined(SKSL_STANDALONE) || SK_SUPPORT_GPU
17821784

17831785
#if !defined(SKSL_STANDALONE) && SK_SUPPORT_GPU
17841786
bool Compiler::toPipelineStage(Program& program, PipelineStageArgs* outArgs) {

src/sksl/SkSLCompiler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ class SK_API Compiler : public ErrorReporter {
141141

142142
bool toMetal(Program& program, String* out);
143143

144+
#if defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
144145
bool toCPP(Program& program, String name, OutputStream& out);
145146

146147
bool toH(Program& program, String name, OutputStream& out);
148+
#endif
147149

148150
std::unique_ptr<ByteCode> toByteCode(Program& program);
149151

src/sksl/SkSLHCodeGenerator.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include <set>
2121

22+
#if defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
23+
2224
namespace SkSL {
2325

2426
HCodeGenerator::HCodeGenerator(const Context* context, const Program* program,
@@ -383,3 +385,5 @@ bool HCodeGenerator::generateCode() {
383385
}
384386

385387
} // namespace SkSL
388+
389+
#endif // defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)

src/sksl/SkSLHCodeGenerator.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
#include <cctype>
1717

18+
#if defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
19+
1820
constexpr const char* kFragmentProcessorHeader =
1921
R"(
2022
/**************************************************************************************************
@@ -83,4 +85,6 @@ class HCodeGenerator : public CodeGenerator {
8385

8486
} // namespace SkSL
8587

86-
#endif
88+
#endif // defined(SKSL_STANDALONE) || defined(GR_TEST_UTILS)
89+
90+
#endif // SKSL_HCODEGENERATOR

0 commit comments

Comments
 (0)