diff --git a/Cargo.toml b/Cargo.toml index d50de6d..3ce5fac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_smud" -version = "0.1.1" +version = "0.2.0" edition = "2021" license = "MIT OR Apache-2.0" authors = ["Johan Helsing "] @@ -10,25 +10,18 @@ categories = ["game-development", "rendering", "graphics"] repository = "https://github.com/johanhelsing/bevy_smud" [dependencies] -bevy = { version = "0.6.0", default-features = false, features = ["render"] } +bevy = { version = "0.7.0", default-features = false, features = ["render"] } bytemuck = "1.7" bitflags = "1.2" copyless = "0.1" [dev-dependencies] -bevy = "0.6" -bevy_pancam = "0.2" -bevy_lospec = { git = "https://github.com/johanhelsing/bevy_lospec", branch = "main" } -bevy_asset_loader = "0.8" +bevy = "0.7" +bevy_pancam = "0.3" +bevy_lospec = "0.1" +bevy_asset_loader = "0.10" rand = "0.8" -# [features] -# smud_shader_hot_reloading = ["bevy/bevy_shader_hot_reloading"] - -# [patch.crates-io] -# bevy = { git = "https://github.com/superdump/bevy", branch = "hot-reload-core-shaders" } -# bevy = { path = "../bevy" } - [profile.dev] opt-level = 1 diff --git a/README.md b/README.md index 89ca2fb..ab0608d 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,8 @@ I intend to support the `main` branch of Bevy in the `bevy-main` branch. |bevy|bevy_smud| |---|---| -|0.6|0.1, main| +|0.7|0.2, main| +|0.6|0.1| ## Thanks! diff --git a/src/lib.rs b/src/lib.rs index 45527e4..b5a4690 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,12 +25,12 @@ use bevy::{ render_resource::{ std140::AsStd140, BindGroup, BindGroupDescriptor, BindGroupEntry, BindGroupLayout, BindGroupLayoutDescriptor, BindGroupLayoutEntry, BindingType, BlendState, - BufferBindingType, BufferSize, BufferUsages, BufferVec, CachedPipelineId, + BufferBindingType, BufferSize, BufferUsages, BufferVec, CachedRenderPipelineId, ColorTargetState, ColorWrites, Face, FragmentState, FrontFace, MultisampleState, - PolygonMode, PrimitiveState, PrimitiveTopology, RenderPipelineCache, - RenderPipelineDescriptor, ShaderImport, ShaderStages, SpecializedPipeline, - SpecializedPipelines, TextureFormat, VertexAttribute, VertexBufferLayout, VertexFormat, - VertexState, VertexStepMode, + PipelineCache, PolygonMode, PrimitiveState, PrimitiveTopology, + RenderPipelineDescriptor, ShaderImport, ShaderStages, SpecializedRenderPipeline, + SpecializedRenderPipelines, TextureFormat, VertexAttribute, VertexBufferLayout, + VertexFormat, VertexState, VertexStepMode, }, renderer::{RenderDevice, RenderQueue}, texture::BevyDefault, @@ -84,7 +84,7 @@ impl Plugin for SmudPlugin { .init_resource::() .init_resource::() .init_resource::() - .init_resource::>() + .init_resource::>() .add_system_to_stage(RenderStage::Extract, extract_shapes) .add_system_to_stage(RenderStage::Extract, extract_sdf_shaders) .add_system_to_stage(RenderStage::Queue, queue_shapes); @@ -220,7 +220,7 @@ struct SmudPipelineKey { shader: (HandleId, HandleId), } -impl SpecializedPipeline for SmudPipeline { +impl SpecializedRenderPipeline for SmudPipeline { type Key = SmudPipelineKey; fn specialize(&self, key: Self::Key) -> RenderPipelineDescriptor { @@ -421,8 +421,8 @@ fn extract_shapes( fn queue_shapes( mut commands: Commands, mut views: Query<(&mut RenderPhase, &VisibleEntities)>, - mut pipelines: ResMut>, - mut pipeline_cache: ResMut, + mut pipelines: ResMut>, + mut pipeline_cache: ResMut, mut extracted_shapes: ResMut, // todo needs mut? mut shape_meta: ResMut, transparent_draw_functions: Res>, @@ -491,7 +491,7 @@ fn queue_shapes( ), }; let mut current_batch_entity = Entity::from_raw(u32::MAX); - let mut current_batch_pipeline = CachedPipelineId::INVALID; + let mut current_batch_pipeline = CachedRenderPipelineId::INVALID; // Add a phase item for each shape, and detect when successive items can be batched. // Spawn an entity with a `ShapeBatch` component for each possible batch. @@ -522,7 +522,7 @@ fn queue_shapes( } } - if current_batch_pipeline == CachedPipelineId::INVALID { + if current_batch_pipeline == CachedRenderPipelineId::INVALID { debug!("Shape not ready yet, skipping"); continue; // skip shapes that are not ready yet } diff --git a/src/ui.rs b/src/ui.rs index 23354b6..5f68379 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -16,8 +16,8 @@ use bevy::{ SetItemPipeline, TrackedRenderPass, }, render_resource::{ - BindGroupDescriptor, BindGroupEntry, CachedPipelineId, PrimitiveTopology, - RenderPipelineCache, SpecializedPipelines, + BindGroupDescriptor, BindGroupEntry, CachedRenderPipelineId, PipelineCache, + PrimitiveTopology, SpecializedRenderPipelines, }, renderer::{RenderDevice, RenderQueue}, view::ViewUniforms, @@ -109,8 +109,8 @@ fn extract_ui_shapes( fn prepare_ui_shapes( mut commands: Commands, - mut pipelines: ResMut>, - mut pipeline_cache: ResMut, + mut pipelines: ResMut>, + mut pipeline_cache: ResMut, mut extracted_shapes: ResMut, mut shape_meta: ResMut, // TODO: make UI meta? render_device: Res, @@ -144,7 +144,7 @@ fn prepare_ui_shapes( HandleId::Id(Uuid::nil(), u64::MAX), ); let mut last_z = 0.; - let mut current_batch_pipeline = CachedPipelineId::INVALID; + let mut current_batch_pipeline = CachedRenderPipelineId::INVALID; // todo: how should msaa be handled for ui? // would perhaps be solved if I move this to queue? @@ -181,11 +181,11 @@ fn prepare_ui_shapes( }; pipelines.specialize(&mut pipeline_cache, &smud_pipeline, specialize_key) } - None => CachedPipelineId::INVALID, + None => CachedRenderPipelineId::INVALID, } } - if current_batch_pipeline == CachedPipelineId::INVALID { + if current_batch_pipeline == CachedRenderPipelineId::INVALID { debug!("Shape not ready yet, skipping"); continue; // skip shapes that are not ready yet } @@ -278,5 +278,5 @@ pub struct UiShapeBatch { range: Range, shader_key: (HandleId, HandleId), z: FloatOrd, - pipeline: CachedPipelineId, + pipeline: CachedRenderPipelineId, }