smaller code cleanups, copy paste errors, or wrong merge resolutions fixed according to MR reviews

This commit is contained in:
Marcel Märtens 2024-01-26 12:31:56 +01:00
parent 02aa740f72
commit 856c64c9ee
15 changed files with 33 additions and 70 deletions

View File

@ -25,8 +25,8 @@ tracy-server-debuginfo = "run --bin veloren-server-cli --features tracy,simd --p
tracy-server-releasedebuginfo = "run --bin veloren-server-cli --features tracy,simd --profile releasedebuginfo"
tracy-test-server = "run --bin veloren-server-cli --no-default-features --features tracy,simd --profile no_overflow"
# voxygen
test-voxygen = "run --bin veloren-voxygen --no-default-features --features simd,egui-ui"
tracy-voxygen = "run --bin veloren-voxygen --no-default-features --features tracy,simd,egui-ui --profile no_overflow"
test-voxygen = "run --bin veloren-voxygen --no-default-features --features simd,egui-ui,shaderc-from-source"
tracy-voxygen = "run --bin veloren-voxygen --no-default-features --features tracy,simd,egui-ui,shaderc-from-source --profile no_overflow"
dbg-voxygen = "run --bin veloren-voxygen --profile debuginfo"
# misc
swarm = "run --bin swarm --features client/bin_bot,client/tick_network --"

27
Cargo.lock generated
View File

@ -2900,7 +2900,7 @@ dependencies = [
"log",
"thiserror",
"winapi",
"window_clipboard 0.3.0",
"window_clipboard",
"winit",
]
@ -4876,16 +4876,6 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab"
[[package]]
name = "raw-window-handle"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76"
dependencies = [
"libc",
"raw-window-handle 0.4.3",
]
[[package]]
name = "raw-window-handle"
version = "0.4.3"
@ -7294,7 +7284,6 @@ dependencies = [
"veloren-world",
"wgpu",
"wgpu-profiler",
"window_clipboard 0.2.4",
"winit",
"winres",
]
@ -8037,20 +8026,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "window_clipboard"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "015dd4474dc6aa96fe19aae3a24587a088bd90331dba5a5cc60fb3a180234c4d"
dependencies = [
"clipboard-win 4.5.0",
"clipboard_macos",
"clipboard_wayland",
"clipboard_x11",
"raw-window-handle 0.3.4",
"thiserror",
]
[[package]]
name = "window_clipboard"
version = "0.3.0"

View File

@ -166,27 +166,10 @@ shred = { git = "https://github.com/amethyst/shred.git", rev = "5d52c6fc390dd04c
# with uint in uniforms for gl.
wgpu = { git = "https://github.com/IsseW/wgpu", rev = "5ea160164" }
# [patch."https://github.com/gfx-rs/gfx"]
# gfx-hal = { git = "https://github.com/Imberflur/gfx.git", tag = "veloren-fixes-v1" }
# gfx-backend-empty = { git = "https://github.com/Imberflur/gfx.git", tag = "veloren-fixes-v1" }
# gfx-backend-vulkan = { git = "https://github.com/Imberflur/gfx.git", tag = "veloren-fixes-v1" }
# gfx-backend-gl = { git = "https://github.com/Imberflur/gfx.git", tag = "veloren-fixes-v1" }
# gfx-backend-dx12 = { git = "https://github.com/Imberflur/gfx.git", tag = "veloren-fixes-v1" }
# gfx-backend-dx11 = { git = "https://github.com/Imberflur/gfx.git", tag = "veloren-fixes-v1" }
# gfx-backend-metal = { git = "https://github.com/Imberflur/gfx.git", tag = "veloren-fixes-v1" }
# # use the latest fixes in naga (remove when updates trickle down to wgpu-rs)
# naga = { git = "https://github.com/gfx-rs/naga.git", rev = "3a0f0144112ff621dd7f731bf455adf6cab19164" }
# # use the latest fixes in gfx (remove when updates trickle down to wgpu-rs)
# gfx-hal = { git = "https://github.com/gfx-rs/gfx.git", rev = "e305dcca3557923a6a8810162d8dd09cb45a43a6" }
# gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx.git", rev = "e305dcca3557923a6a8810162d8dd09cb45a43a6" }
# gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx.git", rev = "e305dcca3557923a6a8810162d8dd09cb45a43a6" }
# gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx.git", rev = "e305dcca3557923a6a8810162d8dd09cb45a43a6" }
# gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx.git", rev = "e305dcca3557923a6a8810162d8dd09cb45a43a6" }
# gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx.git", rev = "e305dcca3557923a6a8810162d8dd09cb45a43a6" }
# gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx.git", rev = "e305dcca3557923a6a8810162d8dd09cb45a43a6" }
# keyboard-keynames = { git = "https://gitlab.com/Capucho/keyboard-keynames.git", rev = "7b1375ee4ea01d0e0b80c419cb27f0498e67df3a" }
# naga = { path = "../naga" }
# keyboard-keynames = { git = "https://gitlab.com/Capucho/keyboard-keynames.git", rev = "7b1375ee4ea01d0e0b80c419cb27f0498e67df3a" }
# # Uncomment this to use a local fork of winit (for testing purposes)
# winit = { path = "../winit" }

View File

@ -58,7 +58,7 @@ voxygen-egui = {package = "veloren-voxygen-egui", path = "egui", optional = true
# Graphics
winit = {version = "0.28.6", features = ["serde"]}
# naga has an issue for spirv in wgpu 18.0
wgpu = { version = "=0.18.0", default-features = false, features = ["trace", "spirv", "glsl"] }
wgpu = { version = "0.18.0", default-features = false, features = ["trace", "spirv", "glsl"] }
wgpu-profiler = "0.15.0"
bytemuck = { version="1.7", features=["derive"] }
# shaderc = "0.8.0"
@ -74,7 +74,6 @@ conrod_winit = {git = "https://gitlab.com/veloren/conrod.git", branch="copypasta
euc = "0.5.0"
iced = {package = "iced_native", git = "https://github.com/Imberflur/iced", tag = "veloren-winit-0.28"}
iced_winit = {git = "https://github.com/Imberflur/iced", tag = "veloren-winit-0.28"}
window_clipboard = "0.2"
glyph_brush = "0.7.0"
# https://gitlab.com/Frinksy/keyboard-keynames/-/merge_requests/8
keyboard-keynames = { git = "https://gitlab.com/Imbris/keyboard-keynames.git", tag = "veloren-winit-0.28" }

View File

@ -108,7 +108,7 @@ fn draw_give_items(ui: &mut Ui, state: &mut AdminCommandState, egui_actions: &mu
});
}
fn draw_spawn_entities(ui: &mut Ui, state: &mut AdminCommandState, egui_actions: &mut EguiActions) {
ui.spacing_mut().window_margin = Margin::symmetric(10.0, 10.0);
ui.spacing_mut().window_margin = Margin::same(10.0);
Resize::default()
.default_size([400.0, 200.0])
.show(ui, |ui| {

View File

@ -47,6 +47,7 @@ impl From<wgpu::BufferAsyncError> for RenderError {
impl From<wgpu::SurfaceError> for RenderError {
fn from(err: wgpu::SurfaceError) -> Self { Self::SurfaceError(err) }
}
impl From<(&str, shaderc::Error)> for RenderError {
fn from((shader_name, err): (&str, shaderc::Error)) -> Self {
Self::ShaderError(shader_name.into(), err)

View File

@ -286,7 +286,7 @@ impl AtlasData for FigureSpriteAtlasData {
// col lights
wgpu::BindGroupLayoutEntry {
binding: 0,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Texture {
sample_type: wgpu::TextureSampleType::Float { filterable: true },
view_dimension: wgpu::TextureViewDimension::D2,
@ -296,7 +296,7 @@ impl AtlasData for FigureSpriteAtlasData {
},
wgpu::BindGroupLayoutEntry {
binding: 1,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
count: None,
},

View File

@ -534,7 +534,7 @@ impl GlobalsLayouts {
// clouds t_weather
wgpu::BindGroupLayoutEntry {
binding: 12,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Texture {
sample_type: wgpu::TextureSampleType::Float { filterable: true },
view_dimension: wgpu::TextureViewDimension::D2,
@ -544,14 +544,14 @@ impl GlobalsLayouts {
},
wgpu::BindGroupLayoutEntry {
binding: 13,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
count: None,
},
// rain occlusion
wgpu::BindGroupLayoutEntry {
binding: 14,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Uniform,
has_dynamic_offset: false,
@ -608,7 +608,7 @@ impl GlobalsLayouts {
// Rain occlusion maps
wgpu::BindGroupLayoutEntry {
binding: 4,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Texture {
sample_type: wgpu::TextureSampleType::Depth,
view_dimension: wgpu::TextureViewDimension::D2,
@ -618,7 +618,7 @@ impl GlobalsLayouts {
},
wgpu::BindGroupLayoutEntry {
binding: 5,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Comparison),
count: None,
},

View File

@ -53,7 +53,7 @@ impl RainOcclusionLayout {
label: None,
entries: &[wgpu::BindGroupLayoutEntry {
binding: 0,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Uniform,
has_dynamic_offset: false,

View File

@ -71,7 +71,7 @@ impl RopeLayout {
// locals
wgpu::BindGroupLayoutEntry {
binding: 0,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Uniform,
has_dynamic_offset: false,
@ -113,6 +113,7 @@ impl RopePipeline {
global_layout: &GlobalsLayouts,
layout: &RopeLayout,
aa_mode: AaMode,
format: wgpu::TextureFormat,
) -> Self {
common_base::span!(_guard, "RopePipeline::new");
let render_pipeline_layout =
@ -171,8 +172,7 @@ impl RopePipeline {
entry_point: "main",
targets: &[
Some(wgpu::ColorTargetState {
// TODO: use a constant and/or pass in this format on pipeline construction
format: wgpu::TextureFormat::Rgba16Float,
format,
blend: Some(wgpu::BlendState {
color: wgpu::BlendComponent {
src_factor: wgpu::BlendFactor::SrcAlpha,

View File

@ -345,7 +345,7 @@ impl AtlasData for TerrainAtlasData {
// col lights
wgpu::BindGroupLayoutEntry {
binding: 0,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Texture {
sample_type: wgpu::TextureSampleType::Float { filterable: true },
view_dimension: wgpu::TextureViewDimension::D2,
@ -355,14 +355,14 @@ impl AtlasData for TerrainAtlasData {
},
wgpu::BindGroupLayoutEntry {
binding: 1,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
count: None,
},
// kind
wgpu::BindGroupLayoutEntry {
binding: 2,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Texture {
sample_type: wgpu::TextureSampleType::Uint,
view_dimension: wgpu::TextureViewDimension::D2,
@ -372,7 +372,7 @@ impl AtlasData for TerrainAtlasData {
},
wgpu::BindGroupLayoutEntry {
binding: 3,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::NonFiltering),
count: None,
},

View File

@ -188,7 +188,7 @@ impl UiLayout {
// tex_locals
wgpu::BindGroupLayoutEntry {
binding: 2,
visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT,
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Uniform,
has_dynamic_offset: false,

View File

@ -225,7 +225,7 @@ impl Renderer {
dx12_shader_compiler: wgpu::Dx12Compiler::Fxc,
gles_minor_version: wgpu::Gles3MinorVersion::Automatic,
// TODO: Look into what we want here.
flags: wgpu::InstanceFlags::all(),
flags: wgpu::InstanceFlags::from_build_config().with_env(),
});
let dims = window.inner_size();

View File

@ -700,6 +700,7 @@ fn create_ingame_and_shadow_pipelines(
&layouts.global,
&layouts.rope,
pipeline_modes.aa,
format,
)
},
"rope pipeline creation",

View File

@ -1041,10 +1041,14 @@ impl Window {
pub fn grab_cursor(&mut self, grab: bool) {
self.cursor_grabbed = grab;
self.window.set_cursor_visible(!grab);
let res = self.window.set_cursor_grab(match grab {
true => winit::window::CursorGrabMode::Confined,
false => winit::window::CursorGrabMode::None,
});
use winit::window::CursorGrabMode;
let res = if grab {
self.window
.set_cursor_grab(CursorGrabMode::Locked)
.or_else(|_e| self.window.set_cursor_grab(CursorGrabMode::Confined))
} else {
self.window.set_cursor_grab(CursorGrabMode::None)
};
if let Err(e) = res {
error!(?e, ?grab, "Failed to toggle cursor grab");