mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'sharp/fix-ci' into 'master'
Fix benchmarks and profile overrides. See merge request veloren/veloren!736
This commit is contained in:
@ -107,8 +107,6 @@ coverage:
|
|||||||
tags:
|
tags:
|
||||||
- veloren-docker
|
- veloren-docker
|
||||||
script:
|
script:
|
||||||
- sed -i '/cargo-features/d' Cargo.toml
|
|
||||||
- sed -i '/profile.dev.overrides/,+1d' Cargo.toml
|
|
||||||
- cargo tarpaulin -v
|
- cargo tarpaulin -v
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
|
16
Cargo.toml
16
Cargo.toml
@ -22,21 +22,21 @@ codegen-units = 8
|
|||||||
lto = false
|
lto = false
|
||||||
incremental = true
|
incremental = true
|
||||||
# All dependencies (but not this crate itself)
|
# All dependencies (but not this crate itself)
|
||||||
[profile.dev.overrides."*"]
|
[profile.dev.package."*"]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
[profile.dev.overrides."veloren-common"]
|
[profile.dev.package."veloren-common"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-client"]
|
[profile.dev.package."veloren-client"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-chat-cli"]
|
[profile.dev.package."veloren-chat-cli"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-server"]
|
[profile.dev.package."veloren-server"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-server-cli"]
|
[profile.dev.package."veloren-server-cli"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-voxygen"]
|
[profile.dev.package."veloren-voxygen"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-world"]
|
[profile.dev.package."veloren-world"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
|
|
||||||
# this profile is used by developers if dev doesn't has enough debug information, the name must != debug, as debug is used by dev because....
|
# this profile is used by developers if dev doesn't has enough debug information, the name must != debug, as debug is used by dev because....
|
||||||
|
@ -2,7 +2,7 @@ use common::terrain::Block;
|
|||||||
use common::terrain::TerrainGrid;
|
use common::terrain::TerrainGrid;
|
||||||
use common::vol::SampleVol;
|
use common::vol::SampleVol;
|
||||||
use common::vol::Vox;
|
use common::vol::Vox;
|
||||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
use criterion::{black_box, criterion_group, criterion_main, Benchmark, Criterion};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use veloren_voxygen::mesh::Meshable;
|
use veloren_voxygen::mesh::Meshable;
|
||||||
@ -12,8 +12,6 @@ const CENTER: Vec2<i32> = Vec2 { x: 512, y: 512 };
|
|||||||
const GEN_SIZE: i32 = 4;
|
const GEN_SIZE: i32 = 4;
|
||||||
|
|
||||||
pub fn criterion_benchmark(c: &mut Criterion) {
|
pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
// Lower sample size to save time
|
|
||||||
c = c.sample_size(15);
|
|
||||||
// Generate chunks here to test
|
// Generate chunks here to test
|
||||||
let mut terrain = TerrainGrid::new().unwrap();
|
let mut terrain = TerrainGrid::new().unwrap();
|
||||||
let world = World::generate(42);
|
let world = World::generate(42);
|
||||||
@ -57,69 +55,79 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
|
|
||||||
// Test speed of cloning voxel sample into a flat array
|
// Test speed of cloning voxel sample into a flat array
|
||||||
let (volume, range) = sample(Vec2::new(1, 1));
|
let (volume, range) = sample(Vec2::new(1, 1));
|
||||||
c.bench_function("copying 1,1 into flat array", |b| {
|
c.bench(
|
||||||
b.iter(|| {
|
"meshing",
|
||||||
let mut flat = vec![Block::empty(); range.size().product() as usize];
|
Benchmark::new("copying 1,1 into flat array", move |b| {
|
||||||
let mut i = 0;
|
b.iter(|| {
|
||||||
let mut volume = volume.cached();
|
let mut flat = vec![Block::empty(); range.size().product() as usize];
|
||||||
for x in 0..range.size().w {
|
let mut i = 0;
|
||||||
for y in 0..range.size().h {
|
let mut volume = volume.cached();
|
||||||
for z in 0..range.size().d {
|
for x in 0..range.size().w {
|
||||||
flat[i] = *volume.get(range.min + Vec3::new(x, y, z)).unwrap();
|
for y in 0..range.size().h {
|
||||||
i += 1;
|
for z in 0..range.size().d {
|
||||||
|
flat[i] = *volume.get(range.min + Vec3::new(x, y, z)).unwrap();
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
/*let (w, h, d) = range.size().into_tuple();
|
||||||
/*let (w, h, d) = range.size().into_tuple();
|
for (chunk_key, chunk) in volume.iter() {
|
||||||
for (chunk_key, chunk) in volume.iter() {
|
let chunk_pos = volume.key_pos(chunk_key);
|
||||||
let chunk_pos = volume.key_pos(chunk_key);
|
let min = chunk_pos.map2(
|
||||||
let min = chunk_pos.map2(
|
Vec2::new(range.min.x, range.min.y),
|
||||||
Vec2::new(range.min.x, range.min.y),
|
|cmin: i32, rmin: i32| (rmin - cmin).max(0),
|
||||||
|cmin: i32, rmin: i32| (rmin - cmin).max(0),
|
);
|
||||||
);
|
// Chunk not in area of interest
|
||||||
// Chunk not in area of interest
|
if min
|
||||||
if min
|
.map2(TerrainGrid::chunk_size(), |m, size| m >= size as i32)
|
||||||
.map2(TerrainGrid::chunk_size(), |m, size| m >= size as i32)
|
.reduce_and()
|
||||||
.reduce_and()
|
{
|
||||||
{
|
// TODO: comment after ensuing no panics
|
||||||
// TODO: comment after ensuing no panics
|
panic!("Shouldn't happen in this case");
|
||||||
panic!("Shouldn't happen in this case");
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
let min = min.map(|m| m.min(31));
|
||||||
let min = min.map(|m| m.min(31));
|
// TODO: Don't hardcode 31
|
||||||
// TODO: Don't hardcode 31
|
let max = chunk_pos.map2(Vec2::new(range.max.x, range.max.y), |cmin, rmax| {
|
||||||
let max = chunk_pos.map2(Vec2::new(range.max.x, range.max.y), |cmin, rmax| {
|
(rmax - cmin).min(31)
|
||||||
(rmax - cmin).min(31)
|
});
|
||||||
});
|
if max.map(|m| m < 0).reduce_and() {
|
||||||
if max.map(|m| m < 0).reduce_and() {
|
panic!("Shouldn't happen in this case: {:?}", max);
|
||||||
panic!("Shouldn't happen in this case: {:?}", max);
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
let max = max.map(|m| m.max(0));
|
||||||
let max = max.map(|m| m.max(0));
|
// Add z dims
|
||||||
// Add z dims
|
let min = Vec3::new(min.x, min.y, range.min.z);
|
||||||
let min = Vec3::new(min.x, min.y, range.min.z);
|
let max = Vec3::new(max.x, max.y, range.max.z);
|
||||||
let max = Vec3::new(max.x, max.y, range.max.z);
|
// Offset of chunk in sample being cloned
|
||||||
// Offset of chunk in sample being cloned
|
let offset = Vec3::new(
|
||||||
let offset = Vec3::new(
|
chunk_pos.x - range.min.x,
|
||||||
chunk_pos.x - range.min.x,
|
chunk_pos.y - range.min.y,
|
||||||
chunk_pos.y - range.min.y,
|
-range.min.z,
|
||||||
-range.min.z,
|
);
|
||||||
);
|
for (pos, &block) in chunk.vol_iter(min, max) {
|
||||||
for (pos, &block) in chunk.vol_iter(min, max) {
|
let pos = pos + offset;
|
||||||
let pos = pos + offset;
|
flat[(w * h * pos.z + w * pos.y + pos.x) as usize] = block;
|
||||||
flat[(w * h * pos.z + w * pos.y + pos.x) as usize] = block;
|
}
|
||||||
}
|
}*/
|
||||||
}*/
|
black_box(flat);
|
||||||
black_box(flat);
|
});
|
||||||
});
|
})
|
||||||
});
|
// Lower sample size to save time
|
||||||
|
.sample_size(15),
|
||||||
|
);
|
||||||
|
|
||||||
for x in 1..GEN_SIZE - 1 {
|
for x in 1..GEN_SIZE - 1 {
|
||||||
for y in 1..GEN_SIZE - 1 {
|
for y in 1..GEN_SIZE - 1 {
|
||||||
let (volume, range) = sample(Vec2::new(x, y));
|
let (volume, range) = sample(Vec2::new(x, y));
|
||||||
c.bench_function(&format!("Terrain mesh {}, {}", x, y), |b| {
|
c.bench(
|
||||||
b.iter(|| volume.generate_mesh(black_box(range)))
|
"meshing",
|
||||||
});
|
Benchmark::new(&format!("Terrain mesh {}, {}", x, y), move |b| {
|
||||||
|
b.iter(|| volume.generate_mesh(black_box(range)))
|
||||||
|
})
|
||||||
|
// Lower sample size to save time
|
||||||
|
.sample_size(15),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1231,6 +1231,12 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
\n\
|
\n\
|
||||||
Dodge\n\
|
Dodge\n\
|
||||||
\n\
|
\n\
|
||||||
|
Roll\n\
|
||||||
|
\n\
|
||||||
|
Climb\n\
|
||||||
|
\n\
|
||||||
|
Climb down\n\
|
||||||
|
\n\
|
||||||
Auto Walk\n\
|
Auto Walk\n\
|
||||||
\n\
|
\n\
|
||||||
Sheathe/Draw Weapons\n\
|
Sheathe/Draw Weapons\n\
|
||||||
@ -1239,6 +1245,10 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
\n\
|
\n\
|
||||||
Sit\n\
|
Sit\n\
|
||||||
\n\
|
\n\
|
||||||
|
Mount\n\
|
||||||
|
\n\
|
||||||
|
Interact\n\
|
||||||
|
\n\
|
||||||
\n\
|
\n\
|
||||||
Basic Attack\n\
|
Basic Attack\n\
|
||||||
Secondary Attack/Block/Aim\n\
|
Secondary Attack/Block/Aim\n\
|
||||||
@ -1318,6 +1328,16 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
\n\
|
\n\
|
||||||
{}\n\
|
{}\n\
|
||||||
\n\
|
\n\
|
||||||
|
{}\n\
|
||||||
|
\n\
|
||||||
|
{}\n\
|
||||||
|
\n\
|
||||||
|
{}\n\
|
||||||
|
\n\
|
||||||
|
{}\n\
|
||||||
|
\n\
|
||||||
|
{}\n\
|
||||||
|
\n\
|
||||||
\n\
|
\n\
|
||||||
{}\n\
|
{}\n\
|
||||||
{}\n\
|
{}\n\
|
||||||
@ -1369,10 +1389,15 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
controls.jump,
|
controls.jump,
|
||||||
controls.glide,
|
controls.glide,
|
||||||
"??", // Dodge
|
"??", // Dodge
|
||||||
|
controls.roll,
|
||||||
|
controls.climb,
|
||||||
|
controls.climb_down,
|
||||||
"??", // Auto Walk
|
"??", // Auto Walk
|
||||||
controls.toggle_wield,
|
controls.toggle_wield,
|
||||||
"??", // Put on/Remove Helmet
|
"??", // Put on/Remove Helmet
|
||||||
controls.sit,
|
controls.sit,
|
||||||
|
controls.mount,
|
||||||
|
controls.interact,
|
||||||
controls.primary,
|
controls.primary,
|
||||||
controls.secondary,
|
controls.secondary,
|
||||||
"1", // Skillbar Slot 1
|
"1", // Skillbar Slot 1
|
||||||
|
Reference in New Issue
Block a user