mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Remove wgpu patch/update wgpu, rebase fixes, remove use of deprecated
vek functions for left, right, up, down, forward_rh, forward_lh
This commit is contained in:
parent
855101d72a
commit
72e6fe89df
@ -110,8 +110,3 @@ nativeBuildInputs = ["pkg-config"]
|
||||
# macos CI fix isn't merged yet
|
||||
winit = { git = "https://gitlab.com/veloren/winit.git", branch = "macos-test-spiffed" }
|
||||
vek = { git = "https://gitlab.com/veloren/vek.git", branch = "fix_intrinsics2" }
|
||||
|
||||
# Pending https://github.com/gfx-rs/wgpu/pull/1080
|
||||
[patch.'https://github.com/gfx-rs/wgpu']
|
||||
wgpu-core = { git="https://github.com/JCapucho/wgpu" }
|
||||
wgpu-types = { git="https://github.com/JCapucho/wgpu" }
|
||||
|
@ -648,6 +648,6 @@ vec3 greedy_extract_col_light_attr(texture2D t_col_light, sampler s_col_light, v
|
||||
|
||||
vec3 greedy_extract_col_light_glow(texture2D t_col_light, sampler s_col_light, vec2 f_uv_pos, out float f_light, out float f_glow) {
|
||||
uint f_attr;
|
||||
return greedy_extract_col_light_attr(t_col_light, f_uv_pos, f_light, f_glow, f_attr);
|
||||
return greedy_extract_col_light_attr(t_col_light, s_col_light, f_uv_pos, f_light, f_glow, f_attr);
|
||||
}
|
||||
#endif
|
||||
|
@ -150,7 +150,7 @@ impl<'a> GreedyMesh<'a> {
|
||||
FO: for<'r> FnMut(&'r mut D, Vec3<i32>) -> bool + 'a,
|
||||
FS: for<'r> FnMut(&'r mut D, Vec3<i32>, Vec3<i32>, Vec2<Vec3<i32>>) -> Option<(bool, M)>,
|
||||
FP: FnMut(Vec2<u16>, Vec2<Vec2<u16>>, Vec3<f32>, Vec2<Vec3<f32>>, Vec3<f32>, &M),
|
||||
FT: for<'r> FnMut(&'r mut D, Vec3<i32>, u8, u8) -> <<ColLightFmt as gfx::format::Formatted>::Surface as gfx::format::SurfaceTyped>::DataType + 'a,
|
||||
FT: for<'r> FnMut(&'r mut D, Vec3<i32>, u8, u8) -> [u8; 4] + 'a,
|
||||
{
|
||||
span!(_guard, "push", "GreedyMesh::push");
|
||||
let cont = greedy_mesh(
|
||||
@ -211,7 +211,7 @@ where
|
||||
FO: for<'r> FnMut(&'r mut D, Vec3<i32>) -> bool + 'a,
|
||||
FS: for<'r> FnMut(&'r mut D, Vec3<i32>, Vec3<i32>, Vec2<Vec3<i32>>) -> Option<(bool, M)>,
|
||||
FP: FnMut(Vec2<u16>, Vec2<Vec2<u16>>, Vec3<f32>, Vec2<Vec3<f32>>, Vec3<f32>, &M),
|
||||
FT: for<'r> FnMut(&'r mut D, Vec3<i32>, u8, u8) -> <<ColLightFmt as gfx::format::Formatted>::Surface as gfx::format::SurfaceTyped>::DataType + 'a,
|
||||
FT: for<'r> FnMut(&'r mut D, Vec3<i32>, u8, u8) -> [u8; 4] + 'a,
|
||||
{
|
||||
span!(_guard, "greedy_mesh");
|
||||
// TODO: Collect information to see if we can choose a good value here.
|
||||
|
@ -148,7 +148,7 @@ impl CloudsPipeline {
|
||||
layout: &CloudsLayout,
|
||||
aa_mode: AaMode,
|
||||
) -> Self {
|
||||
common::span!(_guard, "CloudsPipeline::new");
|
||||
common_base::span!(_guard, "CloudsPipeline::new");
|
||||
let render_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("Clouds pipeline layout"),
|
||||
|
@ -178,7 +178,7 @@ impl FigurePipeline {
|
||||
layout: &FigureLayout,
|
||||
aa_mode: AaMode,
|
||||
) -> Self {
|
||||
common::span!(_guard, "FigurePipeline::new");
|
||||
common_base::span!(_guard, "FigurePipeline::new");
|
||||
let render_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("Figure pipeline layout"),
|
||||
|
@ -121,7 +121,7 @@ impl FluidPipeline {
|
||||
terrain_layout: &TerrainLayout,
|
||||
aa_mode: AaMode,
|
||||
) -> Self {
|
||||
common::span!(_guard, "FluidPipeline::new");
|
||||
common_base::span!(_guard, "FluidPipeline::new");
|
||||
let render_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("Fluid pipeline layout"),
|
||||
|
@ -181,7 +181,7 @@ impl ParticlePipeline {
|
||||
global_layout: &GlobalsLayouts,
|
||||
aa_mode: AaMode,
|
||||
) -> Self {
|
||||
common::span!(_guard, "ParticlePipeline::new");
|
||||
common_base::span!(_guard, "ParticlePipeline::new");
|
||||
let render_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("Particle pipeline layout"),
|
||||
|
@ -116,7 +116,7 @@ impl PostProcessPipeline {
|
||||
layout: &PostProcessLayout,
|
||||
aa_mode: AaMode,
|
||||
) -> Self {
|
||||
common::span!(_guard, "PostProcessPipeline::new");
|
||||
common_base::span!(_guard, "PostProcessPipeline::new");
|
||||
let render_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("Post process pipeline layout"),
|
||||
|
@ -137,7 +137,7 @@ impl ShadowFigurePipeline {
|
||||
figure_layout: &FigureLayout,
|
||||
aa_mode: AaMode,
|
||||
) -> Self {
|
||||
common::span!(_guard, "new");
|
||||
common_base::span!(_guard, "new");
|
||||
|
||||
let render_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
|
@ -39,7 +39,7 @@ impl SkyboxPipeline {
|
||||
layouts: &GlobalsLayouts,
|
||||
aa_mode: AaMode,
|
||||
) -> Self {
|
||||
common::span!(_guard, "SkyboxPipeline::new");
|
||||
common_base::span!(_guard, "SkyboxPipeline::new");
|
||||
let render_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("Skybox pipeline layout"),
|
||||
|
@ -212,7 +212,7 @@ impl SpritePipeline {
|
||||
terrain_layout: &TerrainLayout,
|
||||
aa_mode: AaMode,
|
||||
) -> Self {
|
||||
common::span!(_guard, "SpritePipeline::new");
|
||||
common_base::span!(_guard, "SpritePipeline::new");
|
||||
let render_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("Sprite pipeline layout"),
|
||||
|
@ -212,7 +212,7 @@ impl TerrainPipeline {
|
||||
layout: &TerrainLayout,
|
||||
aa_mode: AaMode,
|
||||
) -> Self {
|
||||
common::span!(_guard, "TerrainPipeline::new");
|
||||
common_base::span!(_guard, "TerrainPipeline::new");
|
||||
let render_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("Terrain pipeline layout"),
|
||||
|
@ -67,10 +67,10 @@ impl assets::Compound for Shaders {
|
||||
"include.cloud.none",
|
||||
"include.cloud.regular",
|
||||
"figure-vert",
|
||||
"light-shadows-vert",
|
||||
"light-shadows-directed-vert",
|
||||
"light-shadows-figure-vert",
|
||||
"light-shadows-directed-vert",
|
||||
"light-shadows-directed-frag",
|
||||
"point-light-shadows-vert",
|
||||
"skybox-vert",
|
||||
"skybox-frag",
|
||||
"figure-frag",
|
||||
@ -97,7 +97,7 @@ impl assets::Compound for Shaders {
|
||||
];
|
||||
|
||||
let shaders = shaders
|
||||
.into_iter()
|
||||
.iter()
|
||||
.map(|shader| {
|
||||
let full_specifier = ["voxygen.shaders.", shader].concat();
|
||||
let asset = AssetExt::load(&full_specifier)?;
|
||||
@ -327,7 +327,6 @@ impl Renderer {
|
||||
| wgpu::Features::ADDRESS_MODE_CLAMP_TO_BORDER
|
||||
| wgpu::Features::PUSH_CONSTANTS,
|
||||
limits,
|
||||
shader_validation: true,
|
||||
},
|
||||
None,
|
||||
))?;
|
||||
@ -780,6 +779,7 @@ impl Renderer {
|
||||
});
|
||||
let mut clear = |tex: &Texture| {
|
||||
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
label: Some("Clear dummy shadow texture"),
|
||||
color_attachments: &[],
|
||||
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor {
|
||||
attachment: &tex.view,
|
||||
@ -2135,7 +2135,10 @@ fn create_pipelines(
|
||||
});
|
||||
|
||||
let mut create_shader = |name, kind| {
|
||||
let glsl = &shaders.get(name).unwrap().0;
|
||||
let glsl = &shaders
|
||||
.get(name)
|
||||
.unwrap_or_else(|| panic!("Can't retrieve shader: {}", name))
|
||||
.0;
|
||||
let file_name = format!("{}.glsl", name);
|
||||
create_shader_module(device, &mut compiler, glsl, kind, &file_name, &options)
|
||||
};
|
||||
@ -2359,6 +2362,6 @@ fn create_shader_module(
|
||||
Ok(device.create_shader_module(&wgpu::ShaderModuleDescriptor {
|
||||
label: Some(source),
|
||||
source: wgpu::ShaderSource::SpirV(Cow::Borrowed(spv.as_binary())),
|
||||
experimental_translation: false,
|
||||
flags: wgpu::ShaderFlags::VALIDATION,
|
||||
}))
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ impl<'a> Drawer<'a> {
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
label: Some("shadow pass"),
|
||||
color_attachments: &[],
|
||||
depth_stencil_attachment: Some(
|
||||
wgpu::RenderPassDepthStencilAttachmentDescriptor {
|
||||
@ -74,6 +75,7 @@ impl<'a> Drawer<'a> {
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
label: Some("first pass"),
|
||||
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
|
||||
attachment: &self.renderer.tgt_color_view,
|
||||
resolve_target: None,
|
||||
@ -109,6 +111,7 @@ impl<'a> Drawer<'a> {
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
label: Some("second pass (clouds)"),
|
||||
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
|
||||
attachment: &self.renderer.tgt_color_pp_view,
|
||||
resolve_target: None,
|
||||
@ -135,6 +138,7 @@ impl<'a> Drawer<'a> {
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
label: Some("third pass (postprocess + ui)"),
|
||||
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
|
||||
attachment: &self.tex.view,
|
||||
resolve_target: None,
|
||||
@ -180,11 +184,13 @@ impl<'a> Drawer<'a> {
|
||||
array_layer_count: NonZeroU32::new(1),
|
||||
});
|
||||
|
||||
let label = format!("point shadow face: {} pass", face);
|
||||
let mut render_pass =
|
||||
self.encoder
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
label: Some(&label),
|
||||
color_attachments: &[],
|
||||
depth_stencil_attachment: Some(
|
||||
wgpu::RenderPassDepthStencilAttachmentDescriptor {
|
||||
|
@ -4772,9 +4772,9 @@ impl FigureMgr {
|
||||
)
|
||||
.join()
|
||||
// Don't render dead entities
|
||||
.filter(|(_, _, _, health, _)| health.map_or(true, |h| !h.is_dead))
|
||||
.filter(|(_, _, _, health, _, _)| health.map_or(true, |h| !h.is_dead))
|
||||
// Don't render player
|
||||
.filter(|(entity, _, _, _, _)| *entity != player_entity)
|
||||
.filter(|(entity, _, _, _, _, _)| *entity != player_entity)
|
||||
{
|
||||
if let Some((bound, model, col_lights)) = self.get_model_for_render(
|
||||
tick,
|
||||
|
@ -740,14 +740,10 @@ impl Scene {
|
||||
v_p.z = 0.0;
|
||||
v_p.normalize();
|
||||
let l_r: math::Mat4<f32> = if factor > EPSILON_UPSILON {
|
||||
<<<<<<< HEAD
|
||||
math::Mat4::look_at_rh(math::Vec3::zero(), -math::Vec3::unit_z(), v_p)
|
||||
=======
|
||||
// NOTE: Our coordinates are now in left-handed space, but v_p isn't; however,
|
||||
// v_p has no z component, so we don't have to adjust it for left-handed
|
||||
// spaces.
|
||||
math::Mat4::look_at_lh(math::Vec3::zero(), math::Vec3::forward_lh(), v_p)
|
||||
>>>>>>> 00820cebc (Fix directed shadows, mostly.)
|
||||
math::Mat4::look_at_lh(math::Vec3::zero(), math::Vec3::unit_z(), v_p)
|
||||
} else {
|
||||
math::Mat4::identity()
|
||||
};
|
||||
@ -788,23 +784,23 @@ impl Scene {
|
||||
// moves from view-space (right-handed) to world-space (right-handed).
|
||||
let view_point = view_inv
|
||||
* math::Vec4::from_point(
|
||||
math::Vec3::forward_rh() * p_z, /* + math::Vec4::unit_w() */
|
||||
-math::Vec3::unit_z() * p_z, /* + math::Vec4::unit_w() */
|
||||
);
|
||||
let view_plane = view_mat.transposed() * math::Vec4::forward_rh();
|
||||
let view_plane = view_mat.transposed() * -math::Vec4::unit_z();
|
||||
|
||||
// moves from rotated light space (left-handed) to world space (right-handed).
|
||||
let light_point = light_all_inv
|
||||
* math::Vec4::from_point(
|
||||
math::Vec3::up() * p_y, /* + math::Vec4::unit_w() */
|
||||
math::Vec3::unit_y() * p_y, /* + math::Vec4::unit_w() */
|
||||
);
|
||||
let light_plane = light_all_mat.transposed() * math::Vec4::up();
|
||||
let light_plane = light_all_mat.transposed() * math::Vec4::unit_y();
|
||||
|
||||
// moves from rotated light space (left-handed) to world space (right-handed).
|
||||
let shadow_point = light_all_inv
|
||||
* math::Vec4::from_point(
|
||||
math::Vec3::right() * p_x, /* + math::Vec4::unit_w() */
|
||||
math::Vec3::unit_x() * p_x, /* + math::Vec4::unit_w() */
|
||||
);
|
||||
let shadow_plane = light_all_mat.transposed() * math::Vec4::right();
|
||||
let shadow_plane = light_all_mat.transposed() * math::Vec4::unit_x();
|
||||
|
||||
// Find the point at the intersection of the three planes; note that since the
|
||||
// equations are already in right-handed world space, we don't need to negate
|
||||
@ -848,8 +844,8 @@ impl Scene {
|
||||
// NOTE: I don't think the w component should be anything but 1 here, but
|
||||
// better safe than sorry.
|
||||
(
|
||||
f64::from(z0.homogenized().dot(math::Vec4::forward_rh())),
|
||||
f64::from(z1.homogenized().dot(math::Vec4::forward_rh())),
|
||||
f64::from(z0.homogenized().dot(-math::Vec4::unit_z())),
|
||||
f64::from(z1.homogenized().dot(-math::Vec4::unit_z())),
|
||||
)
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user