Revert "[sksl] Make sksl tracing optional"

This reverts commit 6bc4bdf645.

Reason for revert: Android roll

Original change's description:
> [sksl] Make sksl tracing optional
>
> This removes the required dependency on our JSON code. In the Bazel
> rules, this dependency is pushed down into sksl instead of required
> by the cc_binary rules.
>
> It adds a stub version of SkVMDebugTrace.cpp and removes
> SkVMDebugTracePlayer unless the appropriate GN or Bazel flag
> is set (skia_enable_sksl_tracing and enable_sksl_tracing,
> respectively). There was an existing #define that CanvasKit
> used (CK_INCLUDE_SKSL_TRACE) and this was changed to
> SKSL_ENABLE_TRACING.
>
> Users of //:skia_core no longer need to specify a JSON dep,
> if sksl needs it (e.g. for tracing), then it will specify
> the dependency.
>
> Change-Id: I2fcd29cde118fc391c269ba2d8f8a40a6f164c99
> Bug: skia:12541
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528837
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Kevin Lubick <kjlubick@google.com>

Bug: skia:12541
Change-Id: Icf75495f19e409d96925ca4dca9e839eca4057ec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529129
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
This commit is contained in:
John Stiles 2022-04-11 17:41:47 +00:00 committed by SkCQ
parent d459e5c70f
commit 471fd2eb09
14 changed files with 29 additions and 87 deletions

View File

@ -30,8 +30,7 @@ build --flag_alias=enable_vma=//bazel/common_config_settings:use_vulkan_memory_a
build --flag_alias=disable_vma=no//bazel/common_config_settings:use_vulkan_memory_allocator
build --flag_alias=enable_skslc=//bazel/common_config_settings:enable_skslc
build --flag_alias=disable_skslc=no//bazel/common_config_settings:enable_skslc
build --flag_alias=enable_sksl_tracing=//bazel/common_config_settings:enable_sksl_tracing
build --flag_alias=disable_sksl_tracing=no//bazel/common_config_settings:enable_sksl_tracing
# CanvasKit flags
build --flag_alias=ck_enable_fonts=//modules/canvaskit:enable_fonts
build --flag_alias=ck_disable_fonts=no//modules/canvaskit:enable_fonts

View File

@ -711,7 +711,6 @@ if (skia_compile_sksl_tests) {
# Build skslc.
skia_executable("skslc") {
defines = [
"SKSL_ENABLE_TRACING",
"SKSL_STANDALONE",
"SK_DISABLE_TRACING",
"SK_ENABLE_SPIRV_CROSS",
@ -1374,11 +1373,6 @@ skia_component("skia") {
if (skia_enable_sksl) {
deps += [ ":dehydrate_sksl" ]
sources += skia_sksl_sources
if (skia_enable_sksl_tracing) {
defines += [ "SKSL_ENABLE_TRACING" ]
sources += skia_sksl_tracing_sources
}
}
if (skia_build_for_debugger) {

View File

@ -33,11 +33,6 @@ GENERAL_DEFINES = [
"SK_ENABLE_SPIRV_VALIDATION",
],
"//conditions:default": [],
}) + select({
"//bazel/common_config_settings:enable_sksl_tracing_true": [
"SKSL_ENABLE_TRACING",
],
"//conditions:default": [],
})
GPU_DEFINES = select({

View File

@ -7,7 +7,6 @@ It is based off of https://github.com/bazelbuild/examples/tree/main/rules/starla
"""
_bool_flags = [
"//bazel/common_config_settings:enable_sksl_tracing",
"//bazel/common_config_settings:enable_skslc",
"//bazel/common_config_settings:is_skia_dev_build",
"//bazel/common_config_settings:use_icu",

View File

@ -197,16 +197,6 @@ bool_flag(
flag_name = "disable_effect_serialization",
)
bool_flag(
default = False,
flag_name = "enable_skslc",
)
bool_flag(
default = False,
flag_name = "enable_sksl_tracing",
)
bool_flag(
default = False,
flag_name = "is_skia_dev_build",
@ -217,3 +207,9 @@ bool_flag(
flag_name = "use_vulkan_memory_allocator",
public = False, # Users should use :vulkan_with_vma
)
bool_flag(
default = False,
flag_name = "enable_skslc",
)

View File

@ -23,6 +23,7 @@ cc_binary_with_flags(
},
deps = [
"//:skia_core",
"//src/utils:json_srcs",
"//tools/sk_app",
],
)
@ -45,6 +46,7 @@ cc_binary_with_flags(
},
deps = [
"//:skia_core",
"//src/utils:json_srcs",
"//tools/sk_app",
],
)
@ -67,6 +69,7 @@ cc_binary_with_flags(
},
deps = [
"//:skia_core",
"//src/utils:json_srcs",
"//tools/sk_app",
],
)

View File

@ -25,7 +25,6 @@ declare_args() {
skia_enable_skottie = !(is_win && is_component_build) ||
(is_wasm && skia_canvaskit_enable_skottie)
skia_enable_sksl = true
skia_enable_sksl_tracing = is_skia_dev_build
skia_enable_skvm_jit_when_possible = is_skia_dev_build
skia_enable_svg = !is_component_build
skia_enable_tools = is_skia_dev_build

View File

@ -204,6 +204,8 @@ skia_sksl_sources = [
"$_src/sksl/spirv.h",
"$_src/sksl/tracing/SkVMDebugTrace.cpp",
"$_src/sksl/tracing/SkVMDebugTrace.h",
"$_src/sksl/tracing/SkVMDebugTracePlayer.cpp",
"$_src/sksl/tracing/SkVMDebugTracePlayer.h",
"$_src/sksl/transform/SkSLBuiltinVariableScanner.cpp",
"$_src/sksl/transform/SkSLEliminateDeadFunctions.cpp",
"$_src/sksl/transform/SkSLEliminateDeadGlobalVariables.cpp",
@ -212,11 +214,6 @@ skia_sksl_sources = [
"$_src/sksl/transform/SkSLTransform.h",
]
skia_sksl_tracing_sources = [
"$_src/sksl/tracing/SkVMDebugTracePlayer.cpp",
"$_src/sksl/tracing/SkVMDebugTracePlayer.h",
]
skia_sksl_gpu_sources = [
"$_src/sksl/codegen/SkSLCodeGenerator.h",
"$_src/sksl/codegen/SkSLGLSLCodeGenerator.cpp",

View File

@ -138,6 +138,9 @@ CK_DEFINES = [
}) + select({
":enable_runtime_effect_true": ["CK_INCLUDE_RUNTIME_EFFECT=1"],
":enable_runtime_effect_false": [],
}) + select({
":enable_sksl_tracing_true": ["CK_INCLUDE_SKSL_TRACE=1"],
":enable_sksl_tracing_false": [],
})
CK_RELEASE_OPTS = [
@ -348,9 +351,6 @@ cc_binary_with_flags(
"use_icu": [
"True",
],
"enable_sksl_tracing": [
"True",
],
"shaper_backend": [
"harfbuzz_shaper",
],
@ -421,6 +421,11 @@ bool_flag(
flag_name = "enable_runtime_effect",
)
bool_flag(
default = True,
flag_name = "enable_sksl_tracing",
)
bool_flag(
default = True,
flag_name = "include_matrix_js",

View File

@ -369,6 +369,9 @@ skia_wasm_lib("canvaskit") {
if (skia_canvaskit_enable_rt_shader) {
defines += [ "CK_INCLUDE_RUNTIME_EFFECT" ]
}
if (skia_canvaskit_enable_sksl_trace) {
defines += [ "CK_INCLUDE_SKSL_TRACE" ]
}
if (!skia_canvaskit_enable_alias_font) {
defines += [ "CANVASKIT_NO_ALIAS_FONT" ]
}
@ -379,7 +382,4 @@ skia_wasm_lib("canvaskit") {
if (!skia_canvaskit_enable_font) {
defines += [ "CK_NO_FONTS" ]
}
if (skia_enable_sksl_tracing) {
defines += [ "SKSL_ENABLE_TRACING" ]
}
}

View File

@ -89,7 +89,7 @@
#include "include/pathops/SkPathOps.h"
#endif
#if defined(CK_INCLUDE_RUNTIME_EFFECT) && defined(SKSL_ENABLE_TRACING)
#if defined(CK_INCLUDE_RUNTIME_EFFECT) && defined(CK_INCLUDE_SKSL_TRACE)
#include "include/sksl/SkSLDebugTrace.h"
#endif
@ -1802,7 +1802,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
}), allow_raw_pointers());
#ifdef CK_INCLUDE_RUNTIME_EFFECT
#ifdef SKSL_ENABLE_TRACING
#ifdef CK_INCLUDE_SKSL_TRACE
class_<SkSL::DebugTrace>("DebugTrace")
.smart_ptr<sk_sp<SkSL::DebugTrace>>("sk_sp<DebugTrace>")
.function("writeTrace", optional_override([](SkSL::DebugTrace& self) -> std::string {
@ -1830,7 +1830,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
}
return effect;
}))
#ifdef SKSL_ENABLE_TRACING
#ifdef CK_INCLUDE_SKSL_TRACE
.class_function("MakeTraced", optional_override([](
sk_sp<SkShader> shader,
int traceCoordX,

View File

@ -230,7 +230,6 @@ echo "Compiling"
skia_use_zlib=true \
skia_enable_gpu=${ENABLE_GPU} \
skia_build_for_debugger=${DEBUGGER_ENABLED} \
skia_enable_sksl_tracing=${ENABLE_SKSL_TRACE} \
\
${GN_SHAPER} \
${GN_FONT} \
@ -248,6 +247,7 @@ echo "Compiling"
skia_canvaskit_enable_particles=${ENABLE_PARTICLES} \
skia_canvaskit_enable_pathops=${ENABLE_PATHOPS} \
skia_canvaskit_enable_rt_shader=${ENABLE_RT_SHADER} \
skia_canvaskit_enable_sksl_trace=${ENABLE_SKSL_TRACE} \
skia_canvaskit_enable_matrix_helper=${ENABLE_MATRIX} \
skia_canvaskit_enable_canvas_bindings=${ENABLE_CANVAS} \
skia_canvaskit_enable_font=${ENABLE_FONT} \

View File

@ -15,7 +15,8 @@ filegroup(
)
cc_library(
name = "core_srcs",
name = "srcs",
visibility = ["//:__subpackages__"],
deps = [
":SkSLAnalysis_src",
":SkSLBuiltinMap_src",
@ -147,23 +148,6 @@ cc_library(
],
)
cc_library(
name = "tracing_srcs",
deps = [
"//src/sksl/tracing:SkVMDebugTracePlayer_src",
"//src/utils:json_srcs",
],
)
cc_library(
name = "srcs",
visibility = ["//:__subpackages__"],
deps = [":core_srcs"] + select({
"//bazel/common_config_settings:enable_sksl_tracing_true": [":tracing_srcs"],
"//bazel/common_config_settings:enable_sksl_tracing_false": [],
}),
)
generated_cc_atom(
name = "GLSL.std.450_hdr",
hdrs = ["GLSL.std.450.h"],

View File

@ -7,8 +7,6 @@
#include "src/sksl/tracing/SkVMDebugTrace.h"
#ifdef SKSL_ENABLE_TRACING
#include "include/core/SkData.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkStream.h"
@ -388,30 +386,3 @@ bool SkVMDebugTrace::readTrace(SkStream* r) {
}
} // namespace SkSL
#else // SKSL_ENABLE_TRACING
#include <string>
namespace SkSL {
void SkVMDebugTrace::setTraceCoord(const SkIPoint &coord) {}
void SkVMDebugTrace::setSource(std::string source) {}
bool SkVMDebugTrace::readTrace(SkStream *r) { return false; }
void SkVMDebugTrace::writeTrace(SkWStream *w) const {}
void SkVMDebugTrace::dump(SkWStream *o) const {}
std::string SkVMDebugTrace::getSlotComponentSuffix(int slotIndex) const { return ""; }
std::string SkVMDebugTrace::getSlotValue(int slotIndex, int32_t value) const { return ""; }
double SkVMDebugTrace::interpretValueBits(int slotIndex, int32_t valueBits) const { return 0; }
std::string SkVMDebugTrace::slotValueToString(int slotIndex, double value) const { return ""; }
}
#endif