Tile source fixes (#236)

* Fix a bug with empty layers

* Switch to XYZ

* Fix tile url

* Execute apt-get update
This commit is contained in:
Max Ammann 2023-01-11 20:45:46 +01:00 committed by GitHub
parent f6fc816761
commit f82ac0e8a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 11 deletions

View File

@ -8,12 +8,10 @@ runs:
# On Ubuntu 22.04 (currently used) using the PPA introduces SEGVs. # On Ubuntu 22.04 (currently used) using the PPA introduces SEGVs.
#- name: Use oibaf PPA for drivers #- name: Use oibaf PPA for drivers
# shell: bash # shell: bash
# run: | # run: sudo apt-get update -y -qq && sudo add-apt-repository ppa:oibaf/graphics-drivers -y
# sudo apt-get update -y -qq
# sudo add-apt-repository ppa:oibaf/graphics-drivers -y
- name: Install Mesa Dependencies - name: Install Mesa Dependencies
shell: bash shell: bash
run: sudo apt-get install -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers run: sudo apt-get update -y -qq && sudo apt-get install -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- name: Install wgpu-info - name: Install wgpu-info
shell: bash shell: bash
# Rev is for 0.14.1: https://github.com/gfx-rs/wgpu/tree/v0.14.1 # Rev is for 0.14.1: https://github.com/gfx-rs/wgpu/tree/v0.14.1

View File

@ -12,7 +12,7 @@ runs:
if: runner.os == 'Linux' if: runner.os == 'Linux'
shell: bash shell: bash
run: | run: |
sudo apt-get install -y \ sudo apt-get update -y -qq && sudo apt-get install -y \
protobuf-compiler \ protobuf-compiler \
libwayland-dev libxkbcommon-dev # Required for winit libwayland-dev libxkbcommon-dev # Required for winit
- name: Install System Dependencies (macOS) - name: Install System Dependencies (macOS)

View File

@ -68,11 +68,11 @@ where
} }
pub async fn fetch(&self, coords: &WorldTileCoords) -> Result<Vec<u8>, SourceFetchError> { pub async fn fetch(&self, coords: &WorldTileCoords) -> Result<Vec<u8>, SourceFetchError> {
let tile_coords = coords.into_tile(TileAddressingScheme::TMS).unwrap(); let tile_coords = coords.into_tile(TileAddressingScheme::XYZ).unwrap();
self.inner_client self.inner_client
.fetch( .fetch(
format!( format!(
"https://maps.tuerantuer.org/europe_germany/{z}/{x}/{y}.pbf", "https://maps.tuerantuer.org/europe_germany/{z}/{x}/{y}",
x = tile_coords.x, x = tile_coords.x,
y = tile_coords.y, y = tile_coords.y,
z = tile_coords.z z = tile_coords.z

View File

@ -38,6 +38,8 @@ pub trait LayerTessellated: Send {
fn coords(&self) -> WorldTileCoords; fn coords(&self) -> WorldTileCoords;
fn is_empty(&self) -> bool;
fn to_stored_layer(self) -> StoredLayer; fn to_stored_layer(self) -> StoredLayer;
} }
@ -119,6 +121,10 @@ impl LayerTessellated for DefaultLayerTesselated {
self.coords self.coords
} }
fn is_empty(&self) -> bool {
self.buffer.usable_indices == 0
}
fn to_stored_layer(self) -> StoredLayer { fn to_stored_layer(self) -> StoredLayer {
StoredLayer::TessellatedLayer { StoredLayer::TessellatedLayer {
coords: self.coords, coords: self.coords,

View File

@ -143,11 +143,16 @@ impl RenderCommand<(IndexEntry, TileShape)> for DrawTile {
&entry.coords &entry.coords
); );
let index_range = entry.indices_buffer_range();
if index_range.is_empty() {
tracing::error!("Tried to draw a vector tile without any vertices");
return RenderCommandResult::Failure;
}
pass.set_stencil_reference(reference); pass.set_stencil_reference(reference);
pass.set_index_buffer(
buffer_pool.indices().slice(entry.indices_buffer_range()), pass.set_index_buffer(buffer_pool.indices().slice(index_range), INDEX_FORMAT);
INDEX_FORMAT,
);
pass.set_vertex_buffer( pass.set_vertex_buffer(
0, 0,
buffer_pool.vertices().slice(entry.vertices_buffer_range()), buffer_pool.vertices().slice(entry.vertices_buffer_range()),

View File

@ -64,6 +64,11 @@ impl<E: Environment> Stage for PopulateTileStore<E> {
tile_repository.put_layer(layer); tile_repository.put_layer(layer);
} }
Message::LayerTessellated(message) => { Message::LayerTessellated(message) => {
// TODO: Is it fine to ignore layers without any vertices?
if message.is_empty() {
continue;
}
let layer: StoredLayer = message.to_stored_layer(); let layer: StoredLayer = message.to_stored_layer();
tracing::debug!( tracing::debug!(

View File

@ -190,6 +190,11 @@ impl LayerTessellated for FlatBufferTransferable {
data.coords().unwrap().into() data.coords().unwrap().into()
} }
fn is_empty(&self) -> bool {
let data = unsafe { root_as_flat_layer_tessellated_unchecked(&self.data[self.start..]) };
data.usable_indices() == 0
}
fn to_stored_layer(self) -> StoredLayer { fn to_stored_layer(self) -> StoredLayer {
let data = unsafe { root_as_flat_layer_tessellated_unchecked(&self.data[self.start..]) }; let data = unsafe { root_as_flat_layer_tessellated_unchecked(&self.data[self.start..]) };
let vertices = data let vertices = data