From 7993086302935e96825848e49466967c06228243 Mon Sep 17 00:00:00 2001 From: Robin KAY Date: Mon, 6 Nov 2023 07:42:18 +0000 Subject: [PATCH] Change to use released Bevy 0.12. --- Cargo.toml | 5 ++--- src/pipeline.rs | 16 ++++++++++------ src/uniforms.rs | 22 +++++++++++----------- src/view_uniforms.rs | 12 ++++++------ 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 36f081e..867dd38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ keywords = ["gamedev", "bevy", "outline"] categories = ["game-engines", "rendering"] [dependencies] -bevy = { git = "https://github.com/bevyengine/bevy.git", rev = "5d110eb96e64eda03d3f3716d2e94555a68ec846", default-features = false, features = [ +bevy = { version = "0.12", default-features = false, features = [ "bevy_asset", "bevy_render", "bevy_pbr", @@ -26,9 +26,8 @@ thiserror = "1.0" wgpu-types = "0.17" [dev-dependencies] -bevy = { git = "https://github.com/bevyengine/bevy.git", rev = "5d110eb96e64eda03d3f3716d2e94555a68ec846", default-features = false, features = [ +bevy = { version = "0.12", default-features = false, features = [ "animation", - "multi-threaded", "bevy_gltf", "bevy_pbr", "bevy_scene", diff --git a/src/pipeline.rs b/src/pipeline.rs index bc55ac5..48bab6a 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -4,7 +4,8 @@ use bevy::ecs::query::QueryItem; use bevy::ecs::system::lifetimeless::Read; use bevy::ecs::system::SystemParamItem; use bevy::pbr::{ - setup_morph_and_skinning_defs, MeshFlags, MeshPipelineKey, MeshTransforms, MeshUniform, + setup_morph_and_skinning_defs, MeshFlags, MeshPipelineKey, MeshPipelineViewLayoutKey, + MeshTransforms, MeshUniform, }; use bevy::prelude::*; use bevy::render::batching::GetBatchData; @@ -253,11 +254,14 @@ impl SpecializedMeshPipeline for OutlinePipeline { buffer_attrs.push(Mesh::ATTRIBUTE_POSITION.at_shader_location(0)); } - let mut bind_layouts = vec![if key.msaa() == Msaa::Off { - self.mesh_pipeline.view_layout.clone() - } else { - self.mesh_pipeline.view_layout_multisampled.clone() - }]; + let mut bind_layouts = vec![self + .mesh_pipeline + .get_view_layout(if key.msaa() == Msaa::Off { + MeshPipelineViewLayoutKey::empty() + } else { + MeshPipelineViewLayoutKey::MULTISAMPLED + }) + .clone()]; bind_layouts.push(setup_morph_and_skinning_defs( &self.mesh_pipeline.mesh_layouts, diff --git a/src/uniforms.rs b/src/uniforms.rs index 897aa23..bd4c50b 100644 --- a/src/uniforms.rs +++ b/src/uniforms.rs @@ -8,7 +8,7 @@ use bevy::{ render::{ extract_component::{ComponentUniforms, DynamicUniformIndex}, render_phase::{PhaseItem, RenderCommand, RenderCommandResult, TrackedRenderPass}, - render_resource::{BindGroup, BindGroupDescriptor, BindGroupEntry, ShaderType}, + render_resource::{BindGroup, BindGroupEntry, ShaderType}, renderer::RenderDevice, Extract, }, @@ -107,14 +107,14 @@ pub(crate) fn prepare_outline_stencil_bind_group( vertex: Res>, ) { if let Some(vertex_binding) = vertex.binding() { - let bind_group = render_device.create_bind_group(&BindGroupDescriptor { - entries: &[BindGroupEntry { + let bind_group = render_device.create_bind_group( + Some("outline_stencil_bind_group"), + &outline_pipeline.outline_stencil_bind_group_layout, + &[BindGroupEntry { binding: 0, resource: vertex_binding.clone(), }], - label: Some("outline_stencil_bind_group"), - layout: &outline_pipeline.outline_stencil_bind_group_layout, - }); + ); commands.insert_resource(OutlineStencilBindGroup { bind_group }); } } @@ -127,8 +127,10 @@ pub(crate) fn prepare_outline_volume_bind_group( fragment: Res>, ) { if let (Some(vertex_binding), Some(fragment_binding)) = (vertex.binding(), fragment.binding()) { - let bind_group = render_device.create_bind_group(&BindGroupDescriptor { - entries: &[ + let bind_group = render_device.create_bind_group( + "outline_volume_bind_group", + &outline_pipeline.outline_volume_bind_group_layout, + &[ BindGroupEntry { binding: 0, resource: vertex_binding.clone(), @@ -138,9 +140,7 @@ pub(crate) fn prepare_outline_volume_bind_group( resource: fragment_binding.clone(), }, ], - label: Some("outline_volume_bind_group"), - layout: &outline_pipeline.outline_volume_bind_group_layout, - }); + ); commands.insert_resource(OutlineVolumeBindGroup { bind_group }); } } diff --git a/src/view_uniforms.rs b/src/view_uniforms.rs index 64311c5..b503ab9 100644 --- a/src/view_uniforms.rs +++ b/src/view_uniforms.rs @@ -6,7 +6,7 @@ use bevy::render::render_phase::{ PhaseItem, RenderCommand, RenderCommandResult, RenderPhase, TrackedRenderPass, }; use bevy::render::render_resource::ShaderType; -use bevy::render::render_resource::{BindGroup, BindGroupDescriptor, BindGroupEntry}; +use bevy::render::render_resource::{BindGroup, BindGroupEntry}; use bevy::render::renderer::RenderDevice; use bevy::render::view::RenderLayers; use bevy::render::Extract; @@ -56,14 +56,14 @@ pub(crate) fn prepare_outline_view_bind_group( view_uniforms: Res>, ) { if let Some(view_binding) = view_uniforms.binding() { - let bind_group = render_device.create_bind_group(&BindGroupDescriptor { - entries: &[BindGroupEntry { + let bind_group = render_device.create_bind_group( + "outline_view_bind_group", + &outline_pipeline.outline_view_bind_group_layout, + &[BindGroupEntry { binding: 0, resource: view_binding.clone(), }], - label: Some("outline_view_bind_group"), - layout: &outline_pipeline.outline_view_bind_group_layout, - }); + ); commands.insert_resource(OutlineViewBindGroup { bind_group }); } }