diff --git a/Cargo.lock b/Cargo.lock index 8103ce57341b..db5e8a231b96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6648,6 +6648,7 @@ dependencies = [ "ahash", "egui", "fjadra", + "itertools 0.13.0", "nohash-hasher", "re_chunk", "re_data_ui", diff --git a/crates/viewer/re_view_graph/Cargo.toml b/crates/viewer/re_view_graph/Cargo.toml index 87841bba1e15..b1f469349f5b 100644 --- a/crates/viewer/re_view_graph/Cargo.toml +++ b/crates/viewer/re_view_graph/Cargo.toml @@ -37,4 +37,5 @@ re_viewport_blueprint.workspace = true ahash.workspace = true egui.workspace = true fjadra.workspace = true +itertools.workspace = true nohash-hasher.workspace = true diff --git a/crates/viewer/re_view_graph/src/visualizers/nodes.rs b/crates/viewer/re_view_graph/src/visualizers/nodes.rs index ce0a06fa7200..bdb926e128de 100644 --- a/crates/viewer/re_view_graph/src/visualizers/nodes.rs +++ b/crates/viewer/re_view_graph/src/visualizers/nodes.rs @@ -78,7 +78,7 @@ impl VisualizerSystem for NodeVisualizer { &timeline_query, ); - let all_indexed_nodes = results.iter_as(query.timeline, components::GraphNode::name()); + let all_nodes = results.iter_as(query.timeline, components::GraphNode::name()); let all_colors = results.iter_as(query.timeline, components::Color::name()); let all_positions = results.iter_as(query.timeline, components::Position2D::name()); let all_labels = results.iter_as(query.timeline, components::Text::name()); @@ -88,12 +88,11 @@ impl VisualizerSystem for NodeVisualizer { .map_or(true, bool::from); let data = range_zip_1x4( - // TODO(cmc): Provide a `iter_struct`. - all_indexed_nodes.component_slow::(), - all_colors.primitive::(), - all_positions.primitive_array::<2, f32>(), - all_labels.string(), - all_radii.primitive::(), + all_nodes.slice::(), + all_colors.slice::(), + all_positions.slice::<[f32; 2]>(), + all_labels.slice::(), + all_radii.slice::(), ); for (_index, nodes, colors, positions, labels, radii) in data { @@ -114,6 +113,7 @@ impl VisualizerSystem for NodeVisualizer { Option::::default, ) .map(|(node, instance, color, position, label, radius)| { + let node = components::GraphNode(node.clone().into()); let color = color.map(|&c| egui::Color32::from(Color::new(c))); let label = match (label, show_label) { (Some(label), true) => Label::Text { @@ -133,7 +133,7 @@ impl VisualizerSystem for NodeVisualizer { NodeInstance { instance_index: instance, - id: NodeId::from_entity_node(&data_result.entity_path, node), + id: NodeId::from_entity_node(&data_result.entity_path, &node), position: position.map(|[x, y]| egui::Pos2::new(x, y)), label, } diff --git a/crates/viewer/re_view_map/src/visualizers/geo_line_strings.rs b/crates/viewer/re_view_map/src/visualizers/geo_line_strings.rs index 74550c4f368a..bd1c9341be55 100644 --- a/crates/viewer/re_view_map/src/visualizers/geo_line_strings.rs +++ b/crates/viewer/re_view_map/src/visualizers/geo_line_strings.rs @@ -66,9 +66,9 @@ impl VisualizerSystem for GeoLineStringsVisualizer { // iterate over each chunk and find all relevant component slices for (_index, lines, colors, radii) in re_query::range_zip_1x2( - all_lines.primitive_array_list::<2, f64>(), - all_colors.primitive::(), - all_radii.primitive::(), + all_lines.slice::<&[[f64; 2]]>(), + all_colors.slice::(), + all_radii.slice::(), ) { // required component let lines = lines.as_slice(); diff --git a/crates/viewer/re_view_map/src/visualizers/geo_points.rs b/crates/viewer/re_view_map/src/visualizers/geo_points.rs index f904049f8893..eff0e4aecc56 100644 --- a/crates/viewer/re_view_map/src/visualizers/geo_points.rs +++ b/crates/viewer/re_view_map/src/visualizers/geo_points.rs @@ -69,10 +69,10 @@ impl VisualizerSystem for GeoPointsVisualizer { // iterate over each chunk and find all relevant component slices for (_index, positions, colors, radii, class_ids) in re_query::range_zip_1x3( - all_positions.primitive_array::<2, f64>(), - all_colors.primitive::(), - all_radii.primitive::(), - all_class_ids.primitive::(), + all_positions.slice::<[f64; 2]>(), + all_colors.slice::(), + all_radii.slice::(), + all_class_ids.slice::(), ) { // required component let num_instances = positions.len(); diff --git a/crates/viewer/re_view_spatial/src/max_image_dimension_subscriber.rs b/crates/viewer/re_view_spatial/src/max_image_dimension_subscriber.rs index 327d24b60db5..02f025bac866 100644 --- a/crates/viewer/re_view_spatial/src/max_image_dimension_subscriber.rs +++ b/crates/viewer/re_view_spatial/src/max_image_dimension_subscriber.rs @@ -84,8 +84,8 @@ impl PerStoreChunkSubscriber for MaxImageDimensionsStoreSubscriber { } // Handle `ImageEncoded`, `AssetVideo`… - let blobs = event.diff.chunk.iter_buffer(&Blob::name()); - let media_types = event.diff.chunk.iter_string(&MediaType::name()); + let blobs = event.diff.chunk.iter_slices::<&[u8]>(Blob::name()); + let media_types = event.diff.chunk.iter_slices::(MediaType::name()); for (blob, media_type) in itertools::izip!(blobs, media_types.map(Some).chain(std::iter::repeat(None))) { diff --git a/crates/viewer/re_view_spatial/src/visualizers/arrows2d.rs b/crates/viewer/re_view_spatial/src/visualizers/arrows2d.rs index 93b2e76457a6..4a8a6c42e771 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/arrows2d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/arrows2d.rs @@ -200,7 +200,7 @@ impl VisualizerSystem for Arrows2DVisualizer { re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); - use super::entity_iterator::{iter_primitive_array, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -214,7 +214,7 @@ impl VisualizerSystem for Arrows2DVisualizer { let num_vectors = all_vector_chunks .iter() - .flat_map(|chunk| chunk.iter_primitive_array::<2, f32>(&Vector2D::name())) + .flat_map(|chunk| chunk.iter_slices::<[f32; 2]>(Vector2D::name())) .map(|vectors| vectors.len()) .sum(); @@ -227,7 +227,7 @@ impl VisualizerSystem for Arrows2DVisualizer { let timeline = ctx.query.timeline(); let all_vectors_indexed = - iter_primitive_array::<2, f32>(&all_vector_chunks, timeline, Vector2D::name()); + iter_slices::<[f32; 2]>(&all_vector_chunks, timeline, Vector2D::name()); let all_origins = results.iter_as(timeline, Position2D::name()); let all_colors = results.iter_as(timeline, Color::name()); let all_radii = results.iter_as(timeline, Radius::name()); @@ -238,13 +238,13 @@ impl VisualizerSystem for Arrows2DVisualizer { let data = re_query::range_zip_1x7( all_vectors_indexed, - all_origins.primitive_array::<2, f32>(), - all_colors.primitive::(), - all_radii.primitive::(), - all_labels.string(), - all_class_ids.primitive::(), - all_keypoint_ids.primitive::(), - all_show_labels.bool(), + all_origins.slice::<[f32; 2]>(), + all_colors.slice::(), + all_radii.slice::(), + all_labels.slice::(), + all_class_ids.slice::(), + all_keypoint_ids.slice::(), + all_show_labels.slice::(), ) .map( |( diff --git a/crates/viewer/re_view_spatial/src/visualizers/arrows3d.rs b/crates/viewer/re_view_spatial/src/visualizers/arrows3d.rs index 2e02f969f53d..9739ae8c1bc7 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/arrows3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/arrows3d.rs @@ -199,7 +199,7 @@ impl VisualizerSystem for Arrows3DVisualizer { re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); - use super::entity_iterator::{iter_primitive_array, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -213,7 +213,7 @@ impl VisualizerSystem for Arrows3DVisualizer { let num_vectors = all_vector_chunks .iter() - .flat_map(|chunk| chunk.iter_primitive_array::<3, f32>(&Vector3D::name())) + .flat_map(|chunk| chunk.iter_slices::<[f32; 3]>(Vector3D::name())) .map(|vectors| vectors.len()) .sum(); @@ -226,7 +226,7 @@ impl VisualizerSystem for Arrows3DVisualizer { let timeline = ctx.query.timeline(); let all_vectors_indexed = - iter_primitive_array::<3, f32>(&all_vector_chunks, timeline, Vector3D::name()); + iter_slices::<[f32; 3]>(&all_vector_chunks, timeline, Vector3D::name()); let all_origins = results.iter_as(timeline, Position3D::name()); let all_colors = results.iter_as(timeline, Color::name()); let all_radii = results.iter_as(timeline, Radius::name()); @@ -236,12 +236,12 @@ impl VisualizerSystem for Arrows3DVisualizer { let data = re_query::range_zip_1x6( all_vectors_indexed, - all_origins.primitive_array::<3, f32>(), - all_colors.primitive::(), - all_radii.primitive::(), - all_labels.string(), - all_class_ids.primitive::(), - all_show_labels.bool(), + all_origins.slice::<[f32; 3]>(), + all_colors.slice::(), + all_radii.slice::(), + all_labels.slice::(), + all_class_ids.slice::(), + all_show_labels.slice::(), ) .map( |(_index, vectors, origins, colors, radii, labels, class_ids, show_labels)| { diff --git a/crates/viewer/re_view_spatial/src/visualizers/assets3d.rs b/crates/viewer/re_view_spatial/src/visualizers/assets3d.rs index ab884dade8fc..cf5fa4df0eba 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/assets3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/assets3d.rs @@ -142,7 +142,7 @@ impl VisualizerSystem for Asset3DVisualizer { let mut instances = Vec::new(); - use super::entity_iterator::{iter_buffer, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -155,7 +155,8 @@ impl VisualizerSystem for Asset3DVisualizer { }; let timeline = ctx.query.timeline(); - let all_blobs_indexed = iter_buffer::(&all_blob_chunks, timeline, Blob::name()); + let all_blobs_indexed = + iter_slices::<&[u8]>(&all_blob_chunks, timeline, Blob::name()); let all_media_types = results.iter_as(timeline, MediaType::name()); let all_albedo_factors = results.iter_as(timeline, AlbedoFactor::name()); @@ -163,8 +164,8 @@ impl VisualizerSystem for Asset3DVisualizer { let data = re_query::range_zip_1x2( all_blobs_indexed, - all_media_types.string(), - all_albedo_factors.primitive::(), + all_media_types.slice::(), + all_albedo_factors.slice::(), ) .filter_map(|(index, blobs, media_types, albedo_factors)| { blobs.first().map(|blob| Asset3DComponentData { diff --git a/crates/viewer/re_view_spatial/src/visualizers/boxes2d.rs b/crates/viewer/re_view_spatial/src/visualizers/boxes2d.rs index 2a236f2cd3e6..75434f6c4638 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/boxes2d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/boxes2d.rs @@ -199,7 +199,7 @@ impl VisualizerSystem for Boxes2DVisualizer { re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); - use super::entity_iterator::{iter_primitive_array, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -214,7 +214,7 @@ impl VisualizerSystem for Boxes2DVisualizer { let num_boxes: usize = all_half_size_chunks .iter() - .flat_map(|chunk| chunk.iter_primitive_array::<2, f32>(&HalfSize2D::name())) + .flat_map(|chunk| chunk.iter_slices::<[f32; 2]>(HalfSize2D::name())) .map(|vectors| vectors.len()) .sum(); if num_boxes == 0 { @@ -226,11 +226,8 @@ impl VisualizerSystem for Boxes2DVisualizer { line_builder.reserve_vertices(num_boxes * 5)?; let timeline = ctx.query.timeline(); - let all_half_sizes_indexed = iter_primitive_array::<2, f32>( - &all_half_size_chunks, - timeline, - HalfSize2D::name(), - ); + let all_half_sizes_indexed = + iter_slices::<[f32; 2]>(&all_half_size_chunks, timeline, HalfSize2D::name()); let all_centers = results.iter_as(timeline, Position2D::name()); let all_colors = results.iter_as(timeline, Color::name()); let all_radii = results.iter_as(timeline, Radius::name()); @@ -240,12 +237,12 @@ impl VisualizerSystem for Boxes2DVisualizer { let data = re_query::range_zip_1x6( all_half_sizes_indexed, - all_centers.primitive_array::<2, f32>(), - all_colors.primitive::(), - all_radii.primitive::(), - all_labels.string(), - all_class_ids.primitive::(), - all_show_labels.bool(), + all_centers.slice::<[f32; 2]>(), + all_colors.slice::(), + all_radii.slice::(), + all_labels.slice::(), + all_class_ids.slice::(), + all_show_labels.slice::(), ) .map( |( diff --git a/crates/viewer/re_view_spatial/src/visualizers/boxes3d.rs b/crates/viewer/re_view_spatial/src/visualizers/boxes3d.rs index 2d48e092ed32..b6c90cd65ed6 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/boxes3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/boxes3d.rs @@ -121,7 +121,7 @@ impl VisualizerSystem for Boxes3DVisualizer { let mut builder = ProcMeshDrawableBuilder::new(&mut self.0, render_ctx, view_query, "boxes3d", &Fallback); - use super::entity_iterator::{iter_primitive_array, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -136,7 +136,7 @@ impl VisualizerSystem for Boxes3DVisualizer { let num_boxes: usize = all_half_size_chunks .iter() - .flat_map(|chunk| chunk.iter_primitive_array::<3, f32>(&HalfSize3D::name())) + .flat_map(|chunk| chunk.iter_slices::<[f32; 3]>(HalfSize3D::name())) .map(|vectors| vectors.len()) .sum(); if num_boxes == 0 { @@ -144,11 +144,8 @@ impl VisualizerSystem for Boxes3DVisualizer { } let timeline = ctx.query.timeline(); - let all_half_sizes_indexed = iter_primitive_array::<3, f32>( - &all_half_size_chunks, - timeline, - HalfSize3D::name(), - ); + let all_half_sizes_indexed = + iter_slices::<[f32; 3]>(&all_half_size_chunks, timeline, HalfSize3D::name()); let all_colors = results.iter_as(timeline, Color::name()); let all_radii = results.iter_as(timeline, Radius::name()); let all_labels = results.iter_as(timeline, Text::name()); @@ -159,7 +156,7 @@ impl VisualizerSystem for Boxes3DVisualizer { let all_fill_modes = results.iter_as(timeline, FillMode::name()); // fill mode is currently a non-repeated component let fill_mode: FillMode = all_fill_modes - .primitive::() + .slice::() .next() .and_then(|(_, fill_modes)| { fill_modes.first().copied().and_then(FillMode::from_u8) @@ -179,11 +176,11 @@ impl VisualizerSystem for Boxes3DVisualizer { let data = re_query::range_zip_1x5( all_half_sizes_indexed, - all_colors.primitive::(), - all_radii.primitive::(), - all_labels.string(), - all_class_ids.primitive::(), - all_show_labels.bool(), + all_colors.slice::(), + all_radii.slice::(), + all_labels.slice::(), + all_class_ids.slice::(), + all_show_labels.slice::(), ) .map( |(_index, half_sizes, colors, radii, labels, class_ids, show_labels)| { diff --git a/crates/viewer/re_view_spatial/src/visualizers/capsules3d.rs b/crates/viewer/re_view_spatial/src/visualizers/capsules3d.rs index a2e2c5f1b41c..a85b1d630680 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/capsules3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/capsules3d.rs @@ -148,7 +148,7 @@ impl VisualizerSystem for Capsules3DVisualizer { &Fallback, ); - use super::entity_iterator::{iter_primitive, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -167,12 +167,12 @@ impl VisualizerSystem for Capsules3DVisualizer { let num_lengths: usize = all_length_chunks .iter() - .flat_map(|chunk| chunk.iter_primitive::(&Length::name())) + .flat_map(|chunk| chunk.iter_slices::(Length::name())) .map(|lengths| lengths.len()) .sum(); let num_radii: usize = all_radius_chunks .iter() - .flat_map(|chunk| chunk.iter_primitive::(&components::Radius::name())) + .flat_map(|chunk| chunk.iter_slices::(components::Radius::name())) .map(|radii| radii.len()) .sum(); let num_instances = num_lengths.max(num_radii); @@ -182,9 +182,9 @@ impl VisualizerSystem for Capsules3DVisualizer { let timeline = ctx.query.timeline(); let all_lengths_indexed = - iter_primitive::(&all_length_chunks, timeline, Length::name()); + iter_slices::(&all_length_chunks, timeline, Length::name()); let all_radii_indexed = - iter_primitive::(&all_radius_chunks, timeline, components::Radius::name()); + iter_slices::(&all_radius_chunks, timeline, components::Radius::name()); let all_colors = results.iter_as(timeline, Color::name()); let all_labels = results.iter_as(timeline, Text::name()); let all_show_labels = results.iter_as(timeline, ShowLabels::name()); @@ -193,10 +193,10 @@ impl VisualizerSystem for Capsules3DVisualizer { let data = re_query::range_zip_2x4( all_lengths_indexed, all_radii_indexed, - all_colors.primitive::(), - all_labels.string(), - all_show_labels.bool(), - all_class_ids.primitive::(), + all_colors.slice::(), + all_labels.slice::(), + all_show_labels.slice::(), + all_class_ids.slice::(), ) .map( |(_index, lengths, radii, colors, labels, show_labels, class_ids)| { diff --git a/crates/viewer/re_view_spatial/src/visualizers/depth_images.rs b/crates/viewer/re_view_spatial/src/visualizers/depth_images.rs index 94c53af9c08b..7c62b385459d 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/depth_images.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/depth_images.rs @@ -259,7 +259,7 @@ impl VisualizerSystem for DepthImageVisualizer { let mut depth_clouds = Vec::new(); - use super::entity_iterator::{iter_buffer, iter_component, process_archetype}; + use super::entity_iterator::{iter_component, iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -278,7 +278,7 @@ impl VisualizerSystem for DepthImageVisualizer { let timeline = ctx.query.timeline(); let all_buffers_indexed = - iter_buffer::(&all_buffer_chunks, timeline, ImageBuffer::name()); + iter_slices::<&[u8]>(&all_buffer_chunks, timeline, ImageBuffer::name()); let all_formats_indexed = iter_component::( &all_format_chunks, timeline, @@ -292,10 +292,10 @@ impl VisualizerSystem for DepthImageVisualizer { let mut data = re_query::range_zip_1x5( all_buffers_indexed, all_formats_indexed, - all_colormaps.primitive::(), - all_value_ranges.primitive_array::<2, f64>(), - all_depth_meters.primitive::(), - all_fill_ratios.primitive::(), + all_colormaps.slice::(), + all_value_ranges.slice::<[f64; 2]>(), + all_depth_meters.slice::(), + all_fill_ratios.slice::(), ) .filter_map( |(index, buffers, format, colormap, value_range, depth_meter, fill_ratio)| { diff --git a/crates/viewer/re_view_spatial/src/visualizers/ellipsoids.rs b/crates/viewer/re_view_spatial/src/visualizers/ellipsoids.rs index fa4f55c57f6c..b4e9b252344e 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/ellipsoids.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/ellipsoids.rs @@ -133,7 +133,7 @@ impl VisualizerSystem for Ellipsoids3DVisualizer { &Fallback, ); - use super::entity_iterator::{iter_primitive_array, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -148,7 +148,7 @@ impl VisualizerSystem for Ellipsoids3DVisualizer { let num_ellipsoids: usize = all_half_size_chunks .iter() - .flat_map(|chunk| chunk.iter_primitive_array::<3, f32>(&HalfSize3D::name())) + .flat_map(|chunk| chunk.iter_slices::<[f32; 3]>(HalfSize3D::name())) .map(|vectors| vectors.len()) .sum(); if num_ellipsoids == 0 { @@ -161,11 +161,8 @@ impl VisualizerSystem for Ellipsoids3DVisualizer { // line_builder.reserve_vertices(num_ellipsoids * sphere_mesh.vertex_count)?; let timeline = ctx.query.timeline(); - let all_half_sizes_indexed = iter_primitive_array::<3, f32>( - &all_half_size_chunks, - timeline, - HalfSize3D::name(), - ); + let all_half_sizes_indexed = + iter_slices::<[f32; 3]>(&all_half_size_chunks, timeline, HalfSize3D::name()); let all_colors = results.iter_as(timeline, Color::name()); let all_line_radii = results.iter_as(timeline, Radius::name()); // Deserialized because it's a union. @@ -176,12 +173,12 @@ impl VisualizerSystem for Ellipsoids3DVisualizer { let data = re_query::range_zip_1x6( all_half_sizes_indexed, - all_colors.primitive::(), - all_line_radii.primitive::(), - all_fill_modes.primitive::(), - all_labels.string(), - all_class_ids.primitive::(), - all_show_labels.bool(), + all_colors.slice::(), + all_line_radii.slice::(), + all_fill_modes.slice::(), + all_labels.slice::(), + all_class_ids.slice::(), + all_show_labels.slice::(), ) .map( |( diff --git a/crates/viewer/re_view_spatial/src/visualizers/encoded_image.rs b/crates/viewer/re_view_spatial/src/visualizers/encoded_image.rs index 7e8f24a4fcd5..bc720479c1d4 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/encoded_image.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/encoded_image.rs @@ -133,7 +133,7 @@ impl EncodedImageVisualizer { results: &HybridResults<'_>, spatial_ctx: &SpatialSceneEntityContext<'_>, ) { - use super::entity_iterator::iter_buffer; + use super::entity_iterator::iter_slices; use re_view::RangeResultsExt as _; let entity_path = ctx.target_entity_path; @@ -143,14 +143,14 @@ impl EncodedImageVisualizer { }; let timeline = ctx.query.timeline(); - let all_blobs_indexed = iter_buffer::(&all_blob_chunks, timeline, Blob::name()); + let all_blobs_indexed = iter_slices::<&[u8]>(&all_blob_chunks, timeline, Blob::name()); let all_media_types = results.iter_as(timeline, MediaType::name()); let all_opacities = results.iter_as(timeline, Opacity::name()); for ((_time, tensor_data_row_id), blobs, media_types, opacities) in re_query::range_zip_1x2( all_blobs_indexed, - all_media_types.string(), - all_opacities.primitive::(), + all_media_types.slice::(), + all_opacities.slice::(), ) { let Some(blob) = blobs.first() else { continue; diff --git a/crates/viewer/re_view_spatial/src/visualizers/images.rs b/crates/viewer/re_view_spatial/src/visualizers/images.rs index 00fdecf89b37..f65147801287 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/images.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/images.rs @@ -118,7 +118,7 @@ impl ImageVisualizer { results: &HybridResults<'_>, spatial_ctx: &SpatialSceneEntityContext<'_>, ) { - use super::entity_iterator::{iter_buffer, iter_component}; + use super::entity_iterator::{iter_component, iter_slices}; use re_view::RangeResultsExt as _; let entity_path = ctx.target_entity_path; @@ -132,7 +132,7 @@ impl ImageVisualizer { let timeline = ctx.query.timeline(); let all_buffers_indexed = - iter_buffer::(&all_buffer_chunks, timeline, ImageBuffer::name()); + iter_slices::<&[u8]>(&all_buffer_chunks, timeline, ImageBuffer::name()); let all_formats_indexed = iter_component::(&all_formats_chunks, timeline, ImageFormat::name()); let all_opacities = results.iter_as(timeline, Opacity::name()); @@ -140,7 +140,7 @@ impl ImageVisualizer { let data = re_query::range_zip_1x2( all_buffers_indexed, all_formats_indexed, - all_opacities.primitive::(), + all_opacities.slice::(), ) .filter_map(|(index, buffers, formats, opacities)| { let buffer = buffers.first()?; diff --git a/crates/viewer/re_view_spatial/src/visualizers/lines2d.rs b/crates/viewer/re_view_spatial/src/visualizers/lines2d.rs index d5b5db1f7cae..8cb7b1590fe6 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/lines2d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/lines2d.rs @@ -182,7 +182,7 @@ impl VisualizerSystem for Lines2DVisualizer { re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); - use super::entity_iterator::{iter_primitive_array_list, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -199,9 +199,7 @@ impl VisualizerSystem for Lines2DVisualizer { let num_strips = all_strip_chunks .iter() - .flat_map(|chunk| { - chunk.iter_primitive_array_list::<2, f32>(&LineStrip2D::name()) - }) + .flat_map(|chunk| chunk.iter_slices::<[f32; 2]>(LineStrip2D::name())) .map(|strips| strips.len()) .sum(); if num_strips == 0 { @@ -211,15 +209,13 @@ impl VisualizerSystem for Lines2DVisualizer { let num_vertices = all_strip_chunks .iter() - .flat_map(|chunk| { - chunk.iter_primitive_array_list::<2, f32>(&LineStrip2D::name()) - }) + .flat_map(|chunk| chunk.iter_slices::<[f32; 2]>(LineStrip2D::name())) .map(|strips| strips.iter().map(|strip| strip.len()).sum::()) .sum::(); line_builder.reserve_vertices(num_vertices)?; let all_strips_indexed = - iter_primitive_array_list(&all_strip_chunks, timeline, LineStrip2D::name()); + iter_slices::<&[[f32; 2]]>(&all_strip_chunks, timeline, LineStrip2D::name()); let all_colors = results.iter_as(timeline, Color::name()); let all_radii = results.iter_as(timeline, Radius::name()); let all_labels = results.iter_as(timeline, Text::name()); @@ -228,11 +224,11 @@ impl VisualizerSystem for Lines2DVisualizer { let data = re_query::range_zip_1x5( all_strips_indexed, - all_colors.primitive::(), - all_radii.primitive::(), - all_labels.string(), - all_class_ids.primitive::(), - all_show_labels.bool(), + all_colors.slice::(), + all_radii.slice::(), + all_labels.slice::(), + all_class_ids.slice::(), + all_show_labels.slice::(), ) .map( |(_index, strips, colors, radii, labels, class_ids, show_labels)| { diff --git a/crates/viewer/re_view_spatial/src/visualizers/lines3d.rs b/crates/viewer/re_view_spatial/src/visualizers/lines3d.rs index 9ef6d4511fb2..bdced188aa5a 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/lines3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/lines3d.rs @@ -187,7 +187,7 @@ impl VisualizerSystem for Lines3DVisualizer { re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); - use super::entity_iterator::{iter_primitive_array_list, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -202,9 +202,7 @@ impl VisualizerSystem for Lines3DVisualizer { let num_strips = all_strip_chunks .iter() - .flat_map(|chunk| { - chunk.iter_primitive_array_list::<3, f32>(&LineStrip3D::name()) - }) + .flat_map(|chunk| chunk.iter_slices::<[f32; 3]>(LineStrip3D::name())) .map(|strips| strips.len()) .sum(); if num_strips == 0 { @@ -214,16 +212,14 @@ impl VisualizerSystem for Lines3DVisualizer { let num_vertices = all_strip_chunks .iter() - .flat_map(|chunk| { - chunk.iter_primitive_array_list::<3, f32>(&LineStrip3D::name()) - }) + .flat_map(|chunk| chunk.iter_slices::<[f32; 3]>(LineStrip3D::name())) .map(|strips| strips.iter().map(|strip| strip.len()).sum::()) .sum::(); line_builder.reserve_vertices(num_vertices)?; let timeline = ctx.query.timeline(); let all_strips_indexed = - iter_primitive_array_list(&all_strip_chunks, timeline, LineStrip3D::name()); + iter_slices::<&[[f32; 3]]>(&all_strip_chunks, timeline, LineStrip3D::name()); let all_colors = results.iter_as(timeline, Color::name()); let all_radii = results.iter_as(timeline, Radius::name()); let all_labels = results.iter_as(timeline, Text::name()); @@ -232,11 +228,11 @@ impl VisualizerSystem for Lines3DVisualizer { let data = re_query::range_zip_1x5( all_strips_indexed, - all_colors.primitive::(), - all_radii.primitive::(), - all_labels.string(), - all_class_ids.primitive::(), - all_show_labels.bool(), + all_colors.slice::(), + all_radii.slice::(), + all_labels.slice::(), + all_class_ids.slice::(), + all_show_labels.slice::(), ) .map( |(_index, strips, colors, radii, labels, class_ids, show_labels)| { diff --git a/crates/viewer/re_view_spatial/src/visualizers/meshes.rs b/crates/viewer/re_view_spatial/src/visualizers/meshes.rs index d5e83f60f9d2..aaa6dd9ceb30 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/meshes.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/meshes.rs @@ -176,7 +176,7 @@ impl VisualizerSystem for Mesh3DVisualizer { let mut instances = Vec::new(); - use super::entity_iterator::{iter_primitive_array, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -191,7 +191,7 @@ impl VisualizerSystem for Mesh3DVisualizer { }; let timeline = ctx.query.timeline(); - let all_vertex_positions_indexed = iter_primitive_array::<3, f32>( + let all_vertex_positions_indexed = iter_slices::<[f32; 3]>( &all_vertex_position_chunks, timeline, Position3D::name(), @@ -209,16 +209,15 @@ impl VisualizerSystem for Mesh3DVisualizer { let data = re_query::range_zip_1x8( all_vertex_positions_indexed, - all_vertex_normals.primitive_array::<3, f32>(), - all_vertex_colors.primitive::(), - all_vertex_texcoords.primitive_array::<2, f32>(), - all_triangle_indices.primitive_array::<3, u32>(), - all_albedo_factors.primitive::(), - // TODO(cmc): Provide a `iter_blob`. - all_albedo_buffers.component_slow::(), + all_vertex_normals.slice::<[f32; 3]>(), + all_vertex_colors.slice::(), + all_vertex_texcoords.slice::<[f32; 2]>(), + all_triangle_indices.slice::<[f32; 3]>(), + all_albedo_factors.slice::(), + all_albedo_buffers.slice::<&[u8]>(), // Legit call to `component_slow`, `ImageFormat` is real complicated. all_albedo_formats.component_slow::(), - all_class_ids.primitive::(), + all_class_ids.slice::(), ) .map( |( @@ -250,7 +249,11 @@ impl VisualizerSystem for Mesh3DVisualizer { bytemuck::cast_slice(albedo_factors) }) .first(), - albedo_buffer: albedo_buffers.unwrap_or_default().first().cloned(), // shallow clone + albedo_buffer: albedo_buffers + .unwrap_or_default() + .first() + .cloned() + .map(Into::into), // shallow clone albedo_format: albedo_formats.unwrap_or_default().first().copied(), class_ids: class_ids .map_or(&[], |class_ids| bytemuck::cast_slice(class_ids)), diff --git a/crates/viewer/re_view_spatial/src/visualizers/points2d.rs b/crates/viewer/re_view_spatial/src/visualizers/points2d.rs index 2b54e568c1d7..ecc05c39f821 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/points2d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/points2d.rs @@ -206,7 +206,7 @@ impl VisualizerSystem for Points2DVisualizer { re_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, ); - use super::entity_iterator::{iter_primitive_array, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -221,7 +221,7 @@ impl VisualizerSystem for Points2DVisualizer { let num_positions = all_position_chunks .iter() - .flat_map(|chunk| chunk.iter_primitive_array::<2, f32>(&Position2D::name())) + .flat_map(|chunk| chunk.iter_slices::<[f32; 2]>(Position2D::name())) .map(|points| points.len()) .sum(); @@ -232,11 +232,8 @@ impl VisualizerSystem for Points2DVisualizer { point_builder.reserve(num_positions)?; let timeline = ctx.query.timeline(); - let all_positions_indexed = iter_primitive_array::<2, f32>( - &all_position_chunks, - timeline, - Position2D::name(), - ); + let all_positions_indexed = + iter_slices::<[f32; 2]>(&all_position_chunks, timeline, Position2D::name()); let all_colors = results.iter_as(timeline, Color::name()); let all_radii = results.iter_as(timeline, Radius::name()); let all_labels = results.iter_as(timeline, Text::name()); @@ -246,12 +243,12 @@ impl VisualizerSystem for Points2DVisualizer { let data = re_query::range_zip_1x6( all_positions_indexed, - all_colors.primitive::(), - all_radii.primitive::(), - all_labels.string(), - all_class_ids.primitive::(), - all_keypoint_ids.primitive::(), - all_show_labels.bool(), + all_colors.slice::(), + all_radii.slice::(), + all_labels.slice::(), + all_class_ids.slice::(), + all_keypoint_ids.slice::(), + all_show_labels.slice::(), ) .map( |( diff --git a/crates/viewer/re_view_spatial/src/visualizers/points3d.rs b/crates/viewer/re_view_spatial/src/visualizers/points3d.rs index 7928fea07477..55521f3bcd98 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/points3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/points3d.rs @@ -196,7 +196,7 @@ impl VisualizerSystem for Points3DVisualizer { re_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, ); - use super::entity_iterator::{iter_primitive_array, process_archetype}; + use super::entity_iterator::{iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -211,7 +211,7 @@ impl VisualizerSystem for Points3DVisualizer { let num_positions = all_position_chunks .iter() - .flat_map(|chunk| chunk.iter_primitive_array::<3, f32>(&Position3D::name())) + .flat_map(|chunk| chunk.iter_slices::<[f32; 3]>(Position3D::name())) .map(|points| points.len()) .sum(); @@ -222,11 +222,8 @@ impl VisualizerSystem for Points3DVisualizer { point_builder.reserve(num_positions)?; let timeline = ctx.query.timeline(); - let all_positions_indexed = iter_primitive_array::<3, f32>( - &all_position_chunks, - timeline, - Position3D::name(), - ); + let all_positions_indexed = + iter_slices::<[f32; 3]>(&all_position_chunks, timeline, Position3D::name()); let all_colors = results.iter_as(timeline, Color::name()); let all_radii = results.iter_as(timeline, Radius::name()); let all_labels = results.iter_as(timeline, Text::name()); @@ -236,12 +233,12 @@ impl VisualizerSystem for Points3DVisualizer { let data = re_query::range_zip_1x6( all_positions_indexed, - all_colors.primitive::(), - all_radii.primitive::(), - all_labels.string(), - all_class_ids.primitive::(), - all_keypoint_ids.primitive::(), - all_show_labels.bool(), + all_colors.slice::(), + all_radii.slice::(), + all_labels.slice::(), + all_class_ids.slice::(), + all_keypoint_ids.slice::(), + all_show_labels.slice::(), ) .map( |( diff --git a/crates/viewer/re_view_spatial/src/visualizers/segmentation_images.rs b/crates/viewer/re_view_spatial/src/visualizers/segmentation_images.rs index 87cf23354ec3..9521bafabb86 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/segmentation_images.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/segmentation_images.rs @@ -67,7 +67,7 @@ impl VisualizerSystem for SegmentationImageVisualizer { return Err(ViewSystemExecutionError::NoRenderContextError); }; - use super::entity_iterator::{iter_buffer, iter_component, process_archetype}; + use super::entity_iterator::{iter_component, iter_slices, process_archetype}; process_archetype::( ctx, view_query, @@ -88,7 +88,7 @@ impl VisualizerSystem for SegmentationImageVisualizer { let timeline = ctx.query.timeline(); let all_buffers_indexed = - iter_buffer::(&all_buffer_chunks, timeline, ImageBuffer::name()); + iter_slices::<&[u8]>(&all_buffer_chunks, timeline, ImageBuffer::name()); let all_formats_indexed = iter_component::( &all_formats_chunks, timeline, @@ -99,7 +99,7 @@ impl VisualizerSystem for SegmentationImageVisualizer { let data = re_query::range_zip_1x2( all_buffers_indexed, all_formats_indexed, - all_opacities.primitive::(), + all_opacities.slice::(), ) .filter_map(|(index, buffers, formats, opacity)| { let buffer = buffers.first()?; diff --git a/crates/viewer/re_view_spatial/src/visualizers/videos.rs b/crates/viewer/re_view_spatial/src/visualizers/videos.rs index 55e0321fae27..f8362e9ae71d 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/videos.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/videos.rs @@ -104,7 +104,7 @@ impl VisualizerSystem for VideoFrameReferenceVisualizer { timeline, VideoTimestamp::name(), ), - all_video_references.string(), + all_video_references.slice::(), ) { let Some(video_timestamp): Option<&VideoTimestamp> = video_timestamps.first() else { diff --git a/crates/viewer/re_view_tensor/src/visualizer_system.rs b/crates/viewer/re_view_tensor/src/visualizer_system.rs index aa5e0cbd2412..a44193024953 100644 --- a/crates/viewer/re_view_tensor/src/visualizer_system.rs +++ b/crates/viewer/re_view_tensor/src/visualizer_system.rs @@ -69,7 +69,7 @@ impl VisualizerSystem for TensorSystem { let all_ranges = results.iter_as(timeline, ValueRange::name()); for ((_, tensor_row_id), tensors, data_ranges) in - re_query::range_zip_1x1(all_tensors_indexed, all_ranges.primitive_array::<2, f64>()) + re_query::range_zip_1x1(all_tensors_indexed, all_ranges.slice::<[f64; 2]>()) { let Some(tensor) = tensors.first() else { continue; diff --git a/crates/viewer/re_view_text_log/src/visualizer_system.rs b/crates/viewer/re_view_text_log/src/visualizer_system.rs index d6330d8b842d..9f597807b1dd 100644 --- a/crates/viewer/re_view_text_log/src/visualizer_system.rs +++ b/crates/viewer/re_view_text_log/src/visualizer_system.rs @@ -110,9 +110,9 @@ impl TextLogSystem { let all_colors = results.iter_as(timeline, Color::name()); let all_frames = range_zip_1x2( - all_texts.string(), - all_levels.string(), - all_colors.primitive::(), + all_texts.slice::(), + all_levels.slice::(), + all_colors.slice::(), ); let all_frames = izip!(all_timepoints, all_frames); diff --git a/crates/viewer/re_view_time_series/src/line_visualizer_system.rs b/crates/viewer/re_view_time_series/src/line_visualizer_system.rs index 03ee2a16469b..6ea021d08867 100644 --- a/crates/viewer/re_view_time_series/src/line_visualizer_system.rs +++ b/crates/viewer/re_view_time_series/src/line_visualizer_system.rs @@ -260,7 +260,7 @@ impl SeriesLineSystem { debug_assert_eq!(Scalar::arrow_datatype(), ArrowDatatype::Float64); all_scalar_chunks .iter() - .flat_map(|chunk| chunk.iter_primitive::(&Scalar::name())) + .flat_map(|chunk| chunk.iter_slices::(Scalar::name())) .enumerate() .for_each(|(i, values)| { if !values.is_empty() { @@ -301,7 +301,7 @@ impl SeriesLineSystem { re_tracing::profile_scope!("override/default fast path"); let color = all_color_chunks[0] - .iter_primitive::(&Color::name()) + .iter_slices::(Color::name()) .next() .and_then(map_raw_color); @@ -314,7 +314,7 @@ impl SeriesLineSystem { let all_colors = all_color_chunks.iter().flat_map(|chunk| { itertools::izip!( chunk.iter_component_indices(&query.timeline(), &Color::name()), - chunk.iter_primitive::(&Color::name()) + chunk.iter_slices::(Color::name()) ) }); @@ -344,7 +344,7 @@ impl SeriesLineSystem { re_tracing::profile_scope!("override/default fast path"); let stroke_width = all_stroke_width_chunks[0] - .iter_primitive::(&StrokeWidth::name()) + .iter_slices::(StrokeWidth::name()) .next() .and_then(|stroke_widths| stroke_widths.first().copied()); @@ -362,7 +362,7 @@ impl SeriesLineSystem { &query.timeline(), &StrokeWidth::name() ), - chunk.iter_primitive::(&StrokeWidth::name()) + chunk.iter_slices::(StrokeWidth::name()) ) }); diff --git a/crates/viewer/re_view_time_series/src/point_visualizer_system.rs b/crates/viewer/re_view_time_series/src/point_visualizer_system.rs index 912fbd149474..94810b6e1b8a 100644 --- a/crates/viewer/re_view_time_series/src/point_visualizer_system.rs +++ b/crates/viewer/re_view_time_series/src/point_visualizer_system.rs @@ -275,7 +275,7 @@ impl SeriesPointSystem { let mut i = 0; all_scalar_chunks .iter() - .flat_map(|chunk| chunk.iter_primitive::(&Scalar::name())) + .flat_map(|chunk| chunk.iter_slices::(Scalar::name())) .for_each(|values| { if !values.is_empty() { if values.len() > 1 { @@ -318,7 +318,7 @@ impl SeriesPointSystem { re_tracing::profile_scope!("override/default fast path"); let color = all_color_chunks[0] - .iter_primitive::(&Color::name()) + .iter_slices::(Color::name()) .next() .and_then(map_raw_color); @@ -331,7 +331,7 @@ impl SeriesPointSystem { let all_colors = all_color_chunks.iter().flat_map(|chunk| { itertools::izip!( chunk.iter_component_indices(&query.timeline(), &Color::name()), - chunk.iter_primitive::(&Color::name()) + chunk.iter_slices::(Color::name()) ) }); @@ -360,7 +360,7 @@ impl SeriesPointSystem { re_tracing::profile_scope!("override/default fast path"); let marker_size = all_marker_size_chunks[0] - .iter_primitive::(&MarkerSize::name()) + .iter_slices::(MarkerSize::name()) .next() .and_then(|marker_sizes| marker_sizes.first().copied()); @@ -377,7 +377,7 @@ impl SeriesPointSystem { itertools::izip!( chunk .iter_component_indices(&query.timeline(), &MarkerSize::name()), - chunk.iter_primitive::(&MarkerSize::name()) + chunk.iter_slices::(Color::name()) ) });