Skip to content

Commit 84274e1

Browse files
authored
Merge branch 'main' into katya/update-the-viewer-docs
2 parents c123a8a + 5325fd8 commit 84274e1

File tree

31 files changed

+598
-149
lines changed

31 files changed

+598
-149
lines changed

.github/workflows/contrib_rerun_py.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ jobs:
6161
# this stops `re_web_viewer_server/build.rs` from running
6262
RERUN_IS_PUBLISHING: true
6363
run: |
64-
cargo build \
64+
pixi run cargo build \
6565
--locked \
6666
-p rerun-cli \
6767
--no-default-features \
68-
--features native_viewer,web_viewer \
68+
--features release \
6969
--release \
7070
--target x86_64-unknown-linux-gnu
7171

.github/workflows/reusable_build_and_upload_rerun_cli.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ jobs:
176176
# this stops `re_web_viewer_server/build.rs` from running
177177
RERUN_IS_PUBLISHING: true
178178
run: |
179-
cargo build \
179+
pixi run cargo build \
180180
--locked \
181181
-p rerun-cli \
182182
--no-default-features \
183-
--features native_viewer,web_viewer \
183+
--features release \
184184
--release \
185185
--target ${{ needs.set-config.outputs.TARGET }}
186186

Cargo.lock

+4-2
Original file line numberDiff line numberDiff line change
@@ -5379,9 +5379,9 @@ dependencies = [
53795379

53805380
[[package]]
53815381
name = "re_rav1d"
5382-
version = "0.1.2"
5382+
version = "0.1.3"
53835383
source = "registry+https://github.com/rust-lang/crates.io-index"
5384-
checksum = "c4a4d7117cc5dd728738e5187a78914a3229b3ab819e96079b0ad8bca84b9f30"
5384+
checksum = "e5eb64c43c68024d96d99d52ef0525030d17bdcc6a6b4ddba048ec8f713c91fc"
53855385
dependencies = [
53865386
"assert_matches",
53875387
"atomig",
@@ -5942,6 +5942,8 @@ dependencies = [
59425942
"indicatif",
59435943
"itertools 0.13.0",
59445944
"parking_lot",
5945+
"re_build_info",
5946+
"re_build_tools",
59455947
"re_log",
59465948
"re_mp4",
59475949
"re_rav1d",

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ re_math = "0.20.0"
109109
# If this package fails to build, install `nasm` locally, or build through `pixi`.
110110
# NOTE: we use `dav1d` as an alias for our own re_rav1d crate
111111
# See https://github.com/rerun-io/re_rav1d/pull/2
112-
dav1d = { package = "re_rav1d", version = "0.1.2", default-features = false }
112+
dav1d = { package = "re_rav1d", version = "0.1.3", default-features = false }
113113
# dav1d = { version = "0.10.3" } # Requires separate install of `dav1d` library. Fast in debug builds. Useful for development.
114114

115115
# egui-crates:

crates/build/re_build_info/src/build_info.rs

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ pub struct BuildInfo {
1414
/// `CARGO_PKG_NAME`
1515
pub crate_name: &'static str,
1616

17+
/// Space-separated names of all features enabled for this crate.
18+
pub features: &'static str,
19+
1720
/// Crate version, parsed from `CARGO_PKG_VERSION`, ignoring any `+metadata` suffix.
1821
pub version: super::CrateVersion,
1922

@@ -74,6 +77,7 @@ impl std::fmt::Display for BuildInfo {
7477
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7578
let Self {
7679
crate_name,
80+
features,
7781
version,
7882
rustc_version,
7983
llvm_version,
@@ -89,6 +93,10 @@ impl std::fmt::Display for BuildInfo {
8993

9094
write!(f, "{crate_name} {version}")?;
9195

96+
if !features.is_empty() {
97+
write!(f, " ({features})")?;
98+
}
99+
92100
if let Some(rustc_version) = rustc_version {
93101
write!(f, " [{rustc_version}")?;
94102
if let Some(llvm_version) = llvm_version {
@@ -147,6 +155,7 @@ impl CrateVersion {
147155
fn crate_version_from_build_info_string() {
148156
let build_info = BuildInfo {
149157
crate_name: "re_build_info",
158+
features: "default extra",
150159
version: CrateVersion {
151160
major: 0,
152161
minor: 10,

crates/build/re_build_info/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ macro_rules! build_info {
1515
() => {
1616
$crate::BuildInfo {
1717
crate_name: env!("CARGO_PKG_NAME"),
18+
features: env!("RE_BUILD_FEATURES"),
1819
version: $crate::CrateVersion::parse(env!("CARGO_PKG_VERSION")),
1920
rustc_version: env!("RE_BUILD_RUSTC_VERSION"),
2021
llvm_version: env!("RE_BUILD_LLVM_VERSION"),

crates/build/re_build_tools/src/lib.rs

+27
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ pub fn export_build_info_vars_for_crate(crate_name: &str) {
194194
);
195195
}
196196
}
197+
198+
set_env(
199+
"RE_BUILD_FEATURES",
200+
&enabled_features_of(crate_name).unwrap().join(" "),
201+
);
197202
}
198203

199204
/// ISO 8601 / RFC 3339 build time.
@@ -273,3 +278,25 @@ fn rust_llvm_versions() -> anyhow::Result<(String, String)> {
273278
pub fn cargo_metadata() -> anyhow::Result<cargo_metadata::Metadata> {
274279
Ok(cargo_metadata::MetadataCommand::new().exec()?)
275280
}
281+
282+
/// Returns a list of all the enabled features of the given package.
283+
pub fn enabled_features_of(crate_name: &str) -> anyhow::Result<Vec<String>> {
284+
let metadata = cargo_metadata()?;
285+
286+
let mut features = vec![];
287+
for package in &metadata.packages {
288+
if package.name == crate_name {
289+
for feature in package.features.keys() {
290+
println!("Checking if feature is enabled: {feature:?}");
291+
let feature_in_screaming_snake_case =
292+
feature.to_ascii_uppercase().replace('-', "_");
293+
if std::env::var(format!("CARGO_FEATURE_{feature_in_screaming_snake_case}")).is_ok()
294+
{
295+
features.push(feature.clone());
296+
}
297+
}
298+
}
299+
}
300+
301+
Ok(features)
302+
}

crates/store/re_chunk_store/src/dataframe.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ pub struct QueryExpression {
542542
/// Examples: `Some(Timeline("frame"))`, `None` (only static data).
543543
//
544544
// TODO(cmc): this has to be a selector otherwise this is a horrible UX.
545-
pub filtered_index: Option<Timeline>,
545+
pub filtered_index: Option<Index>,
546546

547547
/// The range of index values used to filter out _rows_ from the view contents.
548548
///
@@ -589,7 +589,7 @@ pub struct QueryExpression {
589589
/// Example: `ComponentColumnSelector("rerun.components.Position3D")`.
590590
//
591591
// TODO(cmc): multi-pov support
592-
pub filtered_point_of_view: Option<ComponentColumnSelector>,
592+
pub filtered_is_not_null: Option<ComponentColumnSelector>,
593593

594594
/// Specifies how null values should be filled in the returned dataframe.
595595
///
@@ -792,7 +792,7 @@ impl ChunkStore {
792792
filtered_index_range: _,
793793
filtered_index_values: _,
794794
using_index_values: _,
795-
filtered_point_of_view: _,
795+
filtered_is_not_null: _,
796796
sparse_fill_strategy: _,
797797
selection: _,
798798
} = query;

crates/store/re_dataframe/src/query.rs

+9-13
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,7 @@ impl QueryHandle<'_> {
445445
query: &RangeQuery,
446446
view_contents: &[ColumnDescriptor],
447447
) -> (Option<usize>, Vec<Vec<(AtomicU64, Chunk)>>) {
448-
let mut view_pov_chunks_idx = self
449-
.query
450-
.filtered_point_of_view
451-
.as_ref()
452-
.map(|_| usize::MAX);
448+
let mut view_pov_chunks_idx = self.query.filtered_is_not_null.as_ref().map(|_| usize::MAX);
453449

454450
let view_chunks = view_contents
455451
.iter()
@@ -462,7 +458,7 @@ impl QueryHandle<'_> {
462458
.fetch_chunks(query, &column.entity_path, [column.component_name])
463459
.unwrap_or_default();
464460

465-
if let Some(pov) = self.query.filtered_point_of_view.as_ref() {
461+
if let Some(pov) = self.query.filtered_is_not_null.as_ref() {
466462
if pov.entity_path == column.entity_path
467463
&& column.component_name.matches(&pov.component_name)
468464
{
@@ -1196,7 +1192,7 @@ mod tests {
11961192
// * [x] filtered_index_values
11971193
// * [x] view_contents
11981194
// * [x] selection
1199-
// * [x] filtered_point_of_view
1195+
// * [x] filtered_is_not_null
12001196
// * [x] sparse_fill_strategy
12011197
// * [x] using_index_values
12021198
//
@@ -1551,7 +1547,7 @@ mod tests {
15511547
}
15521548

15531549
#[test]
1554-
fn filtered_point_of_view() -> anyhow::Result<()> {
1550+
fn filtered_is_not_null() -> anyhow::Result<()> {
15551551
re_log::setup_logging();
15561552

15571553
let store = create_nasty_store()?;
@@ -1569,7 +1565,7 @@ mod tests {
15691565
{
15701566
let query = QueryExpression {
15711567
filtered_index,
1572-
filtered_point_of_view: Some(ComponentColumnSelector {
1568+
filtered_is_not_null: Some(ComponentColumnSelector {
15731569
entity_path: "no/such/entity".into(),
15741570
component_name: MyPoint::name().to_string(),
15751571
}),
@@ -1598,7 +1594,7 @@ mod tests {
15981594
{
15991595
let query = QueryExpression {
16001596
filtered_index,
1601-
filtered_point_of_view: Some(ComponentColumnSelector {
1597+
filtered_is_not_null: Some(ComponentColumnSelector {
16021598
entity_path: entity_path.clone(),
16031599
component_name: "AComponentColumnThatDoesntExist".into(),
16041600
}),
@@ -1627,7 +1623,7 @@ mod tests {
16271623
{
16281624
let query = QueryExpression {
16291625
filtered_index,
1630-
filtered_point_of_view: Some(ComponentColumnSelector {
1626+
filtered_is_not_null: Some(ComponentColumnSelector {
16311627
entity_path: entity_path.clone(),
16321628
component_name: MyPoint::name().to_string(),
16331629
}),
@@ -1666,7 +1662,7 @@ mod tests {
16661662
{
16671663
let query = QueryExpression {
16681664
filtered_index,
1669-
filtered_point_of_view: Some(ComponentColumnSelector {
1665+
filtered_is_not_null: Some(ComponentColumnSelector {
16701666
entity_path: entity_path.clone(),
16711667
component_name: MyColor::name().to_string(),
16721668
}),
@@ -2180,7 +2176,7 @@ mod tests {
21802176
{
21812177
let query = QueryExpression {
21822178
filtered_index,
2183-
filtered_point_of_view: Some(ComponentColumnSelector {
2179+
filtered_is_not_null: Some(ComponentColumnSelector {
21842180
entity_path: entity_path.clone(),
21852181
component_name: MyPoint::name().to_string(),
21862182
}),

crates/store/re_video/Cargo.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ av1 = ["dep:dav1d"]
3030

3131
## Enable faster native video decoding with assembly.
3232
## You need to install [nasm](https://nasm.us/) to compile with this feature.
33-
# TODO(#7671): this feature flag currently does nothing on Linux.
3433
nasm = [
35-
# The default feature set of our dav1d fork has asm enabled (except on Linux, see above)
34+
# The default feature set of our dav1d fork has asm enabled
3635
"dav1d?/default",
3736
]
3837

3938

4039
[dependencies]
40+
re_build_info.workspace = true
4141
re_log.workspace = true
4242
re_tracing.workspace = true
4343

@@ -62,6 +62,9 @@ dav1d = { workspace = true, optional = true, default-features = false, features
6262
[dev-dependencies]
6363
indicatif.workspace = true
6464

65+
[build-dependencies]
66+
re_build_tools.workspace = true
67+
6568

6669
[[example]]
6770
name = "frames"

crates/store/re_video/build.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
re_build_tools::export_build_info_vars_for_crate(env!("CARGO_PKG_NAME"));
3+
}

crates/store/re_video/src/decode/av1.rs

+16-8
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,22 @@ impl SyncDav1dDecoder {
3737
pub fn new(debug_name: String) -> Result<Self> {
3838
re_tracing::profile_function!();
3939

40-
// TODO(#7671): enable this warning again on Linux when the `nasm` feature actually does something
41-
#[allow(clippy::overly_complex_bool_expr)]
42-
if !cfg!(target_os = "linux") && !cfg!(feature = "nasm") {
43-
re_log::warn_once!(
44-
"NOTE: native AV1 video decoder is running extra slowly. \
45-
Speed it up by compiling Rerun with the `nasm` feature enabled. \
46-
You'll need to also install nasm: https://nasm.us/"
47-
);
40+
if !cfg!(feature = "nasm") {
41+
// The `nasm` feature makes AV1 decoding much faster.
42+
// On Linux the difference is huge (~25x).
43+
// On Windows, the difference was also pretty big (unsure how big).
44+
// On an M3 Mac the difference is smalelr (2-3x),
45+
// and ever without `nasm` emilk can play an 8k video at 2x speed.
46+
47+
if cfg!(target_os = "macos") && cfg!(target_arch = "aarch64") {
48+
re_log::warn_once!(
49+
"The native AV1 video decoder is unnecessarily slow. \
50+
Speed it up by compiling Rerun with the `nasm` feature enabled."
51+
);
52+
} else {
53+
// Better to return an error than to be perceived as being slow
54+
return Err(Error::Dav1dWithoutNasm);
55+
}
4856
}
4957

5058
// See https://videolan.videolan.me/dav1d/structDav1dSettings.html for settings docs

crates/store/re_video/src/decode/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ pub enum Error {
100100
#[cfg(not(target_arch = "wasm32"))]
101101
#[error("dav1d: {0}")]
102102
Dav1d(#[from] dav1d::Error),
103+
104+
#[cfg(feature = "av1")]
105+
#[cfg(not(target_arch = "wasm32"))]
106+
#[error("To enabled native AV1 decoding, compile Rerun with the `nasm` feature enabled.")]
107+
Dav1dWithoutNasm,
103108
}
104109

105110
pub type Result<T = (), E = Error> = std::result::Result<T, E>;

0 commit comments

Comments
 (0)