Commit graph

5155 commits

Author SHA1 Message Date
Simon Hausmann
467a02310c Fix assert in C++ code generator when using repeated sub-components
Instead of requiring inlining, assume that the generated code will provide an
implementation of layouting_info as well as root_item.

They're not implemented yet though.
2021-10-28 15:52:29 +02:00
Simon Hausmann
c2d757013e Revert "Fix assert in code generator when using sub-components as repeated elements"
This reverts commit 6e8d463d4bb88720a9682c839c5754959dd57c20.

It's better if the generated code for sub-components implements a
root_item function, instead of blowing up the generated code.
2021-10-28 15:52:29 +02:00
Simon Hausmann
0898248044 Fix assert in code generator when using sub-components as repeated elements
We need to inline those because the generator asserts that it's
a built-in element in order to implement `root_item`.
2021-10-28 15:52:29 +02:00
Simon Hausmann
7a7fb72d8b compiler internal: fix item index generation for sub-components
(1) ... when the root element is a sub-component itself (the initialy child offset is not 1)

(2) when children themselves are sub-components, then they may occupy more entries in the item tree
2021-10-28 15:52:29 +02:00
Simon Hausmann
82b5c3bcce Fix the item index generation to take sub-components into account
A regular element where the base type is a built-in item uses one slot,
while a sub-component expands to multiple nested built-in items.
2021-10-28 15:52:29 +02:00
Simon Hausmann
125a2ae125 C++ generator: forward the sub-component start indicies
Within sub-components we only know the local item index, and together with the
offset provided in the constructor we'll be able to
compute the correct index for items that's needed sometimes,
for example for focus setting.

The item indices are still wrong though, that'll need fixing in the corresponding pass.
2021-10-28 15:52:29 +02:00
Simon Hausmann
d0216a4291 C++ generator: don't generate m_window and self_weak for sub-components 2021-10-28 15:52:29 +02:00
Simon Hausmann
2a7976abda C++ generator: generate members for sub-components 2021-10-28 15:52:29 +02:00
Simon Hausmann
98f6cab553 Make it easier to distinguish between the component types in the generators
Besides `is_global()` add `is_root_component` to Rc<Component>, so that
we can distinguish between the main component (that should have the full
API, etc.) and supplementary components.

This also avoids the generation of unnecessary members when inlining is
disabled.
2021-10-28 15:52:29 +02:00
Simon Hausmann
5e7175b1e3 C++ generator: Don't generate a class initialize for the m_window member for child components
The constructor initializes it property, so don't generate code that
when read might give the false impression that we allocate a new window.
2021-10-28 15:52:29 +02:00
Olivier Goffart
bcc973bb63 Make sure the ids are unique globally
For the inner elements, they don't need to be unique, but that might
make debugging easier.
For the globals, their name need to be unique.
2021-10-28 15:52:29 +02:00
Olivier Goffart
c9c43766f4 fixup previous commit: remove stray debug 2021-10-28 15:52:29 +02:00
Olivier Goffart
9c6bc6afc7 Do the property analysis accounting for several component 2021-10-28 15:52:29 +02:00
Simon Hausmann
0238af1780 Minor cleanup in pass handling
Remove the roots vector again, with selective inlining it's better
to use the "live" data structures instead of a copy of the roots.

It would be nice to centralize that into a helper function that returns
say an `Ref<'_, impl Iterator<Item = &Rc<Component>>>>` but that's not
possible yet.

The same chained iterator pattern is also used in some passes already.
2021-10-28 15:52:29 +02:00
Simon Hausmann
bc81d80f4a Fix structure collection with non-inlined components
Make sure that doc.root_component.used_types.structs has all the
structs, instead of storing them in used_types for each sub-component.
That should also account for the same structures used by different
components.
2021-10-28 15:52:29 +02:00
Simon Hausmann
370e2ca14b Make the inlining pass remove inlined componts from used_types.sub_components
It seems cleaner to do this in the inlining pass, as we initially selectively inline.
2021-10-28 15:52:29 +02:00
Simon Hausmann
9028f69f27 C++ generator cleanup: Remove supplementary_components field again
This amends the parent commit, we don't need a separate vec, after
inlining the sub_components should simply be empty.
2021-10-28 15:52:29 +02:00
Simon Hausmann
b5f4a2c27c C++ generator: begin generating code for supplementary components
The generation is still incomplete, but this change passes them to the C++ generator
when not inlining.

Another option would've been a "inline: bool", but that won't suffice in
the future when we may want to use heuristics to selectively inline some
and others not. And always taking used_types.sub_components is wrong
when inlining as those are ... inlined.
2021-10-28 15:52:29 +02:00
Simon Hausmann
4183c7122b C++ generator cleanup: move component vtable generation into a helper function
Despite only being called from one place, this reduces the size
of `generate_component`, in an effort to make it more readable.
2021-10-28 15:52:29 +02:00
Simon Hausmann
007fe36839 C++ Generator: more cleanups
Move all `!component.is_global()` related code generation into one block.
2021-10-28 15:52:29 +02:00
Simon Hausmann
545ec38ed3 C++ generator: minor cleanup
Also de-duplicate the self_weak member emission
2021-10-28 15:52:29 +02:00
Simon Hausmann
13e8b36c33 Minor cleanup in C++ generator
Have one place to emit the m_window member
2021-10-28 15:52:29 +02:00
Simon Hausmann
14eb078335 Fix tests
Don't disable inlining by default
2021-10-28 15:52:29 +02:00
Simon Hausmann
6c42998a57 Make it possible to disabling inlining by environment variable
`SIXTYFPS_DISABLE_INLINING=true` will do that and subsequently apply all the optimizations passes
on all components instead of just the root.

In the future we'll flip this around make make inlining opt-in, instead
of opt-out.
2021-10-28 15:52:29 +02:00
Olivier Goffart
25dfc218b0 Collect globals before inlining 2021-10-28 15:52:29 +02:00
Olivier Goffart
f25a7cbc0a Do the apply_default_properties_from_style before inlining
Note: the extra parentheses allow to avoid rustfmt to split in many lines
2021-10-28 15:52:29 +02:00
Olivier Goffart
32668eed9c Fix a bunch of panic that might occur later as the optimizations happen per component 2021-10-28 15:52:29 +02:00
Olivier Goffart
fd8b97b228 Do the materialize_fake_properties before inlining 2021-10-28 15:52:29 +02:00
Olivier Goffart
2767ceb10b Make the visible pass work on the non-inlined tree 2021-10-28 15:52:29 +02:00
Olivier Goffart
8622dcb910 Do the default_geometry pass without inlining 2021-10-28 15:52:29 +02:00
Olivier Goffart
67dd409f87 Move a few more passes before inlining 2021-10-28 15:52:29 +02:00
Olivier Goffart
567c644a5f Fix PopupWindow position when all elements are not inlined
Pass a reference to the parent item in the show_popup function
so we can compute the exact location at runtime.
2021-10-28 15:52:29 +02:00
Olivier Goffart
5f07678478 Make the layout pass work on non-inlined tree 2021-10-28 15:52:29 +02:00
Olivier Goffart
7b41f8a4bc Do the popup window pass before inlining 2021-10-28 15:52:29 +02:00
Olivier Goffart
6e5596cdfc Make the repeater pass work on the non-inlined object tree 2021-10-28 15:52:29 +02:00
Olivier Goffart
171a23d7d1 Do the flickable and states passes before inlining 2021-10-28 15:52:29 +02:00
Olivier Goffart
fff6f04be0 Progressively work on pass so they work without inlining
Revert part of the previous commit that tries to do all the pass without inlining

Fixup the few first passes so they work without inlining, but still do a full
inlining for most passes

The goal is to make it work pass by pass until we can have everything without
requiring full inlining
2021-10-28 15:52:29 +02:00
Simon Hausmann
a318df522b Prepare for optional inlining
Even if we make inlining optional, there are *some* situations where we just
need to do the inlining anyway to avoid
needless complexity.
2021-10-28 15:52:29 +02:00
Olivier Goffart
72f022b3ed Document the test harness 2021-10-26 14:51:23 +02:00
ogoffart
b25ae6fbcd Bump version number to 0.1.5 2021-10-26 07:36:54 +00:00
Simon Hausmann
6671aaefcc Remove unnecessary weak-table dependency 2021-10-25 14:56:33 +02:00
Simon Hausmann
44c632dee1 Remove path to non-existent bin directory 2021-10-22 17:15:07 +02:00
Olivier Goffart
ce65e7871c Update the GIT_TAG in the readme 2021-10-22 16:51:25 +02:00
Olivier Goffart
043a58a5f0 Revert "Set the documentation URL to the latest release"
This reverts commit ec61c969f0.
2021-10-22 16:50:48 +02:00
Olivier Goffart
51fa9dc51b sixtyfps-viewer: re-enable the x11 feature by default
Some change in the feature handling caused it not to enable x11 nor wayland
2021-10-22 16:42:09 +02:00
Olivier Goffart
d194e18f99 Update the version number in the .md files 2021-10-22 16:09:02 +02:00
Olivier Goffart
ec61c969f0 Set the documentation URL to the latest release 2021-10-22 16:06:07 +02:00
Olivier Goffart
794692cbb8 Update version in docs 2021-10-22 16:05:14 +02:00
Simon Hausmann
916107887b Move the binaries from bin/ into the main folder 2021-10-22 15:56:08 +02:00
Simon Hausmann
24fffda907 Try running prepare_binary_package.sh on Windows with -x 2021-10-22 15:37:18 +02:00