Skip to content

Commit

Permalink
Change to use released Bevy 0.12.
Browse files Browse the repository at this point in the history
  • Loading branch information
komadori committed Nov 6, 2023
1 parent 41127ef commit 7993086
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
16 changes: 10 additions & 6 deletions src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 11 additions & 11 deletions src/uniforms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -107,14 +107,14 @@ pub(crate) fn prepare_outline_stencil_bind_group(
vertex: Res<ComponentUniforms<OutlineStencilUniform>>,
) {
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 });
}
}
Expand All @@ -127,8 +127,10 @@ pub(crate) fn prepare_outline_volume_bind_group(
fragment: Res<ComponentUniforms<OutlineFragmentUniform>>,
) {
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(),
Expand All @@ -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 });
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/view_uniforms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -56,14 +56,14 @@ pub(crate) fn prepare_outline_view_bind_group(
view_uniforms: Res<ComponentUniforms<OutlineViewUniform>>,
) {
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 });
}
}
Expand Down

0 comments on commit 7993086

Please sign in to comment.