Skip to content

Commit

Permalink
fix: ABI mismatch between skia and imzero_client_cpp (SK_TRIVIAL_ABI …
Browse files Browse the repository at this point in the history
…macro will be used even when is_trivial_abi is false in build_skia.sh!)
  • Loading branch information
stergiotis committed Jul 1, 2024
1 parent 7e216be commit d712993
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
11 changes: 9 additions & 2 deletions dhall/sourceTreeParts.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ let skia =
] : List Text
}
, defines = {, local = [
, "SK_TRIVIAL_ABI=\\[\\[clang::trivial_abi\\]\\]"
, "SK_GAMMA_APPLY_TO_A8"
, "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1"
, "GR_TEST_UTILS=1"
Expand Down Expand Up @@ -440,6 +439,15 @@ let skia =
] : List Text}
, cxxflags = {
, global = [
, "-ffp-contract=off" -- standard compliant fp processing
, "-fstrict-aliasing" -- is on on >=O2 optimization
, "-fPIC"
, "-fvisibility=hidden"
, "-fdata-sections"
, "-ffunction-sections"
, "-fvisibility-inlines-hidden"
, "-fno-exceptions"
, "-fno-rtti"
] : List Text
, local = [
, "-Wno-unused-parameter"
Expand Down Expand Up @@ -592,7 +600,6 @@ let skiaSdl = \(asan : Bool) ->
}
, defines = {, local = [
, "SK_DEBUG"
, "SK_TRIVIAL_ABI=\\[\\[clang::trivial_abi\\]\\]"
, "SK_GAMMA_APPLY_TO_A8"
, "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1"
--, "GR_TEST_UTILS=1"
Expand Down
2 changes: 1 addition & 1 deletion skia/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ target_compile_options(imguiTextedit PUBLIC -Wno-unused-variable)
add_library(skiaSdl OBJECT "${CMAKE_CURRENT_LIST_DIR}/./skia/sdl3/imgui_impl_opengl3.cpp"
"${CMAKE_CURRENT_LIST_DIR}/./skia/sdl3/imgui_impl_sdl3.cpp"
"${CMAKE_CURRENT_LIST_DIR}/./skia/sdl3/main.cpp"
"${CMAKE_CURRENT_LIST_DIR}/./skia/sdl3/app.cpp"
"${CMAKE_CURRENT_LIST_DIR}/./skia/paragraph.cpp"
"${CMAKE_CURRENT_LIST_DIR}/./skia/cliOptions.cpp"
"${CMAKE_CURRENT_LIST_DIR}/./skia/setupUI.cpp"
Expand All @@ -104,7 +105,6 @@ add_library(skiaSdl OBJECT "${CMAKE_CURRENT_LIST_DIR}/./skia/sdl3/imgui_impl_ope
"${CMAKE_CURRENT_LIST_DIR}/./contrib/skia/src/gpu/ganesh/gl/GrGLUtil.cpp")
target_compile_options(skiaSdl PUBLIC -Wno-unused-parameter)
target_compile_definitions(skiaSdl PUBLIC SK_DEBUG
SK_TRIVIAL_ABI=\[\[clang::trivial_abi\]\]
SK_GAMMA_APPLY_TO_A8
SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1
SK_TYPEFACE_FACTORY_FREETYPE
Expand Down
10 changes: 9 additions & 1 deletion skia/skia/sdl3/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,4 +520,12 @@ int App::Run(CliOptions &opts) {
return 0;
}

App::App() = default;
App::App() {
fTotalVectorCmdSerializedSize = 0;
fSkpBytesWritten = 0;
fSvgBytesWritten = 0;
fPngBytesWritten = 0;
fBackgroundColor = SK_ColorRED;
fFffiInterpreter = false;
fUseVectorCmd = false;
}
20 changes: 10 additions & 10 deletions skia/skia/sdl3/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class App {
void Paint(SkSurface* surface, int width, int height);
void DrawImGuiVectorCmdsFB(SkCanvas &canvas);

SkPaint fFontPaint{};
VectorCmdSkiaRenderer fVectorCmdSkiaRenderer{};
size_t fTotalVectorCmdSerializedSize{};
size_t fSkpBytesWritten{};
size_t fSvgBytesWritten{};
size_t fPngBytesWritten{};
ImZeroSkiaSetupUI fImZeroSkiaSetupUi{};
bool fFffiInterpreter{};
SkColor fBackgroundColor{};
bool fUseVectorCmd{};
SkPaint fFontPaint;
VectorCmdSkiaRenderer fVectorCmdSkiaRenderer;
size_t fTotalVectorCmdSerializedSize;
size_t fSkpBytesWritten;
size_t fSvgBytesWritten;
size_t fPngBytesWritten;
ImZeroSkiaSetupUI fImZeroSkiaSetupUi;
bool fFffiInterpreter;
SkColor fBackgroundColor;
bool fUseVectorCmd;
};
2 changes: 1 addition & 1 deletion skia/skia/vectorCmdSkiaRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static SkColor convertColor(uint32_t col) {
(col >> IM_COL32_B_SHIFT) & 0xff);
#endif
}
VectorCmdSkiaRenderer::VectorCmdSkiaRenderer() : fVertexPaint(nullptr),fRenderMode(RenderModeE_Normal) {
VectorCmdSkiaRenderer::VectorCmdSkiaRenderer() : fVertexPaint(nullptr),fRenderMode(RenderModeE_Normal), backdropFilter(nullptr) {
#ifdef RENDER_MODE_BACKDROP_FILTER_ENABLED
backdropFilter = SkImageFilters::Blur(8, 8, SkTileMode::kClamp, nullptr);
#if 0
Expand Down

0 comments on commit d712993

Please sign in to comment.